1 |
- !function e(t,i,n){function o(s,a){if(!i[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(r)return r(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var h=i[s]={exports:{}};t[s][0].call(h.exports,function(e){var i=t[s][1][e];return o(i||e)},h,h.exports,e,t,i,n)}return i[s].exports}for(var r="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,i){"use strict";e("./")},{"./":2}],2:[function(e,t,i){"use strict";e("./src/controls"),e("./src/loaders"),e("./src/misc"),e("./src/pathfinding"),e("./src/primitives")},{"./src/controls":13,"./src/loaders":21,"./src/misc":26,"./src/pathfinding":32,"./src/primitives":40}],3:[function(e,t,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)};THREE.LoaderUtils={extractUrlBase:THREE.Loader.prototype.extractUrlBase,decodeText:function(e){return(new TextDecoder).decode(e)}},t.exports=THREE.FBXLoader=function(){function e(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager}function t(e){this.textureLoader=e}function i(){}function n(){}function r(){}function s(){}function a(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function c(){}function l(e){var t=e.match(/FBXVersion: (\d+)/);if(t){return parseInt(t[1])}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function h(e){return e/46186158e3}function u(e,t,i,n){var o;switch(n.mappingType){case"ByPolygonVertex":o=e;break;case"ByPolygon":o=t;break;case"ByVertice":o=i;break;case"AllSame":o=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}"IndexToDirect"===n.referenceType&&(o=n.indices[o]);var r=o*n.dataSize,s=r+n.dataSize;return function(e,t,i,n){for(var o=i,r=0;o<n;o++,r++)e[r]=t[o];return e}(b,n.buffer,r,s)}function d(e){var t=new THREE.Matrix4;k.set(0,0,0),R.identity();var i=p(e.eulerOrder?e.eulerOrder:0);if(e.translation&&k.fromArray(e.translation),e.rotationOffset&&k.add(x.fromArray(e.rotationOffset)),e.rotation){(n=e.rotation.map(THREE.Math.degToRad)).push(i),R.makeRotationFromEuler(w.fromArray(n))}if(e.preRotation){(n=e.preRotation.map(THREE.Math.degToRad)).push(i),T.makeRotationFromEuler(w.fromArray(n)),R.premultiply(T)}if(e.postRotation){var n=e.postRotation.map(THREE.Math.degToRad);n.push(i),T.makeRotationFromEuler(w.fromArray(n)),T.getInverse(T),R.multiply(T)}return e.scale&&t.scale(x.fromArray(e.scale)),t.setPosition(k),t.multiply(R),t}function p(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===e?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function f(e){return e.split(",").map(function(e){return parseFloat(e)})}function v(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=e.byteLength),THREE.LoaderUtils.decodeText(new Uint8Array(e,t,i))}function m(e,t,i){return e.slice(0,t).concat(i).concat(e.slice(t))}var g,y,E;e.prototype={constructor:e,crossOrigin:"anonymous",load:function(e,t,i,n){var o=this,r=THREE.LoaderUtils.extractUrlBase(e),s=new THREE.FileLoader(this.manager);s.setResponseType("arraybuffer"),s.load(e,function(i){try{var s=o.parse(i,r);t(s)}catch(t){setTimeout(function(){n&&n(t),o.manager.itemError(e)},0)}},i,n)},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,i){if(function(e){var t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===v(e,0,t.length)}(e))g=(new s).parse(e);else{var n=v(e);if(!function(e){function t(t){var i=e[t-1];return e=e.slice(n+t),n++,i}for(var i=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0,o=0;o<i.length;++o)if(t(1)===i[o])return!1;return!0}(n))throw new Error("THREE.FBXLoader: Unknown format.");if(l(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+l(n));g=(new r).parse(n)}return new t(new THREE.TextureLoader(this.manager).setPath(i).setCrossOrigin(this.crossOrigin)).parse(g)}},t.prototype={constructor:t,parse:function(){y=this.parseConnections();var e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),o=this.parseDeformers(),r=(new i).parse(o);return this.parseScene(o,r,n),E},parseConnections:function(){var e=new Map;if("Connections"in g){g.Connections.connections.forEach(function(t){var i=t[0],n=t[1],o=t[2];e.has(i)||e.set(i,{parents:[],children:[]});var r={ID:n,relationship:o};e.get(i).parents.push(r),e.has(n)||e.set(n,{parents:[],children:[]});var s={ID:i,relationship:o};e.get(n).children.push(s)})}return e},parseImages:function(){var e={},t={};if("Video"in g.Objects){var i=g.Objects.Video;for(var n in i){var o=i[n];if(e[c=parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o){var r=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,s="string"==typeof o.Content&&""!==o.Content;if(r||s){var a=this.parseImage(i[n]);t[o.RelativeFilename||o.Filename]=a}}}}for(var c in e){var l=e[c];void 0!==t[l]?e[c]=t[l]:e[c]=e[c].split("\\").pop()}return e},parseImage:function(e){var t,i=e.Content,n=e.RelativeFilename||e.Filename,o=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(o){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":if("function"!=typeof THREE.TGALoader)return void console.warn("FBXLoader: THREE.TGALoader is required to load TGA textures");null===THREE.Loader.Handlers.get(".tga")&&THREE.Loader.Handlers.add(/\.tga$/i,new THREE.TGALoader),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+o+'" is not supported.')}if("string"==typeof i)return"data:"+t+";base64,"+i;var r=new Uint8Array(i);return window.URL.createObjectURL(new Blob([r],{type:t}))},parseTextures:function(e){var t=new Map;if("Texture"in g.Objects){var i=g.Objects.Texture;for(var n in i){var o=this.parseTexture(i[n],e);t.set(parseInt(n),o)}}return t},parseTexture:function(e,t){var i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;var n=e.WrapModeU,o=e.WrapModeV,r=void 0!==n?n.value:0,s=void 0!==o?o.value:0;if(i.wrapS=0===r?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,i.wrapT=0===s?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,"Scaling"in e){var a=e.Scaling.value;i.repeat.x=a[0],i.repeat.y=a[1]}return i},loadTexture:function(e,t){var i,n=this.textureLoader.path,o=y.get(e.id).children;void 0!==o&&o.length>0&&void 0!==t[o[0].ID]&&(0!==(i=t[o[0].ID]).indexOf("blob:")&&0!==i.indexOf("data:")||this.textureLoader.setPath(void 0));var r,s=e.FileName.slice(-3).toLowerCase();if("tga"===s){var a=THREE.Loader.Handlers.get(".tga");null===a?(console.warn("FBXLoader: TGALoader not found, creating empty placeholder texture for",i),r=new THREE.Texture):r=a.load(i)}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating empty placeholder texture for",i),r=new THREE.Texture):r=this.textureLoader.load(i);return this.textureLoader.setPath(n),r},parseMaterials:function(e){var t=new Map;if("Material"in g.Objects){var i=g.Objects.Material;for(var n in i){var o=this.parseMaterial(i[n],e);null!==o&&t.set(parseInt(n),o)}}return t},parseMaterial:function(e,t){var i=e.id,n=e.attrName,r=e.ShadingModel;if("object"===(void 0===r?"undefined":o(r))&&(r=r.value),!y.has(i))return null;var s,a=this.parseParameters(e,t,i);switch(r.toLowerCase()){case"phong":s=new THREE.MeshPhongMaterial;break;case"lambert":s=new THREE.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),s=new THREE.MeshPhongMaterial({color:3342591})}return s.setValues(a),s.name=n,s},parseParameters:function(e,t,i){var n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new THREE.Color).fromArray(e.Diffuse.value):e.DiffuseColor&&"Color"===e.DiffuseColor.type&&(n.color=(new THREE.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new THREE.Color).fromArray(e.Emissive.value):e.EmissiveColor&&"Color"===e.EmissiveColor.type&&(n.emissive=(new THREE.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new THREE.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new THREE.Color).fromArray(e.SpecularColor.value));var o=this;return y.get(i).children.forEach(function(e){var i=e.relationship;switch(i){case"Bump":n.bumpMap=o.getTexture(t,e.ID);break;case"DiffuseColor":n.map=o.getTexture(t,e.ID);break;case"DisplacementColor":n.displacementMap=o.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=o.getTexture(t,e.ID);break;case"NormalMap":n.normalMap=o.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=o.getTexture(t,e.ID),n.envMap.mapping=THREE.EquirectangularReflectionMapping;break;case"SpecularColor":n.specularMap=o.getTexture(t,e.ID);break;case"TransparentColor":n.alphaMap=o.getTexture(t,e.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",i)}}),n},getTexture:function(e,t){return"LayeredTexture"in g.Objects&&t in g.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=y.get(t).children[0].ID),e.get(t)},parseDeformers:function(){var e={},t={};if("Deformer"in g.Objects){var i=g.Objects.Deformer;for(var n in i){var o=i[n],r=y.get(parseInt(n));if("Skin"===o.attrType){var s=this.parseSkeleton(r,i);s.ID=n,r.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),s.geometryID=r.parents[0].ID,e[n]=s}else if("BlendShape"===o.attrType){var a={id:n};a.rawTargets=this.parseMorphTargets(r,i),a.id=n,r.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=a}}}return{skeletons:e,morphTargets:t}},parseSkeleton:function(e,t){var i=[];return e.children.forEach(function(e){var n=t[e.ID];if("Cluster"===n.attrType){var o={ID:e.ID,indices:[],weights:[],transform:(new THREE.Matrix4).fromArray(n.Transform.a),transformLink:(new THREE.Matrix4).fromArray(n.TransformLink.a),linkMode:n.Mode};"Indexes"in n&&(o.indices=n.Indexes.a,o.weights=n.Weights.a),i.push(o)}}),{rawBones:i,bones:[]}},parseMorphTargets:function(e,t){for(var i=[],n=0;n<e.children.length;n++){if(8===n){console.warn("FBXLoader: maximum of 8 morph targets supported. Ignoring additional targets.");break}var o=e.children[n],r=t[o.ID],s={name:r.attrName,initialWeight:r.DeformPercent,id:r.id,fullWeights:r.FullWeights.a};if("BlendShapeChannel"!==r.attrType)return;y.get(parseInt(o.ID)).children.forEach(function(e){void 0===e.relationship&&(s.geoID=e.ID)}),i.push(s)}return i},parseScene:function(e,t,i){E=new THREE.Group;var o=this.parseModels(e.skeletons,t,i),r=g.Objects.Model,s=this;o.forEach(function(e){var t=r[e.ID];s.setLookAtProperties(e,t);y.get(e.ID).parents.forEach(function(t){var i=o.get(t.ID);void 0!==i&&i.add(e)}),null===e.parent&&E.add(e)}),this.bindSkeleton(e.skeletons,t,o),this.createAmbientLight(),this.setupMorphMaterials();var a=(new n).parse();1===E.children.length&&E.children[0].isGroup&&(E.children[0].animations=a,E=E.children[0]),E.animations=a},parseModels:function(e,t,i){var n=new Map,o=g.Objects.Model;for(var r in o){var s=parseInt(r),a=o[r],c=y.get(s),l=this.buildSkeleton(c,e,s,a.attrName);if(!l){switch(a.attrType){case"Camera":l=this.createCamera(c);break;case"Light":l=this.createLight(c);break;case"Mesh":l=this.createMesh(c,t,i);break;case"NurbsCurve":l=this.createCurve(c,t);break;case"LimbNode":case"Null":default:l=new THREE.Group}l.name=THREE.PropertyBinding.sanitizeNodeName(a.attrName),l.ID=s}this.setModelTransforms(l,a),n.set(s,l)}return n},buildSkeleton:function(e,t,i,n){var o=null;return e.parents.forEach(function(e){for(var r in t){var s=t[r];s.rawBones.forEach(function(t,r){if(t.ID===e.ID){var a=o;(o=new THREE.Bone).matrixWorld.copy(t.transformLink),o.name=THREE.PropertyBinding.sanitizeNodeName(n),o.ID=i,s.bones[r]=o,null!==a&&o.add(a)}})}}),o},createCamera:function(e){var t,i;if(e.children.forEach(function(e){var t=g.Objects.NodeAttribute[e.ID];void 0!==t&&(i=t)}),void 0===i)t=new THREE.Object3D;else{var n=0;void 0!==i.CameraProjectionType&&1===i.CameraProjectionType.value&&(n=1);var o=1;void 0!==i.NearPlane&&(o=i.NearPlane.value/1e3);var r=1e3;void 0!==i.FarPlane&&(r=i.FarPlane.value/1e3);var s=window.innerWidth,a=window.innerHeight;void 0!==i.AspectWidth&&void 0!==i.AspectHeight&&(s=i.AspectWidth.value,a=i.AspectHeight.value);var c=s/a,l=45;void 0!==i.FieldOfView&&(l=i.FieldOfView.value);var h=i.FocalLength?i.FocalLength.value:null;switch(n){case 0:t=new THREE.PerspectiveCamera(l,c,o,r),null!==h&&t.setFocalLength(h);break;case 1:t=new THREE.OrthographicCamera(-s/2,s/2,a/2,-a/2,o,r);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new THREE.Object3D}}return t},createLight:function(e){var t,i;if(e.children.forEach(function(e){var t=g.Objects.NodeAttribute[e.ID];void 0!==t&&(i=t)}),void 0===i)t=new THREE.Object3D;else{var n;n=void 0===i.LightType?0:i.LightType.value;var o=16777215;void 0!==i.Color&&(o=(new THREE.Color).fromArray(i.Color.value));var r=void 0===i.Intensity?1:i.Intensity.value/100;void 0!==i.CastLightOnObject&&0===i.CastLightOnObject.value&&(r=0);var s=0;void 0!==i.FarAttenuationEnd&&(s=void 0!==i.EnableFarAttenuation&&0===i.EnableFarAttenuation.value?0:i.FarAttenuationEnd.value);switch(n){case 0:t=new THREE.PointLight(o,r,s,1);break;case 1:t=new THREE.DirectionalLight(o,r);break;case 2:var a=Math.PI/3;void 0!==i.InnerAngle&&(a=THREE.Math.degToRad(i.InnerAngle.value));var c=0;void 0!==i.OuterAngle&&(c=THREE.Math.degToRad(i.OuterAngle.value),c=Math.max(c,1)),t=new THREE.SpotLight(o,r,s,a,c,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a THREE.PointLight."),t=new THREE.PointLight(o,r)}void 0!==i.CastShadows&&1===i.CastShadows.value&&(t.castShadow=!0)}return t},createMesh:function(e,t,i){var n,o=null,r=null,s=[];return e.children.forEach(function(e){t.has(e.ID)&&(o=t.get(e.ID)),i.has(e.ID)&&s.push(i.get(e.ID))}),s.length>1?r=s:s.length>0?r=s[0]:(r=new THREE.MeshPhongMaterial({color:13421772}),s.push(r)),"color"in o.attributes&&s.forEach(function(e){e.vertexColors=THREE.VertexColors}),o.FBX_Deformer?(s.forEach(function(e){e.skinning=!0}),n=new THREE.SkinnedMesh(o,r)):n=new THREE.Mesh(o,r),n},createCurve:function(e,t){var i=e.children.reduce(function(e,i){return t.has(i.ID)&&(e=t.get(i.ID)),e},null),n=new THREE.LineBasicMaterial({color:3342591,linewidth:1});return new THREE.Line(i,n)},setModelTransforms:function(e,t){var i={};"RotationOrder"in t&&(i.eulerOrder=parseInt(t.RotationOrder.value)),"Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value);var n=d(i);e.applyMatrix(n)},setLookAtProperties:function(e,t){if("LookAtProperty"in t){y.get(e.ID).children.forEach(function(t){if("LookAtProperty"===t.relationship){var i=g.Objects.Model[t.ID];if("Lcl_Translation"in i){var n=i.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(n),E.add(e.target)):e.lookAt((new THREE.Vector3).fromArray(n))}}})}},bindSkeleton:function(e,t,i){var n=this.parsePoseNodes();for(var o in e){var r=e[o];y.get(parseInt(r.ID)).parents.forEach(function(e){if(t.has(e.ID)){var o=e.ID;y.get(o).parents.forEach(function(e){if(i.has(e.ID)){i.get(e.ID).bind(new THREE.Skeleton(r.bones),n[e.ID])}})}})}},parsePoseNodes:function(){var e={};if("Pose"in g.Objects){var t=g.Objects.Pose;for(var i in t)if("BindPose"===t[i].attrType){var n=t[i].PoseNode;Array.isArray(n)?n.forEach(function(t){e[t.Node]=(new THREE.Matrix4).fromArray(t.Matrix.a)}):e[n.Node]=(new THREE.Matrix4).fromArray(n.Matrix.a)}}return e},createAmbientLight:function(){if("GlobalSettings"in g&&"AmbientColor"in g.GlobalSettings){var e=g.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],n=e[2];if(0!==t||0!==i||0!==n){var o=new THREE.Color(t,i,n);E.add(new THREE.AmbientLight(o,1))}}},setupMorphMaterials:function(){E.traverse(function(e){if(e.isMesh&&(e.geometry.morphAttributes.position||e.geometry.morphAttributes.normal)){var t=e.uuid,i=e.material.uuid,n=!1;E.traverse(function(e){e.isMesh&&e.material.uuid===i&&e.uuid!==t&&(n=!0)}),!0===n&&(e.material=e.material.clone()),e.material.morphTargets=!0}})}},i.prototype={constructor:i,parse:function(e){var t=new Map;if("Geometry"in g.Objects){var i=g.Objects.Geometry;for(var n in i){var o=y.get(parseInt(n)),r=this.parseGeometry(o,i[n],e);t.set(parseInt(n),r)}}return t},parseGeometry:function(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}},parseMeshGeometry:function(e,t,i){var n=i.skeletons,o=i.morphTargets,r=e.parents.map(function(e){return g.Objects.Model[e.ID]});if(0!==r.length){var s=e.children.reduce(function(e,t){return void 0!==n[t.ID]&&(e=n[t.ID]),e},null),a=e.children.reduce(function(e,t){return void 0!==o[t.ID]&&(e=o[t.ID]),e},null),c=r[0],l={};"RotationOrder"in c&&(l.eulerOrder=c.RotationOrder.value),"GeometricTranslation"in c&&(l.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(l.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(l.scale=c.GeometricScaling.value);var h=d(l);return this.genGeometry(t,s,a,h)}},genGeometry:function(e,t,i,n){var o=new THREE.BufferGeometry;e.attrName&&(o.name=e.attrName);var r=this.parseGeoNode(e,t),s=this.genBuffers(r),a=new THREE.Float32BufferAttribute(s.vertex,3);if(n.applyToBufferAttribute(a),o.addAttribute("position",a),s.colors.length>0&&o.addAttribute("color",new THREE.Float32BufferAttribute(s.colors,3)),t&&(o.addAttribute("skinIndex",new THREE.Uint16BufferAttribute(s.weightsIndices,4)),o.addAttribute("skinWeight",new THREE.Float32BufferAttribute(s.vertexWeights,4)),o.FBX_Deformer=t),s.normal.length>0){var c=new THREE.Float32BufferAttribute(s.normal,3);(new THREE.Matrix3).getNormalMatrix(n).applyToBufferAttribute(c),o.addAttribute("normal",c)}if(s.uvs.forEach(function(e,t){var i="uv"+(t+1).toString();0===t&&(i="uv"),o.addAttribute(i,new THREE.Float32BufferAttribute(s.uvs[t],2))}),r.material&&"AllSame"!==r.material.mappingType){var l=s.materialIndex[0],h=0;if(s.materialIndex.forEach(function(e,t){e!==l&&(o.addGroup(h,t-h,l),l=e,h=t)}),o.groups.length>0){var u=o.groups[o.groups.length-1],d=u.start+u.count;d!==s.materialIndex.length&&o.addGroup(d,s.materialIndex.length-d,l)}0===o.groups.length&&o.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(o,e,i,n),o},parseGeoNode:function(e,t){var i={};if(i.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],i.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];for(var n=0;e.LayerElementUV[n];)i.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return i.weightTable={},null!==t&&(i.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(n,o){void 0===i.weightTable[n]&&(i.weightTable[n]=[]),i.weightTable[n].push({id:t,weight:e.weights[o]})})})),i},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},i=0,n=0,o=!1,r=[],s=[],a=[],c=[],l=[],h=[],d=this;return e.vertexIndices.forEach(function(p,f){var v=!1;p<0&&(p^=-1,v=!0);var m=[],g=[];if(r.push(3*p,3*p+1,3*p+2),e.color){T=u(f,i,p,e.color);a.push(T[0],T[1],T[2])}if(e.skeleton){if(void 0!==e.weightTable[p]&&e.weightTable[p].forEach(function(e){g.push(e.weight),m.push(e.id)}),g.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);var y=[0,0,0,0],E=[0,0,0,0];g.forEach(function(e,t){var i=e,n=m[t];E.forEach(function(e,t,o){if(i>e){o[t]=i,i=e;var r=y[t];y[t]=n,n=r}})}),m=y,g=E}for(;g.length<4;)g.push(0),m.push(0);for(var b=0;b<4;++b)l.push(g[b]),h.push(m[b])}if(e.normal){var T=u(f,i,p,e.normal);s.push(T[0],T[1],T[2])}if(e.material&&"AllSame"!==e.material.mappingType)var w=u(f,i,p,e.material)[0];e.uv&&e.uv.forEach(function(e,t){var n=u(f,i,p,e);void 0===c[t]&&(c[t]=[]),c[t].push(n[0]),c[t].push(n[1])}),n++,v&&(d.genFace(t,e,r,w,s,a,c,l,h,n),i++,n=0,r=[],s=[],a=[],c=[],l=[],h=[])}),t},genFace:function(e,t,i,n,o,r,s,a,c,l){for(var h=2;h<l;h++)e.vertex.push(t.vertexPositions[i[0]]),e.vertex.push(t.vertexPositions[i[1]]),e.vertex.push(t.vertexPositions[i[2]]),e.vertex.push(t.vertexPositions[i[3*(h-1)]]),e.vertex.push(t.vertexPositions[i[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[i[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[i[3*h]]),e.vertex.push(t.vertexPositions[i[3*h+1]]),e.vertex.push(t.vertexPositions[i[3*h+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[4*(h-1)]),e.vertexWeights.push(a[4*(h-1)+1]),e.vertexWeights.push(a[4*(h-1)+2]),e.vertexWeights.push(a[4*(h-1)+3]),e.vertexWeights.push(a[4*h]),e.vertexWeights.push(a[4*h+1]),e.vertexWeights.push(a[4*h+2]),e.vertexWeights.push(a[4*h+3]),e.weightsIndices.push(c[0]),e.weightsIndices.push(c[1]),e.weightsIndices.push(c[2]),e.weightsIndices.push(c[3]),e.weightsIndices.push(c[4*(h-1)]),e.weightsIndices.push(c[4*(h-1)+1]),e.weightsIndices.push(c[4*(h-1)+2]),e.weightsIndices.push(c[4*(h-1)+3]),e.weightsIndices.push(c[4*h]),e.weightsIndices.push(c[4*h+1]),e.weightsIndices.push(c[4*h+2]),e.weightsIndices.push(c[4*h+3])),t.color&&(e.colors.push(r[0]),e.colors.push(r[1]),e.colors.push(r[2]),e.colors.push(r[3*(h-1)]),e.colors.push(r[3*(h-1)+1]),e.colors.push(r[3*(h-1)+2]),e.colors.push(r[3*h]),e.colors.push(r[3*h+1]),e.colors.push(r[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(o[0]),e.normal.push(o[1]),e.normal.push(o[2]),e.normal.push(o[3*(h-1)]),e.normal.push(o[3*(h-1)+1]),e.normal.push(o[3*(h-1)+2]),e.normal.push(o[3*h]),e.normal.push(o[3*h+1]),e.normal.push(o[3*h+2])),t.uv&&t.uv.forEach(function(t,i){void 0===e.uvs[i]&&(e.uvs[i]=[]),e.uvs[i].push(s[i][0]),e.uvs[i].push(s[i][1]),e.uvs[i].push(s[i][2*(h-1)]),e.uvs[i].push(s[i][2*(h-1)+1]),e.uvs[i].push(s[i][2*h]),e.uvs[i].push(s[i][2*h+1])})},addMorphTargets:function(e,t,i,n){if(null!==i){e.morphAttributes.position=[],e.morphAttributes.normal=[];var o=this;i.rawTargets.forEach(function(i){var r=g.Objects.Geometry[i.geoID];void 0!==r&&o.genMorphGeometry(e,t,r,n)})}},genMorphGeometry:function(e,t,i,n){var o=new THREE.BufferGeometry;i.attrName&&(o.name=i.attrName);for(var r=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],s=void 0!==t.Vertices?t.Vertices.a.slice():[],a=void 0!==i.Vertices?i.Vertices.a:[],c=void 0!==i.Indexes?i.Indexes.a:[],l=0;l<c.length;l++){var h=3*c[l];s[h]+=a[3*l],s[h+1]+=a[3*l+1],s[h+2]+=a[3*l+2]}var u={vertexIndices:r,vertexPositions:s},d=this.genBuffers(u),p=new THREE.Float32BufferAttribute(d.vertex,3);p.name=i.attrName,n.applyToBufferAttribute(p),e.morphAttributes.position.push(p)},parseNormals:function(e){var t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Normals.a,o=[];return"IndexToDirect"===i&&("NormalIndex"in e?o=e.NormalIndex.a:"NormalsIndex"in e&&(o=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:o,mappingType:t,referenceType:i}},parseUVs:function(e){var t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.UV.a,o=[];return"IndexToDirect"===i&&(o=e.UVIndex.a),{dataSize:2,buffer:n,indices:o,mappingType:t,referenceType:i}},parseVertexColors:function(e){var t=e.MappingInformationType,i=e.ReferenceInformationType,n=e.Colors.a,o=[];return"IndexToDirect"===i&&(o=e.ColorIndex.a),{dataSize:4,buffer:n,indices:o,mappingType:t,referenceType:i}},parseMaterialIndices:function(e){var t=e.MappingInformationType,i=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};for(var n=e.Materials.a,o=[],r=0;r<n.length;++r)o.push(r);return{dataSize:1,buffer:n,indices:o,mappingType:t,referenceType:i}},parseNurbsGeometry:function(e){if(void 0===THREE.NURBSCurve)return console.error("THREE.FBXLoader: The loader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new THREE.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new THREE.BufferGeometry;for(var i=t-1,n=e.KnotVector.a,o=[],r=e.Points.a,s=0,a=r.length;s<a;s+=4)o.push((new THREE.Vector4).fromArray(r,s));var c,l;if("Closed"===e.Form)o.push(o[0]);else if("Periodic"===e.Form){c=i,l=n.length-1-c;for(s=0;s<i;++s)o.push(o[s])}var h=new THREE.NURBSCurve(i,n,o,c,l).getPoints(7*o.length),u=new Float32Array(3*h.length);h.forEach(function(e,t){e.toArray(u,3*t)});var d=new THREE.BufferGeometry;return d.addAttribute("position",new THREE.BufferAttribute(u,3)),d}},n.prototype={constructor:n,parse:function(){var e=[],t=this.parseClips();if(void 0===t)return e;for(var i in t){var n=t[i],o=this.addClip(n);e.push(o)}return e},parseClips:function(){if(void 0!==g.Objects.AnimationCurve){var e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);var t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}},parseAnimationCurveNodes:function(){var e=g.Objects.AnimationCurveNode,t=new Map;for(var i in e){var n=e[i];if(null!==n.attrName.match(/S|R|T|DeformPercent/)){var o={id:n.id,attr:n.attrName,curves:{}};t.set(o.id,o)}}return t},parseAnimationCurves:function(e){var t=g.Objects.AnimationCurve;for(var i in t){var n={id:t[i].id,times:t[i].KeyTime.a.map(h),values:t[i].KeyValueFloat.a},o=y.get(n.id);if(void 0!==o){var r=o.parents[0].ID,s=o.parents[0].relationship;s.match(/X/)?e.get(r).curves.x=n:s.match(/Y/)?e.get(r).curves.y=n:s.match(/Z/)?e.get(r).curves.z=n:s.match(/d|DeformPercent/)&&e.has(r)&&(e.get(r).curves.morph=n)}}},parseAnimationLayers:function(e){var t=g.Objects.AnimationLayer,i=new Map;for(var n in t){var o=[],r=y.get(parseInt(n));if(void 0!==r){var s=this;r.children.forEach(function(t,i){if(e.has(t.ID)){var n=e.get(t.ID);if(void 0!==n.curves.x||void 0!==n.curves.y||void 0!==n.curves.z){if(void 0===o[i]){y.get(t.ID).parents.forEach(function(e){void 0!==e.relationship&&(u=e.ID)});var r=g.Objects.Model[u.toString()],a={modelName:THREE.PropertyBinding.sanitizeNodeName(r.attrName),initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:s.getModelAnimTransform(r)};"PreRotation"in r&&(a.preRotations=r.PreRotation.value),"PostRotation"in r&&(a.postRotations=r.PostRotation.value),o[i]=a}o[i][n.attr]=n}else if(void 0!==n.curves.morph){if(void 0===o[i]){var c;y.get(t.ID).parents.forEach(function(e){void 0!==e.relationship&&(c=e.ID)});var l=y.get(c).parents[0].ID,h=y.get(l).parents[0].ID,u=y.get(h).parents[0].ID,r=g.Objects.Model[u],a={modelName:THREE.PropertyBinding.sanitizeNodeName(r.attrName),morphName:g.Objects.Deformer[c].attrName};o[i]=a}o[i][n.attr]=n}}}),i.set(parseInt(n),o)}}return i},getModelAnimTransform:function(e){var t={};return"RotationOrder"in e&&(t.eulerOrder=parseInt(e.RotationOrder.value)),"Lcl_Translation"in e&&(t.translation=e.Lcl_Translation.value),"RotationOffset"in e&&(t.rotationOffset=e.RotationOffset.value),"Lcl_Rotation"in e&&(t.rotation=e.Lcl_Rotation.value),"PreRotation"in e&&(t.preRotation=e.PreRotation.value),"PostRotation"in e&&(t.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(t.scale=e.Lcl_Scaling.value),d(t)},parseAnimStacks:function(e){var t=g.Objects.AnimationStack,i={};for(var n in t){var o=y.get(parseInt(n)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var r=e.get(o[0].ID);i[n]={name:t[n].attrName,layer:r}}return i},addClip:function(e){var t=[],i=this;return e.layer.forEach(function(e){t=t.concat(i.generateTracks(e))}),new THREE.AnimationClip(e.name,-1,t)},generateTracks:function(e){var t=[],i=new THREE.Vector3,n=new THREE.Quaternion,o=new THREE.Vector3;if(e.transform&&e.transform.decompose(i,n,o),i=i.toArray(),n=(new THREE.Euler).setFromQuaternion(n).toArray(),o=o.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var r=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");void 0!==r&&t.push(r)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var s=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotations,e.postRotations);void 0!==s&&t.push(s)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var a=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");void 0!==a&&t.push(a)}if(void 0!==e.DeformPercent){var c=this.generateMorphTrack(e);void 0!==c&&t.push(c)}return t},generateVectorTrack:function(e,t,i,n){var o=this.getTimesForAllAxes(t),r=this.getKeyframeTrackValues(o,t,i);return new THREE.VectorKeyframeTrack(e+"."+n,o,r)},generateRotationTrack:function(e,t,i,n,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(THREE.Math.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(THREE.Math.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(THREE.Math.degToRad));var r=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(r,t,i);void 0!==n&&((n=n.map(THREE.Math.degToRad)).push("ZYX"),n=(new THREE.Euler).fromArray(n),n=(new THREE.Quaternion).setFromEuler(n)),void 0!==o&&((o=o.map(THREE.Math.degToRad)).push("ZYX"),o=(new THREE.Euler).fromArray(o),o=(new THREE.Quaternion).setFromEuler(o).inverse());for(var a=new THREE.Quaternion,c=new THREE.Euler,l=[],h=0;h<s.length;h+=3)c.set(s[h],s[h+1],s[h+2],"ZYX"),a.setFromEuler(c),void 0!==n&&a.premultiply(n),void 0!==o&&a.multiply(o),a.toArray(l,h/3*4);return new THREE.QuaternionKeyframeTrack(e+".quaternion",r,l)},generateMorphTrack:function(e){var t=e.DeformPercent.curves.morph,i=t.values.map(function(e){return e/100}),n=E.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new THREE.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,i)},getTimesForAllAxes:function(e){var t=[];return void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}).filter(function(e,t,i){return i.indexOf(e)==t})},getKeyframeTrackValues:function(e,t,i){var n=i,o=[],r=-1,s=-1,a=-1;return e.forEach(function(e){if(t.x&&(r=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(a=t.z.times.indexOf(e)),-1!==r){var i=t.x.values[r];o.push(i),n[0]=i}else o.push(n[0]);if(-1!==s){var c=t.y.values[s];o.push(c),n[1]=c}else o.push(n[1]);if(-1!==a){var l=t.z.values[a];o.push(l),n[2]=l}else o.push(n[2])}),o},interpolateRotations:function(e){for(var t=1;t<e.values.length;t++){var i=e.values[t-1],n=e.values[t]-i,o=Math.abs(n);if(o>=180){for(var r=o/180,s=n/r,a=i+s,c=e.times[t-1],l=(e.times[t]-c)/r,h=c+l,u=[],d=[];h<e.times[t];)u.push(h),h+=l,d.push(a),a+=s;e.times=m(e.times,t,u),e.values=m(e.values,t,d)}}}},r.prototype={constructor:r,getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,console.log("FBXTree: ",c),this.allNodes=new c,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,i=e.split(/[\r\n]+/);return i.forEach(function(e,n){var o=e.match(/^[\s\t]*;/),r=e.match(/^[\s\t]*$/);if(!o&&!r){var s=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),c=e.match("^\\t{"+(t.currentIndent-1)+"}}");s?t.parseNodeBegin(e,s):a?t.parseNodeProperty(e,a,i[++n]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}}),this.allNodes},parseNodeBegin:function(e,t){var i=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")}),o={name:i},r=this.parseNodeAttr(n),s=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(i,o):i in s?("PoseNode"===i?s.PoseNode.push(o):void 0!==s[i].id&&(s[i]={},s[i][s[i].id]=s[i]),""!==r.id&&(s[i][r.id]=o)):"number"==typeof r.id?(s[i]={},s[i][r.id]=o):"Properties70"!==i&&(s[i]="PoseNode"===i?[o]:o),"number"==typeof r.id&&(o.id=r.id),""!==r.name&&(o.attrName=r.name),""!==r.type&&(o.attrType=r.type),this.pushStack(o)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var i="",n="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:i,type:n}},parseNodeProperty:function(e,t,i){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===n&&","===o&&(o=i.replace(/"/g,"").replace(/,$/,"").trim());var r=this.getCurrentNode();if("Properties70"!==r.name){if("C"===n){var s=o.split(",").slice(1),a=parseInt(s[0]),c=parseInt(s[1]),l=o.split(",").slice(3);n="connections",function(e,t){for(var i=0,n=e.length,o=t.length;i<o;i++,n++)e[n]=t[i]}(o=[a,c],l=l.map(function(e){return e.trim().replace(/^"/,"")})),void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=o),n in r&&Array.isArray(r[n])?r[n].push(o):"a"!==n?r[n]=o:r.a=o,this.setCurrentProp(r,n),"a"===n&&","!==o.slice(-1)&&(r.a=f(o))}else this.parseNodeSpecialProperty(e,n,o)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=f(t.a))},parseNodeSpecialProperty:function(e,t,i){var n=i.split('",').map(function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=n[0],r=n[1],s=n[2],a=n[3],c=n[4];switch(r){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=f(c)}this.getPrevNode()[o]={type:r,type2:s,flag:a,value:c},this.setCurrentProp(this.getPrevNode(),o)}},s.prototype={constructor:s,parse:function(e){var t=new a(e);t.skip(23);var i=t.getUint32();console.log("THREE.FBXLoader: FBX binary version: "+i);for(var n=new c;!this.endOfContent(t);){var o=this.parseNode(t,i);null!==o&&n.add(o.name,o)}return n},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var i={},n=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32(),r=(t>=7500?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(r);if(0===n)return null;for(var a=[],c=0;c<o;c++)a.push(this.parseProperty(e));var l=a.length>0?a[0]:"",h=a.length>1?a[1]:"",u=a.length>2?a[2]:"";for(i.singleProperty=1===o&&e.getOffset()===n;n>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(s,i,d)}return i.propertyList=a,"number"==typeof l&&(i.id=l),""!==h&&(i.attrName=h),""!==u&&(i.attrType=u),""!==s&&(i.name=s),i},parseSubNode:function(e,t,i){if(!0===i.singleProperty){var n=i.propertyList[0];Array.isArray(n)?(t[i.name]=i,i.a=n):t[i.name]=n}else if("Connections"===e&&"C"===i.name){var o=[];i.propertyList.forEach(function(e,t){0!==t&&o.push(e)}),void 0===t.connections&&(t.connections=[]),t.connections.push(o)}else if("Properties70"===i.name){Object.keys(i).forEach(function(e){t[e]=i[e]})}else if("Properties70"===e&&"P"===i.name){var r,s=i.propertyList[0],a=i.propertyList[1],c=i.propertyList[2],l=i.propertyList[3];0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),r="Color"===a||"ColorRGB"===a||"Vector"===a||"Vector3D"===a||0===a.indexOf("Lcl_")?[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:i.propertyList[4],t[s]={type:a,type2:c,flag:l,value:r}}else void 0===t[i.name]?"number"==typeof i.id?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:"PoseNode"===i.name?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):void 0===t[i.name][i.id]&&(t[i.name][i.id]=i)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":i=e.getUint32();return e.getArrayBuffer(i);case"S":var i=e.getUint32();return e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=e.getUint32(),o=e.getUint32(),r=e.getUint32();if(0===o)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}"undefined"==typeof Zlib&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var s=new a(new Zlib.Inflate(new Uint8Array(e.getArrayBuffer(r))).decompress().buffer);switch(t){case"b":case"c":return s.getBooleanArray(n);case"d":return s.getFloat64Array(n);case"f":return s.getFloat32Array(n);case"i":return s.getInt32Array(n);case"l":return s.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},a.prototype={constructor:a,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),e=e+1&4294967295,-(4294967296*t+e)):4294967296*t+e},getInt64Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],i=0;i<e;i++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=[],i=0;i<e;i++)t[i]=this.getUint8();var n=t.indexOf(0);return n>=0&&(t=t.slice(0,n)),THREE.LoaderUtils.decodeText(new Uint8Array(t))}},c.prototype={constructor:c,add:function(e,t){this[e]=t}};var b=[],T=new THREE.Matrix4,w=new THREE.Euler,x=new THREE.Vector3,k=new THREE.Vector3,R=new THREE.Matrix4;return e}()},{}],4:[function(e,t,i){"use strict";t.exports=Object.assign(function(){},{FACE_1:0,FACE_2:1,FACE_3:2,FACE_4:3,L_SHOULDER_1:4,R_SHOULDER_1:5,L_SHOULDER_2:6,R_SHOULDER_2:7,SELECT:8,START:9,DPAD_UP:12,DPAD_DOWN:13,DPAD_LEFT:14,DPAD_RIGHT:15,VENDOR:16})},{}],5:[function(e,t,i){"use strict";t.exports=function(e,t,i){this.type=e,this.index=t,this.pressed=i.pressed,this.value=i.value}},{}],6:[function(e,t,i){"use strict";t.exports={size:5,cellSize:10,extrudeSettings:{amount:1,bevelEnabled:!0,bevelSegments:1,steps:1,bevelSize:.5,bevelThickness:.5},autogenerated:!0,cells:[{q:-1,r:0,s:1,h:1,walkable:!0,userData:{}},{q:0,r:-1,s:1,h:1,walkable:!0,userData:{}},{q:0,r:0,s:0,h:1,walkable:!0,userData:{}},{q:1,r:-1,s:0,h:1,walkable:!0,userData:{}},{q:-1,r:1,s:0,h:0,walkable:!0,userData:{}},{q:0,r:1,s:-1,h:0,walkable:!0,userData:{}},{q:1,r:0,s:-1,h:0,walkable:!0,userData:{}}]}},{}],7:[function(e,t,i){"use strict";function n(e){var t=document.getElementById(e),i=t.parentNode;try{i&&i.removeChild(t)}catch(e){}}function o(e,t,i){return new i(function(i,o){var r=t.timeout||5e3,s="script_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),a=function(e,t){var i=document.createElement("script");return i.type="text/javascript",i.async=!0,i.id=t,i.src=e,i}(e,s),c=setTimeout(function(){o(new Error("Script request to "+e+" timed out")),n(s)},r),l=function(e){clearTimeout(e)};a.addEventListener("load",function(e){i({ok:!0}),l(c),n(s)}),a.addEventListener("error",function(t){o(new Error("Script request to "+e+" failed "+t)),l(c),n(s)}),function(e){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}(a)})}t.exports=function(e){return e=e||{},function(t,i){return i=i||{},o(t,i,e.Promise||Promise)}}},{}],8:[function(e,t,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},r=t.exports={VERSION:"0.1.1",PI:Math.PI,TAU:2*Math.PI,DEG_TO_RAD:.0174532925,RAD_TO_DEG:57.2957795,SQRT3:Math.sqrt(3),TILE:"tile",ENT:"entity",STR:"structure",HEX:"hex",SQR:"square",ABS:"abstract"};r.Board=function(e,t){if(!e)throw new Error("You must pass in a grid system for the board to use.");this.tiles=[],this.tileGroup=null,this.group=new THREE.Object3D,this.grid=null,this.overlay=null,this.finder=new r.AStarFinder(t),r.Loader.init(),this.setGrid(e)},r.Board.prototype={setEntityOnTile:function(e,t){var i=this.grid.cellToPixel(t.cell);e.position.copy(i),e.position.y+=e.heightOffset||0,e.tile&&(e.tile.entity=null),e.tile=t,t.entity=e},addTile:function(e){-1===this.tiles.indexOf(e)&&(this.tiles.push(e),this.snapTileToGrid(e),e.position.y=0,this.tileGroup.add(e.mesh),this.grid.add(e.cell),e.cell.tile=e)},removeTile:function(e){if(e){var t=this.tiles.indexOf(e);this.grid.remove(e.cell),-1!==t&&this.tiles.splice(t,1),e.dispose()}},removeAllTiles:function(){if(this.tileGroup)for(var e=this.tileGroup.children,t=0;t<e.length;t++)this.tileGroup.remove(e[t])},getTileAtCell:function(e){var t=this.grid.cellToHash(e);return e.tile||(void 0!==this.grid.cells[t]?this.grid.cells[t].tile:null)},snapToGrid:function(e){var t=this.grid.pixelToCell(e);e.copy(this.grid.cellToPixel(t))},snapTileToGrid:function(e){if(e.cell)e.position.copy(this.grid.cellToPixel(e.cell));else{var t=this.grid.pixelToCell(e.position);e.position.copy(this.grid.cellToPixel(t))}return e},getRandomTile:function(){var e=r.Tools.randomInt(0,this.tiles.length-1);return this.tiles[e]},findPath:function(e,t,i){return this.finder.findPath(e.cell,t.cell,i,this.grid)},setGrid:function(e){this.group.remove(this.tileGroup),this.grid&&e!==this.grid&&(this.removeAllTiles(),this.tiles.forEach(function(e){this.grid.remove(e.cell),e.dispose()}),this.grid.dispose()),this.grid=e,this.tiles=[],this.tileGroup=new THREE.Object3D,this.group.add(this.tileGroup)},generateOverlay:function(e){var t=new THREE.LineBasicMaterial({color:0,opacity:.3});this.overlay&&this.group.remove(this.overlay),this.overlay=new THREE.Object3D,this.grid.generateOverlay(e,this.overlay,t),this.group.add(this.overlay)},generateTilemap:function(e){this.reset();var t=this.grid.generateTiles(e);this.tiles=t,this.tileGroup=new THREE.Object3D;for(var i=0;i<t.length;i++)this.tileGroup.add(t[i].mesh);this.group.add(this.tileGroup)},reset:function(){this.removeAllTiles(),this.tileGroup&&this.group.remove(this.tileGroup)}},r.Board.prototype.constructor=r.Board,r.Cell=function(e,t,i,n){this.q=e||0,this.r=t||0,this.s=i||0,this.h=n||1,this.tile=null,this.userData={},this.walkable=!0,this._calcCost=0,this._priority=0,this._visited=!1,this._parent=null,this.uniqueID=r.LinkedList.generateID()},r.Cell.prototype={set:function(e,t,i){return this.q=e,this.r=t,this.s=i,this},copy:function(e){return this.q=e.q,this.r=e.r,this.s=e.s,this.h=e.h,this.tile=e.tile||null,this.userData=e.userData||{},this.walkable=e.walkable,this},add:function(e){return this.q+=e.q,this.r+=e.r,this.s+=e.s,this},equals:function(e){return this.q===e.q&&this.r===e.r&&this.s===e.s}},r.Cell.prototype.constructor=r.Cell,r.HexGrid=function(e){e=e||{},this.type=r.HEX,this.size=5,this.cellSize=void 0===e.cellSize?10:e.cellSize,this.cells={},this.numCells=0,this.extrudeSettings=null,this.autogenerated=!1;var t,i=[];for(t=0;6>t;t++)i.push(this._createVertex(t));for(this.cellShape=new THREE.Shape,this.cellShape.moveTo(i[0].x,i[0].y),t=1;6>t;t++)this.cellShape.lineTo(i[t].x,i[t].y);this.cellShape.lineTo(i[0].x,i[0].y),this.cellShape.autoClose=!0,this.cellGeo=new THREE.Geometry,this.cellGeo.vertices=i,this.cellGeo.verticesNeedUpdate=!0,this.cellShapeGeo=new THREE.ShapeGeometry(this.cellShape),this._cellWidth=2*this.cellSize,this._cellLength=.5*r.SQRT3*this._cellWidth,this._hashDelimeter=".",this._directions=[new r.Cell(1,-1,0),new r.Cell(1,0,-1),new r.Cell(0,1,-1),new r.Cell(-1,1,0),new r.Cell(-1,0,1),new r.Cell(0,-1,1)],this._diagonals=[new r.Cell(2,-1,-1),new r.Cell(1,1,-2),new r.Cell(-1,2,-1),new r.Cell(-2,1,1),new r.Cell(-1,-1,2),new r.Cell(1,-2,1)],this._list=[],this._vec3=new THREE.Vector3,this._cel=new r.Cell,this._conversionVec=new THREE.Vector3,this._geoCache=[],this._matCache=[]},r.HexGrid.TWO_THIRDS=2/3,r.HexGrid.prototype={cellToPixel:function(e){return this._vec3.x=e.q*this._cellWidth*.75,this._vec3.y=e.h,this._vec3.z=-(e.s-e.r)*this._cellLength*.5,this._vec3},pixelToCell:function(e){var t=e.x*(r.HexGrid.TWO_THIRDS/this.cellSize),i=(-e.x/3+r.SQRT3/3*e.z)/this.cellSize;return this._cel.set(t,i,-t-i),this._cubeRound(this._cel)},getCellAt:function(e){var t=e.x*(r.HexGrid.TWO_THIRDS/this.cellSize),i=(-e.x/3+r.SQRT3/3*e.z)/this.cellSize;return this._cel.set(t,i,-t-i),this._cubeRound(this._cel),this.cells[this.cellToHash(this._cel)]},getNeighbors:function(e,t,i){var n,o,r=this._directions.length;for(this._list.length=0,n=0;r>n;n++)this._cel.copy(e),this._cel.add(this._directions[n]),!(o=this.cells[this.cellToHash(this._cel)])||i&&!i(e,o)||this._list.push(o);if(t)for(n=0;r>n;n++)this._cel.copy(e),this._cel.add(this._diagonals[n]),!(o=this.cells[this.cellToHash(this._cel)])||i&&!i(e,o)||this._list.push(o);return this._list},getRandomCell:function(){var e,t=0,i=r.Tools.randomInt(0,this.numCells);for(e in this.cells){if(t===i)return this.cells[e];t++}return this.cells[e]},cellToHash:function(e){return e.q+this._hashDelimeter+e.r+this._hashDelimeter+e.s},distance:function(e,t){var i=Math.max(Math.abs(e.q-t.q),Math.abs(e.r-t.r),Math.abs(e.s-t.s));return i+=t.h-e.h},clearPath:function(){var e,t;for(e in this.cells)(t=this.cells[e])._calcCost=0,t._priority=0,t._parent=null,t._visited=!1},traverse:function(e){var t;for(t in this.cells)e(this.cells[t])},generateTile:function(e,t,i){var n=Math.abs(e.h);1>n&&(n=1);var o=this._geoCache[n];o||(this.extrudeSettings.amount=n,o=new THREE.ExtrudeGeometry(this.cellShape,this.extrudeSettings),this._geoCache[n]=o);var s=new r.Tile({size:this.cellSize,scale:t,cell:e,geometry:o,material:i});return e.tile=s,s},generateTiles:function(e){e=e||{};var t=[],i={tileScale:.95,cellSize:this.cellSize,material:null,extrudeSettings:{amount:1,bevelEnabled:!0,bevelSegments:1,steps:1,bevelSize:.5,bevelThickness:.5}};i=r.Tools.merge(i,e),this.cellSize=i.cellSize,this._cellWidth=2*this.cellSize,this._cellLength=.5*r.SQRT3*this._cellWidth,this.autogenerated=!0,this.extrudeSettings=i.extrudeSettings;var n,o,s;for(n in this.cells)s=this.cells[n],(o=this.generateTile(s,i.tileScale,i.material)).position.copy(this.cellToPixel(s)),o.position.y=0,t.push(o);return t},generateTilePoly:function(e){e||(e=new THREE.MeshBasicMaterial({color:2405631}));var t=new THREE.Mesh(this.cellShapeGeo,e);return this._vec3.set(1,0,0),t.rotateOnAxis(this._vec3,r.PI/2),t},generate:function(e){e=e||{},this.size=void 0===e.size?this.size:e.size;var t,i,n,o;for(t=-this.size;t<this.size+1;t++)for(i=-this.size;i<this.size+1;i++)n=-t-i,Math.abs(t)<=this.size&&Math.abs(i)<=this.size&&Math.abs(n)<=this.size&&(o=new r.Cell(t,i,n),this.add(o))},generateOverlay:function(e,t,i){var n,o,s,a=this.cellShape.createPointsGeometry();for(n=-e;e+1>n;n++)for(o=-e;e+1>o;o++)if(s=-n-o,Math.abs(n)<=e&&Math.abs(o)<=e&&Math.abs(s)<=e){this._cel.set(n,o,s);var c=new THREE.Line(a,i);c.position.copy(this.cellToPixel(this._cel)),c.rotation.x=90*r.DEG_TO_RAD,t.add(c)}},add:function(e){var t=this.cellToHash(e);if(!this.cells[t])return this.cells[t]=e,this.numCells++,e},remove:function(e){var t=this.cellToHash(e);this.cells[t]&&(delete this.cells[t],this.numCells--)},dispose:function(){this.cells=null,this.numCells=0,this.cellShape=null,this.cellGeo.dispose(),this.cellGeo=null,this.cellShapeGeo.dispose(),this.cellShapeGeo=null,this._list=null,this._vec3=null,this._conversionVec=null,this._geoCache=null,this._matCache=null},load:function(e,t,i){var n=this;r.Tools.getJSON({url:e,callback:function(e){n.fromJSON(e),t.call(i||null,e)},cache:!1,scope:n})},fromJSON:function(e){var t,i,n=e.cells;for(this.cells={},this.numCells=0,this.size=e.size,this.cellSize=e.cellSize,this._cellWidth=2*this.cellSize,this._cellLength=.5*r.SQRT3*this._cellWidth,this.extrudeSettings=e.extrudeSettings,this.autogenerated=e.autogenerated,t=0;t<n.length;t++)(i=new r.Cell).copy(n[t]),this.add(i)},toJSON:function(){var e,t,i={size:this.size,cellSize:this.cellSize,extrudeSettings:this.extrudeSettings,autogenerated:this.autogenerated},n=[];for(t in this.cells)e=this.cells[t],n.push({q:e.q,r:e.r,s:e.s,h:e.h,walkable:e.walkable,userData:e.userData});return i.cells=n,i},_createVertex:function(e){var t=r.TAU/6*e;return new THREE.Vector3(this.cellSize*Math.cos(t),this.cellSize*Math.sin(t),0)},_cubeRound:function(e){var t=Math.round(e.q),i=Math.round(e.r),n=Math.round(e.s),o=Math.abs(t-e.q),r=Math.abs(i-e.r),s=Math.abs(n-e.s);return o>r&&o>s?t=-i-n:r>s?i=-t-n:n=-t-i,this._cel.set(t,i,n)}},r.HexGrid.prototype.constructor=r.HexGrid,r.SqrGrid=function(e){e=e||{},this.type=r.SQR,this.size=5,this.cellSize=void 0===e.cellSize?10:e.cellSize,this.cells={},this.numCells=0,this.extrudeSettings=null,this.autogenerated=!1;var t=[];t.push(new THREE.Vector3),t.push(new THREE.Vector3(-this.cellSize,this.cellSize)),t.push(new THREE.Vector3(this.cellSize,this.cellSize)),t.push(new THREE.Vector3(this.cellSize,-this.cellSize)),this.cellShape=new THREE.Shape,this.cellShape.moveTo(-this.cellSize,-this.cellSize),this.cellShape.lineTo(-this.cellSize,this.cellSize),this.cellShape.lineTo(this.cellSize,this.cellSize),this.cellShape.lineTo(this.cellSize,-this.cellSize),this.cellShape.lineTo(-this.cellSize,-this.cellSize),this.cellGeo=new THREE.Geometry,this.cellGeo.vertices=t,this.cellGeo.verticesNeedUpdate=!0,this.cellShapeGeo=new THREE.ShapeGeometry(this.cellShape),this._fullCellSize=2*this.cellSize,this._hashDelimeter=".",this._directions=[new r.Cell(1,0,0),new r.Cell(0,-1,0),new r.Cell(-1,0,0),new r.Cell(0,1,0)],this._diagonals=[new r.Cell(-1,-1,0),new r.Cell(-1,1,0),new r.Cell(1,1,0),new r.Cell(1,-1,0)],this._list=[],this._vec3=new THREE.Vector3,this._cel=new r.Cell,this._conversionVec=new THREE.Vector3,this._geoCache=[],this._matCache=[]},r.SqrGrid.prototype={cellToPixel:function(e){return this._vec3.x=e.q*this._fullCellSize,this._vec3.y=e.h,this._vec3.z=e.r*this._fullCellSize,this._vec3},pixelToCell:function(e){var t=Math.round(e.x/this._fullCellSize),i=Math.round(e.z/this._fullCellSize);return this._cel.set(t,i,0)},getCellAt:function(e){var t=Math.round(e.x/this._fullCellSize),i=Math.round(e.z/this._fullCellSize);return this._cel.set(t,i),this.cells[this.cellToHash(this._cel)]},getNeighbors:function(e,t,i){var n,o,r=this._directions.length;for(this._list.length=0,n=0;r>n;n++)this._cel.copy(e),this._cel.add(this._directions[n]),!(o=this.cells[this.cellToHash(this._cel)])||i&&!i(e,o)||this._list.push(o);if(t)for(n=0;r>n;n++)this._cel.copy(e),this._cel.add(this._diagonals[n]),!(o=this.cells[this.cellToHash(this._cel)])||i&&!i(e,o)||this._list.push(o);return this._list},getRandomCell:function(){var e,t=0,i=r.Tools.randomInt(0,this.numCells);for(e in this.cells){if(t===i)return this.cells[e];t++}return this.cells[e]},cellToHash:function(e){return e.q+this._hashDelimeter+e.r},distance:function(e,t){var i=Math.max(Math.abs(e.q-t.q),Math.abs(e.r-t.r));return i+=t.h-e.h},clearPath:function(){var e,t;for(e in this.cells)(t=this.cells[e])._calcCost=0,t._priority=0,t._parent=null,t._visited=!1},traverse:function(e){var t;for(t in this.cells)e(this.cells[t])},generateTile:function(e,t,i){var n=Math.abs(e.h);1>n&&(n=1);var o=this._geoCache[n];o||(this.extrudeSettings.amount=n,o=new THREE.ExtrudeGeometry(this.cellShape,this.extrudeSettings),this._geoCache[n]=o);var s=new r.Tile({size:this.cellSize,scale:t,cell:e,geometry:o,material:i});return e.tile=s,s},generateTiles:function(e){e=e||{};var t=[],i={tileScale:.95,cellSize:this.cellSize,material:null,extrudeSettings:{amount:1,bevelEnabled:!0,bevelSegments:1,steps:1,bevelSize:.5,bevelThickness:.5}};i=r.Tools.merge(i,e),this.cellSize=i.cellSize,this._fullCellSize=2*this.cellSize,this.autogenerated=!0,this.extrudeSettings=i.extrudeSettings;var n,o,s;for(n in this.cells)s=this.cells[n],(o=this.generateTile(s,i.tileScale,i.material)).position.copy(this.cellToPixel(s)),o.position.y=0,t.push(o);return t},generateTilePoly:function(e){e||(e=new THREE.MeshBasicMaterial({color:2405631}));var t=new THREE.Mesh(this.cellShapeGeo,e);return this._vec3.set(1,0,0),t.rotateOnAxis(this._vec3,r.PI/2),t},generate:function(e){e=e||{},this.size=void 0===e.size?this.size:e.size;var t,i,n,o=Math.ceil(this.size/2);for(t=-o;o>t;t++)for(i=-o;o>i;i++)n=new r.Cell(t,i+1),this.add(n)},generateOverlay:function(e,t,i){var n,o,s=Math.ceil(e/2);for(n=-s;s>n;n++)for(o=-s;s>o;o++){this._cel.set(n,o);var a=new THREE.Line(this.cellGeo,i);a.position.copy(this.cellToPixel(this._cel)),a.rotation.x=90*r.DEG_TO_RAD,t.add(a)}},add:function(e){var t=this.cellToHash(e);if(!this.cells[t])return this.cells[t]=e,this.numCells++,e},remove:function(e){var t=this.cellToHash(e);this.cells[t]&&(delete this.cells[t],this.numCells--)},dispose:function(){this.cells=null,this.numCells=0,this.cellShape=null,this.cellGeo.dispose(),this.cellGeo=null,this.cellShapeGeo.dispose(),this.cellShapeGeo=null,this._list=null,this._vec3=null,this._conversionVec=null,this._geoCache=null,this._matCache=null},load:function(e,t,i){r.Tools.getJSON({url:e,callback:function(e){this.fromJSON(e),t.call(i||null,e)},cache:!1,scope:this})},fromJSON:function(e){var t,i,n=e.cells;for(this.cells={},this.numCells=0,this.size=e.size,this.cellSize=e.cellSize,this._fullCellSize=2*this.cellSize,this.extrudeSettings=e.extrudeSettings,this.autogenerated=e.autogenerated,t=0;t<n.length;t++)(i=new r.Cell).copy(n[t]),this.add(i)},toJSON:function(){var e,t,i={size:this.size,cellSize:this.cellSize,extrudeSettings:this.extrudeSettings,autogenerated:this.autogenerated},n=[];for(t in this.cells)e=this.cells[t],n.push({q:e.q,r:e.r,s:e.s,h:e.h,walkable:e.walkable,userData:e.userData});return i.cells=n,i}},r.SqrGrid.prototype.constructor=r.SqrGrid,r.Tile=function(e){e=e||{};var t={cell:null,geometry:null,material:null};if(!(t=r.Tools.merge(t,e)).cell||!t.geometry)throw new Error("Missing vg.Tile configuration");this.cell=t.cell,this.cell.tile&&this.cell.tile!==this&&this.cell.tile.dispose(),this.cell.tile=this,this.uniqueID=r.Tools.generateID(),this.geometry=t.geometry,this.material=t.material,this.material||(this.material=new THREE.MeshPhongMaterial({color:r.Tools.randomizeRGB("30, 30, 30",13)})),this.objectType=r.TILE,this.entity=null,this.userData={},this.selected=!1,this.highlight="0x0084cc",this.mesh=new THREE.Mesh(this.geometry,this.material),this.mesh.userData.structure=this,this.position=this.mesh.position,this.rotation=this.mesh.rotation,this.rotation.x=-90*r.DEG_TO_RAD,this.mesh.scale.set(t.scale,t.scale,1),this.material.emissive?this._emissive=this.material.emissive.getHex():this._emissive=null},r.Tile.prototype={select:function(){return this.material.emissive&&this.material.emissive.setHex(this.highlight),this.selected=!0,this},deselect:function(){return null!==this._emissive&&this.material.emissive&&this.material.emissive.setHex(this._emissive),this.selected=!1,this},toggle:function(){return this.selected?this.deselect():this.select(),this},dispose:function(){this.cell&&this.cell.tile&&(this.cell.tile=null),this.cell=null,this.position=null,this.rotation=null,this.mesh.parent&&this.mesh.parent.remove(this.mesh),this.mesh.userData.structure=null,this.mesh=null,this.material=null,this.userData=null,this.entity=null,this.geometry=null,this._emissive=null}},r.Tile.prototype.constructor=r.Tile,function(){var e=function(){this.first=null,this.last=null,this.length=0,this.objToNodeMap={},this.uniqueID=Date.now()+""+Math.floor(1e3*Math.random()),this.sortArray=[]};e.generateID=function(){return Math.random().toString(36).slice(2)+Date.now()},(e.prototype={getNode:function(e){return this.objToNodeMap[e.uniqueID]},addNode:function(t){var i=new function(){this.obj=null,this.next=null,this.prev=null,this.free=!0};if(!t.uniqueID)try{t.uniqueID=e.generateID()}catch(e){return console.error("[LinkedList.addNode] obj passed is immutable: cannot attach necessary identifier"),null}return i.obj=t,i.free=!1,this.objToNodeMap[t.uniqueID]=i,i},swapObjects:function(e,t){this.objToNodeMap[e.obj.uniqueID]=null,this.objToNodeMap[t.uniqueID]=e,e.obj=t},add:function(e){var t=this.objToNodeMap[e.uniqueID];if(t){if(!1===t.free)return;t.obj=e,t.free=!1,t.next=null,t.prev=null}else t=this.addNode(e);if(this.first){if(!this.last)throw new Error("[LinkedList.add] No last in the list -- that shouldn't happen here");this.last.next=t,t.prev=this.last,this.last=t,t.next=null}else this.first=t,this.last=t,t.next=null,t.prev=null;this.length++,this.showDebug&&this.dump("after add")},has:function(e){return!!this.objToNodeMap[e.uniqueID]},moveUp:function(e){this.dump("before move up");var t=this.getNode(e);if(!t)throw"Oops, trying to move an object that isn't in the list";if(t.prev){var i=t.prev,n=i.prev;t==this.last&&(this.last=i);var o=t.next;n&&(n.next=t),t.next=i,t.prev=i.prev,i.next=o,i.prev=t,this.first==i&&(this.first=t)}},moveDown:function(e){var t=this.getNode(e);if(!t)throw"Oops, trying to move an object that isn't in the list";if(t.next){var i=t.next;this.moveUp(i.obj),this.last==i&&(this.last=t)}},sort:function(e){var t,i,n=this.sortArray,o=this.first;for(n.length=0;o;)n.push(o.obj),o=o.next;for(this.clear(),n.sort(e),i=n.length,t=0;i>t;t++)this.add(n[t])},remove:function(e){var t=this.getNode(e);return!(!t||t.free)&&(t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.prev||(this.first=t.next),t.next||(this.last=t.prev),t.free=!0,t.prev=null,t.next=null,this.length--,!0)},shift:function(){var e=this.first;return 0===this.length?null:(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),this.first=e.next,e.next||(this.last=null),e.free=!0,e.prev=null,e.next=null,this.length--,e.obj)},pop:function(){var e=this.last;return 0===this.length?null:(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),this.last=e.prev,e.prev||(this.first=null),e.free=!0,e.prev=null,e.next=null,this.length--,e.obj)},concat:function(e){for(var t=e.first;t;)this.add(t.obj),t=t.next},clear:function(){for(var e=this.first;e;)e.free=!0,e=e.next;this.first=null,this.length=0},dispose:function(){for(var e=this.first;e;)e.obj=null,e=e.next;this.first=null,this.objToNodeMap=null},dump:function(e){console.log("===================="+e+"=====================");for(var t=this.first;t;)console.log("{"+t.obj.toString()+"} previous="+(t.prev?t.prev.obj:"NULL")),t=t.next();console.log("==================================="),console.log("Last: {"+(this.last?this.last.obj:"NULL")+"} First: {"+(this.first?this.first.obj:"NULL")+"}")}}).constructor=e,r.LinkedList=e}(),function(){var e=function(e,t,i,n,o){this._listener=t,this.isOnce=i,this.context=n,this.signal=e,this._priority=o||0};(e.prototype={active:!0,params:null,execute:function(e){var t,i;return this.active&&this._listener&&(i=this.params?this.params.concat(e):e,t=this._listener.apply(this.context,i),this.isOnce&&this.detach()),t},detach:function(){return this.isBound()?this.signal.remove(this._listener,this.context):null},isBound:function(){return!!this.signal&&!!this._listener},_destroy:function(){delete this.signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this.isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}}).constructor=e;var t=function e(){this._bindings=[],this._prevParams=null;var t=this;this.dispatch=function(){e.prototype.dispatch.apply(t,arguments)}};(t.prototype={memorize:!1,_shouldPropagate:!0,active:!0,validateListener:function(e,t){if("function"!=typeof e)throw new Error("Signal: listener is a required param of {fn}() and should be a Function.".replace("{fn}",t))},_registerListener:function(t,i,n,o){var r,s=this._indexOfListener(t,n);if(-1!==s){if((r=this._bindings[s]).isOnce!==i)throw new Error("You cannot add"+(i?"":"Once")+"() then add"+(i?"Once":"")+"() the same listener without removing the relationship first.")}else r=new e(this,t,i,n,o),this._addBinding(r);return this.memorize&&this._prevParams&&r.execute(this._prevParams),r},_addBinding:function(e){var t=this._bindings.length;do{t--}while(this._bindings[t]&&e._priority<=this._bindings[t]._priority);this._bindings.splice(t+1,0,e)},_indexOfListener:function(e,t){for(var i,n=this._bindings.length;n--;)if((i=this._bindings[n])._listener===e&&i.context===t)return n;return-1},has:function(e,t){return-1!==this._indexOfListener(e,t)},add:function(e,t,i){return this.validateListener(e,"add"),this._registerListener(e,!1,t,i)},addOnce:function(e,t,i){return this.validateListener(e,"addOnce"),this._registerListener(e,!0,t,i)},remove:function(e,t){this.validateListener(e,"remove");var i=this._indexOfListener(e,t);return-1!==i&&(this._bindings[i]._destroy(),this._bindings.splice(i,1)),e},removeAll:function(e){void 0===e&&(e=null);for(var t=this._bindings.length;t--;)e?this._bindings[t].context===e&&(this._bindings[t]._destroy(),this._bindings.splice(t,1)):this._bindings[t]._destroy();e||(this._bindings.length=0)},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){var e,t=Array.prototype.slice.call(arguments),i=this._bindings.length;if(this.memorize&&(this._prevParams=t),i){e=this._bindings.slice(),this._shouldPropagate=!0;do{i--}while(e[i]&&this._shouldPropagate&&!1!==e[i].execute(t))}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}}).constructor=t,r.Signal=t}(),r.AStarFinder=function(e){e=e||{};var t={allowDiagonal:!1,heuristicFilter:null};t=r.Tools.merge(t,e),this.allowDiagonal=t.allowDiagonal,this.heuristicFilter=t.heuristicFilter,this.list=new r.LinkedList},r.AStarFinder.prototype={findPath:function(e,t,i,n){var o,s,a,c,l,h;for(i=i||this.heuristicFilter,n.clearPath(),this.list.clear(),this.list.add(e);this.list.length>0;){if(this.list.sort(this.compare),o=this.list.shift(),o._visited=!0,o===t)return r.PathUtil.backtrace(t);for(l=0,h=(a=n.getNeighbors(o,this.allowDiagonal,i)).length;h>l;l++)if((c=a[l]).walkable&&(s=o._calcCost+n.distance(o,c),!c._visited||s<c._calcCost)){if(c._visited=!0,c._parent=o,c._calcCost=s,c._priority=s+n.distance(t,c),c===t)return r.PathUtil.backtrace(t);this.list.add(c)}}return null},compare:function(e,t){return e._priority-t._priority}},r.AStarFinder.prototype.constructor=r.AStarFinder,r.PathUtil={backtrace:function(e){for(var t=[e];e._parent;)e=e._parent,t.push(e);return t.reverse()},biBacktrace:function(e,t){var i=this.backtrace(e),n=this.backtrace(t);return i.concat(n.reverse())},pathLength:function(e){var t,i,n,o,r,s=0;for(t=1;t<e.length;++t)i=e[t-1],n=e[t],o=i[0]-n[0],r=i[1]-n[1],s+=Math.sqrt(o*o+r*r);return s},interpolate:function(e,t,i,n){var o,r,s,a,c,l,h=Math.abs,u=[];for(s=h(i-e),a=h(n-t),o=i>e?1:-1,r=n>t?1:-1,c=s-a;e!==i||t!==n;)u.push([e,t]),(l=2*c)>-a&&(c-=a,e+=o),s>l&&(c+=s,t+=r);return u},expandPath:function(e){var t,i,n,o,r,s,a=[],c=e.length;if(2>c)return a;for(r=0;c-1>r;++r)for(t=e[r],i=e[r+1],o=(n=this.interpolate(t[0],t[1],i[0],i[1])).length,s=0;o-1>s;++s)a.push(n[s]);return a.push(e[c-1]),a},smoothenPath:function(e,t){var i,n,o,r,s,a,c,l,h,u,d,p,f=t.length,v=t[0][0],m=t[0][1],g=t[f-1][0],y=t[f-1][1];for(s=[[i=v,n=m]],c=2;f>c;++c){for(o=(h=t[c])[0],r=h[1],u=this.interpolate(i,n,o,r),p=!1,l=1;l<u.length;++l)if(d=u[l],!e.isWalkableAt(d[0],d[1])){p=!0;break}p&&(a=t[c-1],s.push(a),i=a[0],n=a[1])}return s.push([g,y]),s},compressPath:function(e){if(e.length<3)return e;var t,i,n,o,r,s,a=[],c=e[0][0],l=e[0][1],h=e[1][0],u=e[1][1],d=h-c,p=u-l;for(d/=r=Math.sqrt(d*d+p*p),p/=r,a.push([c,l]),s=2;s<e.length;s++)t=h,i=u,n=d,o=p,d=(h=e[s][0])-t,p=(u=e[s][1])-i,p/=r=Math.sqrt(d*d+p*p),((d/=r)!==n||p!==o)&&a.push([t,i]);return a.push([h,u]),a}},r.Loader={manager:null,imageLoader:null,crossOrigin:!1,init:function(e){this.crossOrigin=e||!1,this.manager=new THREE.LoadingManager(function(){},function(){},function(){console.warn("Error loading images")}),this.imageLoader=new THREE.ImageLoader(this.manager),this.imageLoader.crossOrigin=e},loadTexture:function(e,t,i,n){var o=new THREE.Texture(null,t);return this.imageLoader.load(e,function(e){o.image=e,o.needsUpdate=!0,i&&i(o)},null,function(e){n&&n(e)}),o.sourceFile=e,o}},r.MouseCaster=function(e,t,i){this.down=!1,this.rightDown=!1,this.pickedObject=null,this.selectedObject=null,this.allHits=null,this.active=!0,this.shift=!1,this.ctrl=!1,this.wheel=0,this.position=new THREE.Vector3,this.screenPosition=new THREE.Vector2,this.signal=new r.Signal,this.group=e,this._camera=t,this._raycaster=new THREE.Raycaster,this._preventDefault=!1,(i=i||document).addEventListener("mousemove",this._onDocumentMouseMove.bind(this),!1),i.addEventListener("mousedown",this._onDocumentMouseDown.bind(this),!1),i.addEventListener("mouseup",this._onDocumentMouseUp.bind(this),!1),i.addEventListener("mousewheel",this._onMouseWheel.bind(this),!1),i.addEventListener("DOMMouseScroll",this._onMouseWheel.bind(this),!1)},r.MouseCaster.OVER="over",r.MouseCaster.OUT="out",r.MouseCaster.DOWN="down",r.MouseCaster.UP="up",r.MouseCaster.CLICK="click",r.MouseCaster.WHEEL="wheel",r.MouseCaster.prototype={update:function(){if(this.active){this._raycaster.setFromCamera(this.screenPosition,this._camera);var e,t,i=this._raycaster.intersectObject(this.group,!0);i.length>0?(e=i[0],t=e.object.userData.structure,this.pickedObject!=t&&(this.pickedObject&&this.signal.dispatch(r.MouseCaster.OUT,this.pickedObject),this.pickedObject=t,this.selectedObject=null,this.signal.dispatch(r.MouseCaster.OVER,this.pickedObject)),this.position.copy(e.point),this.screenPosition.z=e.distance):(this.pickedObject&&this.signal.dispatch(r.MouseCaster.OUT,this.pickedObject),this.pickedObject=null,this.selectedObject=null),this.allHits=i}},preventDefault:function(){this._preventDefault=!0},_onDocumentMouseDown:function(e){return(e=e||window.event).preventDefault(),this._preventDefault?(this._preventDefault=!1,!1):(this.pickedObject&&(this.selectedObject=this.pickedObject),this.shift=e.shiftKey,this.ctrl=e.ctrlKey,this.down=1===e.which,this.rightDown=3===e.which,void this.signal.dispatch(r.MouseCaster.DOWN,this.pickedObject))},_onDocumentMouseUp:function(e){return e.preventDefault(),this._preventDefault?(this._preventDefault=!1,!1):(this.shift=e.shiftKey,this.ctrl=e.ctrlKey,this.signal.dispatch(r.MouseCaster.UP,this.pickedObject),this.selectedObject&&this.pickedObject&&this.selectedObject.uniqueID===this.pickedObject.uniqueID&&this.signal.dispatch(r.MouseCaster.CLICK,this.pickedObject),this.down=1!==e.which&&this.down,void(this.rightDown=3!==e.which&&this.rightDown))},_onDocumentMouseMove:function(e){e.preventDefault(),this.screenPosition.x=e.clientX/window.innerWidth*2-1,this.screenPosition.y=-e.clientY/window.innerHeight*2+1},_onMouseWheel:function(e){if(this.active){e.preventDefault(),e.stopPropagation();var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?this.wheel++:this.wheel--,this.signal.dispatch(r.MouseCaster.WHEEL,this.wheel)}}},r.MouseCaster.prototype.constructor=r.MouseCaster,r.Scene=function(e,t){var i={element:document.body,alpha:!0,antialias:!0,clearColor:"#fff",sortObjects:!1,fog:null,light:new THREE.DirectionalLight(16777215),lightPosition:null,cameraType:"PerspectiveCamera",cameraPosition:null,orthoZoom:4},n={minDistance:100,maxDistance:1e3,zoomSpeed:2,noZoom:!1};if(i=r.Tools.merge(i,e),"boolean"!=typeof t&&(n=r.Tools.merge(n,t)),this.renderer=new THREE.WebGLRenderer({alpha:i.alpha,antialias:i.antialias}),this.renderer.setClearColor(i.clearColor,0),this.renderer.sortObjects=i.sortObjects,this.width=window.innerWidth,this.height=window.innerHeight,this.orthoZoom=i.orthoZoom,this.container=new THREE.Scene,this.container.fog=i.fog,this.container.add(new THREE.AmbientLight(14540253)),i.lightPosition||i.light.position.set(-1,1,-1).normalize(),this.container.add(i.light),"OrthographicCamera"===i.cameraType){var o=window.innerWidth/this.orthoZoom,s=window.innerHeight/this.orthoZoom;this.camera=new THREE.OrthographicCamera(o/-2,o/2,s/2,s/-2,1,5e3)}else this.camera=new THREE.PerspectiveCamera(50,this.width/this.height,1,5e3);this.contolled=!!t,this.contolled&&(this.controls=new THREE.OrbitControls(this.camera,this.renderer.domElement),this.controls.minDistance=n.minDistance,this.controls.maxDistance=n.maxDistance,this.controls.zoomSpeed=n.zoomSpeed,this.controls.noZoom=n.noZoom),i.cameraPosition&&this.camera.position.copy(i.cameraPosition),window.addEventListener("resize",function(){if(this.width=window.innerWidth,this.height=window.innerHeight,"OrthographicCamera"===this.camera.type){var e=this.width/this.orthoZoom,t=this.height/this.orthoZoom;this.camera.left=e/-2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=t/-2}else this.camera.aspect=this.width/this.height;this.camera.updateProjectionMatrix(),this.renderer.setSize(this.width,this.height)}.bind(this),!1),this.attachTo(i.element)},r.Scene.prototype={attachTo:function(e){e.style.width=this.width+"px",e.style.height=this.height+"px",this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.width,this.height),e.appendChild(this.renderer.domElement)},add:function(e){this.container.add(e)},remove:function(e){this.container.remove(e)},render:function(){this.contolled&&this.controls.update(),this.renderer.render(this.container,this.camera)},updateOrthoZoom:function(){if(this.orthoZoom<=0)this.orthoZoom=0;else{var e=this.width/this.orthoZoom,t=this.height/this.orthoZoom;this.camera.left=e/-2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=t/-2,this.camera.updateProjectionMatrix()}},focusOn:function(e){this.camera.lookAt(e.position)}},r.Scene.prototype.constructor=r.Scene,r.SelectionManager=function(e){this.mouse=e,this.onSelect=new r.Signal,this.onDeselect=new r.Signal,this.selected=null,this.toggleSelection=!1,this.mouse.signal.add(this.onMouse,this)},r.SelectionManager.prototype={select:function(e,t){e&&(t=t||!0,this.selected!==e&&this.clearSelection(t),e.selected?this.toggleSelection&&(t&&this.onDeselect.dispatch(e),e.deselect()):e.select(),this.selected=e,t&&this.onSelect.dispatch(e))},clearSelection:function(e){e=e||!0,this.selected&&(e&&this.onDeselect.dispatch(this.selected),this.selected.deselect()),this.selected=null},onMouse:function(e,t){switch(e){case r.MouseCaster.DOWN:t||this.clearSelection();break;case r.MouseCaster.CLICK:this.select(t)}}},r.SelectionManager.prototype.constructor=r.SelectionManager,r.Tools={clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},sign:function(e){return e&&e/Math.abs(e)},random:function(e,t){return 1===arguments.length?Math.random()*e-.5*e:Math.random()*(t-e)+e},randomInt:function(e,t){return 1===arguments.length?Math.random()*e-.5*e|0:Math.random()*(t-e+1)+e|0},normalize:function(e,t,i){return(e-t)/(i-t)},getShortRotation:function(e){return(e%=this.TAU)>this.PI?e-=this.TAU:e<-this.PI&&(e+=this.TAU),e},generateID:function(){return Math.random().toString(36).slice(2)+Date.now()},isPlainObject:function(e){if("object"!=(void 0===e?"undefined":o(e))||e.nodeType||e===e.window)return!1;try{if(e.constructor&&!Object.prototype.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}return!0},merge:function(e,t){var i=this,n=Array.isArray(t),o=n&&[]||{};return n?(e=e||[],o=o.concat(e),t.forEach(function(t,n){void 0===o[n]?o[n]=t:i.isPlainObject(t)?o[n]=i.merge(e[n],t):-1===e.indexOf(t)&&o.push(t)}),o):(e&&i.isPlainObject(e)&&Object.keys(e).forEach(function(t){o[t]=e[t]}),Object.keys(t).forEach(function(n){t[n]&&i.isPlainObject(t[n])&&e[n]?o[n]=i.merge(e[n],t[n]):o[n]=t[n]}),o)},now:function(){return window.nwf?window.nwf.system.Performance.elapsedTime:window.performance.now()},empty:function(e){for(;e.lastChild;)e.removeChild(e.lastChild)},radixSort:function(e,t,i,n){if(t=t||0,i=i||e.length,n=n||31,!(t>=i-1||0>n)){for(var o=t,r=i,s=1<<n;r>o;)if(e[o]&s){--r;var a=e[o];e[o]=e[r],e[r]=a}else++o;this.radixSort(e,t,r,n-1),this.radixSort(e,r,i,n-1)}},randomizeRGB:function(e,t){var i,n,o=e.split(","),r="rgb(";for(t=this.randomInt(t),i=0;3>i;i++)0>(n=parseInt(o[i])+t)?n=0:n>255&&(n=255),r+=n+",";return r=r.substring(0,r.length-1),r+=")"},getJSON:function(e){var t=new XMLHttpRequest,i=void 0!==e.cache&&e.cache?e.url:e.url+"?t="+Math.floor(1e4*Math.random())+Date.now();t.onreadystatechange=function(){if(200!==this.status)0!==this.status&&console.warn("[Tools.getJSON] Error: "+this.status+" ("+this.statusText+") :: "+e.url);else{var t=null;try{t=JSON.parse(this.responseText)}catch(e){return}e.callback.call(e.scope||null,t)}},t.open("GET",i,!0),t.setRequestHeader("Accept","application/json"),t.setRequestHeader("Content-Type","application/json"),t.send("")}}},{}],9:[function(e,t,i){"use strict";!function(e){function t(e,t){return-1!==String(e).indexOf(t)}function i(e,t,i){u!==t&&h!==t&&l!==t||Object.keys(i).forEach(function(t){e[t]=i[t]})}function n(e){var t="keyCode"in e?e.keyCode:"which"in e?e.which:0,i=function(){if(y||"keyLocation"in e){var i=y?e.location:e.keyLocation;if(i&&t in f[i])return f[i][t]}return"keyIdentifier"in e&&e.keyIdentifier in p?p[e.keyIdentifier]:t in d?d[t]:null}();if(!i)return null;var n=function(){var t=v[i.code];return t?e.shiftKey&&"shiftKey"in t?t.shiftKey:t.key:i.code}();return{code:i.code,key:n,location:i.location,keyCap:i.keyCap}}var o="KeyboardEvent"in e;o||(e.KeyboardEvent=function(){throw TypeError("Illegal constructor")}),"DOM_KEY_LOCATION_STANDARD"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_STANDARD=0),"DOM_KEY_LOCATION_LEFT"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_LEFT=1),"DOM_KEY_LOCATION_RIGHT"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_RIGHT=2),"DOM_KEY_LOCATION_NUMPAD"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD=3);var r=window.KeyboardEvent.DOM_KEY_LOCATION_STANDARD,s=window.KeyboardEvent.DOM_KEY_LOCATION_LEFT,a=window.KeyboardEvent.DOM_KEY_LOCATION_RIGHT,c=window.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD,l=t(navigator.platform,"Win")?"win":t(navigator.platform,"Mac")?"mac":t(navigator.platform,"CrOS")?"cros":t(navigator.platform,"Linux")?"linux":t(navigator.userAgent,"iPad")||t(navigator.platform,"iPod")||t(navigator.platform,"iPhone")?"ios":"",h=t(navigator.userAgent,"Chrome/")?"chrome":t(navigator.vendor,"Apple")?"safari":t(navigator.userAgent,"MSIE")?"ie":t(navigator.userAgent,"Gecko/")?"moz":t(navigator.userAgent,"Opera/")?"opera":"",u=h+"-"+l,d={3:{code:"Cancel"},6:{code:"Help"},8:{code:"Backspace"},9:{code:"Tab"},12:{code:"Clear"},13:{code:"Enter"},16:{code:"Shift"},17:{code:"Control"},18:{code:"Alt"},19:{code:"Pause"},20:{code:"CapsLock"},21:{code:"KanaMode"},22:{code:"HangulMode"},23:{code:"JunjaMode"},24:{code:"FinalMode"},25:{code:"KanjiMode"},27:{code:"Escape"},28:{code:"Convert"},29:{code:"NonConvert"},30:{code:"Accept"},31:{code:"ModeChange"},32:{code:"Space"},33:{code:"PageUp"},34:{code:"PageDown"},35:{code:"End"},36:{code:"Home"},37:{code:"ArrowLeft"},38:{code:"ArrowUp"},39:{code:"ArrowRight"},40:{code:"ArrowDown"},41:{code:"Select"},42:{code:"Print"},43:{code:"Execute"},44:{code:"PrintScreen"},45:{code:"Insert"},46:{code:"Delete"},47:{code:"Help"},48:{code:"Digit0",keyCap:"0"},49:{code:"Digit1",keyCap:"1"},50:{code:"Digit2",keyCap:"2"},51:{code:"Digit3",keyCap:"3"},52:{code:"Digit4",keyCap:"4"},53:{code:"Digit5",keyCap:"5"},54:{code:"Digit6",keyCap:"6"},55:{code:"Digit7",keyCap:"7"},56:{code:"Digit8",keyCap:"8"},57:{code:"Digit9",keyCap:"9"},65:{code:"KeyA",keyCap:"a"},66:{code:"KeyB",keyCap:"b"},67:{code:"KeyC",keyCap:"c"},68:{code:"KeyD",keyCap:"d"},69:{code:"KeyE",keyCap:"e"},70:{code:"KeyF",keyCap:"f"},71:{code:"KeyG",keyCap:"g"},72:{code:"KeyH",keyCap:"h"},73:{code:"KeyI",keyCap:"i"},74:{code:"KeyJ",keyCap:"j"},75:{code:"KeyK",keyCap:"k"},76:{code:"KeyL",keyCap:"l"},77:{code:"KeyM",keyCap:"m"},78:{code:"KeyN",keyCap:"n"},79:{code:"KeyO",keyCap:"o"},80:{code:"KeyP",keyCap:"p"},81:{code:"KeyQ",keyCap:"q"},82:{code:"KeyR",keyCap:"r"},83:{code:"KeyS",keyCap:"s"},84:{code:"KeyT",keyCap:"t"},85:{code:"KeyU",keyCap:"u"},86:{code:"KeyV",keyCap:"v"},87:{code:"KeyW",keyCap:"w"},88:{code:"KeyX",keyCap:"x"},89:{code:"KeyY",keyCap:"y"},90:{code:"KeyZ",keyCap:"z"},91:{code:"OSLeft",location:s},92:{code:"OSRight",location:a},93:{code:"ContextMenu"},95:{code:"Standby"},96:{code:"Numpad0",keyCap:"0",location:c},97:{code:"Numpad1",keyCap:"1",location:c},98:{code:"Numpad2",keyCap:"2",location:c},99:{code:"Numpad3",keyCap:"3",location:c},100:{code:"Numpad4",keyCap:"4",location:c},101:{code:"Numpad5",keyCap:"5",location:c},102:{code:"Numpad6",keyCap:"6",location:c},103:{code:"Numpad7",keyCap:"7",location:c},104:{code:"Numpad8",keyCap:"8",location:c},105:{code:"Numpad9",keyCap:"9",location:c},106:{code:"NumpadMultiply",keyCap:"*",location:c},107:{code:"NumpadAdd",keyCap:"+",location:c},108:{code:"NumpadComma",keyCap:",",location:c},109:{code:"NumpadSubtract",keyCap:"-",location:c},110:{code:"NumpadDecimal",keyCap:".",location:c},111:{code:"NumpadDivide",keyCap:"/",location:c},112:{code:"F1"},113:{code:"F2"},114:{code:"F3"},115:{code:"F4"},116:{code:"F5"},117:{code:"F6"},118:{code:"F7"},119:{code:"F8"},120:{code:"F9"},121:{code:"F10"},122:{code:"F11"},123:{code:"F12"},124:{code:"F13"},125:{code:"F14"},126:{code:"F15"},127:{code:"F16"},128:{code:"F17"},129:{code:"F18"},130:{code:"F19"},131:{code:"F20"},132:{code:"F21"},133:{code:"F22"},134:{code:"F23"},135:{code:"F24"},144:{code:"NumLock",location:c},145:{code:"ScrollLock"},160:{code:"ShiftLeft",location:s},161:{code:"ShiftRight",location:a},162:{code:"ControlLeft",location:s},163:{code:"ControlRight",location:a},164:{code:"AltLeft",location:s},165:{code:"AltRight",location:a},166:{code:"BrowserBack"},167:{code:"BrowserForward"},168:{code:"BrowserRefresh"},169:{code:"BrowserStop"},170:{code:"BrowserSearch"},171:{code:"BrowserFavorites"},172:{code:"BrowserHome"},173:{code:"VolumeMute"},174:{code:"VolumeDown"},175:{code:"VolumeUp"},176:{code:"MediaTrackNext"},177:{code:"MediaTrackPrevious"},178:{code:"MediaStop"},179:{code:"MediaPlayPause"},180:{code:"LaunchMail"},181:{code:"MediaSelect"},182:{code:"LaunchApp1"},183:{code:"LaunchApp2"},186:{code:"Semicolon",keyCap:";"},187:{code:"Equal",keyCap:"="},188:{code:"Comma",keyCap:","},189:{code:"Minus",keyCap:"-"},190:{code:"Period",keyCap:"."},191:{code:"Slash",keyCap:"/"},192:{code:"Backquote",keyCap:"`"},219:{code:"BracketLeft",keyCap:"["},220:{code:"Backslash",keyCap:"\\"},221:{code:"BracketRight",keyCap:"]"},222:{code:"Quote",keyCap:"'"},226:{code:"IntlBackslash",keyCap:"\\"},229:{code:"Process"},246:{code:"Attn"},247:{code:"CrSel"},248:{code:"ExSel"},249:{code:"EraseEof"},250:{code:"Play"},251:{code:"ZoomToggle"},254:{code:"Clear"}};i(d,"moz",{59:{code:"Semicolon",keyCap:";"},61:{code:"Equal",keyCap:"="},107:{code:"Equal",keyCap:"="},109:{code:"Minus",keyCap:"-"},187:{code:"NumpadAdd",keyCap:"+",location:c},189:{code:"NumpadSubtract",keyCap:"-",location:c}}),i(d,"moz-mac",{12:{code:"NumLock",location:c},173:{code:"Minus",keyCap:"-"}}),i(d,"moz-win",{173:{code:"Minus",keyCap:"-"}}),i(d,"chrome-mac",{93:{code:"OSRight",location:a}}),i(d,"safari",{3:{code:"Enter"},25:{code:"Tab"}}),i(d,"ios",{10:{code:"Enter",location:r}}),i(d,"safari-mac",{91:{code:"OSLeft",location:s},93:{code:"OSRight",location:a},229:{code:"KeyQ",keyCap:"Q"}});var p={};"cros"===l&&(p["U+00A0"]={code:"ShiftLeft",location:s},p["U+00A1"]={code:"ShiftRight",location:a},p["U+00A2"]={code:"ControlLeft",location:s},p["U+00A3"]={code:"ControlRight",location:a},p["U+00A4"]={code:"AltLeft",location:s},p["U+00A5"]={code:"AltRight",location:a}),"chrome-mac"===u&&(p["U+0010"]={code:"ContextMenu"}),"safari-mac"===u&&(p["U+0010"]={code:"ContextMenu"}),"ios"===l&&(p["U+0010"]={code:"Function"},p["U+001C"]={code:"ArrowLeft"},p["U+001D"]={code:"ArrowRight"},p["U+001E"]={code:"ArrowUp"},p["U+001F"]={code:"ArrowDown"},p["U+0001"]={code:"Home"},p["U+0004"]={code:"End"},p["U+000B"]={code:"PageUp"},p["U+000C"]={code:"PageDown"});var f=[];f[s]={16:{code:"ShiftLeft",location:s},17:{code:"ControlLeft",location:s},18:{code:"AltLeft",location:s}},f[a]={16:{code:"ShiftRight",location:a},17:{code:"ControlRight",location:a},18:{code:"AltRight",location:a}},f[c]={13:{code:"NumpadEnter",location:c}},i(f[c],"moz",{109:{code:"NumpadSubtract",location:c},107:{code:"NumpadAdd",location:c}}),i(f[s],"moz-mac",{224:{code:"OSLeft",location:s}}),i(f[a],"moz-mac",{224:{code:"OSRight",location:a}}),i(f[a],"moz-win",{91:{code:"OSRight",location:a}}),i(f[a],"mac",{93:{code:"OSRight",location:a}}),i(f[c],"chrome-mac",{12:{code:"NumLock",location:c}}),i(f[c],"safari-mac",{12:{code:"NumLock",location:c},187:{code:"NumpadAdd",location:c},189:{code:"NumpadSubtract",location:c},190:{code:"NumpadDecimal",location:c},191:{code:"NumpadDivide",location:c}});var v={ShiftLeft:{key:"Shift"},ShiftRight:{key:"Shift"},ControlLeft:{key:"Control"},ControlRight:{key:"Control"},AltLeft:{key:"Alt"},AltRight:{key:"Alt"},OSLeft:{key:"OS"},OSRight:{key:"OS"},NumpadEnter:{key:"Enter"},Space:{key:" "},Digit0:{key:"0",shiftKey:")"},Digit1:{key:"1",shiftKey:"!"},Digit2:{key:"2",shiftKey:"@"},Digit3:{key:"3",shiftKey:"#"},Digit4:{key:"4",shiftKey:"$"},Digit5:{key:"5",shiftKey:"%"},Digit6:{key:"6",shiftKey:"^"},Digit7:{key:"7",shiftKey:"&"},Digit8:{key:"8",shiftKey:"*"},Digit9:{key:"9",shiftKey:"("},KeyA:{key:"a",shiftKey:"A"},KeyB:{key:"b",shiftKey:"B"},KeyC:{key:"c",shiftKey:"C"},KeyD:{key:"d",shiftKey:"D"},KeyE:{key:"e",shiftKey:"E"},KeyF:{key:"f",shiftKey:"F"},KeyG:{key:"g",shiftKey:"G"},KeyH:{key:"h",shiftKey:"H"},KeyI:{key:"i",shiftKey:"I"},KeyJ:{key:"j",shiftKey:"J"},KeyK:{key:"k",shiftKey:"K"},KeyL:{key:"l",shiftKey:"L"},KeyM:{key:"m",shiftKey:"M"},KeyN:{key:"n",shiftKey:"N"},KeyO:{key:"o",shiftKey:"O"},KeyP:{key:"p",shiftKey:"P"},KeyQ:{key:"q",shiftKey:"Q"},KeyR:{key:"r",shiftKey:"R"},KeyS:{key:"s",shiftKey:"S"},KeyT:{key:"t",shiftKey:"T"},KeyU:{key:"u",shiftKey:"U"},KeyV:{key:"v",shiftKey:"V"},KeyW:{key:"w",shiftKey:"W"},KeyX:{key:"x",shiftKey:"X"},KeyY:{key:"y",shiftKey:"Y"},KeyZ:{key:"z",shiftKey:"Z"},Numpad0:{key:"0"},Numpad1:{key:"1"},Numpad2:{key:"2"},Numpad3:{key:"3"},Numpad4:{key:"4"},Numpad5:{key:"5"},Numpad6:{key:"6"},Numpad7:{key:"7"},Numpad8:{key:"8"},Numpad9:{key:"9"},NumpadMultiply:{key:"*"},NumpadAdd:{key:"+"},NumpadComma:{key:","},NumpadSubtract:{key:"-"},NumpadDecimal:{key:"."},NumpadDivide:{key:"/"},Semicolon:{key:";",shiftKey:":"},Equal:{key:"=",shiftKey:"+"},Comma:{key:",",shiftKey:"<"},Minus:{key:"-",shiftKey:"_"},Period:{key:".",shiftKey:">"},Slash:{key:"/",shiftKey:"?"},Backquote:{key:"`",shiftKey:"~"},BracketLeft:{key:"[",shiftKey:"{"},Backslash:{key:"\\",shiftKey:"|"},BracketRight:{key:"]",shiftKey:"}"},Quote:{key:"'",shiftKey:'"'},IntlBackslash:{key:"\\",shiftKey:"|"}};i(v,"mac",{OSLeft:{key:"Meta"},OSRight:{key:"Meta"}});var m={Esc:"Escape",Nonconvert:"NonConvert",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Menu:"ContextMenu",MediaNextTrack:"MediaTrackNext",MediaPreviousTrack:"MediaTrackPrevious",SelectMedia:"MediaSelect",HalfWidth:"Hankaku",FullWidth:"Zenkaku",RomanCharacters:"Romaji",Crsel:"CrSel",Exsel:"ExSel",Zoom:"ZoomToggle"},g=function(e,t){var i={};return Object.keys(e).forEach(function(n){var o=e[n];t in o&&(i[o[t]]=o)}),i}(d,"code");try{var y=o&&"location"in new KeyboardEvent("")}catch(e){}"KeyboardEvent"in e&&"defineProperty"in Object&&function(){function e(e,t,i){t in e||Object.defineProperty(e,t,i)}if(e(KeyboardEvent.prototype,"code",{get:function(){var e=n(this);return e?e.code:""}}),"key"in KeyboardEvent.prototype){var t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,"key");Object.defineProperty(KeyboardEvent.prototype,"key",{get:function(){var e=t.get.call(this);return m.hasOwnProperty(e)?m[e]:e}})}e(KeyboardEvent.prototype,"key",{get:function(){var e=n(this);return e&&"key"in e?e.key:"Unidentified"}}),e(KeyboardEvent.prototype,"location",{get:function(){var e=n(this);return e&&"location"in e?e.location:r}}),e(KeyboardEvent.prototype,"locale",{get:function(){return""}})}(),"queryKeyCap"in e.KeyboardEvent||(e.KeyboardEvent.queryKeyCap=function(e,t){if(e=String(e),!g.hasOwnProperty(e))return"Undefined";if(t&&"en-us"!==String(t).toLowerCase())throw Error("Unsupported locale");var i=g[e];return i.keyCap||i.code||"Undefined"}),e.identifyKey=function(e){if(!("code"in e)){var t=n(e);e.code=t?t.code:"",e.key=t&&"key"in t?t.key:"Unidentified",e.location="location"in e?e.location:"keyLocation"in e?e.keyLocation:t&&"location"in t?t.location:r,e.locale=""}}}(window)},{}],10:[function(e,t,i){var n=function(){};n.computeCentroids=function(e){var t,i,n;for(t=0,i=e.faces.length;t<i;t++)(n=e.faces[t]).centroid=new THREE.Vector3(0,0,0),n.centroid.add(e.vertices[n.a]),n.centroid.add(e.vertices[n.b]),n.centroid.add(e.vertices[n.c]),n.centroid.divideScalar(3)},n.roundNumber=function(e,t){return Number(e.toFixed(t))},n.sample=function(e){return e[Math.floor(Math.random()*e.length)]},n.mergeVertexIds=function(e,t){var i=[];if(e.forEach(function(e){t.indexOf(e)>=0&&i.push(e)}),i.length<2)return[];i.includes(e[0])&&i.includes(e[e.length-1])&&e.push(e.shift()),i.includes(t[0])&&i.includes(t[t.length-1])&&t.push(t.shift()),i=[],e.forEach(function(e){t.includes(e)&&i.push(e)});for(var n=i[1],o=i[0],r=e.slice();r[0]!==n;)r.push(r.shift());for(var s=0,a=t.slice();a[0]!==o;)if(a.push(a.shift()),s++>10)throw new Error("Unexpected state");return a.shift(),a.pop(),r=r.concat(a)},n.setPolygonCentroid=function(e,t){var i=new THREE.Vector3,n=t.vertices;e.vertexIds.forEach(function(e){i.add(n[e])}),i.divideScalar(e.vertexIds.length),e.centroid.copy(i)},n.cleanPolygon=function(e,t){for(var i=[],n=t.vertices,o=0;o<e.vertexIds.length;o++){var r,s,a,c=n[e.vertexIds[o]];0===o?(r=e.vertexIds[1],s=e.vertexIds[e.vertexIds.length-1]):o===e.vertexIds.length-1?(r=e.vertexIds[0],s=e.vertexIds[e.vertexIds.length-2]):(r=e.vertexIds[o+1],s=e.vertexIds[o-1]),a=n[s];var l=n[r].clone().sub(c),h=a.clone().sub(c),u=l.angleTo(h);if(u>Math.PI-.01&&u<Math.PI+.01){var d=[];e.neighbours.forEach(function(t){t.vertexIds.includes(e.vertexIds[o])||d.push(t)}),e.neighbours=d}else i.push(e.vertexIds[o])}e.vertexIds=i,this.setPolygonCentroid(e,t)},n.isConvex=function(e,t){var i=t.vertices;if(e.vertexIds.length<3)return!1;for(var n=!0,o=[],r=0;r<e.vertexIds.length;r++){var s,a,c=i[e.vertexIds[r]];0===r?(s=i[e.vertexIds[1]],a=i[e.vertexIds[e.vertexIds.length-1]]):r===e.vertexIds.length-1?(s=i[e.vertexIds[0]],a=i[e.vertexIds[e.vertexIds.length-2]]):(s=i[e.vertexIds[r+1]],a=i[e.vertexIds[r-1]]);var l=s.clone().sub(c),h=a.clone().sub(c),u=l.angleTo(h);if(u===Math.PI||0===u)return!1;var d=l.cross(h).y;o.push(d)}return o.forEach(function(e){0===e&&(n=!1)}),o.forEach(o[0]>0?function(e){e<0&&(n=!1)}:function(e){e>0&&(n=!1)}),n},n.distanceToSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y,o=e.z-t.z;return i*i+n*n+o*o},n.isPointInPoly=function(e,t){for(var i=!1,n=-1,o=e.length,r=o-1;++n<o;r=n)(e[n].z<=t.z&&t.z<e[r].z||e[r].z<=t.z&&t.z<e[n].z)&&t.x<(e[r].x-e[n].x)*(t.z-e[n].z)/(e[r].z-e[n].z)+e[n].x&&(i=!i);return i},n.isVectorInPolygon=function(e,t,i){var n=1e5,o=-1e5,r=[];return t.vertexIds.forEach(function(e){n=Math.min(i[e].y,n),o=Math.max(i[e].y,o),r.push(i[e])}),!!(e.y<o+.5&&e.y>n-.5&&this.isPointInPoly(r,e))},n.triarea2=function(e,t,i){return(i.x-e.x)*(t.z-e.z)-(t.x-e.x)*(i.z-e.z)},n.vequal=function(e,t){return this.distanceToSquared(e,t)<1e-5};var o=function(e){this.content=[],this.scoreFunction=e};o.prototype.push=function(e){this.content.push(e),this.sinkDown(this.content.length-1)},o.prototype.pop=function(){var e=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),e},o.prototype.remove=function(e){var t=this.content.indexOf(e),i=this.content.pop();t!==this.content.length-1&&(this.content[t]=i,this.scoreFunction(i)<this.scoreFunction(e)?this.sinkDown(t):this.bubbleUp(t))},o.prototype.size=function(){return this.content.length},o.prototype.rescoreElement=function(e){this.sinkDown(this.content.indexOf(e))},o.prototype.sinkDown=function(e){for(var t=this.content[e];e>0;){var i=(e+1>>1)-1,n=this.content[i];if(!(this.scoreFunction(t)<this.scoreFunction(n)))break;this.content[i]=t,this.content[e]=n,e=i}},o.prototype.bubbleUp=function(e){for(var t=this.content.length,i=this.content[e],n=this.scoreFunction(i);;){var o=e+1<<1,r=o-1,s=null,a=void 0;if(r<t&&(a=this.scoreFunction(this.content[r]))<n&&(s=r),o<t&&this.scoreFunction(this.content[o])<(null===s?n:a)&&(s=o),null===s)break;this.content[e]=this.content[s],this.content[s]=i,e=s}};var r=function(){};r.init=function(e){for(var t=0;t<e.length;t++){var i=e[t];i.f=0,i.g=0,i.h=0,i.cost=1,i.visited=!1,i.closed=!1,i.parent=null}},r.cleanUp=function(e){for(var t=0;t<e.length;t++){var i=e[t];delete i.f,delete i.g,delete i.h,delete i.cost,delete i.visited,delete i.closed,delete i.parent}},r.heap=function(){return new o(function(e){return e.f})},r.search=function(e,t,i){this.init(e);var n=this.heap();for(n.push(t);n.size()>0;){var o=n.pop();if(o===i){for(var r=o,s=[];r.parent;)s.push(r),r=r.parent;return this.cleanUp(s),s.reverse()}o.closed=!0;for(var a=this.neighbours(e,o),c=0,l=a.length;c<l;c++){var h=a[c];if(!h.closed){var u=o.g+h.cost,d=h.visited;if(!d||u<h.g){if(h.visited=!0,h.parent=o,!h.centroid||!i.centroid)throw new Error("Unexpected state");h.h=h.h||this.heuristic(h.centroid,i.centroid),h.g=u,h.f=h.g+h.h,d?n.rescoreElement(h):n.push(h)}}}}return[]},r.heuristic=function(e,t){return n.distanceToSquared(e,t)},r.neighbours=function(e,t){for(var i=[],n=0;n<t.neighbours.length;n++)i.push(e[t.neighbours[n]]);return i};var s=1,a=function(){};a.buildZone=function(e){var t=this,i=this._buildNavigationMesh(e),o={};i.vertices.forEach(function(e){e.x=n.roundNumber(e.x,2),e.y=n.roundNumber(e.y,2),e.z=n.roundNumber(e.z,2)}),o.vertices=i.vertices;var r=this._buildPolygonGroups(i);o.groups=[];var s=function(e,t){for(var i=0;i<e.length;i++)if(t===e[i])return i};return r.forEach(function(e){var i=[];e.forEach(function(o){var r=o.neighbours.map(function(t){return s(e,t)}),a=o.neighbours.map(function(e){return t._getSharedVerticesInOrder(o,e)});o.centroid.x=n.roundNumber(o.centroid.x,2),o.centroid.y=n.roundNumber(o.centroid.y,2),o.centroid.z=n.roundNumber(o.centroid.z,2),i.push({id:s(e,o),neighbours:r,vertexIds:o.vertexIds,centroid:o.centroid,portals:a})}),o.groups.push(i)}),o},a._buildNavigationMesh=function(e){return n.computeCentroids(e),e.mergeVertices(),this._buildPolygonsFromGeometry(e)},a._buildPolygonGroups=function(e){var t=[],i=0,n=function(e){e.neighbours.forEach(function(t){void 0===t.group&&(t.group=e.group,n(t))})};return e.polygons.forEach(function(e){void 0===e.group&&(e.group=i++,n(e)),t[e.group]||(t[e.group]=[]),t[e.group].push(e)}),t},a._buildPolygonNeighbours=function(e,t,i){var n=new Set,o=i.get(e.vertexIds[0]),r=i.get(e.vertexIds[1]),s=i.get(e.vertexIds[2]);o.forEach(function(e){(r.has(e)||s.has(e))&&n.add(t.polygons[e])}),r.forEach(function(e){s.has(e)&&n.add(t.polygons[e])}),e.neighbours=Array.from(n)},a._buildPolygonsFromGeometry=function(e){for(var t=this,i=[],n=e.vertices,o=e.faceVertexUvs,r=new Map,a=0;a<n.length;a++)r.set(a,new Set);e.faces.forEach(function(e){i.push({id:s++,vertexIds:[e.a,e.b,e.c],centroid:e.centroid,normal:e.normal,neighbours:[]}),r.get(e.a).add(i.length-1),r.get(e.b).add(i.length-1),r.get(e.c).add(i.length-1)});var c={polygons:i,vertices:n,faceVertexUvs:o};return i.forEach(function(e){t._buildPolygonNeighbours(e,c,r)}),c},a._getSharedVerticesInOrder=function(e,t){var i=e.vertexIds,n=t.vertexIds,o=new Set;if(i.forEach(function(e){n.includes(e)&&o.add(e)}),o.size<2)return[];o.has(i[0])&&o.has(i[i.length-1])&&i.push(i.shift()),o.has(n[0])&&o.has(n[n.length-1])&&n.push(n.shift());var r=[];return i.forEach(function(e){n.includes(e)&&r.push(e)}),r};var c=function(){this.portals=[]};c.prototype.push=function(e,t){void 0===t&&(t=e),this.portals.push({left:e,right:t})},c.prototype.stringPull=function(){var e,t,i,o=this.portals,r=[],s=0,a=0,c=0;t=o[0].left,i=o[0].right,r.push(e=o[0].left);for(var l=1;l<o.length;l++){var h=o[l].left,u=o[l].right;if(n.triarea2(e,i,u)<=0){if(!(n.vequal(e,i)||n.triarea2(e,t,u)>0)){r.push(t),t=e=t,i=e,a=s=a,c=s,l=s;continue}i=u,c=l}if(n.triarea2(e,t,h)>=0){if(!(n.vequal(e,t)||n.triarea2(e,i,h)<0)){r.push(i),t=e=i,i=e,a=s=c,c=s,l=s;continue}t=h,a=l}}return 0!==r.length&&n.vequal(r[r.length-1],o[o.length-1].left)||r.push(o[o.length-1].left),this.path=r,r};var l,h,u,d,p,f,v=function(){this.zones={}};v.createZone=function(e){return a.buildZone(e)},v.prototype.setZoneData=function(e,t){this.zones[e]=t},v.prototype.getGroup=function(e,t){if(!this.zones[e])return null;var i=null,o=Math.pow(50,2);return this.zones[e].groups.forEach(function(e,r){e.forEach(function(e){var s=n.distanceToSquared(e.centroid,t);s<o&&(i=r,o=s)})}),i},v.prototype.getRandomNode=function(e,t,i,o){if(!this.zones[e])return new THREE.Vector3;i=i||null,o=o||0;var r=[];return this.zones[e].groups[t].forEach(function(e){i&&o?n.distanceToSquared(i,e.centroid)<o*o&&r.push(e.centroid):r.push(e.centroid)}),n.sample(r)||new THREE.Vector3},v.prototype.getClosestNode=function(e,t,i,o){void 0===o&&(o=!1);var r=this.zones[t].vertices,s=null,a=1/0;return this.zones[t].groups[i].forEach(function(t){var i=n.distanceToSquared(t.centroid,e);i<a&&(!o||n.isVectorInPolygon(e,t,r))&&(s=t,a=i)}),s},v.prototype.findPath=function(e,t,i,n){var o=this.zones[i].groups[n],s=this.zones[i].vertices,a=this.getClosestNode(e,i,n),l=this.getClosestNode(t,i,n,!0);if(!a||!l)return null;var h=r.search(o,a,l),u=function(e,t){for(var i=0;i<e.neighbours.length;i++)if(e.neighbours[i]===t.id)return e.portals[i]},d=new c;d.push(e);for(var p=0;p<h.length;p++){var f=h[p+1];if(f){var v=u(h[p],f);d.push(s[v[0]],s[v[1]])}}d.push(t),d.stringPull();var m=d.path.map(function(e){return new THREE.Vector3(e.x,e.y,e.z)});return m.shift(),m},v.prototype.clampStep=(u=new THREE.Vector3,d=new THREE.Plane,p=new THREE.Triangle,f=new THREE.Vector3,function(e,t,i,n,o,r){var s=this.zones[n].vertices,a=this.zones[n].groups[o],c=[i],v={};v[i.id]=0,l=void 0,f.set(0,0,0),h=1/0,d.setFromCoplanarPoints(s[i.vertexIds[0]],s[i.vertexIds[1]],s[i.vertexIds[2]]),d.projectPoint(t,u),t.copy(u);for(var m=c.pop();m;m=c.pop()){p.set(s[m.vertexIds[0]],s[m.vertexIds[1]],s[m.vertexIds[2]]),p.closestPointToPoint(t,u),u.distanceToSquared(t)<h&&(l=m,f.copy(u),h=u.distanceToSquared(t));var g=v[m];if(!(g>2))for(var y=0;y<m.neighbours.length;y++){var E=a[m.neighbours[y]];E.id in v||(c.push(E),v[E.id]=g+1)}}return r.copy(f),l}),i.Pathfinding=v},{}],11:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("checkpoint-controls",{schema:{enabled:{default:!0},mode:{default:"teleport",oneOf:["teleport","animate"]},animateSpeed:{default:3}},init:function(){this.active=!0,this.checkpoint=null,this.isNavMeshConstrained=!1,this.offset=new THREE.Vector3,this.position=new THREE.Vector3,this.targetPosition=new THREE.Vector3},play:function(){this.active=!0},pause:function(){this.active=!1},setCheckpoint:function(e){var t=this.el;this.active&&this.checkpoint!==e&&(this.checkpoint&&t.emit("navigation-end",{checkpoint:this.checkpoint}),this.checkpoint=e,this.sync(),this.position.distanceTo(this.targetPosition)<.1?this.checkpoint=null:(t.emit("navigation-start",{checkpoint:e}),"teleport"===this.data.mode&&(this.el.setAttribute("position",this.targetPosition),this.checkpoint=null,t.emit("navigation-end",{checkpoint:e}),t.components["movement-controls"].updateNavLocation())))},isVelocityActive:function(){return!(!this.active||!this.checkpoint)},getVelocity:function(){if(this.active){var e=this.data,t=this.offset,i=this.position,n=this.targetPosition,o=this.checkpoint;return this.sync(),i.distanceTo(n)<.1?(this.checkpoint=null,this.el.emit("navigation-end",{checkpoint:o}),t.set(0,0,0)):(t.setLength(e.animateSpeed),t)}},sync:function(){var e=this.offset,t=this.position,i=this.targetPosition;t.copy(this.el.getAttribute("position")),i.copy(this.checkpoint.object3D.getWorldPosition()),i.add(this.checkpoint.components.checkpoint.getOffset()),e.copy(i).sub(t)}})},{}],12:[function(e,t,i){"use strict";var n=e("../../lib/GamepadButton"),o=e("../../lib/GamepadButtonEvent");t.exports=AFRAME.registerComponent("gamepad-controls",{GamepadButton:n,schema:{controller:{default:0,oneOf:[0,1,2,3]},enabled:{default:!0},debug:{default:!1},camera:{default:"[camera]",type:"selector"},rotationSensitivity:{default:2}},init:function(){var e=this.el.sceneEl;this.prevTime=window.performance.now(),this.buttons={};var t=this.el.object3D.rotation;this.pitch=new THREE.Object3D,this.pitch.rotation.x=THREE.Math.degToRad(t.x),this.yaw=new THREE.Object3D,this.yaw.position.y=10,this.yaw.rotation.y=THREE.Math.degToRad(t.y),this.yaw.add(this.pitch),e.addBehavior(this)},update:function(){this.tick()},tick:function(e,t){this.updateButtonState(),this.updateRotation(t)},remove:function(){},isVelocityActive:function(){if(!this.data.enabled||!this.isConnected())return!1;var e=this.getDpad(),t=this.getJoystick(0),i=e.x||t.x,n=e.y||t.y;return Math.abs(i)>.2||Math.abs(n)>.2},getVelocityDelta:function(){var e=this.getDpad(),t=this.getJoystick(0),i=e.x||t.x,n=e.y||t.y,o=new THREE.Vector3;return Math.abs(i)>.2&&(o.x+=i),Math.abs(n)>.2&&(o.z+=n),o},isRotationActive:function(){if(!this.data.enabled||!this.isConnected())return!1;var e=this.getJoystick(1);return Math.abs(e.x)>.2||Math.abs(e.y)>.2},updateRotation:function(e){if(this.isRotationActive()){var t=this.data,i=this.yaw,n=this.pitch,o=t.camera.components["look-controls"],r=o&&o.pitchObject&&o.yawObject;r&&(n.rotation.copy(o.pitchObject.rotation),i.rotation.copy(o.yawObject.rotation));var s=this.getJoystick(1);Math.abs(s.x)<=.2&&(s.x=0),Math.abs(s.y)<=.2&&(s.y=0),s.multiplyScalar(t.rotationSensitivity*e/1e3),i.rotation.y-=s.x,n.rotation.x-=s.y,n.rotation.x=Math.max(-Math.PI/2,Math.min(Math.PI/2,n.rotation.x)),t.camera.object3D.rotation.set(n.rotation.x,i.rotation.y,0),r&&(o.pitchObject.rotation.copy(n.rotation),o.yawObject.rotation.copy(i.rotation))}},updateButtonState:function(){var e=this.getGamepad();if(this.data.enabled&&e)for(var t=0;t<e.buttons.length;t++)e.buttons[t].pressed&&!this.buttons[t]?this.emit(new o("gamepadbuttondown",t,e.buttons[t])):!e.buttons[t].pressed&&this.buttons[t]&&this.emit(new o("gamepadbuttonup",t,e.buttons[t])),this.buttons[t]=e.buttons[t].pressed;else Object.keys(this.buttons)&&(this.buttons={})},emit:function(e){this.el.emit(e.type,e),this.el.emit(e.type+":"+e.index,new o(e.type,e.index,e))},getGamepad:function(){var e=navigator.getGamepads&&navigator.getGamepads()[this.data.controller],t=this.el.sceneEl.components["proxy-controls"];return t&&t.isConnected()&&t.getGamepad(this.data.controller)||e},getButton:function(e){return this.getGamepad().buttons[e]},getAxis:function(e){return this.getGamepad().axes[e]},getJoystick:function(e){var t=this.getGamepad();switch(e){case 0:return new THREE.Vector2(t.axes[0],t.axes[1]);case 1:return new THREE.Vector2(t.axes[2],t.axes[3]);default:throw new Error('Unexpected joystick index "%d".',e)}},getDpad:function(){var e=this.getGamepad();return e.buttons[n.DPAD_RIGHT]?new THREE.Vector2((e.buttons[n.DPAD_RIGHT].pressed?1:0)+(e.buttons[n.DPAD_LEFT].pressed?-1:0),(e.buttons[n.DPAD_UP].pressed?-1:0)+(e.buttons[n.DPAD_DOWN].pressed?1:0)):new THREE.Vector2},isConnected:function(){var e=this.getGamepad();return!(!e||!e.connected)},getID:function(){return this.getGamepad().id}})},{"../../lib/GamepadButton":4,"../../lib/GamepadButtonEvent":5}],13:[function(e,t,i){"use strict";e("./checkpoint-controls"),e("./gamepad-controls"),e("./keyboard-controls"),e("./touch-controls"),e("./movement-controls"),e("./trackpad-controls")},{"./checkpoint-controls":11,"./gamepad-controls":12,"./keyboard-controls":14,"./movement-controls":15,"./touch-controls":16,"./trackpad-controls":17}],14:[function(e,t,i){"use strict";e("../../lib/keyboard.polyfill");var n=window.KeyboardEvent;t.exports=AFRAME.registerComponent("keyboard-controls",{schema:{enabled:{default:!0},debug:{default:!1}},init:function(){this.dVelocity=new THREE.Vector3,this.localKeys={},this.listeners={keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this),blur:this.onBlur.bind(this)},this.attachEventListeners()},isVelocityActive:function(){return this.data.enabled&&!!Object.keys(this.getKeys()).length},getVelocityDelta:function(){var e=this.data,t=this.getKeys();return this.dVelocity.set(0,0,0),e.enabled&&((t.KeyW||t.ArrowUp)&&(this.dVelocity.z-=1),(t.KeyA||t.ArrowLeft)&&(this.dVelocity.x-=1),(t.KeyS||t.ArrowDown)&&(this.dVelocity.z+=1),(t.KeyD||t.ArrowRight)&&(this.dVelocity.x+=1)),this.dVelocity.clone()},play:function(){this.attachEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.pause()},attachEventListeners:function(){window.addEventListener("keydown",this.listeners.keydown,!1),window.addEventListener("keyup",this.listeners.keyup,!1),window.addEventListener("blur",this.listeners.blur,!1)},removeEventListeners:function(){window.removeEventListener("keydown",this.listeners.keydown),window.removeEventListener("keyup",this.listeners.keyup),window.removeEventListener("blur",this.listeners.blur)},onKeyDown:function(e){AFRAME.utils.shouldCaptureKeyEvent(e)&&(this.localKeys[e.code]=!0,this.emit(e))},onKeyUp:function(e){AFRAME.utils.shouldCaptureKeyEvent(e)&&(delete this.localKeys[e.code],this.emit(e))},onBlur:function(){for(var e in this.localKeys)this.localKeys.hasOwnProperty(e)&&delete this.localKeys[e]},emit:function(e){"__keyboard-controls-proxy"in e&&this.el.emit(e.type,e),this.el.emit(e.type+":"+e.code,new n(e.type,e)),this.data.debug&&console.log(e.type+":"+e.code)},isPressed:function(e){return e in this.getKeys()},getKeys:function(){return this.isProxied()?this.el.sceneEl.components["proxy-controls"].getKeyboard():this.localKeys},isProxied:function(){var e=this.el.sceneEl.components["proxy-controls"];return e&&e.isConnected()}})},{"../../lib/keyboard.polyfill":9}],15:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("movement-controls",{dependencies:["rotation"],schema:{enabled:{default:!0},controls:{default:["gamepad","trackpad","keyboard","touch"]},speed:{default:.3,min:0},fly:{default:!1},constrainToNavMesh:{default:!1},camera:{default:"[camera]",type:"selector"}},init:function(){var e=this.el;this.velocityCtrl=null,this.velocity=new THREE.Vector3,this.heading=new THREE.Quaternion,this.navGroup=null,this.navNode=null,e.sceneEl.hasLoaded?this.injectControls():e.sceneEl.addEventListener("loaded",this.injectControls.bind(this))},update:function(e){var t=this.el,i=this.data,n=t.sceneEl.systems.nav;t.sceneEl.hasLoaded&&this.injectControls(),n&&i.constrainToNavMesh!==e.constrainToNavMesh&&(i.constrainToNavMesh?n.addAgent(this):n.removeAgent(this))},injectControls:function(){for(var e,t=this.data,i=0;i<t.controls.length;i++)e=t.controls[i]+"-controls",this.el.components[e]||this.el.setAttribute(e,"")},updateNavLocation:function(){this.navGroup=null,this.navNode=null},tick:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3;return function(n,o){if(o){var r=this.el,s=this.data;if(s.enabled){this.updateVelocityCtrl();var a=this.velocityCtrl,c=this.velocity;if(a)if(o/1e3>.2?c.set(0,0,0):this.updateVelocity(o),s.constrainToNavMesh&&!1!==a.isNavMeshConstrained){if(c.lengthSq()<1e-5)return;e.copy(r.object3D.position),t.copy(c).multiplyScalar(o/1e3).add(e);var l=r.sceneEl.systems.nav;this.navGroup=null===this.navGroup?l.getGroup(e):this.navGroup,this.navNode=this.navNode||l.getNode(e,this.navGroup),this.navNode=l.clampStep(e,t,this.navGroup,this.navNode,i),r.object3D.position.copy(i)}else r.hasAttribute("velocity")?r.setAttribute("velocity",c):(r.object3D.position.x+=c.x*o/1e3,r.object3D.position.y+=c.y*o/1e3,r.object3D.position.z+=c.z*o/1e3)}}}}(),updateVelocityCtrl:function(){var e=this.data;if(e.enabled){for(var t=0,i=e.controls.length;t<i;t++){var n=this.el.components[e.controls[t]+"-controls"];if(n&&n.isVelocityActive())return void(this.velocityCtrl=n)}this.velocityCtrl=null}},updateVelocity:function(){var e=new THREE.Vector2,t=new THREE.Quaternion;return function(i){var n=void 0,o=this.el,r=this.velocityCtrl,s=this.velocity,a=this.data;if(r){if(!r.getVelocityDelta){if(r.getVelocity)return void s.copy(r.getVelocity());if(r.getPositionDelta)return void s.copy(r.getPositionDelta(i).multiplyScalar(1e3/i));throw new Error("Incompatible movement controls: ",r)}n=r.getVelocityDelta(i)}if(o.hasAttribute("velocity")&&!a.constrainToNavMesh&&s.copy(this.el.getAttribute("velocity")),n&&a.enabled){var c=a.camera;t.copy(c.object3D.quaternion),t.premultiply(o.object3D.quaternion),n.applyQuaternion(t);var l=n.length();a.fly?(s.copy(n),s.multiplyScalar(16.66667*this.data.speed)):(e.set(n.x,n.z),e.setLength(l*this.data.speed*16.66667),s.x=e.x,s.z=e.y)}}}()})},{}],16:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("touch-controls",{schema:{enabled:{default:!0},reverseEnabled:{default:!0}},init:function(){this.dVelocity=new THREE.Vector3,this.bindMethods(),this.direction=0},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.dVelocity.set(0,0,0)},remove:function(){this.pause()},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;t?(t.addEventListener("touchstart",this.onTouchStart),t.addEventListener("touchend",this.onTouchEnd)):e.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var e=this.el.sceneEl&&this.el.sceneEl.canvas;e&&(e.removeEventListener("touchstart",this.onTouchStart),e.removeEventListener("touchend",this.onTouchEnd))},isVelocityActive:function(){return this.data.enabled&&!!this.direction},getVelocityDelta:function(){return this.dVelocity.z=this.direction,this.dVelocity.clone()},bindMethods:function(){this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this)},onTouchStart:function(e){this.direction=-1,this.data.reverseEnabled&&2===e.touches.length&&(this.direction=1),e.preventDefault()},onTouchEnd:function(e){this.direction=0,e.preventDefault()}})},{}],17:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("trackpad-controls",{schema:{enabled:{default:!0},enableNegX:{default:!0},enablePosX:{default:!0},enableNegZ:{default:!0},enablePosZ:{default:!0},mode:{default:"touch",oneOf:["swipe","touch","press"]}},init:function(){this.dVelocity=new THREE.Vector3,this.zVel=0,this.xVel=0,this.bindMethods()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.dVelocity.set(0,0,0)},remove:function(){this.pause()},addEventListeners:function(){var e=this.data,t=this.el.sceneEl;switch(t.addEventListener("axismove",this.onAxisMove),e.mode){case"swipe":case"touch":t.addEventListener("trackpadtouchstart",this.onTouchStart),t.addEventListener("trackpadtouchend",this.onTouchEnd);break;case"press":t.addEventListener("trackpaddown",this.onTouchStart),t.addEventListener("trackpadup",this.onTouchEnd)}},removeEventListeners:function(){var e=this.el.sceneEl;e.removeEventListener("axismove",this.onAxisMove),e.removeEventListener("trackpadtouchstart",this.onTouchStart),e.removeEventListener("trackpadtouchend",this.onTouchEnd),e.removeEventListener("trackpaddown",this.onTouchStart),e.removeEventListener("trackpadup",this.onTouchEnd)},isVelocityActive:function(){return this.data.enabled&&this.isMoving},getVelocityDelta:function(){return this.dVelocity.z=this.isMoving?-this.zVel:1,this.dVelocity.x=this.isMoving?this.xVel:1,this.dVelocity.clone()},bindMethods:function(){this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onAxisMove=this.onAxisMove.bind(this)},onTouchStart:function(e){switch(this.data.mode){case"swipe":this.canRecordAxis=!0,this.startingAxisData=[];break;case"touch":case"press":this.isMoving=!0}e.preventDefault()},onTouchEnd:function(e){"swipe"==this.data.mode&&(this.startingAxisData=[]),this.isMoving=!1,e.preventDefault()},onAxisMove:function(e){switch(this.data.mode){case"swipe":return this.handleSwipeAxis(e);case"touch":case"press":return this.handleTouchAxis(e)}},handleSwipeAxis:function(e){var t=this.data,i=e.detail.axis;if(0===this.startingAxisData.length&&this.canRecordAxis&&(this.canRecordAxis=!1,this.startingAxisData[0]=i[0],this.startingAxisData[1]=i[1]),this.startingAxisData.length>0){var n=0,o=0;t.enableNegX&&i[0]<this.startingAxisData[0]&&(n=-1),t.enablePosX&&i[0]>this.startingAxisData[0]&&(n=1),t.enablePosZ&&i[1]>this.startingAxisData[1]&&(o=-1),t.enableNegZ&&i[1]<this.startingAxisData[1]&&(o=1);var r=Math.abs(this.startingAxisData[1]-i[1]);Math.abs(this.startingAxisData[0]-i[0])>r?(this.zVel=0,this.xVel=n,this.isMoving=!0):(this.xVel=0,this.zVel=o,this.isMoving=!0)}},handleTouchAxis:function(e){var t=this.data,i=e.detail.axis,n=0,o=0;t.enableNegX&&i[0]<0&&(n=-1),t.enablePosX&&i[0]>0&&(n=1),t.enablePosZ&&i[1]>0&&(o=-1),t.enableNegZ&&i[1]<0&&(o=1),Math.abs(i[0])>Math.abs(i[1])?(this.zVel=0,this.xVel=n):(this.xVel=0,this.zVel=o)}})},{}],18:[function(e,t,i){"use strict";function n(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}var o={once:THREE.LoopOnce,repeat:THREE.LoopRepeat,pingpong:THREE.LoopPingPong};t.exports=AFRAME.registerComponent("animation-mixer",{schema:{clip:{default:"*"},duration:{default:0},clampWhenFinished:{default:!1,type:"boolean"},crossFadeDuration:{default:0},loop:{default:"repeat",oneOf:Object.keys(o)},repetitions:{default:1/0,min:0},timeScale:{default:1}},init:function(){var e=this;this.model=null,this.mixer=null,this.activeActions=[];var t=this.el.getObject3D("mesh");t?this.load(t):this.el.addEventListener("model-loaded",function(t){e.load(t.detail.model)})},load:function(e){var t=this.el;this.model=e,this.mixer=new THREE.AnimationMixer(e),this.mixer.addEventListener("loop",function(e){t.emit("animation-loop",{action:e.action,loopDelta:e.loopDelta})}),this.mixer.addEventListener("finished",function(e){t.emit("animation-finished",{action:e.action,direction:e.direction})}),this.data.clip&&this.update({})},remove:function(){this.mixer&&this.mixer.stopAllAction()},update:function(e){if(e){var t=this.data,i=AFRAME.utils.diff(t,e);if("clip"in i)return this.stopAction(),void(t.clip&&this.playAction());this.activeActions.forEach(function(e){"duration"in i&&t.duration&&e.setDuration(t.duration),"clampWhenFinished"in i&&(e.clampWhenFinished=t.clampWhenFinished),("loop"in i||"repetitions"in i)&&e.setLoop(o[t.loop],t.repetitions),"timeScale"in i&&e.setEffectiveTimeScale(t.timeScale)})}},stopAction:function(){for(var e=this.data,t=0;t<this.activeActions.length;t++)e.crossFadeDuration?this.activeActions[t].fadeOut(e.crossFadeDuration):this.activeActions[t].stop();this.activeActions.length=0},playAction:function(){if(this.mixer){var e=this.model,t=this.data,i=e.animations||(e.geometry||{}).animations||[];if(i.length)for(var r,s=function(e){return new RegExp("^"+e.split(/\*+/).map(n).join(".*")+"$")}(t.clip),a=0;r=i[a];a++)if(r.name.match(s)){var c=this.mixer.clipAction(r,e);c.enabled=!0,c.clampWhenFinished=t.clampWhenFinished,t.duration&&c.setDuration(t.duration),1!==t.timeScale&&c.setEffectiveTimeScale(t.timeScale),c.setLoop(o[t.loop],t.repetitions).fadeIn(t.crossFadeDuration).play(),this.activeActions.push(c)}}},tick:function(e,t){this.mixer&&!isNaN(t)&&this.mixer.update(t/1e3)}})},{}],19:[function(e,t,i){"use strict";THREE.FBXLoader=e("../../lib/FBXLoader"),t.exports=AFRAME.registerComponent("fbx-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){var e=this.data;if(e.src){this.remove();var t=new THREE.FBXLoader;e.crossorigin&&t.setCrossOrigin(e.crossorigin),t.load(e.src,this.load.bind(this))}},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"fbx",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{"../../lib/FBXLoader":3}],20:[function(e,t,i){"use strict";var n=e("../../lib/fetch-script")(),o=function(){var e=void 0;return function(){return e=e||n("https://rawgit.com/mrdoob/three.js/r86/examples/js/loaders/GLTFLoader.js")}}();t.exports=AFRAME.registerComponent("gltf-model-legacy",{schema:{type:"model"},init:function(){var e=this;this.model=null,this.loader=null,this.loaderPromise=o().then(function(){e.loader=new THREE.GLTFLoader,e.loader.setCrossOrigin("Anonymous")})},update:function(){var e=this,t=this,i=this.el,n=this.data;n&&(this.remove(),this.loaderPromise.then(function(){e.loader.load(n,function(e){t.model=e.scene,t.model.animations=e.animations,i.setObject3D("mesh",t.model),i.emit("model-loaded",{format:"gltf",model:t.model})})}))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{"../../lib/fetch-script":7}],21:[function(e,t,i){"use strict";e("./animation-mixer"),e("./fbx-model"),e("./gltf-model-legacy"),e("./object-model")},{"./animation-mixer":18,"./fbx-model":19,"./gltf-model-legacy":20,"./object-model":22}],22:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("object-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){var e=this,t=void 0,i=this.data;i.src&&(this.remove(),t=new THREE.ObjectLoader,i.crossorigin&&t.setCrossOrigin(i.crossorigin),t.load(i.src,function(t){t.traverse(function(e){e instanceof THREE.SkinnedMesh&&e.material&&(e.material.skinning=!!(e.geometry&&e.geometry.bones||[]).length)}),e.load(t)}))},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"json",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{}],23:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("checkpoint",{schema:{offset:{default:{x:0,y:0,z:0},type:"vec3"}},init:function(){this.active=!1,this.targetEl=null,this.fire=this.fire.bind(this),this.offset=new THREE.Vector3},update:function(){this.offset.copy(this.data.offset)},play:function(){this.el.addEventListener("click",this.fire)},pause:function(){this.el.removeEventListener("click",this.fire)},remove:function(){this.pause()},fire:function(){var e=this.el.sceneEl.querySelector("[checkpoint-controls]");if(!e)throw new Error("No `checkpoint-controls` component found.");e.components["checkpoint-controls"].setCheckpoint(this.el)},getOffset:function(){return this.offset.copy(this.data.offset)}})},{}],24:[function(e,t,i){"use strict";function n(e,t,i,n){e&&(t=t||[],e.traverse(function(e){if(e.isMesh){(function(e){return e?Array.isArray(e)?e:e.materials?e.materials:[e]:[]})(e.material).forEach(function(e){(!e||"envMap"in e)&&(t.length&&-1===t.indexOf(e.name)||(e.envMap=i,e.reflectivity=n,e.needsUpdate=!0))})}}))}t.exports=AFRAME.registerComponent("cube-env-map",{multiple:!0,schema:{path:{default:""},extension:{default:"jpg",oneOf:["jpg","png"]},format:{default:"RGBFormat",oneOf:["RGBFormat","RGBAFormat"]},enableBackground:{default:!1},reflectivity:{default:1,min:0,max:1},materials:{default:[]}},init:function(){var e=this,t=this.data;this.texture=(new THREE.CubeTextureLoader).load([t.path+"posx."+t.extension,t.path+"negx."+t.extension,t.path+"posy."+t.extension,t.path+"negy."+t.extension,t.path+"posz."+t.extension,t.path+"negz."+t.extension]),this.texture.format=THREE[t.format],this.object3dsetHandler=function(){var t=e.el.getObject3D("mesh"),i=e.data;n(t,i.materials,e.texture,i.reflectivity)},this.el.addEventListener("object3dset",this.object3dsetHandler)},update:function(e){var t=this.data,i=this.el.getObject3D("mesh"),o=[],r=[];if(t.materials.length&&(e.materials?(o=t.materials.filter(function(t){return!e.materials.includes(t)}),r=e.materials.filter(function(e){return!t.materials.includes(e)})):o=t.materials),o.length&&n(i,o,this.texture,t.reflectivity),r.length&&n(i,r,null,1),e.materials&&t.reflectivity!==e.reflectivity){var s=t.materials.filter(function(t){return e.materials.includes(t)});s.length&&n(i,s,this.texture,t.reflectivity)}this.data.enableBackground&&!e.enableBackground?this.setBackground(this.texture):!this.data.enableBackground&&e.enableBackground&&this.setBackground(null)},remove:function(){this.el.removeEventListener("object3dset",this.object3dsetHandler);var e=this.el.getObject3D("mesh"),t=this.data;n(e,t.materials,null,1),t.enableBackground&&this.setBackground(null)},setBackground:function(e){this.el.sceneEl.object3D.background=e}})},{}],25:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("grab",{init:function(){this.system=this.el.sceneEl.systems.physics,this.GRABBED_STATE="grabbed",this.grabbing=!1,this.hitEl=null,this.physics=this.el.sceneEl.systems.physics,this.constraint=null,this.onHit=this.onHit.bind(this),this.onGripOpen=this.onGripOpen.bind(this),this.onGripClose=this.onGripClose.bind(this)},play:function(){var e=this.el;e.addEventListener("hit",this.onHit),e.addEventListener("gripdown",this.onGripClose),e.addEventListener("gripup",this.onGripOpen),e.addEventListener("trackpaddown",this.onGripClose),e.addEventListener("trackpadup",this.onGripOpen),e.addEventListener("triggerdown",this.onGripClose),e.addEventListener("triggerup",this.onGripOpen)},pause:function(){var e=this.el;e.removeEventListener("hit",this.onHit),e.removeEventListener("gripdown",this.onGripClose),e.removeEventListener("gripup",this.onGripOpen),e.removeEventListener("trackpaddown",this.onGripClose),e.removeEventListener("trackpadup",this.onGripOpen),e.removeEventListener("triggerdown",this.onGripClose),e.removeEventListener("triggerup",this.onGripOpen)},onGripClose:function(){this.grabbing=!0},onGripOpen:function(){var e=this.hitEl;this.grabbing=!1,e&&(e.removeState(this.GRABBED_STATE),this.hitEl=void 0,this.system.removeConstraint(this.constraint),this.constraint=null)},onHit:function(e){var t=e.detail.el;t&&!t.is(this.GRABBED_STATE)&&this.grabbing&&!this.hitEl&&(t.addState(this.GRABBED_STATE),this.hitEl=t,this.constraint=new CANNON.LockConstraint(this.el.body,t.body),this.system.addConstraint(this.constraint))}})},{}],26:[function(e,t,i){"use strict";e("./checkpoint"),e("./cube-env-map"),e("./grab"),e("./jump-ability"),e("./kinematic-body"),e("./mesh-smooth"),e("./normal-material"),e("./sphere-collider")},{"./checkpoint":23,"./cube-env-map":24,"./grab":25,"./jump-ability":27,"./kinematic-body":28,"./mesh-smooth":29,"./normal-material":30,"./sphere-collider":31}],27:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("jump-ability",{dependencies:["velocity"],schema:{on:{default:"keydown:Space gamepadbuttondown:0"},playerHeight:{default:1.764},maxJumps:{default:1},distance:{default:5},debug:{default:!1}},init:function(){this.velocity=0,this.numJumps=0;var e=this.beginJump.bind(this),t=this.data.on.split(" ");this.bindings={};for(var i=0;i<t.length;i++)this.bindings[t[i]]=e,this.el.addEventListener(t[i],e);this.bindings.collide=this.onCollide.bind(this),this.el.addEventListener("collide",this.bindings.collide)},remove:function(){for(var e in this.bindings)this.bindings.hasOwnProperty(e)&&(this.el.removeEventListener(e,this.bindings[e]),delete this.bindings[e]);this.el.removeEventListener("collide",this.bindings.collide),delete this.bindings.collide},beginJump:function(){if(this.numJumps<this.data.maxJumps){var e=this.data,t=Math.sqrt(-2*e.distance*-24.8),i=this.el.getAttribute("velocity");this.el.setAttribute("velocity",{x:i.x,y:t,z:i.z}),this.numJumps++,this.el.emit("jumpstart")}},onCollide:function(){this.numJumps>0&&this.el.emit("jumpend"),this.numJumps=0}})},{}],28:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("kinematic-body",{dependencies:["velocity"],schema:{mass:{default:5},radius:{default:1.3},linearDamping:{default:.05},enableSlopes:{default:!0},enableJumps:{default:!1}},init:function(){this.system=this.el.sceneEl.systems.physics,this.system.addComponent(this);var e=this.el,t=this.data,i=(new CANNON.Vec3).copy(e.object3D.getWorldPosition(new THREE.Vector3));this.body=new CANNON.Body({material:this.system.getMaterial("staticMaterial"),position:i,mass:t.mass,linearDamping:t.linearDamping,fixedRotation:!0}),this.body.addShape(new CANNON.Sphere(t.radius),new CANNON.Vec3(0,t.radius,0)),this.body.el=this.el,this.el.body=this.body,this.system.addBody(this.body),e.hasAttribute("wasd-controls")&&console.warn("[kinematic-body] Not compatible with wasd-controls, use movement-controls.")},remove:function(){this.system.removeBody(this.body),this.system.removeComponent(this),delete this.el.body},beforeStep:function(e,t){if(t){var i=this.el,n=this.data,o=this.body;n.enableJumps||o.velocity.set(0,0,0),o.position.copy(i.getAttribute("position"))}},step:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3,n=new THREE.Vector3;return function(o,r){if(r){var s=this.body,a=this.data,c=void 0,l=-1/0,h=void 0,u=this.system.getContacts();r=Math.min(r,1e3*this.system.data.maxInterval),n.set(0,0,0),e.copy(this.el.getAttribute("velocity")),s.velocity.copy(e);for(var d,p=0;d=u[p];p++)if(d.enabled){if(s.id===d.bi.id)d.ni.negate(i);else{if(s.id!==d.bj.id)continue;i.copy(d.ni)}s.velocity.dot(i)<-1e-6&&i.y<=.5?e.projectOnPlane(i):i.y>.5&&(c=s.id===d.bi.id?Math.abs(d.rj.y+d.bj.position.y):Math.abs(d.ri.y+d.bi.position.y))>l&&(l=c,n.copy(i),h=s.id===d.bi.id?d.bj:d.bi)}t.copy(e).normalize(),h&&(!a.enableJumps||t.y<.5)?(a.enableSlopes?n.y<1-1e-6&&n.copy(this.raycastToGround(h,n)):n.set(0,1,0),e.projectOnPlane(n)):this.system.driver.world&&e.add(this.system.driver.world.gravity.scale(4*r/1e3)),s.velocity.copy(e),this.el.setAttribute("velocity",s.velocity),this.el.setAttribute("position",s.position)}}}(),raycastToGround:function(e,t){var i=void 0,n=void 0,o=this.body.position,r=this.body.position.clone();return(i=new CANNON.Ray(o,r))._updateDirection(),i.intersectBody(e),i.hasHit?(n=i.result.hitNormalWorld,Math.abs(n.y)>Math.abs(t.y)?n:t):t}})},{}],29:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("mesh-smooth",{init:function(){this.el.addEventListener("model-loaded",function(e){e.detail.model.traverse(function(e){e.isMesh&&e.geometry.computeVertexNormals()})})}})},{}],30:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("normal-material",{init:function(){this.material=new THREE.MeshNormalMaterial({flatShading:!0}),this.applyMaterial=this.applyMaterial.bind(this),this.el.addEventListener("object3dset",this.applyMaterial)},remove:function(){this.el.removeEventListener("object3dset",this.applyMaterial)},applyMaterial:function(){var e=this;this.el.object3D.traverse(function(t){t.isMesh&&(t.material=e.material)})}})},{}],31:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("sphere-collider",{schema:{objects:{default:""},state:{default:"collided"},radius:{default:.05},watch:{default:!0}},init:function(){this.observer=null,this.els=[],this.collisions=[],this.handleHit=this.handleHit.bind(this),this.handleHitEnd=this.handleHitEnd.bind(this)},remove:function(){this.pause()},play:function(){var e=this.el.sceneEl;this.data.watch&&(this.observer=new MutationObserver(this.update.bind(this,null)),this.observer.observe(e,{childList:!0,subtree:!0}))},pause:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},update:function(){var e=this.data,t=void 0;t=e.objects?this.el.sceneEl.querySelectorAll(e.objects):this.el.sceneEl.children,this.els=Array.prototype.slice.call(t)},tick:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3,n=new Map;return function(){var o=this.el,r=this.data,s=[],a=void 0;o.getObject3D("mesh")&&(n.clear(),e.copy(o.object3D.getWorldPosition()),o.object3D.getWorldScale(i),a=r.radius*function(e){return Math.max.apply(null,e.toArray())}(i),this.els.forEach(function(i){var o=void 0,r=void 0,c=void 0,l=void 0,h=void 0,u=void 0;i.isEntity&&(r=i.getObject3D("mesh"))&&(u=(l=(new THREE.Box3).setFromObject(r)).getSize(),h=Math.max(u.x,u.y,u.z)/2,o=Math.sqrt(2*h*h),l.getCenter(t),o&&(c=e.distanceTo(t))<o+a&&(s.push(i),n.set(i,c)))}),s.sort(function(e,t){return n.get(e)>n.get(t)?1:-1}).forEach(this.handleHit),0===s.length&&o.emit("hit",{el:null}),this.collisions.filter(function(e){return!n.has(e)}).forEach(this.handleHitEnd),this.collisions=s)}}(),handleHit:function(e){e.emit("hit"),e.addState(this.data.state),this.el.emit("hit",{el:e})},handleHitEnd:function(e){e.emit("hitend"),e.removeState(this.data.state),this.el.emit("hitend",{el:e})}})},{}],32:[function(e,t,i){"use strict";e("./nav-mesh"),e("./nav-agent"),e("./system")},{"./nav-agent":33,"./nav-mesh":34,"./system":35}],33:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("nav-agent",{schema:{destination:{type:"vec3"},active:{default:!1},speed:{default:2}},init:function(){this.system=this.el.sceneEl.systems.nav,this.system.addAgent(this),this.group=null,this.path=[],this.raycaster=new THREE.Raycaster},remove:function(){this.system.removeAgent(this)},update:function(){this.path.length=0},updateNavLocation:function(){this.group=null,this.path=[]},tick:function(){var e=new THREE.Vector3,t=new THREE.Vector3,i=new THREE.Vector3;return function(n,o){var r=this.el,s=this.data,a=this.raycaster,c=s.speed*o/1e3;if(s.active){if(!this.path.length){var l=this.el.object3D.position;this.group=this.group||this.system.getGroup(l),this.path=this.system.getPath(l,e.copy(s.destination),this.group)||[],r.emit("navigation-start")}if(!this.path.length)return console.warn("[nav] Unable to find path to %o.",s.destination),this.el.setAttribute("nav-agent",{active:!1}),void r.emit("navigation-end");var h=r.object3D.position,u=this.path[0];t.subVectors(u,h);var d=void 0;if(t.length()<c){if(this.path.shift(),!this.path.length)return this.el.setAttribute("nav-agent",{active:!1}),void r.emit("navigation-end");i.copy(h),d=this.path[0]}else i.copy(t.setLength(c)).add(h),d=u;d.y=h.y,r.object3D.lookAt(d),a.ray.origin.copy(i),a.ray.origin.y+=1.5,a.ray.direction.y=-1;var p=a.intersectObject(this.system.getNavMesh());p.length?(t.subVectors(p[0].point,h),h.add(t.setLength(c))):h.copy(i)}}}()})},{}],34:[function(e,t,i){"use strict";t.exports=AFRAME.registerComponent("nav-mesh",{init:function(){this.system=this.el.sceneEl.systems.nav,this.hasLoadedNavMesh=!1,this.el.addEventListener("object3dset",this.loadNavMesh.bind(this))},play:function(){this.hasLoadedNavMesh||this.loadNavMesh()},loadNavMesh:function(){var e=this.el.getObject3D("mesh"),t=this.el.sceneEl.object3D;if(e){var i=void 0;if(e.traverse(function(e){e.isMesh&&(i=e)}),i){var n=i.geometry.isBufferGeometry?(new THREE.Geometry).fromBufferGeometry(i.geometry):i.geometry.clone();t.updateMatrixWorld(),n.applyMatrix(i.matrixWorld),this.system.setNavMeshGeometry(n),this.hasLoadedNavMesh=!0}}}})},{}],35:[function(e,t,i){"use strict";var n=e("three-pathfinding").Pathfinding,o=new n,r="level";t.exports=AFRAME.registerSystem("nav",{init:function(){this.navMesh=null,this.agents=new Set},setNavMeshGeometry:function(e){this.navMesh=new THREE.Mesh(e),o.setZoneData(r,n.createZone(e)),Array.from(this.agents).forEach(function(e){return e.updateNavLocation()})},getNavMesh:function(){return this.navMesh},addAgent:function(e){this.agents.add(e)},removeAgent:function(e){this.agents.delete(e)},getPath:function(e,t,i){return this.navMesh?o.findPath(e,t,r,i):null},getGroup:function(e){return this.navMesh?o.getGroup(r,e):null},getNode:function(e,t){return this.navMesh?o.getClosestNode(e,r,t,!0):null},clampStep:function(e,t,i,n,s){return this.navMesh?n?o.clampStep(e,t,n,r,i,s):(s.copy(t),this.getNode(t,i)):(s.copy(t),null)}})},{"three-pathfinding":10}],36:[function(e,t,i){"use strict";t.exports=AFRAME.registerPrimitive("a-grid",{defaultComponents:{geometry:{primitive:"plane",width:75,height:75},rotation:{x:-90,y:0,z:0},material:{src:"url(https://cdn.rawgit.com/donmccurdy/aframe-extras/v1.16.3/assets/grid.png)",repeat:"75 75"}},mappings:{width:"geometry.width",height:"geometry.height",src:"material.src"}})},{}],37:[function(e,t,i){"use strict";var n=e("../../lib/hex-grid.min.js"),o=e("../../lib/default-hex-grid");t.exports.Primitive=AFRAME.registerPrimitive("a-hexgrid",{defaultComponents:{hexgrid:{}},mappings:{src:"hexgrid.src"}}),t.exports.Component=AFRAME.registerComponent("hexgrid",{dependencies:["material"],schema:{src:{type:"asset"}},init:function(){var e=this,t=this.data;t.src?fetch(t.src).then(function(e){return e.json()}).then(function(t){return e.addMesh(t)}):this.addMesh(o)},addMesh:function(e){var t=new n.HexGrid;t.fromJSON(e);var i=new n.Board(t);i.generateTilemap(),this.el.setObject3D("mesh",i.group),this.addMaterial()},addMaterial:function(){var e=(this.el.components.material||{}).material;e&&this.el.object3D.traverse(function(t){t.isMesh&&(t.material=e)})},remove:function(){this.el.removeObject3D("mesh")}})},{"../../lib/default-hex-grid":6,"../../lib/hex-grid.min.js":8}],38:[function(e,t,i){"use strict";t.exports.Primitive=AFRAME.registerPrimitive("a-ocean",{defaultComponents:{ocean:{},rotation:{x:-90,y:0,z:0}},mappings:{width:"ocean.width",depth:"ocean.depth",density:"ocean.density",amplitude:"ocean.amplitude",amplitudeVariance:"ocean.amplitudeVariance",speed:"ocean.speed",speedVariance:"ocean.speedVariance",color:"ocean.color",opacity:"ocean.opacity"}}),t.exports.Component=AFRAME.registerComponent("ocean",{schema:{width:{default:10,min:0},depth:{default:10,min:0},density:{default:10},amplitude:{default:.1},amplitudeVariance:{default:.3},speed:{default:1},speedVariance:{default:2},color:{default:"#7AD2F7",type:"color"},opacity:{default:.8}},play:function(){var e=this.el,t=this.data,i=e.components.material,n=new THREE.PlaneGeometry(t.width,t.depth,t.density,t.density);n.mergeVertices(),this.waves=[];for(var o,r=0,s=n.vertices.length;r<s;r++)o=n.vertices[r],this.waves.push({z:o.z,ang:Math.random()*Math.PI*2,amp:t.amplitude+Math.random()*t.amplitudeVariance,speed:(t.speed+Math.random()*t.speedVariance)/1e3});i||((i={}).material=new THREE.MeshPhongMaterial({color:t.color,transparent:t.opacity<1,opacity:t.opacity,shading:THREE.FlatShading})),this.mesh=new THREE.Mesh(n,i.material),e.setObject3D("mesh",this.mesh)},remove:function(){this.el.removeObject3D("mesh")},tick:function(e,t){if(t){for(var i,n,o=this.mesh.geometry.vertices,r=0;i=o[r];r++)n=this.waves[r],i.z=n.z+Math.sin(n.ang)*n.amp,n.ang+=n.speed*t;this.mesh.geometry.verticesNeedUpdate=!0}}})},{}],39:[function(e,t,i){"use strict";t.exports.Primitive=AFRAME.registerPrimitive("a-tube",{defaultComponents:{tube:{}},mappings:{path:"tube.path",segments:"tube.segments",radius:"tube.radius","radial-segments":"tube.radialSegments",closed:"tube.closed"}}),t.exports.Component=AFRAME.registerComponent("tube",{schema:{path:{default:[]},segments:{default:64},radius:{default:1},radialSegments:{default:8},closed:{default:!1}},init:function(){var e=this.el,t=this.data,i=e.components.material;if(t.path.length){var n=new THREE.CatmullRomCurve3(t.path.map(function(e){return e=e.split(" "),new THREE.Vector3(Number(e[0]),Number(e[1]),Number(e[2]))})),o=new THREE.TubeGeometry(n,t.segments,t.radius,t.radialSegments,t.closed);i||((i={}).material=new THREE.MeshPhongMaterial),this.mesh=new THREE.Mesh(o,i.material),this.el.setObject3D("mesh",this.mesh)}else console.error("[a-tube] `path` property expected but not found.")},update:function(e){Object.keys(e).length&&(this.remove(),this.init())},remove:function(){this.mesh&&this.el.removeObject3D("mesh")}})},{}],40:[function(e,t,i){"use strict";e("./a-grid"),e("./a-hexgrid"),e("./a-ocean"),e("./a-tube")},{"./a-grid":36,"./a-hexgrid":37,"./a-ocean":38,"./a-tube":39}]},{},[1]);
|