diff --git a/LICENSES/MPL-2.0.txt b/LICENSES/MPL-2.0.txt new file mode 100644 index 0000000..ee6256c --- /dev/null +++ b/LICENSES/MPL-2.0.txt @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/dist/aframe-blink-controls.min.js b/dist/aframe-blink-controls.min.js index 8d2f514..8026596 100644 --- a/dist/aframe-blink-controls.min.js +++ b/dist/aframe-blink-controls.min.js @@ -1,2 +1,6 @@ +// SPDX-FileCopyrightText: 2023 Leon van Kammen/NLNET +// +// SPDX-License-Identifier: MPL-2.0 + (()=>{if(AFRAME.registerGeometry("prism",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0}},init:function(t){const i=new THREE.Shape;i.moveTo(t.width/2,0),i.lineTo(0,t.height),i.lineTo(-t.width/2,0),i.lineTo(t.width/2,0);const e={steps:2,depth:t.depth,bevelEnabled:!1};this.geometry=new THREE.ExtrudeGeometry(i,e)}}),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("blink-controls",{schema:{button:{default:"",oneOf:["trackpad","trigger","grip","menu","thumbstick"]},startEvents:{type:"array",default:[]},endEvents:{type:"array",default:[]},cancelEvents:{type:"array",default:[]},collisionEntities:{default:""},hitEntity:{type:"selector"},cameraRig:{type:"selector",default:"#player"},teleportOrigin:{type:"selector",default:"#camera"},hitCylinderColor:{type:"color",default:"#4d93fd"},hitCylinderRadius:{default:.25,min:0},hitCylinderHeight:{default:.3,min:0},interval:{default:0},curveNumberPoints:{default:60,min:2},curveLineWidth:{default:.025},curveHitColor:{type:"color",default:"#4d93fd"},curveMissColor:{type:"color",default:"#ff0000"},curveShootingSpeed:{default:10,min:0},defaultPlaneSize:{default:100},landingNormal:{type:"vec3",default:{x:0,y:1,z:0}},landingMaxAngle:{default:"45",min:0,max:360},drawIncrementally:{default:!0},incrementalDrawMs:{default:300},missOpacity:{default:.8},hitOpacity:{default:.8},snapTurn:{default:!0},rotateOnTeleport:{default:!0}},init:function(){const t=this.data,i=this.el;let e;this.active=!1,this.obj=i.object3D,this.controllerPosition=new THREE.Vector3,this.hitEntityQuaternion=new THREE.Quaternion,this.teleportOriginQuaternion=new THREE.Quaternion,this.hitPoint=new THREE.Vector3,this.collisionObjectNormalMatrix=new THREE.Matrix3,this.collisionWorldNormal=new THREE.Vector3,this.rigWorldPosition=new THREE.Vector3,this.newRigWorldPosition=new THREE.Vector3,this.teleportEventDetail={oldPosition:this.rigWorldPosition,newPosition:this.newRigWorldPosition,hitPoint:this.hitPoint,rotationQuaternion:this.hitEntityQuaternion},this.hit=!1,this.prevCheckTime=void 0,this.referenceNormal=new THREE.Vector3,this.curveMissColor=new THREE.Color,this.curveHitColor=new THREE.Color,this.raycaster=new THREE.Raycaster,this.defaultPlane=this.createDefaultPlane(this.data.defaultPlaneSize),this.defaultCollisionMeshes=[this.defaultPlane];const n=this.teleportEntity=document.createElement("a-entity");if(n.classList.add("teleportRay"),n.setAttribute("visible",!1),i.sceneEl.appendChild(this.teleportEntity),this.onButtonDown=this.onButtonDown.bind(this),this.onButtonUp=this.onButtonUp.bind(this),this.cancel=this.cancel.bind(this),this.handleThumbstickAxis=this.handleThumbstickAxis.bind(this),this.teleportOrigin=this.data.teleportOrigin,this.cameraRig=this.data.cameraRig,this.snapturnRotation=THREE.MathUtils.degToRad(45),this.canSnapturn=!0,this.addedEvents=[],this.data.startEvents.length&&this.data.endEvents.length){for(e=0;e.95&&(Math.abs(t-Math.PI/2)<.6?(this.cameraRig.object3D.rotateY(+this.snapturnRotation),this.canSnapturn=!1):Math.abs(t-1.5*Math.PI)<.6&&(this.cameraRig.object3D.rotateY(-this.snapturnRotation),this.canSnapturn=!1))},handleThumbstickAxis:function(t){if(void 0!==t.detail.x&&void 0!==t.detail.y){const i=Math.atan2(t.detail.x,t.detail.y)+Math.PI,e=Math.sqrt(t.detail.x**2+t.detail.y**2);this.active?(e>.95&&(this.obj.getWorldPosition(this.controllerPosition),this.controllerPosition.setComponent(1,this.hitEntity.object3D.position.y),this.hitEntity.object3D.visible=!1,this.hitEntity.object3D.lookAt(this.controllerPosition),this.hitEntity.object3D.rotateY(i),this.hitEntity.object3D.visible=!0,this.hitEntity.object3D.getWorldQuaternion(this.hitEntityQuaternion)),0===Math.abs(t.detail.x)&&0===Math.abs(t.detail.y)&&this.onButtonUp()):this.thumbstickAxisActivation&&e>.95&&(i<.5||i>5.78)?this.onButtonDown():this.data.snapTurn&&this.handleSnapturn(i,e)}},update:function(t){const i=this.data,e=AFRAME.utils.diff(i,t);this.referenceNormal.copy(i.landingNormal),this.curveMissColor.set(i.curveMissColor),this.curveHitColor.set(i.curveHitColor),(!this.line||"curveLineWidth"in e||"curveNumberPoints"in e||"type"in e)&&(this.line=this.createLine(i),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.numActivePoints=i.curveNumberPoints,this.teleportEntity.setObject3D("mesh",this.line.mesh)),i.hitEntity?this.hitEntity=i.hitEntity:(!this.hitEntity||"hitCylinderColor"in e||"hitCylinderHeight"in e||"hitCylinderRadius"in e)&&(this.hitEntity&&this.hitEntity.parentNode.removeChild(this.hitEntity),this.hitEntity=this.createHitEntity(i),this.el.sceneEl.appendChild(this.hitEntity)),this.hitEntity.setAttribute("visible",!1),i.hitEntity||this.hitEntity.lastElementChild.setAttribute("visible",i.rotateOnTeleport),"collisionEntities"in e&&this.queryCollisionEntities()},remove:function(){const t=this.el,i=this.hitEntity,e=this.teleportEntity;i&&i.parentNode.removeChild(i),e&&e.parentNode.removeChild(e),t.sceneEl.removeEventListener("child-attached",this.childAttachHandler),t.sceneEl.removeEventListener("child-detached",this.childDetachHandler);for(const[i,e]of this.addedEvents)t.removeEventListener(i,e)},tick:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3(0,-9.8,0),n=new THREE.Vector3,s=new THREE.Vector3,o=new THREE.Quaternion,r=new THREE.Vector3,a=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3;let d=0;return function(u,E){if(!this.active)return;if(this.data.drawIncrementally&&this.redrawLine&&(this.redrawLine=!1,d=0),d+=E,this.numActivePoints=this.data.curveNumberPoints*d/this.data.incrementalDrawMs,this.numActivePoints>this.data.curveNumberPoints&&(this.numActivePoints=this.data.curveNumberPoints),this.prevCheckTime&&u-this.prevCheckTime0&&!this.hit&&this.isValidNormalsAngle(s[0].face.normal,s[0].object)){const e=s[0].point;this.line.material.color.set(this.curveHitColor),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.hitEntity.setAttribute("position",e),this.hitEntity.setAttribute("visible",!0),this.hit=!0,this.hitPoint.copy(s[0].point);for(let e=t;ejoints.Wrist,getThumbMetacarpal:()=>joints.T_Metacarpal,getThumbProximal:()=>joints.T_Proximal,getThumbDistal:()=>joints.T_Distal,getThumbTip:()=>joints.T_Tip,getIndexMetacarpal:()=>joints.I_Metacarpal,getIndexProximal:()=>joints.I_Proximal,getIndexIntermediate:()=>joints.I_Intermediate,getIndexDistal:()=>joints.I_Distal,getIndexTip:()=>joints.I_Tip,getMiddleMetacarpal:()=>joints.M_Metacarpal,getMiddleProximal:()=>joints.M_Proximal,getMiddleIntermediate:()=>joints.M_Intermediate,getMiddleDistal:()=>joints.M_Distal,getMiddleTip:()=>joints.M_Tip,getRingMetacarpal:()=>joints.R_Metacarpal,getRingProximal:()=>joints.R_Proximal,getRingIntermediate:()=>joints.R_Intermediate,getRingDistal:()=>joints.R_Distal,getRingTip:()=>joints.R_Tip,getLittleMetacarpal:()=>joints.L_Metacarpal,getLittleProximal:()=>joints.L_Proximal,getLittleIntermediate:()=>joints.L_Intermediate,getLittleDistal:()=>joints.L_Distal,getLittleTip:()=>joints.L_Tip};this.updateData=((controller,frame,referenceSpace)=>{frame.fillJointRadii(controller.hand.values(),radii);validPoses=frame.fillPoses(controller.hand.values(),referenceSpace,transforms);if(!validPoses)return});const normalQuaternion=(new THREE.Quaternion).setFromEuler(new THREE.Euler(Math.PI/2,0,0));this.getOrientedQuaternion=((id,_quaternion)=>{return this.getQuaternion(id,_quaternion)});this.getDirection=((id,_vector)=>{const mtxOffset=id*16;const vector=_vector?_vector:tmpVector.clone();return vector.fromArray(transforms,mtxOffset+8).normalize().negate()});this.getNormal=((id,_vector)=>{let vector=_vector?_vector:tmpVector.clone();this.getQuaternion(id,tmpQuaternion).multiply(normalQuaternion);tmpDummy.quaternion.copy(tmpQuaternion);tmpDummy.getWorldDirection(vector);return vector});this.getQuaternion=((id,_quaternion)=>{const mtxOffset=id*16;let quaternion=_quaternion?_quaternion:tmpQuaternion.clone();var idx=0;for(var i=mtxOffset;i<=mtxOffset+12;i++){rotMtx.elements[idx++]=transforms[i]}quaternion.setFromRotationMatrix(rotMtx);return quaternion});this.getPosition=((id,_vector)=>{const mtxOffset=id*16;let vector=_vector?_vector:tmpVector.clone();return vector.fromArray(transforms,mtxOffset+12)});this.getRadius=(id=>{return radii[id]});this.getValidity=(()=>validPoses)}},{"./JointObject":1}]},{},[2]); diff --git a/dist/aframe-troika-text.min.js b/dist/aframe-troika-text.min.js index 076062b..bab1c38 100644 --- a/dist/aframe-troika-text.min.js +++ b/dist/aframe-troika-text.min.js @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: 2023 Leon van Kammen/NLNET +// +// SPDX-License-Identifier: MPL-2.0 + !function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=n(e),o=r(t);function i(){var e=Object.create(null);function t(n,a){var o=n.id,i=n.name,s=n.dependencies;void 0===s&&(s=[]);var l=n.init;void 0===l&&(l=function(){});var u=n.getTransferables;if(void 0===u&&(u=null),!e[o])try{s=s.map((function(r){return r&&r.isWorkerModule&&(t(r,(function(e){if(e instanceof Error)throw e})),r=e[r.id].value),r})),l=r("<"+i+">.init",l),u&&(u=r("<"+i+">.getTransferables",u));var f=null;"function"==typeof l?f=l.apply(void 0,s):console.error("worker module init function failed to rehydrate"),e[o]={id:o,value:f,getTransferables:u},a(f)}catch(e){e&&e.noLog||console.error(e),a(e)}}function r(e,t){var r=void 0;self.troikaDefine=function(e){return r=e};var n=URL.createObjectURL(new Blob(["/** "+e.replace(/\*/g,"")+" **/\n\ntroikaDefine(\n"+t+"\n)"],{type:"application/javascript"}));try{importScripts(n)}catch(e){console.error(e)}return URL.revokeObjectURL(n),delete self.troikaDefine,r}self.addEventListener("message",(function(r){var n=r.data,a=n.messageId,o=n.action,i=n.data;try{"registerModule"===o&&t(i,(function(e){e instanceof Error?postMessage({messageId:a,success:!1,error:e.message}):postMessage({messageId:a,success:!0,result:{isCallable:"function"==typeof e}})})),"callModule"===o&&function(t,r){var n,a=t.id,o=t.args;e[a]&&"function"==typeof e[a].value||r(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var i=(n=e[a]).value.apply(n,o);i&&"function"==typeof i.then?i.then(s,(function(e){return r(e instanceof Error?e:new Error(""+e))})):s(i)}catch(e){r(e)}function s(t){try{var n=e[a].getTransferables&&e[a].getTransferables(t);n&&Array.isArray(n)&&n.length||(n=void 0),r(t,n)}catch(e){console.error(e),r(e)}}}(i,(function(e,t){e instanceof Error?postMessage({messageId:a,success:!1,error:e.message}):postMessage({messageId:a,success:!0,result:e},t||void 0)}))}catch(e){postMessage({messageId:a,success:!1,error:e.stack})}}))}var s=function(){var e=!1;if("undefined"!=typeof window&&void 0!==window.document)try{new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"}))).terminate(),e=!0}catch(e){"undefined"!=typeof process&&"test"===process.env.NODE_ENV||console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+e.message+"]")}return s=function(){return e},e},l=0,u=0,f=!1,c=Object.create(null),h=Object.create(null),d=Object.create(null);function p(e){if(!(e&&"function"==typeof e.init||f))throw new Error("requires `options.init` function");var t=e.dependencies,r=e.init,n=e.getTransferables,a=e.workerId;if(!s())return function(e){var t=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t._getInitResult().then((function(t){if("function"==typeof t)return t.apply(void 0,e);throw new Error("Worker module function was called but `init` did not return a callable function")}))};return t._getInitResult=function(){var r=e.dependencies,n=e.init;r=Array.isArray(r)?r.map((function(e){return e&&e._getInitResult?e._getInitResult():e})):[];var a=Promise.all(r).then((function(e){return n.apply(null,e)}));return t._getInitResult=function(){return a},a},t}(e);null==a&&(a="#default");var o="workerModule"+ ++l,i=e.name||o,u=null;function c(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(!u){u=g(a,"registerModule",c.workerModuleData);var r=function(){u=null,h[a].delete(r)};(h[a]||(h[a]=new Set)).add(r)}return u.then((function(t){if(t.isCallable)return g(a,"callModule",{id:o,args:e});throw new Error("Worker module function was called but `init` did not return a callable function")}))}return t=t&&t.map((function(e){return"function"!=typeof e||e.workerModuleData||(f=!0,e=p({workerId:a,name:"<"+i+"> function dependency: "+e.name,init:"function(){return (\n"+v(e)+"\n)}"}),f=!1),e&&e.workerModuleData&&(e=e.workerModuleData),e})),c.workerModuleData={isWorkerModule:!0,id:o,name:i,dependencies:t,init:v(r),getTransferables:n&&v(n)},c}function v(e){var t=e.toString();return!/^function/.test(t)&&/^\w+\s*\(/.test(t)&&(t="function "+t),t}function g(e,t,r){return new Promise((function(n,a){var o=++u;d[o]=function(e){e.success?n(e.result):a(new Error("Error in worker "+t+" call: "+e.error))},function(e){var t=c[e];if(!t){var r=v(i);(t=c[e]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+e.replace(/\*/g,"")+" **/\n\n;("+r+")()"],{type:"application/javascript"})))).onmessage=function(e){var t=e.data,r=t.messageId,n=d[r];if(!n)throw new Error("WorkerModule response with empty or unknown messageId");delete d[r],n(t)}}return t}(e).postMessage({messageId:o,action:t,data:r})}))}function m(){var e=function(e){function t(e,t,r,n,a,o,i,s,l,u){var f=1-l;u.x=f*f*f*e+3*f*f*l*r+3*f*l*l*a+l*l*l*i,u.y=f*f*f*t+3*f*f*l*n+3*f*l*l*o+l*l*l*s}function r(e,t){for(var r,n,a,o,i,s=/([MLQCZ])([^MLQCZ]*)/g;r=s.exec(e);){var l=r[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map((function(e){return parseFloat(e)}));switch(r[1]){case"M":o=n=l[0],i=a=l[1];break;case"L":l[0]===o&&l[1]===i||t("L",o,i,o=l[0],i=l[1]);break;case"Q":t("Q",o,i,o=l[2],i=l[3],l[0],l[1]);break;case"C":t("C",o,i,o=l[4],i=l[5],l[0],l[1],l[2],l[3]);break;case"Z":o===n&&i===a||t("L",o,i,n,a)}}}function n(e,n,a){void 0===a&&(a=16);var o={x:0,y:0};r(e,(function(e,r,i,s,l,u,f,c,h){switch(e){case"L":n(r,i,s,l);break;case"Q":for(var d=r,p=i,v=1;v0;)n[a]=arguments[a+2];var o=s[t]||(s[t]=r.getUniformLocation(u,t));r["uniform"+e].apply(r,[o].concat(n))},setAttribute:function(e,t,n,o,s){var l=i[e];l||(l=i[e]={buf:r.createBuffer(),loc:r.getAttribLocation(u,e),data:null}),r.bindBuffer(r.ARRAY_BUFFER,l.buf),r.vertexAttribPointer(l.loc,t,r.FLOAT,!1,0,0),r.enableVertexAttribArray(l.loc),a?r.vertexAttribDivisor(l.loc,o):h("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(l.loc,o),s!==l.data&&(r.bufferData(r.ARRAY_BUFFER,s,n),l.data=s)}})}}}l[e].transaction(o)}function v(e,t){f++;try{r.activeTexture(r.TEXTURE0+f);var n=u[e];n||(n=u[e]=r.createTexture(),r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST)),r.bindTexture(r.TEXTURE_2D,n),t(n,f)}finally{f--}}function g(e,t,n){var a=r.createFramebuffer();c.push(a),r.bindFramebuffer(r.FRAMEBUFFER,a),r.activeTexture(r.TEXTURE0+t),r.bindTexture(r.TEXTURE_2D,e),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);try{n(a)}finally{r.deleteFramebuffer(a),r.bindFramebuffer(r.FRAMEBUFFER,c[--c.length-1]||null)}}function m(){s={},l={},u={},f=-1,c.length=0}r.canvas.addEventListener("webglcontextlost",(function(e){m(),e.preventDefault()}),!1),o.set(r,n={gl:r,isWebGL2:a,getExtension:h,withProgram:p,withTexture:v,withTextureFramebuffer:g,handleContextLoss:m})}t(n)}function l(e,t,r,n,o,i,l,u){void 0===l&&(l=15),void 0===u&&(u=null),s(e,(function(e){var s=e.gl,f=e.withProgram;(0,e.withTexture)("copy",(function(e,c){s.texImage2D(s.TEXTURE_2D,0,s.RGBA,o,i,0,s.RGBA,s.UNSIGNED_BYTE,t),f("copy",a,"precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",(function(e){var t=e.setUniform;(0,e.setAttribute)("aUV",2,s.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),t("1i","image",c),s.bindFramebuffer(s.FRAMEBUFFER,u||null),s.disable(s.BLEND),s.colorMask(8&l,4&l,2&l,1&l),s.viewport(r,n,o,i),s.scissor(r,n,o,i),s.drawArrays(s.TRIANGLES,0,3)}))}))}))}var u=Object.freeze({__proto__:null,withWebGLContext:s,renderImageData:l,resizeWebGLCanvasWithoutClearing:function(e,t,r){var n=e.width,a=e.height;s(e,(function(o){var i=o.gl,s=new Uint8Array(n*a*4);i.readPixels(0,0,n,a,i.RGBA,i.UNSIGNED_BYTE,s),e.width=t,e.height=r,l(i,s,0,0,n,a)}))}});function f(e,t,r,a,o,i){void 0===i&&(i=1);var s=new Uint8Array(e*t),l=a[2]-a[0],u=a[3]-a[1],f=[];n(r,(function(e,t,r,n){f.push({x1:e,y1:t,x2:r,y2:n,minX:Math.min(e,r),minY:Math.min(t,n),maxX:Math.max(e,r),maxY:Math.max(t,n)})})),f.sort((function(e,t){return e.maxX-t.maxX}));for(var c=0;co.minX&&t-no.minY){var i=d(e,t,o.x1,o.y1,o.x2,o.y2);it!=a.y2>t&&e<(a.x2-a.x1)*(t-a.y1)/(a.y2-a.y1)+a.x1&&(r+=a.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y/gm,(function(t,r){let n=e.ShaderChunk[r];return n?b(n):t}))}const x=[];for(let e=0;e<256;e++)x[e]=(e<16?"0":"")+e.toString(16);const S=Object.assign||function(){let e=arguments[0];for(let t=1,r=arguments.length;t(()=>{var e={8167:e=>{var t=Object.prototype.toString;e.exports=function(e){return e.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===t.call(e.buffer)||Array.isArray(e)}},5734:e=>{e.exports=function(e,t){return"number"==typeof e?e:"number"==typeof t?t:0}},7961:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,s=a(e),o=s[0],l=s[1],c=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,l)),h=0,u=l>0?o-4:o;for(n=0;n>16&255,c[h++]=t>>8&255,c[h++]=255&t;return 2===l&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[h++]=255&t),1===l&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[h++]=t>>8&255,c[h++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,a=0,c=i-r;ac?c:a+o));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,i){for(var r,s,o=[],a=t;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},911:(e,t,n)=>{var i=n(9922).hp;e.exports=function(e,t){if(i.isBuffer(e)&&i.isBuffer(t)){if("function"==typeof e.equals)return e.equals(t);if(e.length!==t.length)return!1;for(var n=0;n{"use strict";const i=n(7961),r=n(1024),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let i=a(n);const r=i.write(e,t);return r!==n&&(i=i.slice(0,r)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);const r=function(e){if(l.isBuffer(e)){const t=0|A(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return h(e),a(e<0?0:0|A(e))}function d(e){const t=e.length<0?0:0|A(e.length),n=a(t);for(let i=0;i=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function f(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return i?-1:W(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function v(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,i,r){let s,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){let i=-1;for(s=n;sa&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;ir&&(i=r):i=r;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function _(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function M(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r239?4:t>223?3:t>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(s=l));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(l=(15&t)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=e[r+1],i=e[r+2],a=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){const t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);let n="",i=0;for(;ii.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0);const a=Math.min(s,o),c=this.slice(i,r),h=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return x(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;ri)&&(n=i);let r="";for(let i=t;in)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,i,r,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw new RangeError("Index out of range")}function P(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function U(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function O(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function F(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(i)+(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(i)<>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s=r&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<>>=0,t||L(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[t]=255&e;++s>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Z((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=0,s=1,o=0;for(this[t]=255&e;++r>0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s>>0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Z((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,i,r,s){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new k.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||V(t,e.length-(n+1))}(i,r,s)}function H(e,t){if("number"!=typeof e)throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new k.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new k.ERR_BUFFER_OUT_OF_BOUNDS;throw new k.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),Q("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=G(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=G(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let o=0;o55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,i){let r;for(r=0;r=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const K=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)t[i+r]=e[n]+e[r]}return t}();function Z(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},9089:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var a=0;a0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},6492:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},963:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},2283:(e,t,n)=>{function i(){var e;try{e=t.storage.debug}catch(e){}return e}(t=e.exports=n(8936)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" "),!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,r=0;return e[0].replace(/%[a-z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,n),e},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(i())},8936:(e,t)=>{(t=e.exports=function(e){function i(){}function r(){var e=r;null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=t.colors[n++%t.colors.length]);var i=Array.prototype.slice.call(arguments);i[0]=t.coerce(i[0]),"string"!=typeof i[0]&&(i=["%o"].concat(i));var s=0;i[0]=i[0].replace(/%([a-z%])/g,(function(n,r){if("%%"===n)return n;s++;var o=t.formatters[r];if("function"==typeof o){var a=i[s];n=o.call(e,a),i.splice(s,1),s--}return n})),"function"==typeof t.formatArgs&&(i=t.formatArgs.apply(e,i)),(r.log||t.log||console.log.bind(console)).apply(e,i)}i.enabled=!1,r.enabled=!0;var s=t.enabled(e)?r:i;return s.namespace=e,s}).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),i=n.length,r=0;r{"use strict";var i=n(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(e,t,n){var s=t[n];if(null!=s){if(r.call(e,n)&&(void 0===e[n]||null===e[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(e,n)&&i(s)?e[n]=a(Object(e[n]),t[n]):e[n]=s}}function a(e,t){if(e===t)return e;for(var n in t=Object(t))r.call(t,n)&&o(e,t,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(t),a=0;a{e.exports=function(e){switch(e){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(e,t,n)=>{var i;i="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},e.exports=i},1024:(e,t)=>{t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,l=(1<>1,h=-7,u=n?r-1:0,d=n?-1:1,p=e[t+u];for(u+=d,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+e[t+u],u+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+e[t+u],u+=d,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,l,c=8*s-r-1,h=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,A=i?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*l-1)*Math.pow(2,r),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=A,a/=256,r-=8);for(o=o<0;e[n+p]=255&o,p+=A,o/=256,c-=8);e[n+p-A]|=128*f}},2225:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},8847:e=>{e.exports=function(e){if(!e)return!1;var n=t.call(e);return"[object Function]"===n||"function"==typeof e&&"[object RegExp]"!==n||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var t=Object.prototype.toString},6240:e=>{"use strict";e.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},5651:(e,t,n)=>{var i=n(5406),r=n(4597),s=n(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function u(e){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(e)}function d(e){return new Function(["return function "+e+"() {"," return this._"+e,"}"].join("\n"))()}function p(e,t){if(!e.chars||0===e.chars.length)return null;var n=f(e.chars,t);return n>=0?e.chars[n]:null}function A(e,t,n){if(!e.kernings||0===e.kernings.length)return 0;for(var i=e.kernings,r=0;r=0)return e.chars[i].height}return 0}(a),this._capHeight=function(e){for(var t=0;t=0)return e.chars[i].height}return 0}(a),this._lineHeight=m,this._ascender=m-v-this._xHeight;var x=this;c.forEach((function(e,i){for(var r,s=e.start,o=e.end,l=e.width,c=s;c=0)return e.chars[i]}return 0}(e)||e.chars[0],n=this._opt.tabSize*t.xadvance;this._fallbackSpaceGlyph=t,this._fallbackTabGlyph=r(t,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(e,t){return p(e,t)||(t===c?this._fallbackTabGlyph:t===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(e,t,n,i){var r,s=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:t,end:t,width:0};n=Math.min(e.length,n);for(var h=t;h=i||p>=i)break;a=p,l=f,r=u}c++}return r&&(l+=r.xoffset),{start:t,end:t+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(e){Object.defineProperty(u.prototype,e,{get:d(e),configurable:!0})}))},5751:(e,t,n)=>{var i=n(9922).hp,r=n(3558),s=function(){},o=n(1476),a=n(7034),l=n(7480),c=n(573),h=n(4597),u=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;e.exports=function(e,t){t="function"==typeof t?t:s,"string"==typeof e?e={uri:e}:e||(e={}),e.binary&&(e=function(e){if(u)return h(e,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var t=new self.XMLHttpRequest;return t.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:t},e)}(e)),r(e,(function(n,r,h){if(n)return t(n);if(!/^2/.test(r.statusCode))return t(new Error("http status code: "+r.statusCode));if(!h)return t(new Error("no body result"));var u,d,p=!1;if(u=h,"[object ArrayBuffer]"===Object.prototype.toString.call(u)){var A=new Uint8Array(h);h=i.from(A,"binary")}c(h)&&(p=!0,"string"==typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(e.encoding)),h=h.trim());try{var f=r.headers["content-type"];d=p?l(h):/json/.test(f)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(f)||"<"===h.charAt(0)?a(h):o(h)}catch(e){t(new Error("error parsing font "+e.message)),t=s}t(null,d)}))}},573:(e,t,n)=>{var i=n(9922).hp,r=n(911),s=i.from([66,77,70,3]);e.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&r(e.slice(0,4),s)}},1476:e=>{function t(e,t){if(!(e=e.replace(/\t+/g," ").trim()))return null;var i=e.indexOf(" ");if(-1===i)throw new Error("no named row at line "+t);var r=e.substring(0,i);e=(e=(e=(e=e.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var s=[],o=0;o{var t=[66,77,70];function n(e,t,n){if(n>t.length-1)return 0;var r=t.readUInt8(n++),s=t.readInt32LE(n);switch(n+=4,r){case 1:e.info=function(e,t){var n={};n.size=e.readInt16LE(t);var r=e.readUInt8(t+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=e.readUInt8(t+3)||"",n.stretchH=e.readUInt16LE(t+4),n.aa=e.readUInt8(t+6),n.padding=[e.readInt8(t+7),e.readInt8(t+8),e.readInt8(t+9),e.readInt8(t+10)],n.spacing=[e.readInt8(t+11),e.readInt8(t+12)],n.outline=e.readUInt8(t+13),n.face=function(e,t){return i(e,t).toString("utf8")}(e,t+14),n}(t,n);break;case 2:e.common=function(e,t){var n={};return n.lineHeight=e.readUInt16LE(t),n.base=e.readUInt16LE(t+2),n.scaleW=e.readUInt16LE(t+4),n.scaleH=e.readUInt16LE(t+6),n.pages=e.readUInt16LE(t+8),e.readUInt8(t+10),n.packed=0,n.alphaChnl=e.readUInt8(t+11),n.redChnl=e.readUInt8(t+12),n.greenChnl=e.readUInt8(t+13),n.blueChnl=e.readUInt8(t+14),n}(t,n);break;case 3:e.pages=function(e,t,n){for(var r=[],s=i(e,t),o=s.length+1,a=n/o,l=0;l3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var s={kernings:[],chars:[]},o=0;o<5;o++)r+=n(s,e,r);return s}},7034:(e,t,n)=>{var i=n(7829),r=n(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(e){var t=function(e){for(var t=[],n=0;n element");for(var a=s.getElementsByTagName("page"),l=0;l{var t="chasrset";e.exports=function(e){for(var n in e=Object.assign({},e),t in e&&(e.charset=e[t],delete e[t]),e)"face"!==n&&"charset"!==n&&(e[n]="padding"===n||"spacing"===n?e[n].split(",").map((function(e){return parseInt(e,10)})):parseInt(e[n],10));return e}},3216:e=>{var t=function(e){return e.replace(/^\s+|\s+$/g,"")};e.exports=function(e){if(!e)return{};for(var n,i={},r=t(e).split("\n"),s=0;s{var t,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var a,l=[],c=!1,h=-1;function u(){c&&a&&(c=!1,a.length?l=a.concat(l):h=-1,l.length&&d())}function d(){if(!c){var e=o(u);c=!0;for(var t=l.length;t;){for(a=l,l=[];++h1)for(var n=1;n{var i=n(8480),r=n(8167),s=n(2225),o=[0,2,3],a=[2,1,3];e.exports=function(e,t){e&&(r(e)||s(e))||(t=e||{},e=null);for(var n="string"==typeof(t="number"==typeof t?{count:t}:t||{}).type?t.type:"uint16",l="number"==typeof t.count?t.count:1,c=t.start||0,h=!1!==t.clockwise?o:a,u=h[0],d=h[1],p=h[2],A=6*l,f=e||new(i(n))(A),m=0,g=0;m{"use strict";n.d(t,{A:()=>ve});var i={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},r={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},s=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],o={CSS:{},springs:{}};function a(e,t,n){return Math.min(Math.max(e,t),n)}function l(e,t){return e.indexOf(t)>-1}function c(e,t){return e.apply(null,t)}var h=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,u=/^rgb/,d=/^hsl/,p={arr:function(e){return Array.isArray(e)},obj:function(e){return l(Object.prototype.toString.call(e),"Object")},pth:function(e){return p.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||p.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},hex:function(e){return h.test(e)},rgb:function(e){return u.test(e)},hsl:function(e){return d.test(e)},col:function(e){return p.hex(e)||p.rgb(e)||p.hsl(e)},key:function(e){return!i.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}},A=/\(([^)]+)\)/;function f(e){var t=A.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function m(e,t){var n=f(e),i=a(p.und(n[0])?1:n[0],.1,100),r=a(p.und(n[1])?100:n[1],.1,100),s=a(p.und(n[2])?10:n[2],.1,100),l=a(p.und(n[3])?0:n[3],.1,100),c=Math.sqrt(r/i),h=s/(2*Math.sqrt(r*i)),u=h<1?c*Math.sqrt(1-h*h):0,d=h<1?(h*c-l)/u:-l+c;function A(e){var n=t?t*e/1e3:e;return n=h<1?Math.exp(-n*h*c)*(1*Math.cos(u*n)+d*Math.sin(u*n)):(1+d*n)*Math.exp(-n*c),0===e||1===e?e:1-n}return t?A:function(){var t=o.springs[e];if(t)return t;for(var n=1/6,i=0,r=0;;)if(1===A(i+=n)){if(++r>=16)break}else r=0;var s=i*n*1e3;return o.springs[e]=s,s}}function g(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=a(e,1,10),i=a(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function v(e){return void 0===e&&(e=10),function(t){return Math.round(t*e)*(1/e)}}var y=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function i(e){return 3*e}function r(e,r,s){return((t(r,s)*e+n(r,s))*e+i(r))*e}function s(e,r,s){return 3*t(r,s)*e*e+2*n(r,s)*e+i(r)}return function(t,n,i,o){if(0<=t&&t<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(t!==n||i!==o)for(var l=0;l<11;++l)a[l]=r(l*e,t,i);return function(l){return t===n&&i===o||0===l||1===l?l:r(function(n){for(var o=0,l=1;10!==l&&a[l]<=n;++l)o+=e;--l;var c=o+(n-a[l])/(a[l+1]-a[l])*e,h=s(c,t,i);return h>=.001?function(e,t,n,i){for(var o=0;o<4;++o){var a=s(t,n,i);if(0===a)return t;t-=(r(t,n,i)-e)/a}return t}(n,c,t,i):0===h?c:function(e,t,n,i,s){var o,a,l=0;do{(o=r(a=t+(n-t)/2,i,s)-e)>0?n=a:t=a}while(Math.abs(o)>1e-7&&++l<10);return a}(n,o,o+e,t,i)}(l),n,o)}}}}(),E=function(){var e=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],g],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(e,t){return function(n){return 1-g(e,t)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(e,t){return function(n){return n<.5?g(e,t)(2*n)/2:1-g(e,t)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in t)for(var r=0,s=t[i].length;r=2?arguments[1]:void 0,s=0;s1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(0==o)t=n=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,u=2*a-h;t=c(u,h,s+1/3),n=c(u,h,s),i=c(u,h,s-1/3)}return"rgba("+255*t+","+255*n+","+255*i+","+l+")"}(e):void 0;var t,n}(e);var n=N(e),i=n?e.substr(0,e.length-n.length):e;return t&&!X.test(e)?i+t:i}function J(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function K(e){for(var t,n=e.points,i=0,r=0;r0&&(i+=J(t,s)),t=s}return i}function Z(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*k(e,"r")}(e);case"rect":return function(e){return 2*k(e,"width")+2*k(e,"height")}(e);case"line":return function(e){return J({x:k(e,"x1"),y:k(e,"y1")},{x:k(e,"x2"),y:k(e,"y2")})}(e);case"polyline":return K(e);case"polygon":return function(e){var t=e.points;return K(e)+J(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function $(e,t){var n=t||{},i=n.el||function(e){for(var t=e.parentNode;p.svg(t)&&(t=t.parentNode,p.svg(t.parentNode)););return t}(e),r=i.getBoundingClientRect(),s=k(i,"viewBox"),o=r.width,a=r.height,l=n.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function ee(e,t){function n(n){void 0===n&&(n=0);var i=t+n>=1?t+n:0;return e.el.getPointAtLength(i)}var i=$(e.el,e.svg),r=n(),s=n(-1),o=n(1);switch(e.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var te=/-?\d*\.?\d+/g;function ne(e,t){var n=Y(p.pth(e)?e.totalLength:e,t)+"";return{original:n,numbers:n.match(te)?n.match(te).map(Number):[0],strings:p.str(e)||t?n.split(te):[]}}function ie(e){return C(e?_(p.arr(e)?e.map(M):M(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function re(e){var t=ie(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:V(e)}}}))}var se=/^spring/;function oe(e,t){var n=I(t);if(se.test(n.easing)&&(n.duration=m(n.easing)),p.arr(e)){var i=e.length;2!==i||p.obj(e[0])?p.fnc(t.duration)||(n.duration=t.duration/i):e={value:e}}var r=p.arr(e)?e:[e];return r.map((function(e,n){var i=p.obj(e)&&!p.pth(e)?e:{value:e};return p.und(i.delay)&&(i.delay=n?0:t.delay),p.und(i.endDelay)&&(i.endDelay=n===r.length-1?t.endDelay:0),i})).map((function(e){return B(e,n)}))}var ae={css:function(e,t,n){return e.style[t]=n},attribute:function(e,t,n){return e.setAttribute(t,n)},object:function(e,t,n){return e[t]=n},transform:function(e,t,n,i,r){if(i.list.set(t,n),t===i.last||r){var s="";i.list.forEach((function(e,t){s+=t+"("+e+") "})),e.style.transform=s}}};function le(e,t){for(var n=re(e),i=0,r=n.length;i-1&&(pe.splice(s,1),n=pe.length)}else r.tick(t);i++}e()}else ue=cancelAnimationFrame(ue)}return e}();function me(e){void 0===e&&(e={});var t,n=0,s=0,o=0,l=0,c=null;function h(){return window.Promise&&new Promise((function(e){return c=e}))}var u=h(),d=function(e){var t=T(i,e),n=T(r,e),s=function(e,t){var n=[],i=t.keyframes;for(var r in i&&(t=B(function(e){for(var t=C(_(e.map((function(e){return Object.keys(e)}))),(function(e){return p.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},i=function(i){var r=t[i];n[r]=e.map((function(e){var t={};for(var n in e)p.key(n)?n==r&&(t.value=e[n]):t[n]=e[n];return t}))},r=0;r2||(y=Math.round(y*A)/A)),f.push(y)}var x=p.length;if(x){g=p[0];for(var w=0;w0&&(d.began=!0,y("begin"),y("loopBegin")),m<=r&&0!==d.currentTime&&v(0),(m>=p&&d.currentTime!==i||!i)&&v(i),m>r&&m=i&&(s=0,d.remaining&&!0!==d.remaining&&d.remaining--,d.remaining?(n=o,y("loopComplete"),y("loopBegin"),"alternate"===d.direction&&A()):(d.paused=!0,d.completed||(d.completed=!0,y("loopComplete"),y("complete"),"Promise"in window&&(c(),u=h()))))}return d.reset=function(){var e=d.direction;d.passThrough=!1,d.currentTime=0,d.progress=0,d.paused=!0,d.began=!1,d.changeBegan=!1,d.completed=!1,d.changeCompleted=!1,d.reversePlayback=!1,d.reversed="reverse"===e,d.remaining=d.loop,t=d.children;for(var n=l=t.length;n--;)d.children[n].reset();(d.reversed&&!0!==d.loop||"alternate"===e&&1===d.loop)&&d.remaining++,v(0)},d.set=function(e,t){return le(e,t),d},d.tick=function(e){o=e,n||(n=o),E((o+(s-n))*me.speed)},d.seek=function(e){E(f(e))},d.pause=function(){d.paused=!0,m()},d.play=function(){d.paused&&(d.paused=!1,pe.push(d),m(),ue||fe())},d.reverse=function(){A(),m()},d.restart=function(){d.reset(),d.play()},d.finished=u,d.reset(),d.autoplay&&d.play(),d}function ge(e,t){for(var n=t.length;n--;)S(e,t[n].animatable.target)&&t.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var e=0,t=pe.length;e-1&&pe.splice(s,1);for(var l=0;l{var i=n(5651),r=n(9035),s=n(7106),o=n(1684);e.exports=function(e){return new a(e)};class a extends THREE.BufferGeometry{constructor(e){super(),"string"==typeof e&&(e={text:e}),this._opt=Object.assign({},e),e&&this.update(e)}update(e){if("string"==typeof e&&(e={text:e}),!(e=Object.assign({},this._opt,e)).font)throw new TypeError("must specify a { font } in options");this.layout=i(e);var t=!1!==e.flipY,n=e.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(e){var t=e.data;return t.width*t.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,t),u=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(u),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var d=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(d,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():o.computeBox(t,e)}}},1684:e=>{var t={min:[0,0],max:[0,0]};function n(e){var n=e.length/2;t.min[0]=e[0],t.min[1]=e[1],t.max[0]=e[0],t.max[1]=e[1];for(var i=0;i{e.exports.pages=function(e){var t=new Float32Array(4*e.length*1),n=0;return e.forEach((function(e){var i=e.data.page||0;t[n++]=i,t[n++]=i,t[n++]=i,t[n++]=i})),t},e.exports.uvs=function(e,t,n,i){var r=new Float32Array(4*e.length*2),s=0;return e.forEach((function(e){var o=e.data,a=o.x+o.width,l=o.y+o.height,c=o.x/t,h=o.y/n,u=a/t,d=l/n;i&&(h=(n-o.y)/n,d=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=h})),r},e.exports.positions=function(e){var t=new Float32Array(4*e.length*2),n=0;return e.forEach((function(e){var i=e.data,r=e.position[0]+i.xoffset,s=e.position[1]+i.yoffset,o=i.width,a=i.height;t[n++]=r,t[n++]=s,t[n++]=r,t[n++]=s+a,t[n++]=r+o,t[n++]=s+a,t[n++]=r+o,t[n++]=s})),t}},9835:function(e,t,n){e.exports=function(){"use strict";var e="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};var t,i=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},r=function(e,t){for(var n=0,i=e.length;nl)},b=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},x=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},w=function(e){if(d())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},C=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},_=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},M=function(e,t,n,i){var r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,t),e.compileShader(r);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,n),e.compileShader(s);var o=e.createProgram();for(var a in e.attachShader(o,r),e.attachShader(o,s),i)e.bindAttribLocation(o,i[a],a);return e.linkProgram(o),e.deleteShader(r),e.deleteShader(s),o},S=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r="",s=0;s1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(e.w)},O=(i={},function(e,t){void 0===i[e]&&(console.warn("webvr-polyfill: "+t),i[e]=!0)}),N=function(e,t){O(e,e+" has been deprecated. This may not work on native WebVR displays. "+(t?"Please use "+t+" instead.":""))};function F(e,t,n){if(t){for(var i=[],r=null,s=0;se.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),i.push(null,null);break}r||(r=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(l),i.push(e.getParameter(o),null);break;case e.ACTIVE_TEXTURE:r=e.getParameter(e.ACTIVE_TEXTURE),i.push(null);break;default:i.push(e.getParameter(o))}for(n(e),s=0;se.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_2D,a);break;case e.TEXTURE_BINDING_CUBE_MAP:var l;if((l=t[++s])e.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_CUBE_MAP,a);break;case e.VIEWPORT:e.viewport(a[0],a[1],a[2],a[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:a?e.enable(o):e.disable(o);break;default:console.log("No GL restore behavior for 0x"+o.toString(16))}r&&e.activeTexture(r)}}else n(e)}var k=F,Q=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),G=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");function z(e,t,n,i){this.gl=e,this.cardboardUI=t,this.bufferScale=n,this.dirtySubmitFrameBindings=i,this.ctxAttribs=e.getContextAttributes(),this.instanceExt=e.getExtension("ANGLE_instanced_arrays"),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,u()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=M(e,Q,G,this.attribs),this.uniforms=S(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}z.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},z.prototype.onResize=function(){var e=this.gl,t=this,n=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];k(e,n,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.framebuffer),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.texImage2D(e.TEXTURE_2D,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,t.bufferWidth,t.bufferHeight,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.renderTarget,0),t.ctxAttribs.depth&&t.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t.depthStencilBuffer)):t.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t.depthBuffer)):t.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,t.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,t.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),t.realClearColor.apply(e,t.clearColor)})),this.cardboardUI&&this.cardboardUI.onResize()},z.prototype.patch=function(){if(!this.isPatched){var e=this,t=this.gl.canvas,n=this.gl;u()||(t.width=b()*this.bufferScale,t.height=x()*this.bufferScale,Object.defineProperty(t,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(n){e.bufferWidth=n,e.realCanvasWidth.set.call(t,n),e.onResize()}}),Object.defineProperty(t,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(n){e.bufferHeight=n,e.realCanvasHeight.set.call(t,n),e.onResize()}})),this.lastBoundFramebuffer=n.getParameter(n.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(t,i){e.lastBoundFramebuffer=i||e.framebuffer,e.realBindFramebuffer.call(n,t,e.lastBoundFramebuffer)},this.cullFace=n.getParameter(n.CULL_FACE),this.depthTest=n.getParameter(n.DEPTH_TEST),this.blend=n.getParameter(n.BLEND),this.scissorTest=n.getParameter(n.SCISSOR_TEST),this.stencilTest=n.getParameter(n.STENCIL_TEST),n.enable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!0;break;case n.DEPTH_TEST:e.depthTest=!0;break;case n.BLEND:e.blend=!0;break;case n.SCISSOR_TEST:e.scissorTest=!0;break;case n.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(n,t)},n.disable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!1;break;case n.DEPTH_TEST:e.depthTest=!1;break;case n.BLEND:e.blend=!1;break;case n.SCISSOR_TEST:e.scissorTest=!1;break;case n.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(n,t)},this.colorMask=n.getParameter(n.COLOR_WRITEMASK),n.colorMask=function(t,i,r,s){e.colorMask[0]=t,e.colorMask[1]=i,e.colorMask[2]=r,e.colorMask[3]=s,e.realColorMask.call(n,t,i,r,s)},this.clearColor=n.getParameter(n.COLOR_CLEAR_VALUE),n.clearColor=function(t,i,r,s){e.clearColor[0]=t,e.clearColor[1]=i,e.clearColor[2]=r,e.clearColor[3]=s,e.realClearColor.call(n,t,i,r,s)},this.viewport=n.getParameter(n.VIEWPORT),n.viewport=function(t,i,r,s){e.viewport[0]=t,e.viewport[1]=i,e.viewport[2]=r,e.viewport[3]=s,e.realViewport.call(n,t,i,r,s)},this.isPatched=!0,R(t)}},z.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,t=this.gl.canvas;u()||(Object.defineProperty(t,"width",this.realCanvasWidth),Object.defineProperty(t,"height",this.realCanvasHeight)),t.width=this.bufferWidth,t.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout((function(){R(t)}),1)}},z.prototype.setTextureBounds=function(e,t){e||(e=[0,0,.5,1]),t||(t=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=t[0],this.viewportOffsetScale[5]=t[1],this.viewportOffsetScale[6]=t[2],this.viewportOffsetScale[7]=t[3]},z.prototype.submitFrame=function(){var e=this.gl,t=this,n=[];if(this.dirtySubmitFrameBindings||n.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),k(e,n,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null);var n=0,i=0;t.instanceExt&&(n=e.getVertexAttrib(t.attribs.position,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),i=e.getVertexAttrib(t.attribs.texCoord,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)),t.cullFace&&t.realDisable.call(e,e.CULL_FACE),t.depthTest&&t.realDisable.call(e,e.DEPTH_TEST),t.blend&&t.realDisable.call(e,e.BLEND),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realDisable.call(e,e.STENCIL_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(t.ctxAttribs.alpha||u())&&(t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(t.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.enableVertexAttribArray(t.attribs.position),e.enableVertexAttribArray(t.attribs.texCoord),e.vertexAttribPointer(t.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(t.attribs.texCoord,3,e.FLOAT,!1,20,8),t.instanceExt&&(0!=n&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,0),0!=i&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,0)),e.activeTexture(e.TEXTURE0),e.uniform1i(t.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.uniform4fv(t.uniforms.viewportOffsetScale,t.viewportOffsetScale),e.drawElements(e.TRIANGLES,t.indexCount,e.UNSIGNED_SHORT,0),t.cardboardUI&&t.cardboardUI.renderNoState(),t.realBindFramebuffer.call(t.gl,e.FRAMEBUFFER,t.framebuffer),t.ctxAttribs.preserveDrawingBuffer||(t.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),t.dirtySubmitFrameBindings||t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.cullFace&&t.realEnable.call(e,e.CULL_FACE),t.depthTest&&t.realEnable.call(e,e.DEPTH_TEST),t.blend&&t.realEnable.call(e,e.BLEND),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realEnable.call(e,e.STENCIL_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),!t.ctxAttribs.alpha&&t.ctxAttribs.preserveDrawingBuffer||t.realClearColor.apply(e,t.clearColor),t.instanceExt&&(0!=n&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,n),0!=i&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,i))})),u()){var i=e.canvas;i.width==t.bufferWidth&&i.height==t.bufferHeight||(t.bufferWidth=i.width,t.bufferHeight=i.height,t.onResize())}},z.prototype.updateDeviceInfo=function(e){var t=this.gl,n=this,i=[t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING];k(t,i,(function(t){var i=n.computeMeshVertices_(n.meshWidth,n.meshHeight,e);if(t.bindBuffer(t.ARRAY_BUFFER,n.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW),!n.indexCount){var r=n.computeMeshIndices_(n.meshWidth,n.meshHeight);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW),n.indexCount=r.length}}))},z.prototype.computeMeshVertices_=function(e,t,n){for(var i=new Float32Array(2*e*t*5),r=n.getLeftEyeVisibleTanAngles(),s=n.getLeftEyeNoLensTanAngles(),o=n.getLeftEyeVisibleScreenRect(s),a=0,l=0;l<2;l++){for(var c=0;cr-s&&i.clientXn.clientHeight-s?e(i):i.clientX1e-4;){var r=e-this.distort(n),s=n-r*((n-t)/(r-i));t=n,n=s,i=r}return n},ne.prototype.distort=function(e){for(var t=e*e,n=0,i=0;i=1)return this.w=s,this.x=n,this.y=i,this.z=r,this;var a=Math.acos(o),l=Math.sqrt(1-o*o);if(Math.abs(l)<.001)return this.w=.5*(s+this.w),this.x=.5*(n+this.x),this.y=.5*(i+this.y),this.z=.5*(r+this.z),this;var c=Math.sin((1-t)*a)/l,h=Math.sin(t*a)/l;return this.w=s*c+this.w*h,this.x=n*c+this.x*h,this.y=i*c+this.y*h,this.z=r*c+this.z*h,this},setFromUnitVectors:(le=1e-6,function(e,t){return void 0===oe&&(oe=new se),(ae=e.dot(t)+1)Math.abs(e.z)?oe.set(-e.y,e.x,0):oe.set(0,-e.z,e.y)):oe.crossVectors(e,t),this.x=oe.x,this.y=oe.y,this.z=oe.z,this.w=ae,this.normalize(),this})};var ue=new he({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),de=new he({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),pe={CardboardV1:new fe({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new fe({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};function Ae(e,t){this.viewer=pe.CardboardV2,this.updateDeviceParams(e),this.distortion=new ne(this.viewer.distortionCoefficients);for(var n=0;n=200&&n.status<=299?(i.dpdb=JSON.parse(n.response),i.recalculateDeviceParams_()):console.error("Error loading online DPDB!")})),n.send()}}function ve(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function ye(e,t){this.set(e,t)}function Ee(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new ye,this.currentGyroMeasurement=new ye,this.previousGyroMeasurement=new ye,u()?this.filterQ=new ce(-1,0,0,1):this.filterQ=new ce(1,0,0,1),this.previousFilterQ=new ce,this.previousFilterQ.copy(this.filterQ),this.accelQ=new ce,this.isOrientationInitialized=!1,this.estimatedGravity=new se,this.measuredGravity=new se,this.gyroIntegralQ=new ce}function be(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new ce,this.previousTimestampS=null,this.deltaQ=new ce,this.outQ=new ce}function xe(e,t,n,i){this.yawOnly=n,this.accelerometer=new se,this.gyroscope=new se,this.filter=new Ee(e,i),this.posePredictor=new be(t,i),this.isFirefoxAndroid=A(),this.isIOS=u();var r=f();this.isDeviceMotionInRadians=!this.isIOS&&r&&r<66,this.isWithoutDeviceMotion=g()||m(),this.filterToWorldQ=new ce,u()?this.filterToWorldQ.setFromAxisAngle(new se(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new se(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new ce,this.worldToScreenQ=new ce,this.originalPoseAdjustQ=new ce,this.originalPoseAdjustQ.setFromAxisAngle(new se(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),y()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new ce,this.orientationOut_=new Float32Array(4),this.start()}ge.prototype.getDeviceParams=function(){return this.deviceParams},ge.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},ge.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var t=navigator.userAgent||navigator.vendor||window.opera,n=b(),i=x();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var r=0;rl?(O("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=i)):(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(v()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,i)),this.filter.addAccelMeasurement(this.accelerometer,i),void(this.previousTimestampS=i))},xe.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},xe.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)},xe.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new se(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new se(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},xe.prototype.start=function(){this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),u()&&D()&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},xe.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var we=60,Ce=new se(1,0,0),_e=new se(0,0,1),Me=new ce;Me.setFromAxisAngle(Ce,-Math.PI/2),Me.multiply((new ce).setFromAxisAngle(_e,Math.PI/2));var Se=function(){function e(t){r(this,e),this.config=t,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new ce,this._outQ=new ce,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this.init()}return s(e,[{key:"init",value:function(){var e=null;try{(e=new RelativeOrientationSensor({frequency:we,referenceFrame:"screen"})).addEventListener("error",this._onSensorError)}catch(e){this.errors.push(e),"SecurityError"===e.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===e.name?this.useDeviceMotion():console.error(e)}e&&(this.api="sensor",this.sensor=e,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start())}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new xe(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG),this.sensor&&(this.sensor.removeEventListener("reading",this._onSensorRead),this.sensor.removeEventListener("error",this._onSensorError),this.sensor=null)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var t=this._outQ;return t.copy(Me),t.multiply(this._sensorQ),this.config.YAW_ONLY&&(t.x=t.z=0,t.normalize()),this._out[0]=t.x,this._out[1]=t.y,this._out[2]=t.z,this._out[3]=t.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error),this.useDeviceMotion()}},{key:"_onSensorRead",value:function(){}}]),e}(),Ie="";function Te(){this.loadIcon_();var e=document.createElement("div");(s=e.style).position="fixed",s.top=0,s.right=0,s.bottom=0,s.left=0,s.backgroundColor="gray",s.fontFamily="sans-serif",s.zIndex=1e6;var t=document.createElement("img");t.src=this.icon,(s=t.style).marginLeft="25%",s.marginTop="25%",s.width="50%",e.appendChild(t);var n=document.createElement("div");(s=n.style).textAlign="center",s.fontSize="16px",s.lineHeight="24px",s.margin="24px 25%",s.width="50%",n.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(n);var i=document.createElement("div");(s=i.style).backgroundColor="#CFD8DC",s.position="fixed",s.bottom=0,s.width="100%",s.height="48px",s.padding="14px 24px",s.boxSizing="border-box",s.color="#656A6B",e.appendChild(i);var r=document.createElement("div");r.style.float="left",r.innerHTML="No Cardboard viewer?";var s,o=document.createElement("a");o.href="https://www.google.com/get/cardboard/get-cardboard/",o.innerHTML="get one",o.target="_blank",(s=o.style).float="right",s.fontWeight=600,s.textTransform="uppercase",s.borderLeft="1px solid gray",s.paddingLeft="24px",s.textDecoration="none",s.color="#656A6B",i.appendChild(r),i.appendChild(o),this.overlay=e,this.text=n,this.hide()}Te.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var t=this.overlay.querySelector("img").style;y()?(t.width="20%",t.marginLeft="40%",t.marginTop="3%"):(t.width="50%",t.marginLeft="25%",t.marginTop="25%")},Te.prototype.hide=function(){this.overlay.style.display="none"},Te.prototype.showTemporarily=function(e,t){this.show(t),this.timer=setTimeout(this.hide.bind(this),e)},Te.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},Te.prototype.update=function(){this.disableShowTemporarily(),!y()&&T()?this.show():this.hide()},Te.prototype.loadIcon_=function(){this.icon=c("image/svg+xml",Ie)};var Be="CardboardV1",Re="WEBVR_CARDBOARD_VIEWER",Le="webvr-polyfill-viewer-selector";function De(e){try{this.selectedKey=localStorage.getItem(Re)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=e||Be),this.dialog=this.createDialog_(Ae.Viewers),this.root=null,this.onChangeCallbacks_=[]}function Pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ue(e,t){return e(t={exports:{}},t.exports),t.exports}De.prototype.show=function(e){this.root=e,e.appendChild(this.dialog),this.dialog.querySelector("#"+this.selectedKey).checked=!0,this.dialog.style.display="block"},De.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},De.prototype.getCurrentViewer=function(){return Ae.Viewers[this.selectedKey]},De.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},De.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},De.prototype.fireOnChange_=function(e){for(var t=0;t.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return i(e,[{key:"enable",value:function(){o?(this.disable(),this.noSleepTimer=window.setInterval((function(){window.location.href="/",window.setTimeout(window.stop,0)}),15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){o?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=a},function(e,t,n){e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])}))})),Ne=Pe(Oe),Fe=1e3,ke=[0,0,.5,1],Qe=[.5,0,.5,1],Ge=window.requestAnimationFrame,ze=window.cancelAnimationFrame;function He(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null}function Ve(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return N("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function je(e){var t=!("wakelock"in(e=e||{}))||e.wakelock;this.isPolyfilled=!0,this.displayId=Fe++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return N("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new Ve({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,t&&T()&&(this.wakelock_=new Ne)}je.prototype.getFrameData=function(e){return L(e,this._getPose(),this)},je.prototype.getPose=function(){return N("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},je.prototype.resetPose=function(){return N("VRDisplay.prototype.resetPose"),this._resetPose()},je.prototype.getImmediatePose=function(){return N("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},je.prototype.requestAnimationFrame=function(e){return Ge(e)},je.prototype.cancelAnimationFrame=function(e){return ze(e)},je.prototype.wrapForFullscreen=function(e){if(u())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var n=this.fullscreenElement_.parentElement;n.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),n.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var i=this;function r(){if(i.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];i.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}return r(),this.fullscreenWrapper_},je.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var t=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===t?t.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),t.removeChild(this.fullscreenWrapper_),e}},je.prototype.requestPresent=function(e){var t=this.isPresenting,n=this;return e instanceof Array||(N("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise((function(i,r){if(n.capabilities.canPresent)if(0==e.length||e.length>n.capabilities.maxLayers)r(new Error("Invalid number of layers."));else{var s=e[0];if(s.source){var o=s.leftBounds||ke,a=s.rightBounds||Qe;if(t){var l=n.layer_;l.source!==s.source&&(l.source=s.source);for(var c=0;c<4;c++)l.leftBounds[c]=o[c],l.rightBounds[c]=a[c];return n.wrapForFullscreen(n.layer_.source),n.updatePresent_(),void i()}if(n.layer_={predistorted:s.predistorted,source:s.source,leftBounds:o.slice(0),rightBounds:a.slice(0)},n.waitingForPresent_=!1,n.layer_&&n.layer_.source){var h=n.wrapForFullscreen(n.layer_.source),p=function(){var e=_();n.isPresenting=h===e,n.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch((function(e){console.error("screen.orientation.lock() failed due to",e.message)})),n.waitingForPresent_=!1,n.beginPresent_(),i()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),n.removeFullscreenWrapper(),n.disableWakeLock(),n.endPresent_(),n.removeFullscreenListeners_()),n.fireVRDisplayPresentChange_()},A=function(){n.waitingForPresent_&&(n.removeFullscreenWrapper(),n.removeFullscreenListeners_(),n.disableWakeLock(),n.waitingForPresent_=!1,n.isPresenting=!1,r(new Error("Unable to present.")))};n.addFullscreenListeners_(h,p,A),w(h)?(n.enableWakeLock(),n.waitingForPresent_=!0):(u()||d())&&(n.enableWakeLock(),n.isPresenting=!0,n.beginPresent_(),n.fireVRDisplayPresentChange_(),i())}n.waitingForPresent_||u()||(C(),r(new Error("Unable to present.")))}else i()}else r(new Error("VRDisplay is not capable of presenting."))}))},je.prototype.exitPresent=function(){var e=this.isPresenting,t=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise((function(n,i){e?(!C()&&u()&&(t.endPresent_(),t.fireVRDisplayPresentChange_()),d()&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.endPresent_(),t.fireVRDisplayPresentChange_()),n()):i(new Error("Was not presenting to VRDisplay."))}))},je.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},je.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},je.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},je.prototype.addFullscreenListeners_=function(e,t,n){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=t,this.fullscreenErrorHandler_=n,t&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",t,!1)),n&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",n,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",n,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",n,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",n,!1))},je.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var t=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",t,!1),e.removeEventListener("webkitfullscreenchange",t,!1),document.removeEventListener("mozfullscreenchange",t,!1),e.removeEventListener("msfullscreenchange",t,!1)}if(this.fullscreenErrorHandler_){var n=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",n,!1),e.removeEventListener("webkitfullscreenerror",n,!1),document.removeEventListener("mozfullscreenerror",n,!1),e.removeEventListener("msfullscreenerror",n,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},je.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},je.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},je.prototype.beginPresent_=function(){},je.prototype.endPresent_=function(){},je.prototype.submitFrame=function(e){},je.prototype.getEyeParameters=function(e){return null};var We={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},qe={LEFT:"left",RIGHT:"right"};function Xe(e){var t=B({},We);e=B(t,e||{}),je.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new Ve({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new Se(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new ge(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new Ae(this.dpdb_.getDeviceParams(),e.ADDITIONAL_VIEWERS),this.viewerSelector_=new De(e.DEFAULT_VIEWER),this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new Te),u()&&window.addEventListener("resize",this.onResize_.bind(this))}return Xe.prototype=Object.create(je.prototype),Xe.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},Xe.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},Xe.prototype._getFieldOfView=function(e){var t;if(e==qe.LEFT)t=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=qe.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=this.deviceInfo_.getFieldOfViewRightEye()}return t},Xe.prototype._getEyeOffset=function(e){var t;if(e==qe.LEFT)t=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=qe.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return t},Xe.prototype.getEyeParameters=function(e){var t=this._getEyeOffset(e),n=this._getFieldOfView(e),i={offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(i,"fieldOfView",{enumerable:!0,get:function(){return N("VRFieldOfView","VRFrameData's projection matrices"),n}}),i},Xe.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},Xe.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},Xe.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=b()*this.bufferScale_,e.canvas.height=x()*this.bufferScale_,this.cardboardUI_=new te(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new te(e)),this.distorter_=new z(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(y()&&T()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},Xe.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},Xe.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},Xe.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var n=t.canvas;n.width==this.lastWidth&&n.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=n.width,this.lastHeight=n.height,this.cardboardUI_.render()}},Xe.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},Xe.prototype.onResize_=function(e){if(this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var n=["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"];t.canvas.setAttribute("style",n.join("; ")+";"),R(t.canvas)}},Xe.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},Xe.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},Xe.VRFrameData=He,Xe.VRDisplay=je,Xe}()})),a=(t=o)&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,l={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",PROVIDE_MOBILE_VRDISPLAY:!0,MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1};function c(e){this.config=s(s({},l),e),this.polyfillDisplays=[],this.enabled=!1,this.hasNative="getVRDisplays"in navigator,this.native={},this.native.getVRDisplays=navigator.getVRDisplays,this.native.VRFrameData=window.VRFrameData,this.native.VRDisplay=window.VRDisplay,(!this.hasNative||this.config.PROVIDE_MOBILE_VRDISPLAY&&i())&&(this.enable(),this.getVRDisplays().then((function(e){e&&e[0]&&e[0].fireVRDisplayConnect_&&e[0].fireVRDisplayConnect_()})))}c.prototype.getPolyfillDisplays=function(){if(this._polyfillDisplaysPopulated)return this.polyfillDisplays;if(i()){var e=new a({ADDITIONAL_VIEWERS:this.config.ADDITIONAL_VIEWERS,DEFAULT_VIEWER:this.config.DEFAULT_VIEWER,MOBILE_WAKE_LOCK:this.config.MOBILE_WAKE_LOCK,DEBUG:this.config.DEBUG,DPDB_URL:this.config.DPDB_URL,CARDBOARD_UI_DISABLED:this.config.CARDBOARD_UI_DISABLED,K_FILTER:this.config.K_FILTER,PREDICTION_TIME_S:this.config.PREDICTION_TIME_S,ROTATE_INSTRUCTIONS_DISABLED:this.config.ROTATE_INSTRUCTIONS_DISABLED,YAW_ONLY:this.config.YAW_ONLY,BUFFER_SCALE:this.config.BUFFER_SCALE,DIRTY_SUBMIT_FRAME_BINDINGS:this.config.DIRTY_SUBMIT_FRAME_BINDINGS});this.polyfillDisplays.push(e)}return this._polyfillDisplaysPopulated=!0,this.polyfillDisplays},c.prototype.enable=function(){if(this.enabled=!0,this.hasNative&&this.native.VRFrameData){var e=this.native.VRFrameData,t=new this.native.VRFrameData,n=this.native.VRDisplay.prototype.getFrameData;window.VRDisplay.prototype.getFrameData=function(i){i instanceof e?n.call(this,i):(n.call(this,t),i.pose=t.pose,r(t.leftProjectionMatrix,i.leftProjectionMatrix),r(t.rightProjectionMatrix,i.rightProjectionMatrix),r(t.leftViewMatrix,i.leftViewMatrix),r(t.rightViewMatrix,i.rightViewMatrix))}}navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=a.VRDisplay,window.VRFrameData=a.VRFrameData},c.prototype.getVRDisplays=function(){var e=this;return this.config,this.hasNative?this.native.getVRDisplays.call(navigator).then((function(t){return t.length>0?t:e.getPolyfillDisplays()})):Promise.resolve(this.getPolyfillDisplays())},c.version="0.10.12",c.VRFrameData=a.VRFrameData,c.VRDisplay=a.VRDisplay;var h=Object.freeze({default:c}),u=h&&c||h;return void 0!==e&&e.window&&(e.document||(e.document=e.window.document),e.navigator||(e.navigator=e.window.navigator)),u}()},5406:e=>{var t=/\n/,n=/\s/;function i(e,t,n,i){var r=e.indexOf(t,n);return-1===r||r>i?i:r}function r(e){return n.test(e)}function s(e,t,n,i){return{start:t,end:t+Math.min(i,n-t)}}e.exports=function(t,n){return e.exports.lines(t,n).map((function(e){return t.substring(e.start,e.end)})).join("\n")},e.exports.lines=function(e,n){if(0===(n=n||{}).width&&"nowrap"!==n.mode)return[];e=e||"";var o="number"==typeof n.width?n.width:Number.MAX_VALUE,a=Math.max(0,n.start||0),l="number"==typeof n.end?n.end:e.length,c=n.mode,h=n.measure||s;return"pre"===c?function(e,n,i,r,s){for(var o=[],a=i,l=i;ln&&!r(t.charAt(d));)d--;if(d===n)p>n+1&&p--,d=p;else for(p=d;d>n&&r(t.charAt(d-1));)d--}if(d>=n){var A=e(t,n,d,c);l.push(A)}n=p}return l}(h,e,a,l,o,c)}},3558:(e,t,n)=>{"use strict";var i=n(919),r=n(8847),s=n(3216),o=n(4597);function a(e,t,n){var i=e;return r(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=o(t,{uri:e}),i.callback=n,i}function l(e,t,n){return c(t=a(e,t,n))}function c(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(){var e=void 0;if(e=h.response?h.response:h.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(h),g)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(u),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,v)}function o(){if(!c){var t;clearTimeout(u),t=e.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==t?(r={body:i(),statusCode:t,method:p,headers:{},url:d,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=e.xhr||null;h||(h=e.cors||e.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var u,d=h.url=e.uri||e.url,p=h.method=e.method||"GET",A=e.body||e.data,f=h.headers=e.headers||{},m=!!e.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:h};if("json"in e&&!1!==e.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===e.json?A:e.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,d,!m,e.username,e.password),m||(h.withCredentials=!!e.withCredentials),!m&&e.timeout>0&&(u=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(h.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(h),h.send(A||null),h}e.exports=l,e.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var n=0;n{e.exports=void 0!==self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var t=new self.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}:function(e){var t=document.createElement("div");return t.innerHTML=e,t}},4597:e=>{e.exports=function(){for(var e={},n=0;n{var i=n(8190).registerComponent,r=n(7427).debug("components:anchored:warn");e.exports.Component=i("anchored",{schema:{persistent:{default:!1}},init:function(){var e=this.el.sceneEl.getAttribute("webxr"),t=e.optionalFeatures;-1===t.indexOf("anchors")&&(t.push("anchors"),this.el.sceneEl.setAttribute("webxr",e)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var e,t,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(e=i.frame,t=r.getReferenceSpace(),n=e.getPose(this.anchor.anchorSpace,t),s.matrix.elements=n.transform.matrix,s.matrix.decompose(s.position,s.rotation,s.scale)))},createAnchor:async function(e,t){var n,i,s,o,a=this.el.sceneEl,l=a.renderer.xr,c=this.el.object3D;e=e||c.position,t=t||this.auxQuaternion.setFromEuler(c.rotation),function(e){var t=e.renderer.xr.getSession();return t&&t.restorePersistentAnchor}(a)?(this.anchor&&this.deleteAnchor(),n=a.frame,i=l.getReferenceSpace(),s=new XRRigidTransform({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z,w:t.w}),this.requestAnchorPending=!1,o=await n.createAnchor(s,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await o.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):r("The anchor won't be persisted because the entity has no assigned id.")),a.object3D.attach(this.el.object3D),this.anchor=o):r("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var e,t=this.el.sceneEl.renderer.xr.getSession(),n=t.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return r("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){e=localStorage.getItem(this.el.id);for(var i=0;i{var i=n(4635).A,r=n(8190).components,s=n(8190).registerComponent,o=n(9437),a=n(7427),l=new o.Color,c=new o.Color,h=a.entity.getComponentProperty,u=a.entity.setComponentProperty,d={},p="color",A="rotation",f="components";function m(e){e.x=o.MathUtils.degToRad(e.x),e.y=o.MathUtils.degToRad(e.y),e.z=o.MathUtils.degToRad(e.z)}function g(e,t,n){var i;for(i=0;i=1),x(s)?E(o,s.property,n,s.type):u(o,s.property,n))})},updateConfigForVector:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el;for(e in t=""!==s.from?a.coordinates.parse(s.from):h(o,s.property),n=a.coordinates.parse(s.to),s.property===A&&(m(t),m(n)),this.targetsArray.length=0,this.targetsArray.push(t),r.targets=this.targetsArray,n)r[e]=n[e];"position"!==s.property&&s.property!==A&&"scale"!==s.property?r.update=function(){var e={};return function(t){var n=t.animatables[0].target;n.x===e.x&&n.y===e.y&&n.z===e.z||(e.x=n.x,e.y=n.y,e.z=n.z,u(o,s.property,n))}}():r.update=(i={},function(e){var t=e.animatables[0].target;t.x===i.x&&t.y===i.y&&t.z===i.z||(i.x=t.x,i.y=t.y,i.z=t.z,o.object3D[s.property].set(t.x,t.y,t.z))})},updateConfig:function(){var e,t,n,i,s,o,a;t=this.el,n=this.data.property,s=(o=n.split("."))[0],a=o[1],e=(i=t.components[s]||r[s])?a&&!i.schema[a]?null:a?i.schema[a].type:i.schema.type:null,x(this.data)&&this.data.type===p?this.updateConfigForRawColor():"vec2"===e||"vec3"===e||"vec4"===e?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(e){var t,n=this.data,r=this.el,s=this;return""===n.from&&!!n.property.startsWith(f)&&(t=b(n.property)[1],!r.components[t]&&(r.addEventListener("componentinitialized",(function n(o){o.detail.name===t&&(e(),s.animation=i(s.config),r.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var e,t;for(t in this.el.components)e=this.el.components[t],t!==this.attrName&&"animation"===e.name&&e.animationIsPlaying&&e.data.property===this.data.property&&(e.animationIsPlaying=!1)},addEventListeners:function(){var e=this.data,t=this.el;g(t,e.startEvents,this.onStartEvent),g(t,e.pauseEvents,this.pauseAnimation),g(t,e.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var e=this.data,t=this.el;v(t,e.startEvents,this.onStartEvent),v(t,e.pauseEvents,this.pauseAnimation),v(t,e.resumeEvents,this.resumeAnimation)},setColorConfig:function(e,t){l.set(e),c.set(t),e=this.fromColor,t=this.toColor,e.r=l.r,e.g=l.g,e.b=l.b,t.r=c.r,t.g=c.g,t.b=c.b}})},4395:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);e.exports.Component=i("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new r.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,n=this.camera;n.aspect=t.aspect||window.innerWidth/window.innerHeight,n.far=t.far,n.fov=t.fov,n.near=t.near,n.zoom=t.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.active===t.active||t.spectator||(t.active&&i.activeCameraEl!==n?i.setActiveCamera(n):t.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.spectator===t.spectator||(t.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):t.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}})},3674:(e,t,n)=>{var i,r,s,o,a=n(8190).registerComponent,l=n(7427),c="click",h="mouseup",u="cursor-fusing",d="cursor-hovering",p="cursor-hovered",A={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},f={DOWN:["selectstart"],UP:["selectend"]},m="a-mouse-cursor-hover";e.exports.Component=a("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:l.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},multiple:!0,init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=l.debounce((function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&this.updateMouseEventListeners()},tick:function(){var e=this.el.sceneEl.frame,t=this.activeXRInput;"xrselect"===this.data.rayOrigin&&e&&t&&this.onMouseMove({frame:e,inputSource:t,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(d),e.removeState(u),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(p),this.removeEventListeners()},addEventListeners:function(){var e,t=this.data,n=this.el,i=this;function r(){e=n.sceneEl.canvas,t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.addEventListener(t,i.onCursorDown)})),A.UP.forEach((function(t){e.addEventListener(t,i.onCursorUp)})))}(e=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),t.downEvents.forEach((function(e){n.addEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.addEventListener(e,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,i=this;!(e=n.sceneEl.canvas)||t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.removeEventListener(t,i.onCursorDown)})),A.UP.forEach((function(t){e.removeEventListener(t,i.onCursorUp)}))),t.downEvents.forEach((function(e){n.removeEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.removeEventListener(e,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds)},updateMouseEventListeners:function(){var e,t=this.el;(e=t.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove,!1),e.addEventListener("touchmove",this.onMouseMove,!1),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},onMouseMove:(i=new THREE.Vector3,r=new THREE.Vector2,s=new THREE.Vector3,o={origin:s,direction:i},function(e){var t,n,a,l,c,h,u,d=this.canvasBounds,p=this.el.sceneEl.camera;p.parent.updateMatrixWorld(),t=(n="touchmove"===e.type||"touchstart"===e.type?e.touches.item(0):e).clientX-d.left,a=n.clientY-d.top,r.x=t/d.width*2-1,r.y=-a/d.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==e.type&&"fakeselectevent"!==e.type?"fakeselectout"===e.type?(i.set(0,1,0),s.set(0,9999,0)):p&&p.isPerspectiveCamera?(s.setFromMatrixPosition(p.matrixWorld),i.set(r.x,r.y,.5).unproject(p).sub(s).normalize()):p&&p.isOrthographicCamera?(s.set(r.x,r.y,(p.near+p.far)/(p.near-p.far)).unproject(p),i.set(0,0,-1).transformDirection(p.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+p.type):(l=e.frame,c=e.inputSource,h=this.el.renderer.xr.getReferenceSpace(),u=l.getPose(c.targetRaySpace,h).transform,i.set(0,0,-1),i.applyQuaternion(u.orientation),s.copy(u.position)),this.el.setAttribute("raycaster",o),"touchmove"===e.type&&e.preventDefault()}),onCursorDown:function(e){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===e.type&&(this.activeXRInput=e.inputSource,this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",e),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(h,e),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(h,this.intersectedEventDetail)),t.fuse&&"mouse"!==t.rayOrigin&&"xrselect"!==t.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(c,e),"xrselect"===t.rayOrigin&&this.activeXRInput===e.inputSource&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()}},onIntersection:function(e){var t,n,i,r,s=this.el;n=e.detail.els[0]===s?1:0,r=e.detail.intersections[n],(i=e.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl))&&t.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0);var e=this.el.sceneEl.xrSession,t=this;e&&"mouse"!==this.data.rayOrigin&&(f.DOWN.forEach((function(n){e.addEventListener(n,t.onCursorDown)})),f.UP.forEach((function(n){e.addEventListener(n,t.onCursorUp)})))},setIntersection:function(e,t){var n=this.el,i=this.data,r=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(d),e.addState(p),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add(m),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(u),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(u),r.twoWayEmit(c)}),i.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(p),i.removeState(d),i.removeState(u),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(m),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&0!==(n=this.el.components.raycaster.intersections).length&&(t=n[n[0].object.el===i?1:0])&&this.setIntersection(t.object.el,t))},twoWayEmit:function(e,t){var n,i=this.el,r=this.intersectedEl;function s(e,n){t instanceof MouseEvent?e.mouseEvent=t:"undefined"!=typeof TouchEvent&&t instanceof TouchEvent&&(e.touchEvent=t)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(e,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(e,this.intersectedEventDetail))}})},8388:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="generic";e.exports.Component=i("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},orientationOffset:{type:"vec3"},disabled:{default:!1}},mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.lastControllerCheck=0,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(t){t.detail.name!==e.name&&(e.wasControllerConnected=!0,e.removeEventListeners(),e.removeControllersUpdateListener())}))},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;s(this,l,{hand:t,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:l,orientationOffset:t.orientationOffset,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},initDefaultModel:function(){var e=this.modelEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:.03}),e.setAttribute("material",{color:this.data.color}),this.el.appendChild(e),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}})},9840:(e,t,n)=>{var i=n(7045).to,r=n(7045).Ls,s=n(8190).registerComponent,o=n(9437),a=new o.BufferGeometry;e.exports.Component=s("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:r,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(e),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(t=i.getObject3D("mesh"))?t.geometry=this.geometry:((t=new o.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(t.material=new o.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=a,this.geometry=null},updateSchema:function(e){var t=this.oldData&&this.oldData.primitive,n=e.primitive,r=i[n]&&i[n].schema;if(!r)throw new Error("Unknown geometry schema `"+n+"`");t&&t===n||this.extendSchema(r)}})},297:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427).debug("components:gltf-model:warn");e.exports.Component=i("gltf-model",{schema:{type:"model"},init:function(){var e=this,t=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new r.GLTFLoader,t&&this.loader.setDRACOLoader(t),this.ready=n?n.then((function(t){e.loader.setMeshoptDecoder(t)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var e=this,t=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){e.loader.load(n,(function(n){e.model=n.scene||n.scenes[0],e.model.animations=n.animations,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"gltf",model:e.model})}),void 0,(function(e){var i=e&&e.message?e.message:"Failed to load glTF model";s(i),t.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},9194:(e,t,n)=>{(0,n(8190).registerComponent)("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}})},332:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343).AFRAME_CDN_ROOT,s={toonLeft:r+"controllers/hands/leftHand.glb",toonRight:r+"controllers/hands/rightHand.glb",lowPolyLeft:r+"controllers/hands/leftHandLow.glb",lowPolyRight:r+"controllers/hands/rightHandLow.glb",highPolyLeft:r+"controllers/hands/leftHandHigh.glb",highPolyRight:r+"controllers/hands/rightHandHigh.glb"},o="Point",a="Fist",l="Thumb Up",c={};function h(e,t){var n;if(e)return"grip"===(n=c[e])?n+(t?"close":"open"):"point"===n?n+(t?"up":"down"):"pointing"===n||"pistol"===n?n+(t?"start":"end"):void 0}c[a]="grip",c[l]="pistol",c[o]="pointing",e.exports.Component=i("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},init:function(){var e=this,t=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){e.handleButton("grip","down")},this.onGripUp=function(){e.handleButton("grip","up")},this.onTrackpadDown=function(){e.handleButton("trackpad","down")},this.onTrackpadUp=function(){e.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){e.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){e.handleButton("trackpad","touchend")},this.onTriggerDown=function(){e.handleButton("trigger","down")},this.onTriggerUp=function(){e.handleButton("trigger","up")},this.onTriggerTouchStart=function(){e.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){e.handleButton("trigger","touchend")},this.onGripTouchStart=function(){e.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){e.handleButton("grip","touchend")},this.onThumbstickDown=function(){e.handleButton("thumbstick","down")},this.onThumbstickUp=function(){e.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){e.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){e.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){e.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){e.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){e.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){e.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected),t.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(t/1e3)},onControllerConnected:function(){this.el.object3D.visible=!0},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var e=this.el;e.addEventListener("gripdown",this.onGripDown),e.addEventListener("gripup",this.onGripUp),e.addEventListener("trackpaddown",this.onTrackpadDown),e.addEventListener("trackpadup",this.onTrackpadUp),e.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.addEventListener("triggerdown",this.onTriggerDown),e.addEventListener("triggerup",this.onTriggerUp),e.addEventListener("triggertouchstart",this.onTriggerTouchStart),e.addEventListener("triggertouchend",this.onTriggerTouchEnd),e.addEventListener("griptouchstart",this.onGripTouchStart),e.addEventListener("griptouchend",this.onGripTouchEnd),e.addEventListener("thumbstickdown",this.onThumbstickDown),e.addEventListener("thumbstickup",this.onThumbstickUp),e.addEventListener("abuttontouchstart",this.onAorXTouchStart),e.addEventListener("abuttontouchend",this.onAorXTouchEnd),e.addEventListener("bbuttontouchstart",this.onBorYTouchStart),e.addEventListener("bbuttontouchend",this.onBorYTouchEnd),e.addEventListener("xbuttontouchstart",this.onAorXTouchStart),e.addEventListener("xbuttontouchend",this.onAorXTouchEnd),e.addEventListener("ybuttontouchstart",this.onBorYTouchStart),e.addEventListener("ybuttontouchend",this.onBorYTouchEnd),e.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var e=this.el;e.removeEventListener("gripdown",this.onGripDown),e.removeEventListener("gripup",this.onGripUp),e.removeEventListener("trackpaddown",this.onTrackpadDown),e.removeEventListener("trackpadup",this.onTrackpadUp),e.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.removeEventListener("triggerdown",this.onTriggerDown),e.removeEventListener("triggerup",this.onTriggerUp),e.removeEventListener("triggertouchstart",this.onTriggerTouchStart),e.removeEventListener("triggertouchend",this.onTriggerTouchEnd),e.removeEventListener("griptouchstart",this.onGripTouchStart),e.removeEventListener("griptouchend",this.onGripTouchEnd),e.removeEventListener("thumbstickdown",this.onThumbstickDown),e.removeEventListener("thumbstickup",this.onThumbstickUp),e.removeEventListener("abuttontouchstart",this.onAorXTouchStart),e.removeEventListener("abuttontouchend",this.onAorXTouchEnd),e.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),e.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),e.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),e.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),e.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),e.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),e.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(e){var t,n=this.el,i=this.data.hand,r=this.data.handModelStyle,o=this.data.color,a=this;if(t={hand:i,model:!1},i!==e){var l=s[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(l,(function(e){var r=e.scene.children[0],s="left"===i?Math.PI/2:-Math.PI/2,l=n.sceneEl.hasWebXR?-Math.PI/2:0;r.mixer=new THREE.AnimationMixer(r),a.clips=e.animations,n.setObject3D("mesh",r),r.traverse((function(e){e.isMesh&&(e.material.color=new THREE.Color(o))})),r.position.set(0,0,0),r.rotation.set(l,0,s),n.setAttribute("magicleap-controls",t),n.setAttribute("vive-controls",t),n.setAttribute("oculus-touch-controls",t),n.setAttribute("pico-controls",t),n.setAttribute("windows-motion-controls",t),n.setAttribute("hp-mixed-reality-controls",t)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(e,t){var n,i="down"===t,r="touchstart"===t;if(0===t.indexOf("touch")){if(r===this.touchedButtons[e])return;this.touchedButtons[e]=r}else{if(i===this.pressedButtons[e])return;this.pressedButtons[e]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var e,t,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,c=this.pressedButtons.trigger||this.touchedButtons.trigger,h=this.touchedButtons.AorX||this.touchedButtons.BorY;return t=this.el.components["tracked-controls"],(n=t&&t.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||c?e=a:s&&(e=o):i?e=r||h||s?c?a:o:c?l:"Point + Thumb":c&&(e="Hold"),e},getClip:function(e){var t,n;for(n=0;n{var i,r=n(8190).registerComponent,s=n(4056).P,o=n(7960).checkControllerPresentAndSetup,a=n(1343).AFRAME_CDN_ROOT,l=a+"controllers/oculus-hands/v4/left.glb",c=a+"controllers/oculus-hands/v4/right.glb",h=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];e.exports.Component=r("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var e=0;ethis.pinchDistance+.1*this.pinchDistance&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{id:"",hand:t.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==e.getObject3D("mesh")&&e.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var e,t=this.el;this.checkIfControllerPresent(),e=t.components["tracked-controls"]&&t.components["tracked-controls"].controller,this.mesh&&e&&e.hand&&e.hand instanceof XRHand&&t.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var e=this.data;"dots"===e.modelStyle&&this.initDotsModel(),"mesh"===e.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var e=0;e{var i=n(8190).registerComponent,r=n(9437);i("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var e,t=this.el,n=this.data;e="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",t.setAttribute("hand-tracking-controls",{hand:n.hand}),t.setAttribute("obb-collider",{trackedObject3D:e,size:.04}),this.auxMatrix=new r.Matrix4,this.auxQuaternion=new r.Quaternion,this.auxQuaternion2=new r.Quaternion,this.auxVector=new r.Vector3,this.auxVector2=new r.Vector3,this.grabbingObjectPosition=new r.Vector3,this.grabbedObjectPosition=new r.Vector3,this.grabbedObjectPositionDelta=new r.Vector3,this.grabDeltaPosition=new r.Vector3,this.grabInitialRotation=new r.Quaternion,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded),this.onPinchMoved=this.onPinchMoved.bind(this),this.el.addEventListener("pinchmoved",this.onPinchMoved)},transferEntityOwnership:function(){for(var e,t=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-ar",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("ar-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},1620:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-vr",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("vr-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},7538:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="hp-mixed-reality",h=n(1343).AFRAME_CDN_ROOT+"controllers/hp/mixed-reality/",u={x:0,y:0,z:.06},d={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"};e.exports.Component=i("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t=e.detail.model;this.data.model&&(t.position.copy(u),t.rotation.copy(d),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},8850:(e,t,n)=>{n(6896),n(2784),n(4395),n(3674),n(9840),n(8388),n(297),n(9194),n(9686),n(5593),n(332),n(5387),n(1620),n(7538),n(6219),n(9248),n(8798),n(6298),n(7796),n(7850),n(298),n(3069),n(3176),n(8771),n(6077),n(5744),n(2588),n(7519),n(7394),n(2310),n(4760),n(1072),n(477),n(1603),n(6547),n(4524),n(6466),n(5300),n(7360),n(1507),n(4592),n(6458),n(221),n(3575),n(4005),n(3494),n(6273),n(3239),n(2288),n(6149),n(2130),n(3791),n(2662),n(952),n(1217),n(8346),n(6469)},9248:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427);i("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var e=this.config,t=this.data,n=this.el,i=this,s={hand:t.hand,model:t.model};function o(t){var s=e[t.detail.name];if(s){var o=r.extend({showLine:!0},s.raycaster||{});t.detail.rayOrigin&&(o.origin=t.detail.rayOrigin.origin,o.direction=t.detail.rayOrigin.direction,o.showLine=!0),t.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",o):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",r.extend({fuse:!1},s.cursor))}}n.setAttribute("hp-mixed-reality-controls",s),n.setAttribute("magicleap-controls",s),n.setAttribute("oculus-go-controls",s),n.setAttribute("oculus-touch-controls",s),n.setAttribute("pico-controls",s),n.setAttribute("valve-index-controls",s),n.setAttribute("vive-controls",s),n.setAttribute("vive-focus-controls",s),n.setAttribute("windows-motion-controls",s),n.setAttribute("generic-tracked-controller-controls",{hand:s.hand}),n.addEventListener("controllerconnected",o),n.addEventListener("controllerdisconnected",(function(t){e[t.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(e){o(e),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"oculus-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}})},6219:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).debug("components:layer:warn");e.exports.Component=i("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var e=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=e.createFramebuffer();var t=this.el.sceneEl.getAttribute("webxr"),n=t.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",t)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(e){this.data.src!==e.src&&this.updateSrc()},updateSrc:function(){var e=this.data.type;this.texture=void 0,"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var e,t=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(e=t.getSubImage(this.layer,n),this.loadCubeMapImage(e.colorTexture,i,0)):(e=t.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(e.colorTexture,i,0),e=t.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(e.colorTexture,i,6))))},loadQuadImage:function(){var e=this.data.src,t=this;this.el.sceneEl.systems.material.loadTexture(e,{src:e},(function(n){t.el.sceneEl.renderer.initTexture(n),t.texture=n,"VIDEO"===e.tagName&&setTimeout((function(){t.textureIsVideo=!0}),1e3),t.layer&&(t.layer.height=t.data.height/2||t.texture.image.height/1e3,t.layer.width=t.data.width/2||t.texture.image.width/1e3,t.needsRedraw=!0),t.updateQuadPanel()}))},preGenerateCubeMapTextures:function(e,t){"monocubemap"===this.data.type?this.generateCubeMapTextures(e,0,t):(this.generateCubeMapTextures(e,0,t),this.generateCubeMapTextures(e,6,t))},generateCubeMapTextures:function(e,t,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(e.width,e.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var u=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(u.save(),u.translate(o,o),u.rotate(Math.PI))),u.drawImage(e,(c+t)*a,0,a,a,0,0,o,o),u.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(e,t,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,e),i=!t.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(t,n);var s=0;i.forEach((function(e,t){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,r.RGBA,r.UNSIGNED_BYTE,e),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&(!this.layer&&this.el.sceneEl.is("vr-mode")&&this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var e=this,t=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(t){e.visibilityChanged="hidden"!==t.session.visibilityState},"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var e=this.el.sceneEl,t=e.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(e.xrSession,t);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),e.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var e=this.data.src,t=this.el.sceneEl,n=t.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(e.width,e.height)),s=this.xrGLFactory=new XRWebGLBinding(t.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),t.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var e=this.cubeFaceSize,t=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=e;var r=i.getContext("2d");i.width=i.height=e,r.fillStyle="black",r.fillRect(0,0,e,e),2!==n&&3!==n&&(r.translate(e,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",e/2,e/2)),t.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(e){this.layerEnabled=e,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var e=this.quadPanelEl;this.quadPanelEl||(e=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(e)),e.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),e.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var e=this.el.sceneEl,t=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,e.frame),i=e.renderer.properties.get(this.texture).__webglTexture,r=t.getParameter(t.FRAMEBUFFER_BINDING);t.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n.colorTexture,0),function(e,t,n,i){var r=e.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(e.bindTexture(e.TEXTURE_2D,t),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,e.RGB,e.UNSIGNED_BYTE,i)),e.bindFramebuffer(e.READ_FRAMEBUFFER,r),e.framebufferTexture2D(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.readBuffer(e.COLOR_ATTACHMENT0),e.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,e.COLOR_BUFFER_BIT,e.NEAREST),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.deleteFramebuffer(r)}(t,i,n,this.data.src),t.bindFramebuffer(t.FRAMEBUFFER,r)},updateTransform:function(){var e=this.el,t=this.position,n=this.quaternion;e.object3D.updateMatrixWorld(),t.setFromMatrixPosition(e.object3D.matrixWorld),n.setFromRotationMatrix(e.object3D.matrixWorld),this.layerEnabled||t.set(0,0,1e8),this.layer.transform=new XRRigidTransform(t,n)},onEnterVR:function(){var e=this.el.sceneEl,t=e.xrSession;e.hasWebXR&&XRWebGLBinding&&t?(t.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.needsRedraw=!0,this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):r("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(e){this.referenceSpace=e}})},8798:(e,t,n)=>{var i,r,s,o,a,l,c=n(7427),h=c.diff,u=n(8940),d=n(8190).registerComponent,p=n(9437),A=n(3657),f=p.MathUtils.degToRad,m=u("components:light:warn"),g=new p.CubeTextureLoader,v={};e.exports.Component=d("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:1,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var e=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(e)},update:function(e){var t=this.data,n=h(t,e),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(e){var n=t[e];switch(e){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=f(n);break;case"target":null===n?"spot"!==t.type&&"directional"!==t.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",r.onSetTarget.bind(r,n,i));break;case"envMap":r.updateProbeMap(t,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":t.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[e]=n}}))}},tick:(i=new p.Box3,r=new p.Vector3,s=new p.Vector3,o=new p.Matrix4,a=new p.Sphere,l=new p.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof p.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var e=this.light.shadow.camera;e.getWorldDirection(r),e.getWorldPosition(s),o.copy(e.matrixWorld),o.invert(),e.near=1,e.left=1e5,e.right=-1e5,e.top=-1e5,e.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(t){i.setFromObject(t.object3D),i.getBoundingSphere(a);var n=A.distanceOfPointFromPlane(s,r,a.center),c=A.nearestPointInPlane(s,r,a.center,l).applyMatrix4(o);e.near=Math.min(-n-a.radius-1,e.near),e.left=Math.min(-a.radius+c.x,e.left),e.right=Math.max(a.radius+c.x,e.right),e.top=Math.max(a.radius+c.y,e.top),e.bottom=Math.min(-a.radius+c.y,e.bottom)})),e.updateProjectionMatrix()}}),setLight:function(e){var t=this.el,n=this.getLight(e);n&&(this.light&&t.removeObject3D("light"),this.light=n,this.light.el=t,t.setObject3D("light",this.light),"spot"!==e.type&&"directional"!==e.type&&"hemisphere"!==e.type||t.getObject3D("light").translateY(-1),"spot"===e.type&&(t.setObject3D("light-target",this.defaultTarget),t.getObject3D("light-target").position.set(0,0,-1)),e.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var e=this.el,t=this.data,n=this.light;n.castShadow=t.castShadow;var i=e.getObject3D("cameraHelper");if(t.shadowCameraVisible&&!i?e.setObject3D("cameraHelper",new p.CameraHelper(n.shadow.camera)):!t.shadowCameraVisible&&i&&e.removeObject3D("cameraHelper"),!t.castShadow)return n;n.shadow.bias=t.shadowBias,n.shadow.radius=t.shadowRadius,n.shadow.mapSize.height=t.shadowMapHeight,n.shadow.mapSize.width=t.shadowMapWidth,n.shadow.camera.near=t.shadowCameraNear,n.shadow.camera.far=t.shadowCameraFar,n.shadow.camera instanceof p.OrthographicCamera?(n.shadow.camera.top=t.shadowCameraTop,n.shadow.camera.right=t.shadowCameraRight,n.shadow.camera.bottom=t.shadowCameraBottom,n.shadow.camera.left=t.shadowCameraLeft):n.shadow.camera.fov=t.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(e){var t=e.angle,n=new p.Color(e.color);n=n.getHex();var i=e.decay,r=e.distance,s=new p.Color(e.groundColor);s=s.getHex();var o=e.intensity,a=e.type,l=e.target,c=null;switch(a.toLowerCase()){case"ambient":return new p.AmbientLight(n,o);case"directional":return c=new p.DirectionalLight(n,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new p.HemisphereLight(n,s,o);case"point":return new p.PointLight(n,o,r,i);case"spot":return c=new p.SpotLight(n,o,r,f(t),e.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new p.LightProbe,this.updateProbeMap(e,c),c;default:m("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(e,t){e.envMap||t.copy(new p.LightProbe),v[e.envMap]instanceof window.Promise&&v[e.envMap].then((function(e){t.copy(e)})),v[e.envMap]instanceof p.LightProbe&&t.copy(v[e.envMap]),v[e.envMap]=new window.Promise((function(n){c.srcLoader.validateCubemapSrc(e.envMap,(function(n){g.load(n,(function(n){var i=p.LightProbeGenerator.fromCubeTexture(n);v[e.envMap]=i,t.copy(i)}))}))}))},onSetTarget:function(e,t){t.target=e.object3D},remove:function(){var e=this.el;e.removeObject3D("light"),e.getObject3D("cameraHelper")&&e.removeObject3D("cameraHelper")}})},6298:(e,t,n)=>{var i=n(8190).registerComponent;function r(e,t){return!(!e||!t)&&e.x===t.x&&e.y===t.y&&e.z===t.z}e.exports.Component=i("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var e,t,n=this.data;t=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(e=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(e,t),this.el.setObject3D(this.attrName,this.line)},update:function(e){var t=this.data,n=this.geometry,i=!1,s=this.material,o=n.attributes.position.array;r(t.start,e.start)||(o[0]=t.start.x,o[1]=t.start.y,o[2]=t.start.z,i=!0),r(t.end,e.end)||(o[3]=t.end.x,o[4]=t.end.y,o[5]=t.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),s.color.setStyle(t.color),s.opacity=t.opacity,s.transparent=t.opacity<1,s.visible=t.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}})},7796:(e,t,n)=>{var i,r,s,o,a,l,c,h,u=n(8190).registerComponent,d=n(5892).registerShader,p=n(9437);e.exports.Component=u("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new p.Quaternion,this.hiddenEls=[]},update:function(e){var t,n,i=this.data,r=this.el;i.visualAspectEnabled&&(this.initVisualAspect(),t=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",t),r.setAttribute("material","strokeColor",n),i.on!==e.on&&this.updateEventListener(),void 0!==e.peekMode&&i.peekMode!==e.peekMode&&this.updatePeekMode(),i.image&&e.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src))},updatePeekMode:function(){var e=this.el,t=this.sphereEl;this.data.peekMode?(this.hideAll(),e.getObject3D("mesh").visible=!1,t.setAttribute("visible",!0)):(this.showAll(),e.getObject3D("mesh").visible=!0,t.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var e=this.el;e.isPlaying&&(this.removeEventListener(),e.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var e=this.data.on;e&&this.el.removeEventListener(e,this.navigate)},initVisualAspect:function(){var e,t,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),t=this.sphereEl=this.sphereEl||document.createElement("a-entity"),e=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double"}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),e.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),e.setAttribute("rotation","0 180 0"),e.setAttribute("position","0 0 0"),e.setAttribute("visible",!1),i.appendChild(e),t.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back"}),t.setAttribute("visible",!1),i.appendChild(t),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:(a=new p.Vector3,l=new p.Vector3,c=new p.Quaternion,h=new p.Vector3,function(){var e,t,n=this.el,i=n.object3D,r=n.sceneEl.camera,s=this.textEl;if(this.data.visualAspectEnabled)if(i.updateMatrixWorld(),r.parent.updateMatrixWorld(),r.updateMatrixWorld(),i.matrix.decompose(l,c,h),l.setFromMatrixPosition(i.matrixWorld),a.setFromMatrixPosition(r.matrixWorld),(t=l.distanceTo(a))>20)this.previousQuaternion||(this.quaternionClone.copy(c),this.previousQuaternion=this.quaternionClone),i.lookAt(a);else{if(e=this.calculateCameraPortalOrientation(),t<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;s.setAttribute("text","width",1.5),e<=0?(s.setAttribute("position","0 0 0.75"),s.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(s.setAttribute("position","0 0 -0.75"),s.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),n.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=e}else e<=0?s.setAttribute("rotation","0 180 0"):s.setAttribute("rotation","0 0 0"),s.setAttribute("text","width",5),s.setAttribute("position","0 1.5 0"),n.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(i.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}),hideAll:function(){var e=this.el,t=this.hiddenEls,n=this;t.length>0||e.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==e.sceneEl.object3D&&i.el!==e&&i.el!==n.sphereEl&&i.el!==e.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),t.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(e){e.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(i=new p.Matrix4,r=new p.Vector3,s=new p.Vector3(0,0,1),o=new p.Vector3(0,0,0),function(){var e=this.el,t=e.sceneEl.camera;return r.set(0,0,0),s.set(0,0,1),o.set(0,0,0),e.object3D.matrixWorld.extractRotation(i),s.applyMatrix4(i),e.object3D.updateMatrixWorld(),e.object3D.localToWorld(o),t.parent.parent.updateMatrixWorld(),t.parent.updateMatrixWorld(),t.updateMatrixWorld(),t.localToWorld(r),r.sub(o).normalize(),s.normalize(),Math.sign(s.dot(r))}),remove:function(){this.removeEventListener()}}),d("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / 15.0), 2.0), 0.0, 1.0));","}","}"].join("\n")})},7850:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427),o=Math.PI/2;e.exports.Component=i("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new r.Vector3,this.hmdQuaternion=new r.Quaternion,this.magicWindowAbsoluteEuler=new r.Euler,this.magicWindowDeltaEuler=new r.Euler,this.position=new r.Vector3,this.magicWindowObject=new r.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new r.Vector3,rotation:new r.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var e,t=this.data;(s.device.isMobile()||s.device.isMobileDeviceRequestingDesktopSite())&&(e=this.magicWindowControls=new r.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(e.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?e.enabled=t.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){e.enabled=t.magicWindowTrackingEnabled}))))},update:function(e){var t=this.data;t.enabled!==e.enabled&&this.updateGrabCursor(t.enabled),e&&!t.magicWindowTrackingEnabled&&e.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=t.magicWindowTrackingEnabled),e&&!t.pointerLockEnabled!==e.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(e){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new r.Object3D,this.yawObject=new r.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;t?(t.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),t.addEventListener("touchstart",this.onTouchStart),window.addEventListener("touchmove",this.onTouchMove),window.addEventListener("touchend",this.onTouchEnd),e.addEventListener("enter-vr",this.onEnterVR),e.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):e.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var e=this.el.sceneEl,t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("enter-vr",this.onEnterVR),e.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var e=this.el.object3D,t=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),e.rotation.x=this.magicWindowDeltaEuler.x+t.rotation.x,e.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,e.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var e=this.magicWindowAbsoluteEuler,t=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),e.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===e.y||(this.previousMagicWindowYaw=e.y),this.previousMagicWindowYaw&&(t.x=e.x,t.y+=e.y-this.previousMagicWindowYaw,t.z=e.z,this.previousMagicWindowYaw=e.y))},onMouseMove:function(e){var t,n,i,r=this.pitchObject,s=this.previousMouseEvent,a=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=e.movementX||e.mozMovementX||0,i=e.movementY||e.mozMovementY||0):(n=e.screenX-s.screenX,i=e.screenY-s.screenY),this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,t=this.data.reverseMouseDrag?1:-1,a.rotation.y+=.002*n*t,r.rotation.x+=.002*i*t,r.rotation.x=Math.max(-o,Math.min(o,r.rotation.x)))},onMouseDown:function(e){var t=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!t.is("vr-mode")&&!t.is("ar-mode")||!t.checkHeadsetConnected())&&0===e.button){var n=t&&t.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(e){1!==e.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/i.clientWidth,t=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var e=this.el.sceneEl;e.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),e.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(e){var t=this.el.sceneEl;function n(){t.canvas.classList.add("a-grab-cursor")}function i(){t.canvas.classList.remove("a-grab-cursor")}t.canvas?e?n():i():e?t.addEventListener("render-target-loaded",n):t.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var e=this.el;this.savedPose.position.copy(e.object3D.position),this.savedPose.rotation.copy(e.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var e=this.el,t=this.savedPose;this.hasSavedPose&&(e.object3D.position.copy(t.position),e.object3D.rotation.copy(t.rotation),this.hasSavedPose=!1)}})},298:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="magicleap-one",c=n(1343).AFRAME_CDN_ROOT+"controllers/magicleap/magicleap-one-controller.glb";e.exports.Component=i("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,l,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:l,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",c)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){},setButtonColor:function(e,t){}})},3069:(e,t,n)=>{var i=n(7427),r=n(8190),s=n(9437),o=n(5892),a=i.debug("components:material:error"),l=r.registerComponent,c=o.shaders,h=o.shaderNames;function u(e,t){e.dispose(),t.unregisterMaterial(e),Object.keys(e).filter((function(t){return e[t]&&e[t].isTexture})).forEach((function(t){e[t].dispose()}))}e.exports.Component=l("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:h,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t,n,i,r;n=e&&e.shader,t=this.oldData&&this.oldData.shader,(i=c[r=n||t]&&c[r].schema)||a("Unknown shader schema "+r),t&&n===t||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var e,t,n=this.el.sceneEl,i=this.schema,r=this;function s(e,n){var i;for(i in t)t[i]=e;r.shader.update(t)}for(e in this.tick=void 0,t={},i)"time"===i[e].type&&(this.tick=s,t[e]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(e){var t,n=this.data,i=c[e]&&c[e].Shader;if(!i)throw new Error("Unknown shader "+e);(t=this.shader=new i).el=this.el,t.init(n),this.setMaterial(t.material),this.updateSchema(n)},updateMaterial:function(e){var t,n=this.data,i=this.material;for(t in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(e){switch(e){case"back":return s.BackSide;case"double":return s.DoubleSide;default:return s.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(e){switch(e){case"none":return s.NoBlending;case"additive":return s.AdditiveBlending;case"subtractive":return s.SubtractiveBlending;case"multiply":return s.MultiplyBlending;default:return s.NormalBlending}}(n.blending),i.dithering=n.dithering,e)break;!t||e.alphaTest===n.alphaTest&&e.side===n.side&&e.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var e=new s.MeshBasicMaterial,t=this.material,n=this.el.getObject3D("mesh");n&&(n.material=e),u(t,this.system)},setMaterial:function(e){var t,n=this.el,i=this.system;this.material&&u(this.material,i),this.material=e,i.registerMaterial(e),(t=n.getObject3D("mesh"))?t.material=e:n.addEventListener("object3dset",(function t(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=e,n.removeEventListener("object3dset",t))}))}})},3176:(e,t,n)=>{var i,r,s,o,a,l=n(8190).registerComponent,c=n(9437);l("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new c.Vector3).copy(this.el.object3D.scale),this.auxEuler=new c.Euler,this.boundingBox=new c.Box3,this.boundingBoxSize=new c.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var e,t=this.el,n=t.components["gltf-model"]&&t.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),e=(new c.Box3).setFromObject(n).getCenter(new c.Vector3),n.position.x+=n.position.x-e.x,n.position.y+=n.position.y-e.y,n.position.z+=n.position.z-e.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var e=this.el,t=this.boundingBoxSize,n=this.aabb=this.aabb||new c.OBB;this.obb=this.obb||new c.OBB,e.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(t).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):e.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var e=this.renderColliderMesh,t=this.boundingBoxSize;e?(e.geometry.dispose(),e.geometry=new c.BoxGeometry(t.x,t.y,t.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var e,t,n;e=this.boundingBoxSize,t=this.renderColliderGeometry=new c.BoxGeometry(e.x,e.y,e.z),(n=this.renderColliderMesh=new c.Mesh(t,new c.MeshLambertMaterial({color:65280,side:c.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:(i=new c.Vector3,r=new c.Vector3,s=new c.Quaternion,o=new c.Quaternion,a=new c.Matrix4,function(){var e=this.auxEuler,t=this.boundingBox,n=this.data.size,l=this.trackedObject3D||this.el.object3D,c=this.boundingBoxSize,h=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);e.copy(l.rotation),l.rotation.set(0,0,0),l.parent.matrixWorld.decompose(i,s,r),a.compose(i,o,r),l.parent.matrixWorld.copy(a),t.setFromObject(l,!0),t.getSize(c),c.x=c.x1e-4||Math.abs(t.y-this.previousScale.y)>1e-4||Math.abs(t.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(t),t.set(1,1,1),i.compose(e,n,t),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()})},8771:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=n(9437),o=i("components:obj-model:warn");e.exports.Component=r("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var e=this;this.model=null,this.objLoader=new s.OBJLoader,this.mtlLoader=new s.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(t){e.model&&"material"===t.detail.name&&e.applyMaterial()}))},update:function(){var e=this.data;e.obj&&(this.resetMesh(),this.loadObj(e.obj,e.mtl))},remove:function(){this.model&&this.resetMesh()},resetMesh:function(){this.el.removeObject3D("mesh")},loadObj:function(e,t){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,a=this.el.sceneEl.systems.renderer,l=t.substr(0,t.lastIndexOf("/")+1);if(t)return i.hasAttribute("material")&&o("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(l),void r.load(t,(function(t){t.preload(),s.setMaterials(t),s.load(e,(function(e){n.model=e,n.model.traverse((function(e){if(e.isMesh){var t=e.material;t.map&&a.applyColorCorrection(t.map),t.emissiveMap&&a.applyColorCorrection(t.emissiveMap)}})),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))}));s.load(e,(function(e){n.model=e,n.applyMaterial(),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))},applyMaterial:function(){var e=this.el.components.material;e&&this.model.traverse((function(t){t instanceof s.Mesh&&(t.material=e.material)}))}})},6077:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(7427).device.isWebXRAvailable,c=n(1343).AFRAME_CDN_ROOT+"controllers/oculus/go/oculus-go-controller.gltf",h=l?"oculus-go":"Oculus Go",u=l?{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]};e.exports.Component=i("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:u,bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){s(this,h,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{armModel:t.armModel,hand:t.hand,idPrefix:h,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",c)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),t.trackpad=n.getObjectByName("oculus_go_touchpad"),t.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var i;switch(t){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[e].material.color.set(i)}}})},5744:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(7427).device.isWebXRAvailable,h="oculus-touch",u=c?h:"Oculus Touch",d=n(1343).AFRAME_CDN_ROOT,p=d+"controllers/oculus/oculus-touch-controller-",A=d+"controllers/meta/",f={left:{modelUrl:p+"left.gltf",rayOrigin:{origin:{x:.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(-.005,.003,-.055),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:p+"right.gltf",rayOrigin:{origin:{x:-.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(.005,.003,-.055),modelPivotRotation:new r.Euler(0,0,0)}},m={left:{modelUrl:p+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(-.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)},right:{modelUrl:p+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)}},g="oculus-touch",v={"oculus-touch":c?m:f,"oculus-touch-v2":{left:{modelUrl:p+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)},right:{modelUrl:p+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:p+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:p+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:A+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:A+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:A+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:A+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}}},y=c?{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}}:{left:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","abutton","bbutton","surface"]}};function E(e){e.traverse((function(t){var n;"Mesh"===t.type&&(n=t.material.clone(),e.originalColor=t.material.color,t.material.dispose(),t.material=n)}))}e.exports.Component=i("oculus-touch-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]},orientationOffset:{type:"vec3",default:{x:43,y:0,z:0}}},mapping:y,bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new r.Euler},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,u,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(e){var t,n=this.data;if(n.model)if(this.controllerObject3D)this.el.setObject3D("mesh",this.controllerObject3D);else{if(this.displayModel=v[n.controllerType]||v[g],"auto"===n.controllerType){var i=this.el.sceneEl.systems["tracked-controls-webvr"];if(i&&i.vrDisplay){var r=i.vrDisplay.displayName;/^Oculus Quest$/.test(r)&&(this.displayModel=v["oculus-touch-v2"])}else{t=g;for(var s=Object.keys(v),o=0;o{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="pico-4",h=n(1343).AFRAME_CDN_ROOT+"controllers/pico/pico4/";e.exports.Component=i("pico-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","squeeze","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","squeeze","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)})},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},7519:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.position.set(0,0,0)}})},7394:(e,t,n)=>{var i,r,s=n(8190).registerComponent,o=n(9437),a=n(7427).debug("components:raycaster:warn"),l=/^[\w\s-.,[\]#]*$/,c={childList:!0,attributes:!0,subtree:!0},h="raycaster-intersected-cleared",u="raycaster-intersection-cleared";function d(e,t){var n;for(e.length=t.length,n=0;n0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var e,t=this.el,n=this.intersections;n.length&&(e=n[0].object.el===t&&n[1]?n[1].distance:n[0].distance),this.drawLine(e)},getIntersection:function(e){var t,n;for(t=0;t{var i=n(9437).MathUtils.degToRad,r=n(8190).registerComponent;e.exports.Component=r("rotation",{schema:{type:"vec3"},update:function(){var e=this.data,t=this.el.object3D;t.rotation.set(i(e.x),i(e.y),i(e.z)),t.rotation.order="YXZ"},remove:function(){this.el.object3D.rotation.set(0,0,0)}})},4760:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var e=this.data;this.el.object3D.scale.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}})},3575:(e,t,n)=>{var i,r,s,o=n(8190).registerComponent,a=n(9437),l=(i=new a.Quaternion,r=new a.Vector3,function(e,t,n){t.position.copy(e.transform.position),t.quaternion.copy(e.transform.orientation),r.copy(n),i.copy(e.transform.orientation),r.applyQuaternion(i),t.position.sub(r)});function c(e,t){this.renderer=e,this.xrHitTestSource=null,e.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),e.xr.addEventListener("sessionstart",function(){this.sessionStart(t)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(t)}function h(e){console.warn(e.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from ?')}l.tempFakePose={transform:{orientation:new a.Quaternion,position:new a.Vector3}},c.prototype.previousFrameAnchors=new Set,c.prototype.anchorToObject3D=new Map,c.prototype.sessionStart=function(e){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?e.space?this.session.requestHitTestSource(e).then(function(e){this.xrHitTestSource=e}.bind(this)).catch(h):e.profile&&this.session.requestHitTestSourceForTransientInput(e).then(function(e){this.xrHitTestSource=e,this.transient=!0}.bind(this)).catch(h):h({message:"No requestHitTestSource on the session."})},c.prototype.anchorFromLastHitTestResult=function(e,t){var n=this.lastHitTest;if(n){var i={object3D:e,offset:t};Array.from(this.anchorToObject3D.entries()).forEach(function(t){var n=t[1].object3D,i=t[0];n===e&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(e){this.anchorToObject3D.set(e,i)}.bind(this)).catch((function(e){console.warn(e.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from ?')}))}},c.prototype.doHit=function(e){if(this.renderer.xr.isPresenting){var t,n,i=this.renderer.xr.getReferenceSpace(),r=e.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(t=e.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=t[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(t=e.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=t[0],t[0].getPose(i)):void 0}},c.updateAnchorPoses=function(e,t){var n=e.trackedAnchors||c.prototype.previousFrameAnchors;c.prototype.previousFrameAnchors.forEach((function(e){n.has(e)||c.prototype.anchorToObject3D.delete(e)})),n.forEach((function(n){var i,r,s,o;try{i=e.getPose(n.anchorSpace,t)}catch(e){}if(i){if(!(r=c.prototype.anchorToObject3D.get(n)))return;s=r.offset,o=r.object3D,l(i,o,s)}}))},e.exports.Component=o("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new a.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new a.WebGLRenderTarget(512,512,{}),this.basicMaterial=new a.MeshBasicMaterial({color:0,side:a.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new a.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var e=this.el.getAttribute("webxr"),t=e.optionalFeatures;t.includes("hit-test")&&t.includes("anchors")||(t.push("hit-test"),t.push("anchors"),this.el.setAttribute("webxr",e)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var e=this.el.sceneEl.renderer,t=this.session=e.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,s||(s=new Map),t.requestReferenceSpace("viewer").then(function(t){this.hitTest=new c(e,{space:t}),s.set(t,this.hitTest),this.el.emit("ar-hit-test-start")}.bind(this));var n="generic-touchscreen",i=new c(e,{profile:n});t.addEventListener("selectstart",function(t){if(!0===this.data.enabled){var r=t.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:r,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),r.profiles[0]===n?this.hitTest=i:(this.hitTest=s.get(r)||new c(e,{space:r.targetRaySpace}),s.set(r,this.hitTest)))}}.bind(this)),t.addEventListener("selectend",function(e){if(this.hitTest&&!0===this.data.enabled){var t,n=e.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(t=this.data.target.object3D)&&(l.tempFakePose.transform.position.copy(this.bboxMesh.position),l.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),l(l.tempFakePose,t,this.bboxOffset),t.visible=!0,this.hitTest.anchorFromLastHitTestResult(t,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion})),this.hitTest=null}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new a.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(e){e.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var e=new a.PlaneGeometry(1,1),t=new a.MeshBasicMaterial({transparent:!0,color:16777215});e.rotateX(-Math.PI/2),e.rotateY(-Math.PI/2),this.bbox=new a.Box3,this.bboxMesh=new a.Mesh(e,t),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var e,t,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),t=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(t),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),e=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==e.data[4*s+3]&&255!==e.data[4*s+3]&&(e.data[4*s+3]=128);this.context.putImageData(e,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var e,t,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&c.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?t=this.textureCache.get(this.data.src):(t=(new a.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,t)),this.bboxMesh.material.map=t,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(e=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(e.transform.position),this.bboxMesh.quaternion.copy(e.transform.orientation))}})},4005:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var e=this.data,t=this.el.object3D;e.transparent?t.background=null:t.background=new THREE.Color(e.color)},remove:function(){this.el.object3D.background=null}})},3494:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("debug",{schema:{default:!0},sceneOnly:!0})},6273:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s="a-dialog-buttons-container",o="a-dialog-button";function a(e,t){var n,i,s,o;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(r.AFRAME_INJECTED,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(i),(s=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(s),(o=document.createElement("div")).classList.add("a-dialog-text"),o.innerHTML=e,s.appendChild(o),i.appendChild(t),n}e.exports.Component=i("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var e=this;this.data.enabled&&("localhost"!==location.hostname&&"127.0.0.1"!==location.hostname&&"http:"===location.protocol&&this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0})).catch((function(){var t,n,i,l,c,h,u,d;e.devicePermissionDialogEl=(t=e.data.denyButtonText,n=e.data.allowButtonText,i=e.data.deviceMotionMessage,l=e.onDeviceMotionDialogAllowClicked,c=e.onDeviceMotionDialogDenyClicked,(h=document.createElement("div")).classList.add(s),(u=document.createElement("button")).classList.add(o,"a-dialog-deny-button"),u.setAttribute(r.AFRAME_INJECTED,""),u.innerHTML=t,h.appendChild(u),(d=document.createElement("button")).classList.add(o,"a-dialog-allow-button"),d.setAttribute(r.AFRAME_INJECTED,""),d.innerHTML=n,h.appendChild(d),d.addEventListener("click",(function(e){e.stopPropagation(),l()})),u.addEventListener("click",(function(e){e.stopPropagation(),c()})),a(i,h)),e.el.appendChild(e.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var e,t,n,i,l,c=this,h=(e=c.data.cancelButtonText,t=c.data.httpsMessage,n=function(){c.el.removeChild(h)},(i=document.createElement("div")).classList.add(s),(l=document.createElement("button")).classList.add(o,"a-dialog-ok-button"),l.setAttribute(r.AFRAME_INJECTED,""),l.innerHTML=e,i.appendChild(l),l.addEventListener("click",(function(e){e.stopPropagation(),n()})),a(t,i));this.el.appendChild(h)},onDeviceMotionDialogAllowClicked:function(){var e=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(t){"granted"===t?(e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0):e.el.emit("deviceorientationpermissionrejected"),e.remove()})).catch(console.error)}})},3239:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var e=this.el,t=e.querySelector(".a-enter-vr");!0===this.data?(t&&t.classList.add("embedded"),e.removeFullScreenStyles()):(t&&t.classList.remove("embedded"),e.addFullScreenStyles())}})},6149:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);n(8940)("components:fog:warn"),e.exports.Component=i("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var e=this.data,t=this.el,n=this.el.object3D.fog;n&&e.type===n.name?Object.keys(this.schema).forEach((function(t){var i=e[t];"color"===t&&(i=new r.Color(i)),n[t]=i})):t.object3D.fog=function(e){var t;return(t="exponential"===e.type?new r.FogExp2(e.color,e.density):new r.Fog(e.color,e.near,e.far)).name=e.type,t}(e)},remove:function(){var e=this.el;this.el.object3D.fog&&(e.object3D.fog=null)}})},2288:(e,t,n)=>{var i,r=n(1343).AFRAME_INJECTED,s=n(8330),o=n(8190).registerComponent,a=n(7427),l="https://unpkg.com/aframe-inspector@"+((i=s.version.split("."))[2]="x",i.join(".")+"/dist/aframe-inspector.min.js");e.exports.Component=o("inspector",{schema:{url:{default:l}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var e;this.firstPlay&&"false"!==(e=a.getUrlParameter("inspector"))&&e&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector...'},remove:function(){this.removeEventListeners()},onKeydown:function(e){73===e.keyCode&&(e.ctrlKey&&e.altKey||e.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.openInspector()},openInspector:function(e){var t,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(e):(this.showLoader(),(t=document.createElement("script")).src=this.data.url,t.setAttribute("data-name","aframe-inspector"),t.setAttribute(r,""),t.onload=function(){AFRAME.INSPECTOR.open(e),n.hideLoader(),n.removeEventListeners()},t.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(t),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}})},2130:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).shouldCaptureKeyEvent;e.exports.Component=i("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},update:function(e){var t=this.data;this.enterVREnabled=t.enterVR},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;r(e)&&(this.enterVREnabled&&70===e.keyCode&&t.enterVR(),this.enterVREnabled&&27===e.keyCode&&t.exitVR())}})},3791:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=i("components:pool:warn");e.exports.Component=r("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var e;for(this.availableEls=[],this.usedEls=[],this.data.mixin||s("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||s("Container "+this.data.container+" not found.")),this.container=this.container||this.el,e=0;e{var i,r=n(8190).registerComponent,s=n(9437);e.exports.Component=r("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var e=this.el.getAttribute("webxr"),t=e.requiredFeatures;-1===t.indexOf("mesh-detection")&&(t.push("mesh-detection"),this.el.setAttribute("webxr",e)),-1===t.indexOf("plane-detection")&&(t.push("plane-detection"),this.el.setAttribute("webxr",e)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var e,t,n,i=this.data,r=this.el,s=(r.renderer.xr,this.meshEntities),o=!1,a=[],l=this.data.filterLabels;e=(n=r.frame).detectedMeshes,t=n.detectedPlanes;for(var c=0;c{var i=n(8190).registerComponent;e.exports.Component=i("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var e=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var t=this.el.getAttribute("webxr"),n=t.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",t)),this.el.addEventListener("enter-vr",(function(){e.el.is("ar-mode")&&e.el.renderer.xr.getSession().requestLightProbe&&e.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){e.xrLightProbe&&e.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var e=this.el.renderer,t=e.xr.getSession(),n=this,i=e.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(t.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(t,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),t.requestLightProbe().then((function(e){n.xrLightProbe=e,e.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(e){console.warn("Lighting estimation not supported: "+e.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from ?')}))},updateXRCubeMap:function(){var e=this.el.renderer,t=this.glBinding.getReflectionCubeMap(this.xrLightProbe);t&&(e.properties.get(this.lightingEstimationTexture).__webglTexture=t,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var e=this.el.object3D,t=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(e,t,n,i){var r=Math.max(e.primaryLightIntensity.x,Math.max(e.primaryLightIntensity.y,e.primaryLightIntensity.z));t.sh.fromArray(e.sphericalHarmonicsCoefficients),t.intensity=1,n&&(n.color.setRGB(e.primaryLightIntensity.x/r,e.primaryLightIntensity.y/r,e.primaryLightIntensity.z/r),n.intensity=r,i.copy(e.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(e.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(t,e),e.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}})},1217:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),o=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n");e.exports.Component=i("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var e=this.el;if(!this.canvas){var t=e.renderer.getContext();t&&(this.cubeMapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new r.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:s,fragmentShader:o,side:r.DoubleSide}),this.quad=new r.Mesh(new r.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new r.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),e.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(e,t){return new r.WebGLRenderTarget(e,t,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:r.LinearFilter,magFilter:r.LinearFilter,wrapS:r.ClampToEdgeWrapping,wrapT:r.ClampToEdgeWrapping,format:r.RGBAFormat,type:r.UnsignedByteType})},resize:function(e,t){this.quad.scale.set(e,t,1),this.camera.left=-1*e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-1*t/2,this.camera.updateProjectionMatrix(),this.canvas.width=e,this.canvas.height=t},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(e){var t=83===e.keyCode&&e.ctrlKey&&e.altKey;if(this.data&&t){var n=e.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(e){var t,n,i,s,o=this.el;return"perspective"===e?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||o.camera,t={width:this.data.width,height:this.data.height}):(n=this.camera,s=new r.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:r.RGBFormat,generateMipmaps:!0,minFilter:r.LinearMipmapLinearFilter,colorSpace:r.SRGBColorSpace}),i=new r.CubeCamera(o.camera.near,o.camera.far,s),o.camera.getWorldPosition(i.position),o.camera.getWorldQuaternion(i.quaternion),i.update(o.renderer,o.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,t={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:t,projection:e}},capture:function(e){var t,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,t=this.setCapture(e),this.renderCapture(t.camera,t.size,t.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(e){var t=this.el.renderer.xr.enabled,n=this.el.renderer,i=this.setCapture(e);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=t,this.canvas},renderCapture:function(e,t,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(t.width,t.height),s=new Uint8Array(4*t.width*t.height),this.resize(t.width,t.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,e),l.autoClear=o,l.readRenderTargetPixels(r,0,0,t.width,t.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,t.width,t.height)),i=new ImageData(new Uint8ClampedArray(s),t.width,t.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(e,t,n){for(var i=e.slice(0),r=0;r{var i=n(8190).registerComponent,r=n(282),s=n(7427);n(3729),n(8132);var o=window.aframeStats,a="a-hidden",l=window.threeStats;e.exports.Component=i("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var e=this.el;"false"!==s.getUrlParameter("stats")&&(this.stats=function(e){var t=new l(e.renderer),n=new o(e),i=e.isMobile?[]:[t,n];return new r({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(e),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),e.addEventListener("enter-vr",this.hideBound),e.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var e=this.stats;e&&(e("rAF").tick(),e("FPS").frame(),e().update())},hide:function(){this.statsEl.classList.add(a)},show:function(){this.statsEl.classList.remove(a)}})},6469:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s=n(7427),o="a-hidden";function a(e){e.addEventListener("touchstart",(function(){e.classList.remove("resethover")})),e.addEventListener("touchend",(function(){e.classList.add("resethover")}))}e.exports.Component=i("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},cardboardModeEnabled:{default:!1},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var e=this,t=this.el;"false"!==s.getUrlParameter("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),t.addEventListener("enter-vr",this.updateEnterInterfaces),t.addEventListener("exit-vr",this.updateEnterInterfaces),t.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(t){"loaderReady"===t.data.type&&(e.insideLoader=!0,e.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var e,t,n,i=this.data,l=this.el;if(!i.enabled||this.insideLoader||"false"===s.getUrlParameter("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(e=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(r.AFRAME_INJECTED,""),(t=document.createElement("button")).className="a-enter-vr-button",t.setAttribute("title","Enter VR mode with a headset or fullscreen without"),t.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(t),n.appendChild(t),t.addEventListener("click",(function(t){e(),t.stopPropagation()})),n),l.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(e,t){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),t&&i.classList.add("xr"),i.setAttribute(r.AFRAME_INJECTED,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(n),i.appendChild(n),n.addEventListener("click",(function(t){e(),t.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),l.appendChild(this.enterAREl))),this.orientationModalEl=function(e){var t=document.createElement("div");t.className="a-orientation-modal",t.classList.add(o),t.setAttribute(r.AFRAME_INJECTED,"");var n=document.createElement("button");return n.setAttribute(r.AFRAME_INJECTED,""),n.innerHTML="Exit VR",n.addEventListener("click",e),t.appendChild(n),t}(this.onModalClick),l.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var e=this.el;this.enterVREl&&(e.is("vr-mode")||(e.isMobile||s.device.isMobileDeviceRequestingDesktopSite())&&!this.data.cardboardModeEnabled&&!s.device.checkVRSupport()?this.enterVREl.classList.add(o):(s.device.checkVRSupport()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(o),e.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var e=this.el;this.enterAREl&&(e.is("vr-mode")||!s.device.checkARSupport()?this.enterAREl.classList.add(o):(this.enterAREl.classList.remove(o),e.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var e=this.el,t=this.orientationModalEl;t&&e.isMobile&&(!s.device.isLandscape()&&e.is("vr-mode")?t.classList.remove(o):t.classList.add(o))}})},1072:(e,t,n)=>{var i=n(8190),r=n(9437),s=i.registerComponent;e.exports.Component=s("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var e=this.data;this.updateDescendants(e.cast,e.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(e,t){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof r.Mesh&&(i.castShadow=e,i.receiveShadow=t,n.hasLoaded&&i.material))for(var s=Array.isArray(i.material)?i.material:[i.material],o=0;o{var i=n(8190).registerComponent,r=n(8940),s=n(9437),o=r("components:sound:warn");e.exports.Component=i("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var e=this;this.listener=null,this.audioLoader=new s.AudioLoader,this.pool=new s.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){e.playSound()}},update:function(e){var t,n,i=this.data,r=i.src!==e.src;if(r){if(!i.src)return;this.setupSound()}for(t=0;t0&&(this.stopSound(),n.removeObject3D("sound"));var o=this.listener=i.audioListener||new s.AudioListener;for(i.audioListener=o,i.camera&&i.camera.add(o),i.addEventListener("camera-set-active",(function(e){e.detail.cameraEl.getObject3D("camera").add(o)})),this.pool=new s.Group,e=0;e{var i=n(4433),r=n(5751),s=n(8190).registerComponent,o=n(5892),a=n(9437),l=n(7427),c=l.debug("components:text:error"),h=o.shaders,u=l.debug("components:text:warn"),d=n(1343).AFRAME_CDN_ROOT+"fonts/",p={aileronsemibold:d+"Aileron-Semibold.fnt",dejavu:d+"DejaVu-sdf.fnt",exo2bold:d+"Exo2Bold.fnt",exo2semibold:d+"Exo2SemiBold.fnt",kelsonsans:d+"KelsonSans.fnt",monoid:d+"Monoid.fnt",mozillavr:d+"mozillavr.fnt",roboto:d+"Roboto-msdf.json",sourcecodepro:d+"SourceCodePro.fnt"},A=["roboto"],f="roboto";e.exports.FONTS=p;var m,g,v,y,E=new function(){var e=this.cache={};this.get=function(t,n){return t in e||(e[t]=n()),e[t]}},b={},x={},w=/^\w+:/;function C(e,t,n){return e||(.5+t)*n}e.exports.Component=s("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:f},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:h},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=i(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(e){var t=this.data,n=this.currentFont;x[t.font]?this.texture=x[t.font]:(this.texture=x[t.font]=new a.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),e.font===t.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var e,t,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==A.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in p&&-1===A.indexOf(i.font)&&(n="sdf"),e=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(e){switch(e){case"back":return a.FrontSide;case"double":return a.DoubleSide;default:return a.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!e)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);t=function(e,t,n){var i,r;return(r=new h[t].Shader).el=e,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=t.material,this.shaderObject=t.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var e,t=this.data,n=this.el,i=this.geometry,s=this;t.font||u("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),e=this.lookupFont(t.font||f)||t.font,E.get(e,(function(){return n=e,i=t.yOffset,new Promise((function(e,t){r(n,(function(r,s){if(r)return c("Error loading font",n),void t(r);n.indexOf("/Roboto-msdf.json")>=0&&(i=30),i&&s.chars.map((function(e){e.yoffset+=i})),e(s)}))}));var n,i})).then((function(r){var o;if(1!==r.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");b[e]||(r.widthFactor=b[r]=function(e){var t=0,n=0,i=0;return e.chars.map((function(e){t+=e.xadvance,e.id>=48&&e.id<=57&&(i++,n+=e.xadvance)})),i?n/i:t/e.chars.length}(r)),s.currentFont=r,o=s.getFontImageSrc(),E.get(o,(function(){return e=o,new Promise((function(t,n){(new a.ImageLoader).load(e,(function(e){t(e)}),void 0,(function(){c("Error loading font image",e),n(null)}))}));var e})).then((function(e){var o=s.texture;o&&(o.image=e,o.needsUpdate=!0,x[t.font]=o,s.texture=o,s.initMesh(),s.currentFont=r,s.updateGeometry(i,r),s.updateLayout(),s.mesh.visible=!0,n.emit("textfontset",{font:t.font,fontObj:r}))})).catch((function(e){c(e.message),c(e.stack)}))})).catch((function(e){c(e.message),c(e.stack)}))},initMesh:function(){this.mesh||(this.mesh=new a.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var e=this.lookupFont(this.data.font||f)||this.data.font,t=this.currentFont.pages[0];return t.match(w)&&0!==t.indexOf("http")?e.replace(/(\.fnt)|(\.json)/,".png"):a.LoaderUtils.extractUrlBase(e)+t},updateLayout:function(){var e,t,n,i,r,s,o,a,l,c=this.el,h=this.data,u=this.geometry,d=this.mesh;if(d&&u.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/C(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=u.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(e="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===e)a=-1*r.width;else{if("center"!==e)throw new TypeError("Invalid text.anchor property value",e);a=-1*r.width/2}if("bottom"===(t=h.baseline))l=0;else if("top"===t)l=-1*r.height+r.ascender;else{if("center"!==t)throw new TypeError("Invalid text.baseline property value",t);l=-1*r.height/2}d.position.x=a*s+h.xOffset,d.position.y=l*s,d.position.z=h.zOffset,d.scale.set(s,-1*s,s)}},lookupFont:function(e){return p[e]},updateGeometry:(m={},g={},v=/\\n/g,y=/\\t/g,function(e,t){var n=this.data;g.font=t,g.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:t.common.lineHeight,g.text=n.value.toString().replace(v,"\n").replace(y,"\t"),g.width=C(n.wrapPixels,n.wrapCount,t.widthFactor),e.update(l.extend(m,n,g))})})},4524:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=n(1343).DEFAULT_CAMERA_HEIGHT,o=n(9437),a=n(1343).DEFAULT_HANDEDNESS,l={touches:[]};e.exports.Component=i("tracked-controls-webvr",{schema:{autoHide:{default:!0},controller:{default:0},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},orientationOffset:{type:"vec3"},armModel:{default:!1},headElement:{type:"selector"}},init:function(){this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.changedAxes=[],this.targetControllerNumber=this.data.controller,this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.deltaControllerPosition=new o.Vector3,this.controllerQuaternion=new o.Quaternion,this.controllerEuler=new o.Euler,this.updateGamepad(),this.buttonEventDetails={}},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.update&&n.update(t/1e3),this.updateGamepad(),this.updatePose(),this.updateButtons()},defaultUserHeight:function(){return s},getHeadElement:function(){return this.data.headElement||this.el.sceneEl.camera.el},updateGamepad:function(){var e=this.data,t=r.findMatchingControllerWebVR(this.system.controllers,e.id,e.idPrefix,e.hand,e.controller);this.controller=t,this.el.components["tracked-controls"].controller=t,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},applyArmModel:function(e){var t,n,i,r,s=this.controller,o=this.controllerEuler,l=this.controllerQuaternion,c=this.deltaControllerPosition;n=this.getHeadElement().object3D,r=this.defaultUserHeight(),i=s.pose,t=(s?s.hand:void 0)||a,e.copy(n.position),c.set(.175*("left"===t?-1:"right"===t?1:0),-.3,-.03),c.multiplyScalar(r),c.applyAxisAngle(n.up,n.rotation.y),e.add(c),c.set(0,0,-.175),c.multiplyScalar(r),i.orientation?l.fromArray(i.orientation):l.copy(n.quaternion),o.setFromQuaternion(l),o.set(o.x,o.y,0),c.applyEuler(o),e.add(c)},updatePose:function(){var e,t,n=this.controller,i=this.data,r=this.el.object3D,s=this.system.vrDisplay;n&&((e=n.pose).position?r.position.fromArray(e.position):i.armModel&&this.applyArmModel(r.position),e.orientation&&r.quaternion.fromArray(e.orientation),s&&e.position&&(t=this.el.sceneEl.renderer.xr.getStandingMatrix(),r.matrix.compose(r.position,r.quaternion,r.scale),r.matrix.multiplyMatrices(t,r.matrix),r.matrix.decompose(r.position,r.quaternion,r.scale)),r.rotateX(this.data.orientationOffset.x*o.MathUtils.DEG2RAD),r.rotateY(this.data.orientationOffset.y*o.MathUtils.DEG2RAD),r.rotateZ(this.data.orientationOffset.z*o.MathUtils.DEG2RAD))},updateButtons:function(){var e,t,n=this.controller;if(n){for(t=0;t{var i=n(7960),r=n(8190).registerComponent;e.exports.Component=r("tracked-controls-webxr",{schema:{id:{type:"string",default:""},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},index:{type:"int",default:-1},iterateControllerProfiles:{default:!1},space:{type:"string",oneOf:["targetRaySpace","gripSpace"],default:"gripSpace"}},init:function(){this.updateController=this.updateController.bind(this),this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes}},update:function(){this.updateController()},play:function(){var e=this.el.sceneEl;this.updateController(),e.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(e){return!(!this.controller||this.controller.gamepad||"none"!==e.inputSource.handedness&&e.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=i.findMatchingControllerWebXR(this.system.controllers,this.data.id,this.data.hand,this.data.index,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},tick:function(){var e=this.el.sceneEl,t=this.controller,n=e.frame;t&&e.frame&&this.system.referenceSpace&&(t.hand||(this.pose=n.getPose(t[this.data.space],this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var e=this.el.object3D,t=this.pose;t&&(e.matrix.elements=t.transform.matrix,e.matrix.decompose(e.position,e.rotation,e.scale))},updateButtons:function(){var e,t,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,t=0;t{var i=n(8190).registerComponent;e.exports.Component=i("tracked-controls",{schema:{autoHide:{default:!0},controller:{default:-1},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},handTrackingEnabled:{default:!1},orientationOffset:{type:"vec3"},armModel:{default:!1},headElement:{type:"selector"},iterateControllerProfiles:{default:!1},space:{type:"string",oneOf:["targetRaySpace","gripSpace"],default:"targetRaySpace"}},update:function(){var e=this.data,t=this.el;t.sceneEl.hasWebXR?t.setAttribute("tracked-controls-webxr",{id:e.id,hand:e.hand,index:e.controller,iterateControllerProfiles:e.iterateControllerProfiles,handTrackingEnabled:e.handTrackingEnabled,space:e.space}):t.setAttribute("tracked-controls-webvr",e)}})},7360:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(1343).AFRAME_CDN_ROOT+"controllers/valve/index/valve-index-",h={left:c+"left.glb",right:c+"right.glb"},u="valve",d=n(7427).device.isWebXRAvailable,p={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},A=d?p:{left:{_x:.692295102620542,_y:-.0627618864318427,_z:-.06265893149611756,_order:"XYZ"},right:{_x:.6484021229942998,_y:-.032563619881892894,_z:-.1327973171917482,_order:"XYZ"}},f=d?{left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}}:{left:{x:-.00023692678902063457,y:.04724540367838371,z:-.061959880395271096},right:{x:.002471558599671131,y:.055765208987076195,z:-.061068168708348844}};e.exports.Component=i("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t="right"===e.hand?0:"left"===e.hand?1:2;o(this,u,{index:t,iterateControllerProfiles:!0,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:u,controller:"right"===t.hand?1:"left"===t.hand?0:2,hand:t.hand,orientationOffset:t.orientationOffset}),this.loadModel()},loadModel:function(){var e=this.data;e.model&&this.el.setAttribute("gltf-model",""+h[e.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-t*(Math.PI/40))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=t.trigger.rotation.x,Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.copy(f[this.data.hand]),n.rotation.copy(A[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){}})},5300:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}})},1507:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT,c=l+"controllers/vive/vr_controller_vive.obj",h=l+"controllers/vive/vr_controller_vive.mtl",u=n(7427).device.isWebXRAvailable,d=u?"htc-vive":"OpenVR ",p=u?{axes:{thumbstick:[0,1]},buttons:["trigger","grip","trackpad","none","menu"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger","grip","menu","system"]};e.exports.Component=i("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:p,init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,d,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:c,mtl:h})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-t*(Math.PI/12))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){var n=this.buttonMeshes;if(n)return"grip"===e?(n.grip.left.material.color.set(t),void n.grip.right.material.color.set(t)):void n[e].material.color.set(t)}})},4592:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="HTC Vive Focus",c=n(1343).AFRAME_CDN_ROOT+"controllers/vive/focus-controller/focus-controller.gltf";e.exports.Component=i("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){s(this,l,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{armModel:t.armModel,idPrefix:l,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",c)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),t.triggerPressed=n.getObjectByName("BumperKey_Press"),t.triggerPressed&&(t.triggerPressed.visible=!1),t.trackpad=n.getObjectByName("TouchPad"),t.trackpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpadPressed&&(t.trackpadPressed.visible=!1))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes,i=e+"Pressed";if(n&&n[e]&&n[i]){var r;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[e].visible=!r}}})},6458:(e,t,n)=>{var i,r,s=n(1343).keyboardevent.KEYCODE_TO_CODE,o=n(8190).registerComponent,a=n(9437),l=n(7427).shouldCaptureKeyEvent,c=1e-5,h=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];e.exports.Component=o("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},init:function(){this.keys={},this.easing=1.1,this.velocity=new a.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(e,t){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(e){var t;for(t in e)return!1;return!0}(this.keys))&&(t/=1e3,this.updateVelocity(t),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(t)))},update:function(e){e.adAxis!==this.data.adAxis&&(this.velocity[e.adAxis]=0),e.wsAxis!==this.data.wsAxis&&(this.velocity[e.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(e){var t,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,e>.2)return l[n]=0,void(l[r]=0);var h=Math.pow(1/this.easing,60*e);0!==l[n]&&(l[n]=l[n]*h),0!==l[r]&&(l[r]=l[r]*h),Math.abs(l[n]){var i,r=n(8190).registerComponent,s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(7427),h=c.debug("components:windows-motion-controls:debug"),u=c.debug("components:windows-motion-controls:warn"),d=n(1343).DEFAULT_HANDEDNESS,p=n(1343).AFRAME_CDN_ROOT+"controllers/microsoft/",A={left:"left.glb",right:"right.glb",default:"universal.glb"},f=n(7427).device.isWebXRAvailable,m=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,g=f?"windows-mixed-reality":"Spatial Controller (Spatial Interaction Source) ",v=f?{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"}:{axes:{thumbstick:[0,1],trackpad:[2,3]},buttons:["thumbstick","trigger","grip","menu","trackpad"],axisMeshNames:["THUMBSTICK_X","THUMBSTICK_Y","TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"};e.exports.Component=r("windows-motion-controls",{schema:{hand:{default:d},pair:{default:0},model:{default:!0},hideDisconnected:{default:!0}},mapping:v,bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this,t=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onControllerConnected=function(){e.setModelVisibility(!0)},this.onControllerDisconnected=function(){e.setModelVisibility(!1)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-error",this.onModelError),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-error",this.onModelError),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,g,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var e=this.createControllerModelUrl();this.loadModel(e)}else this.modelReady()},createControllerModelUrl:function(e){var t=this.el.components["tracked-controls"],n=t?t.controller:null,i="default",r=this.data.hand;if(n&&!window.hasNativeWebXRImplementation&&(r=n.hand,!e)){var s=n.id.match(m);i=s&&s[0]||i}return p+i+"/"+(A[r]||A.default)},injectTrackedControls:function(){var e=this.data;this.el.setAttribute("tracked-controls",{idPrefix:g,controller:e.pair,hand:e.hand,armModel:!1}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(e){var t=this.createControllerModelUrl(!0);e.detail.src!==t?(u("Failed to load controller model for device, attempting to load default."),this.loadModel(t)):u("Failed to load default controller model.")},loadModel:function(e){this.el.setAttribute("gltf-model","url("+e+")")},onModelLoaded:function(e){var t,n,i,r,s=this.controllerModel=e.detail.model,o=this.loadedMeshInfo;if(e.target===this.el){if(h("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(t=0;t{e.exports={AFRAME_CDN_ROOT:window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",AFRAME_INJECTED:"aframe-injected",DEFAULT_CAMERA_HEIGHT:1.6,DEFAULT_HANDEDNESS:"right",keyboardevent:n(5440)}},5440:e=>{e.exports={KEYCODE_TO_CODE:{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}}},842:(e,t,n)=>{var i=n(2203).a,r=n(8940),s=n(9437),o=new s.FileLoader,a=r("core:a-assets:warn");function l(e){if(e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload"))return new Promise((function(t,n){if(4===e.readyState)return t();if(e.error)return n();function i(){for(var n=0,i=0;i=e.duration&&("VIDEO"===e.tagName&&s.Cache.add(e.getAttribute("src"),e),t())}e.addEventListener("loadeddata",i,!1),e.addEventListener("progress",i,!1),e.addEventListener("error",n,!1)}))}function c(e){var t=function(e){var t,n,i;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if((i=(n=t).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return e}return a('Cross-origin element (e.g., ) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., )',t),e.crossOrigin="anonymous",e.cloneNode(!0)}(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function h(e){var t=u(e),n=t.lastIndexOf(".");return n>=0&&".glb"===t.slice(n,e.search(/\?|#|$/))?"arraybuffer":"text"}function u(e){var t=document.createElement("a");t.href=e;var n=t.search.replace(/^\?/,""),i=e.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}customElements.define("a-assets",class extends i{constructor(){super(),this.isAssets=!0,this.fileLoader=o,this.timeout=null}connectedCallback(){"complete"===document.readyState?this.doConnectedCallback():document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){var e,t,n,i,r,o,h=this,u=[];if(super.connectedCallback(),!this.parentNode.isScene)throw new Error(" must be a child of a .");for(r=this.querySelectorAll("img"),e=0;e{var i=n(8940)("core:cubemap:warn");class r extends HTMLElement{constructor(e){return super(e)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?r.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var e,t=this.querySelectorAll("[src]"),n=[];if(6===t.length){for(e=0;e did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",r)},4056:(e,t,n)=>{var i=n(2203).a,r=n(8190).components,s=n(9437),o=n(7427),a=o.debug("core:a-entity:debug"),l=o.debug("core:a-entity:warn"),c="__",h=["position","rotation","scale","visible"],u={once:!0};class d extends i{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new s.Group,this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(e,t,n){var i=this.components[e];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(e,t,n)}connectedCallback(){"complete"===document.readyState?d.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){var e,t,n=this;super.connectedCallback(),t=this.sceneEl,this.addToParent(),this.isScene||(t?!(e=t.querySelector("a-assets"))||e.hasLoaded?this.load():e.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var e;if(this.parentEl){for(e in this.components)this.removeComponent(e,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(e){return this.object3DMap[e]}setObject3D(e,t){var n,i=this;if(!(t instanceof s.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(e))&&this.object3D.remove(n),t.el=this,t.children.length&&t.traverse((function(e){e.el=i})),this.object3D.add(t),this.object3DMap[e]=t,this.emit("object3dset",{object:t,type:e})}removeObject3D(e){var t=this.getObject3D(e);t?(this.object3D.remove(t),delete this.object3DMap[e],this.emit("object3dremove",{type:e})):l("Tried to remove `Object3D` of type:",e,"which was not defined.")}getOrCreateObject3D(e,t){var n=this.getObject3D(e);return!n&&t&&(n=new t,this.setObject3D(e,n)),l("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(e.object3D),this.emit("child-attached",{el:e})}addToParent(){var e=this.parentEl=this.parentNode;e&&e.add&&!this.attachedToParent&&(e.add(this),this.attachedToParent=!0)}removeFromParent(){var e=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,e.emit("child-detached",{el:this})}load(){var e=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){e.parentEl&&(e.updateComponents(),(e.isScene||e.parentEl.isPlaying)&&e.play())}))}remove(e){e?this.object3D.remove(e.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var e=this.children,t=[],n=0;n2?l.slice(1).join("__"):l[1],r[h]&&(p(this,e)||void 0!==t||n)&&(e in this.components||(this.initComponentDependencies(h),i=new r[h].Component(this,t,s),this.isPlaying&&i.play(),this.hasAttribute(e)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,e,"")),a("Component initialized: %s",e)))}initComponentDependencies(e){var t,n;if(r[e]&&(t=r[e].dependencies))for(n=0;n0?e.substring(0,l):e,!r[a])return"mixin"===e&&this.mixinUpdate(t),void super.setAttribute.call(this,e,t);if(!this.components[e]&&this.hasAttribute(e)&&this.updateComponent(e,window.HTMLElement.prototype.getAttribute.call(this,e)),void 0!==n&&"string"==typeof t&&t.length>0&&"string"==typeof o.styleParser.parse(t)){for(h in u)delete u[h];(i=u)[t]=n,s=!1}else i=t,s=!0===n;this.updateComponent(e,i,s),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[e].flushToDOM()}flushToDOM(e){var t,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(e)for(n=0;n{var i=n(2203).a,r=n(8190).components,s=n(7427);customElements.define("a-mixin",class extends i{constructor(){super(),this.componentCache={},this.isMixin=!0}connectedCallback(){"complete"===document.readyState?this.doConnectedCallback():document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){super.connectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(),this.cacheAttribute(e,n),this.updateEntities()}setAttribute(e,t){window.HTMLElement.prototype.setAttribute.call(this,e,t),this.cacheAttribute(e,t)}cacheAttribute(e,t){var n,i;i=s.split(e,"__")[0],(n=r[i])&&(void 0===t&&(t=window.HTMLElement.prototype.getAttribute.call(this,e)),this.componentCache[e]=n.parseAttrValueForCache(t))}getAttribute(e){return this.componentCache[e]||window.HTMLElement.prototype.getAttribute.call(this,e)}cacheAttributes(){var e,t,n=this.attributes;for(t=0;t{var i=n(7427),r=i.debug("core:a-node:warn"),s={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function o(e){return e.tagName.toLowerCase()in s||e.isNode}class a extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?a.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){var e;this.sceneEl=this.closestScene(),this.sceneEl||r("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)}attributeChangedCallback(e,t,n){n!==this.computedMixinStr&&("mixin"!==e||this.isMixin||this.updateMixins(n,t))}closestScene(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}closest(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!t.call(n,e);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(e,t){var n,i=this;this.hasLoaded||(t=t||o,n=this.getChildren().filter(t).map((function(e){return new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(t){t.forEach((function(e){"rejected"===e.status&&r("Rendering scene with errors on node: ",e.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),e&&e(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var e=this;new MutationObserver((function(t){var n;for(n=0;n{var i=n(7282),r=n(8313),s=n(1876),o=n(7427),a=e.exports.components={},l=i.parseProperties,c=i.parseProperty,h=i.process,u=i.isSingleProperty,d=i.stringifyProperties,p=i.stringifyProperty,A=o.styleParser,f=o.debug("core:component:warn"),m=document.currentScript,g=new RegExp("[A-Z]+"),v={},y=Object.freeze({}),E=e.exports.Component=function(e,t,n){var i=this;if(this.sceneOnly&&!e.isScene)throw new Error("Component `"+this.name+"` can only be applied to ");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=e,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=v[this.name];var r=this.events;this.events={},function(e,t){var n;for(n in t)e.events[n]=t[n].bind(e)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.nextData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.nextData,this.schema),this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.previousOldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.previousOldData,this.schema),this.parsingAttrValue=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.parsingAttrValue,this.schema)):(this.nextData=void 0,this.oldData=void 0,this.previousOldData=void 0,this.parsingAttrValue=void 0),this.throttledEmitComponentChanged=o.throttleLeadingAndTrailing((function(){e.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(t)};if(E.prototype={schema:{},init:function(){},events:{},update:function(e){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},parse:function(e,t){var n=this.schema;return this.isSingleProperty?c(e,n):l(A.parse(e),n,!0,this.name,t)},stringify:function(e){var t=this.schema;return"string"==typeof e?e:this.isSingleProperty?p(e,t):(e=d(e,t),A.stringify(e))},updateCachedAttrValue:function(e,t){var n,i,r;if(void 0!==e){if(null===e)return this.isObjectBased&&this.attrValue&&this.objectPool.recycle(this.attrValue),void(this.attrValue=void 0);if(e instanceof Object&&!(e instanceof window.HTMLElement)?(i=this.objectPool.use(),n=o.extend(i,e)):n=this.parseAttrValueForCache(e),this.isObjectBased&&!t&&this.attrValue)for(r in this.attrValue)void 0===n[r]&&(n[r]=this.attrValue[r]);this.isObjectBased&&!this.attrValue&&(this.attrValue=this.objectPool.use()),o.objectPool.clearObject(this.attrValue),this.attrValue=w(this.attrValue,n,this.isObjectBased),this.objectPool.recycle(i)}},parseAttrValueForCache:function(e){var t;return"string"!=typeof e?e:(this.isSingleProperty?"string"==typeof(t=this.schema.parse(e))&&(t=e):(o.objectPool.clearObject(this.parsingAttrValue),t=A.parse(e,this.parsingAttrValue)),t)},flushToDOM:function(e){var t=e?this.data:this.attrValue;null!=t&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(t))},updateProperties:function(e,t){var n=this.el;n.hasLoaded||n.isLoading?(null!==e&&(e=this.parseAttrValueForCache(e)),this.updateCachedAttrValue(e,t),this.initialized?(this.updateComponent(e,t),this.callUpdateHandler()):this.initComponent()):this.updateCachedAttrValue(e)},initComponent:function(){var e,t=this.el;this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!1,!0)),this.data=this.buildData(this.attrValue),t.initializingComponents[this.name]||(t.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete t.initializingComponents[this.name],this.oldData=w(this.oldData,this.data,this.isObjectBased),e=this.isObjectBased?y:void 0,this.update(e),t.isPlaying&&this.play(),t.emit("componentinitialized",this.evtDetail,!1))},updateComponent:function(e,t){var n,i;if(t)return this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!0,!0)),void(this.data=this.buildData(this.attrValue,!0,!1));if(this.isSingleProperty)return this.isObjectBased&&c(e,this.schema),void(this.data=e);if(l(e,this.schema,!0,this.name),this.schemaChangeKeys.length)for(n in e)if(n in this.schema&&this.schema[n].schemaChange){i=!0;break}if(i)return this.updateSchema&&this.updateSchema(this.buildData(this.attrValue,!0,!0)),void(this.data=this.buildData(this.attrValue,!0,!1));for(n in e)void 0!==e[n]&&(this.data[n]=e[n])},callUpdateHandler:function(){var e;this.previousOldData instanceof Object&&o.objectPool.clearObject(this.previousOldData),this.isObjectBased?x(this.previousOldData,this.oldData):this.previousOldData=this.oldData,e=!o.deepEqual(this.oldData,this.data),(this.isPositionRotationScale||e)&&(this.oldData instanceof Object&&o.objectPool.clearObject(this.oldData),this.oldData=w(this.oldData,this.data,this.isObjectBased),this.update(this.previousOldData),this.throttledEmitComponentChanged())},handleMixinUpdate:function(){this.data=this.buildData(this.attrValue),this.callUpdateHandler()},resetProperty:function(e){if(this.isObjectBased){if(!(e in this.attrValue))return;delete this.attrValue[e],this.data[e]=this.schema[e].default}else this.attrValue=this.schema.default,this.data=this.schema.default;this.updateProperties(this.attrValue)},extendSchema:function(e){var t;t=o.extend({},a[this.name].schema),o.extend(t,e),this.schema=h(t),this.el.emit("schemachanged",this.evtDetail)},buildData:function(e,t,n){var i,r,s,a,h,u,d,p=this.nextData,A=this.schema,f=this.el.mixinEls;if(i=e&&e.constructor===Array?e.length:null!=e,this.isObjectBased&&o.objectPool.clearObject(p),this.isSingleProperty)r=this.isObjectBased?x(p,A.default):M(A.default)?o.clone(A.default):A.default;else for(a in r=(d=!t&&this.attrValue)instanceof Object?x(p,d):p,A)s=A[a].default,void 0===r[a]&&(r[a]=M(s)?o.clone(s):s);for(u=0;u tag after the scene. Component