From 2b63ca9ff7ad9eee07000af6ecf07f637dffdb2a Mon Sep 17 00:00:00 2001 From: Robin Hawkes Date: Fri, 11 Mar 2016 09:07:03 +0000 Subject: [PATCH] Added methods to override material, mesh settings and geometry generation for layers --- dist/vizicities.js | 402 ++++++++++++++++++---------- dist/vizicities.min.js | 14 +- dist/vizicities.min.js.map | 2 +- src/layer/GeoJSONLayer.js | 87 +++++- src/layer/geometry/PointLayer.js | 17 +- src/layer/geometry/PolygonLayer.js | 175 ++++++------ src/layer/geometry/PolylineLayer.js | 123 +++++---- 7 files changed, 544 insertions(+), 276 deletions(-) diff --git a/dist/vizicities.js b/dist/vizicities.js index 30a28de..3e0fc4b 100644 --- a/dist/vizicities.js +++ b/dist/vizicities.js @@ -15057,7 +15057,15 @@ return /******/ (function(modules) { // webpackBootstrap topojson: false, filter: null, onEachFeature: null, + polygonMaterial: null, + onPolygonMesh: null, + onPolygonBufferAttributes: null, + polylineMaterial: null, + onPolylineMesh: null, + onPolylineBufferAttributes: null, pointGeometry: null, + pointMaterial: null, + onPointMesh: null, style: _utilGeoJSON2['default'].defaultStyle }; @@ -15247,7 +15255,9 @@ return /******/ (function(modules) { // webpackBootstrap geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new THREE.MeshPhongMaterial({ vertexColors: THREE.VertexColors, side: THREE.BackSide @@ -15281,6 +15291,11 @@ return /******/ (function(modules) { // webpackBootstrap this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onPolygonMesh === 'function') { + this._options.onPolygonMesh(mesh); + } + this._polygonMesh = mesh; } }, { @@ -15302,13 +15317,18 @@ return /******/ (function(modules) { // webpackBootstrap var style = typeof this._options.style === 'function' ? this._options.style(this._geojson.features[0]) : this._options.style; style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, style); - var material = new THREE.LineBasicMaterial({ - vertexColors: THREE.VertexColors, - linewidth: style.lineWidth, - transparent: style.lineTransparent, - opacity: style.lineOpacity, - blending: style.lineBlending - }); + var material; + if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) { + material = this._options.material; + } else { + material = new THREE.LineBasicMaterial({ + vertexColors: THREE.VertexColors, + linewidth: style.lineWidth, + transparent: style.lineTransparent, + opacity: style.lineOpacity, + blending: style.lineBlending + }); + } var mesh = new THREE.LineSegments(geometry, material); @@ -15331,6 +15351,11 @@ return /******/ (function(modules) { // webpackBootstrap this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onPolylineMesh === 'function') { + this._options.onPolylineMesh(mesh); + } + this._polylineMesh = mesh; } }, { @@ -15350,7 +15375,9 @@ return /******/ (function(modules) { // webpackBootstrap geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new THREE.MeshPhongMaterial({ vertexColors: THREE.VertexColors // side: THREE.BackSide @@ -15379,6 +15406,11 @@ return /******/ (function(modules) { // webpackBootstrap this._pickingMesh.add(pickingMesh); } + // Pass mesh callback, if defined + if (typeof this._options.onPointMesh === 'function') { + this._options.onPointMesh(mesh); + } + this._pointMesh = mesh; } @@ -15394,10 +15426,38 @@ return /******/ (function(modules) { // webpackBootstrap } if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') { + // Get material instance to use for polygon, if provided + if (typeof this._options.polygonMaterial === 'function') { + options.geometry = this._options.polygonMaterial(feature); + } + + if (typeof this._options.onPolygonMesh === 'function') { + options.onMesh = this._options.onPolygonMesh; + } + + // Pass onBufferAttributes callback, if defined + if (typeof this._options.onPolygonBufferAttributes === 'function') { + options.onBufferAttributes = this._options.onPolygonBufferAttributes; + } + return new _geometryPolygonLayer2['default'](coordinates, options); } if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') { + // Get material instance to use for line, if provided + if (typeof this._options.lineMaterial === 'function') { + options.geometry = this._options.lineMaterial(feature); + } + + if (typeof this._options.onPolylineMesh === 'function') { + options.onMesh = this._options.onPolylineMesh; + } + + // Pass onBufferAttributes callback, if defined + if (typeof this._options.onPolylineBufferAttributes === 'function') { + options.onBufferAttributes = this._options.onPolylineBufferAttributes; + } + return new _geometryPolylineLayer2['default'](coordinates, options); } @@ -15407,6 +15467,15 @@ return /******/ (function(modules) { // webpackBootstrap options.geometry = this._options.pointGeometry(feature); } + // Get material instance to use for point, if provided + if (typeof this._options.pointMaterial === 'function') { + options.geometry = this._options.pointMaterial(feature); + } + + if (typeof this._options.onPointMesh === 'function') { + options.onMesh = this._options.onPointMesh; + } + return new _geometryPointLayer2['default'](coordinates, options); } } @@ -15572,6 +15641,9 @@ return /******/ (function(modules) { // webpackBootstrap // How much control should this layer support? Perhaps a different or custom // layer would be better suited for animation, for example. + // TODO: Allow _setBufferAttributes to use a custom function passed in to + // generate a custom mesh + var _Layer2 = __webpack_require__(37); var _Layer3 = _interopRequireDefault(_Layer2); @@ -15613,6 +15685,12 @@ return /******/ (function(modules) { // webpackBootstrap var defaults = { output: true, interactive: false, + // Custom material override + // + // TODO: Should this be in the style object? + material: null, + onMesh: null, + onBufferAttributes: null, // This default style is separate to Util.GeoJSON.defaultStyle style: { color: '#ffffff', @@ -15706,102 +15784,111 @@ return /******/ (function(modules) { // webpackBootstrap value: function _setBufferAttributes() { var _this2 = this; - var height = 0; + var attributes; - // Convert height into world units - if (this._options.style.height && this._options.style.height !== 0) { - height = this._world.metresToWorld(this._options.style.height, this._pointScale); - } + // Only use this if you know what you're doing + if (typeof this._options.onBufferAttributes === 'function') { + // TODO: Probably want to pass something less general as arguments, + // though passing the instance will do for now (it's everything) + attributes = this._options.onBufferAttributes(this); + } else { + var height = 0; - var colour = new _three2['default'].Color(); - colour.set(this._options.style.color); - - // Light and dark colours used for poor-mans AO gradient on object sides - var light = new _three2['default'].Color(0xffffff); - var shadow = new _three2['default'].Color(0x666666); - - // For each polygon - var attributes = this._projectedCoordinates.map(function (_projectedCoordinates) { - // Convert coordinates to earcut format - var _earcut = _this2._toEarcut(_projectedCoordinates); - - // Triangulate faces using earcut - var faces = _this2._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions); - - var groupedVertices = []; - for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) { - groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions)); + // Convert height into world units + if (this._options.style.height && this._options.style.height !== 0) { + height = this._world.metresToWorld(this._options.style.height, this._pointScale); } - var extruded = (0, _utilExtrudePolygon2['default'])(groupedVertices, faces, { - bottom: 0, - top: height - }); + var colour = new _three2['default'].Color(); + colour.set(this._options.style.color); - var topColor = colour.clone().multiply(light); - var bottomColor = colour.clone().multiply(shadow); + // Light and dark colours used for poor-mans AO gradient on object sides + var light = new _three2['default'].Color(0xffffff); + var shadow = new _three2['default'].Color(0x666666); - var _vertices = extruded.positions; - var _faces = []; - var _colours = []; + // For each polygon + attributes = this._projectedCoordinates.map(function (_projectedCoordinates) { + // Convert coordinates to earcut format + var _earcut = _this2._toEarcut(_projectedCoordinates); - var _colour; - extruded.top.forEach(function (face, fi) { - _colour = []; + // Triangulate faces using earcut + var faces = _this2._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions); - _colour.push([colour.r, colour.g, colour.b]); - _colour.push([colour.r, colour.g, colour.b]); - _colour.push([colour.r, colour.g, colour.b]); + var groupedVertices = []; + for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) { + groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions)); + } - _faces.push(face); - _colours.push(_colour); - }); + var extruded = (0, _utilExtrudePolygon2['default'])(groupedVertices, faces, { + bottom: 0, + top: height + }); - _this2._flat = true; + var topColor = colour.clone().multiply(light); + var bottomColor = colour.clone().multiply(shadow); - if (extruded.sides) { - _this2._flat = false; + var _vertices = extruded.positions; + var _faces = []; + var _colours = []; - // Set up colours for every vertex with poor-mans AO on the sides - extruded.sides.forEach(function (face, fi) { + var _colour; + extruded.top.forEach(function (face, fi) { _colour = []; - // First face is always bottom-bottom-top - if (fi % 2 === 0) { - _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); - _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); - _colour.push([topColor.r, topColor.g, topColor.b]); - // Reverse winding for the second face - // top-top-bottom - } else { - _colour.push([topColor.r, topColor.g, topColor.b]); - _colour.push([topColor.r, topColor.g, topColor.b]); - _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); - } + _colour.push([colour.r, colour.g, colour.b]); + _colour.push([colour.r, colour.g, colour.b]); + _colour.push([colour.r, colour.g, colour.b]); _faces.push(face); _colours.push(_colour); }); - } - // Skip bottom as there's no point rendering it - // allFaces.push(extruded.faces); + _this2._flat = true; - var polygon = { - vertices: _vertices, - faces: _faces, - colours: _colours, - facesCount: _faces.length - }; + if (extruded.sides) { + _this2._flat = false; - if (_this2._options.interactive && _this2._pickingId) { - // Inject picking ID - polygon.pickingId = _this2._pickingId; - } + // Set up colours for every vertex with poor-mans AO on the sides + extruded.sides.forEach(function (face, fi) { + _colour = []; - // Convert polygon representation to proper attribute arrays - return _this2._toAttributes(polygon); - }); + // First face is always bottom-bottom-top + if (fi % 2 === 0) { + _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); + _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); + _colour.push([topColor.r, topColor.g, topColor.b]); + // Reverse winding for the second face + // top-top-bottom + } else { + _colour.push([topColor.r, topColor.g, topColor.b]); + _colour.push([topColor.r, topColor.g, topColor.b]); + _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); + } + + _faces.push(face); + _colours.push(_colour); + }); + } + + // Skip bottom as there's no point rendering it + // allFaces.push(extruded.faces); + + var polygon = { + vertices: _vertices, + faces: _faces, + colours: _colours, + facesCount: _faces.length + }; + + if (_this2._options.interactive && _this2._pickingId) { + // Inject picking ID + polygon.pickingId = _this2._pickingId; + } + + // Convert polygon representation to proper attribute arrays + return _this2._toAttributes(polygon); + }); + } this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes); } @@ -15831,7 +15918,9 @@ return /******/ (function(modules) { // webpackBootstrap geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + if (this._options.material && this._options.material instanceof _three2['default'].Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new _three2['default'].MeshPhongMaterial({ vertexColors: _three2['default'].VertexColors, side: _three2['default'].BackSide @@ -15865,6 +15954,11 @@ return /******/ (function(modules) { // webpackBootstrap this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onMesh === 'function') { + this._options.onMesh(mesh); + } + this._mesh = mesh; } @@ -16870,6 +16964,9 @@ return /******/ (function(modules) { // webpackBootstrap // How much control should this layer support? Perhaps a different or custom // layer would be better suited for animation, for example. + // TODO: Allow _setBufferAttributes to use a custom function passed in to + // generate a custom mesh + var _Layer2 = __webpack_require__(37); var _Layer3 = _interopRequireDefault(_Layer2); @@ -16903,6 +17000,12 @@ return /******/ (function(modules) { // webpackBootstrap var defaults = { output: true, interactive: false, + // Custom material override + // + // TODO: Should this be in the style object? + material: null, + onMesh: null, + onBufferAttributes: null, // This default style is separate to Util.GeoJSON.defaultStyle style: { lineOpacity: 1, @@ -17002,50 +17105,59 @@ return /******/ (function(modules) { // webpackBootstrap value: function _setBufferAttributes() { var _this2 = this; - var height = 0; + var attributes; - // Convert height into world units - if (this._options.style.lineHeight) { - height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale); - } + // Only use this if you know what you're doing + if (typeof this._options.onBufferAttributes === 'function') { + // TODO: Probably want to pass something less general as arguments, + // though passing the instance will do for now (it's everything) + attributes = this._options.onBufferAttributes(this); + } else { + var height = 0; - var colour = new _three2['default'].Color(); - colour.set(this._options.style.lineColor); - - // For each line - var attributes = this._projectedCoordinates.map(function (_projectedCoordinates) { - var _vertices = []; - var _colours = []; - - // Connect coordinate with the next to make a pair - // - // LineSegments requires pairs of vertices so repeat the last point if - // there's an odd number of vertices - var nextCoord; - _projectedCoordinates.forEach(function (coordinate, index) { - _colours.push([colour.r, colour.g, colour.b]); - _vertices.push([coordinate.x, height, coordinate.y]); - - nextCoord = _projectedCoordinates[index + 1] ? _projectedCoordinates[index + 1] : coordinate; - - _colours.push([colour.r, colour.g, colour.b]); - _vertices.push([nextCoord.x, height, nextCoord.y]); - }); - - var line = { - vertices: _vertices, - colours: _colours, - verticesCount: _vertices.length - }; - - if (_this2._options.interactive && _this2._pickingId) { - // Inject picking ID - line.pickingId = _this2._pickingId; + // Convert height into world units + if (this._options.style.lineHeight) { + height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale); } - // Convert line representation to proper attribute arrays - return _this2._toAttributes(line); - }); + var colour = new _three2['default'].Color(); + colour.set(this._options.style.lineColor); + + // For each line + attributes = this._projectedCoordinates.map(function (_projectedCoordinates) { + var _vertices = []; + var _colours = []; + + // Connect coordinate with the next to make a pair + // + // LineSegments requires pairs of vertices so repeat the last point if + // there's an odd number of vertices + var nextCoord; + _projectedCoordinates.forEach(function (coordinate, index) { + _colours.push([colour.r, colour.g, colour.b]); + _vertices.push([coordinate.x, height, coordinate.y]); + + nextCoord = _projectedCoordinates[index + 1] ? _projectedCoordinates[index + 1] : coordinate; + + _colours.push([colour.r, colour.g, colour.b]); + _vertices.push([nextCoord.x, height, nextCoord.y]); + }); + + var line = { + vertices: _vertices, + colours: _colours, + verticesCount: _vertices.length + }; + + if (_this2._options.interactive && _this2._pickingId) { + // Inject picking ID + line.pickingId = _this2._pickingId; + } + + // Convert line representation to proper attribute arrays + return _this2._toAttributes(line); + }); + } this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes); } @@ -17074,13 +17186,19 @@ return /******/ (function(modules) { // webpackBootstrap geometry.computeBoundingBox(); var style = this._options.style; - var material = new _three2['default'].LineBasicMaterial({ - vertexColors: _three2['default'].VertexColors, - linewidth: style.lineWidth, - transparent: style.lineTransparent, - opacity: style.lineOpacity, - blending: style.lineBlending - }); + var material; + + if (this._options.material && this._options.material instanceof _three2['default'].Material) { + material = this._options.material; + } else { + material = new _three2['default'].LineBasicMaterial({ + vertexColors: _three2['default'].VertexColors, + linewidth: style.lineWidth, + transparent: style.lineTransparent, + opacity: style.lineOpacity, + blending: style.lineBlending + }); + } var mesh = new _three2['default'].LineSegments(geometry, material); @@ -17103,6 +17221,11 @@ return /******/ (function(modules) { // webpackBootstrap this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onMesh === 'function') { + this._options.onMesh(mesh); + } + this._mesh = mesh; } @@ -17339,9 +17462,12 @@ return /******/ (function(modules) { // webpackBootstrap output: true, interactive: false, // THREE.Geometry or THREE.BufferGeometry to use for point output - // - // TODO: Make this customisable per point via a callback (like style) geometry: null, + // Custom material override + // + // TODO: Should this be in the style object? + material: null, + onMesh: null, // This default style is separate to Util.GeoJSON.defaultStyle style: { pointColor: '#ff0000' @@ -17542,7 +17668,10 @@ return /******/ (function(modules) { // webpackBootstrap geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + + if (this._options.material && this._options.material instanceof _three2['default'].Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new _three2['default'].MeshBasicMaterial({ vertexColors: _three2['default'].VertexColors // side: THREE.BackSide @@ -17571,6 +17700,11 @@ return /******/ (function(modules) { // webpackBootstrap this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onMesh === 'function') { + this._options.onMesh(mesh); + } + this._mesh = mesh; } diff --git a/dist/vizicities.min.js b/dist/vizicities.min.js index 644db1b..1e26c8b 100644 --- a/dist/vizicities.min.js +++ b/dist/vizicities.min.js @@ -1,8 +1,8 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("proj4"),require("THREE")):"function"==typeof define&&define.amd?define(["proj4","THREE"],t):"object"==typeof exports?exports.VIZI=t(require("proj4"),require("THREE")):e.VIZI=t(e.proj4,e.THREE)}(this,function(__WEBPACK_EXTERNAL_MODULE_22__,__WEBPACK_EXTERNAL_MODULE_24__){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),o=r(i),a=n(42),s=r(a),u=n(37),l=r(u),c=n(36),f=r(c),h=n(46),p=r(h),d=n(61),v=r(d),y=n(72),m=r(y),_=n(73),g=r(_),b=n(80),w=r(b),x=n(75),k=r(x),O=n(78),E=r(O),M=n(79),T=r(M),P=n(11),j=r(P),S=n(10),C=r(S),A={version:"0.3",World:o["default"],world:i.world,Controls:s["default"],Layer:l["default"],layer:u.layer,EnvironmentLayer:f["default"],environmentLayer:c.environmentLayer,ImageTileLayer:p["default"],imageTileLayer:h.imageTileLayer,GeoJSONTileLayer:v["default"],geoJSONTileLayer:d.geoJSONTileLayer,TopoJSONTileLayer:m["default"],topoJSONTileLayer:y.topoJSONTileLayer,GeoJSONLayer:g["default"],geoJSONLayer:_.geoJSONLayer,TopoJSONLayer:w["default"],topoJSONLayer:b.topoJSONLayer,PolygonLayer:k["default"],polygonLayer:x.polygonLayer,PolylineLayer:E["default"],polylineLayer:O.polylineLayer,PointLayer:T["default"],pointLayer:M.pointLayer,Point:j["default"],point:P.point,LatLon:C["default"],latLon:S.latLon};t["default"]=A,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n-1&&this._layers.splice(t,1),e.isOutput()&&(this._engine._scene.remove(e._object3D),this._engine._domScene3D.remove(e._domObject3D),this._engine._domScene2D.remove(e._domObject2D)),this.emit("layerRemoved"),this}},{key:"addControls",value:function(e){return e._addToWorld(this),this._controls.push(e),this.emit("controlsAdded",e),this}},{key:"removeControls",value:function(e){var t=this._controls.indexOf(t);return t>-1&&this._controls.splice(t,1),this.emit("controlsRemoved",e),this}},{key:"stop",value:function(){this._pause=!0}},{key:"start",value:function(){this._pause=!1,this._update()}},{key:"destroy",value:function(){this.stop(),this.off("controlsMoveEnd",this._onControlsMoveEnd);var e,t;for(e=this._controls.length-1;e>=0;e--)t=this._controls[0],this.removeControls(t),t.destroy();var n;for(e=this._layers.length-1;e>=0;e--)n=this._layers[0],this.removeLayer(n),n.destroy();this._environment=null,this._engine.destroy(),this._engine=null,this._container=null}}]),t}(l["default"]);t["default"]=b;var w=function(e,t){return new b(e,t)};t.world=w},function(e,t,n){"use strict";function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(){}var o="function"!=typeof Object.create?"~":!1;i.prototype._events=void 0,i.prototype.listeners=function(e,t){var n=o?o+e:e,r=this._events&&this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,s=new Array(a);a>i;i++)s[i]=r[i].fn;return s},i.prototype.emit=function(e,t,n,r,i,a){var s=o?o+e:e;if(!this._events||!this._events[s])return!1;var u,l,c=this._events[s],f=arguments.length;if("function"==typeof c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,a),!0}for(l=1,u=new Array(f-1);f>l;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var h,p=c.length;for(l=0;p>l;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),f){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;default:if(!u)for(h=1,u=new Array(f-1);f>h;h++)u[h-1]=arguments[h];c[l].fn.apply(c[l].context,u)}}return!0},i.prototype.on=function(e,t,n){var i=new r(t,n||this),a=o?o+e:e;return this._events||(this._events=o?{}:Object.create(null)),this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],i]:this._events[a].push(i):this._events[a]=i,this},i.prototype.once=function(e,t,n){var i=new r(t,n||this,!0),a=o?o+e:e;return this._events||(this._events=o?{}:Object.create(null)),this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],i]:this._events[a].push(i):this._events[a]=i,this},i.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events||!this._events[i])return this;var a=this._events[i],s=[];if(t)if(a.fn)(a.fn!==t||r&&!a.once||n&&a.context!==n)&&s.push(a);else for(var u=0,l=a.length;l>u;u++)(a[u].fn!==t||r&&!a[u].once||n&&a[u].context!==n)&&s.push(a[u]);return s.length?this._events[i]=1===s.length?s[0]:s:delete this._events[i],this},i.prototype.removeAllListeners=function(e){return this._events?(e?delete this._events[o?o+e:e]:this._events=o?{}:Object.create(null),this):this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prototype.setMaxListeners=function(){return this},i.prefixed=o,e.exports=i},function(e,t,n){function r(e,t){return e="number"==typeof e||b.test(e)?+e:-1,t=null==t?m:t,e>-1&&e%1==0&&t>e}function i(e,t,n){var r=e[t];(!c(r,n)||c(r,w[t])&&!x.call(e,t)||void 0===n&&!(t in e))&&(e[t]=n)}function o(e){return function(t){return null==t?void 0:t[e]}}function a(e,t,n){return s(e,t,n)}function s(e,t,n,r){n||(n={});for(var o=-1,a=t.length;++o1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o="function"==typeof o?(i--,o):void 0,a&&l(n[0],n[1],a)&&(o=3>i?void 0:o,i=1),t=Object(t);++r-1&&e%1==0&&m>=e}function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var v=n(4),y=n(5),m=9007199254740991,_="[object Function]",g="[object GeneratorFunction]",b=/^(?:0|[1-9]\d*)$/,w=Object.prototype,x=w.hasOwnProperty,k=w.toString,O=o("length"),E=u(function(e,t){a(t,v(t),e)});e.exports=E},function(e,t){function n(e,t){for(var n=-1,r=Array(e);++n-1&&e%1==0&&t>e}function i(e,t){return E.call(e,t)||"object"==typeof e&&t in e&&null===T(e)}function o(e){return j(Object(e))}function a(e){return function(t){return null==t?void 0:t[e]}}function s(e){var t=e?e.length:void 0;return p(t)&&(C(e)||y(e)||l(e))?n(t,String):null}function u(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||O;return e===n}function l(e){return f(e)&&E.call(e,"callee")&&(!P.call(e,"callee")||M.call(e)==g)}function c(e){return null!=e&&!("function"==typeof e&&h(e))&&p(S(e))}function f(e){return v(e)&&c(e)}function h(e){var t=d(e)?M.call(e):"";return t==b||t==w}function p(e){return"number"==typeof e&&e>-1&&e%1==0&&_>=e}function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){return!!e&&"object"==typeof e}function y(e){return"string"==typeof e||!C(e)&&v(e)&&M.call(e)==x}function m(e){var t=u(e);if(!t&&!c(e))return o(e);var n=s(e),a=!!n,l=n||[],f=l.length;for(var h in e)!i(e,h)||a&&("length"==h||r(h,f))||t&&"constructor"==h||l.push(h);return l}var _=9007199254740991,g="[object Arguments]",b="[object Function]",w="[object GeneratorFunction]",x="[object String]",k=/^(?:0|[1-9]\d*)$/,O=Object.prototype,E=O.hasOwnProperty,M=O.toString,T=Object.getPrototypeOf,P=O.propertyIsEnumerable,j=Object.keys,S=a("length"),C=Array.isArray;e.exports=m},function(e,t){function n(e,t,n){var r=n.length;switch(r){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function r(e,t){if("function"!=typeof e)throw new TypeError(u);return t=w(void 0===t?e.length-1:a(t),0),function(){for(var r=arguments,i=-1,o=w(r.length-t,0),a=Array(o);++ie?-1:1;return t*c}var n=e%1;return e===e?n?e-n:e:0}function s(e){if(o(e)){var t=i(e.valueOf)?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(d,"");var n=y.test(e);return n||m.test(e)?_(e.slice(2),n?2:8):v.test(e)?f:+e}var u="Expected a function",l=1/0,c=1.7976931348623157e308,f=NaN,h="[object Function]",p="[object GeneratorFunction]",d=/^\s+|\s+$/g,v=/^[-+]0x[0-9a-f]+$/i,y=/^0b[01]+$/i,m=/^0o[0-7]+$/i,_=parseInt,g=Object.prototype,b=g.toString,w=Math.max;e.exports=r},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),o=r(i),a=n(15),s=r(a),u=n(17),l=r(u),c=n(19),f=r(c),h=n(20),p=r(h),d={};d.EPSG3857=o["default"],d.EPSG900913=i.EPSG900913,d.EPSG3395=s["default"],d.EPSG4326=l["default"],d.Simple=f["default"],d.Proj4=p["default"],t["default"]=d,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(8),s=r(a),u=n(13),l=r(u),c=n(14),f=r(c),h={code:"EPSG:3857",projection:l["default"],transformScale:1/(Math.PI*l["default"].R),transformation:function(){var e=1/(Math.PI*l["default"].R);return new f["default"](e,0,-e,0)}()},p=(0,o["default"])({},s["default"],h),d=(0,o["default"])({},p,{code:"EPSG:900913"});t.EPSG900913=d,t["default"]=p},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(9),s=r(a),u=(n(10),{wrapLon:[-180,180],R:6378137,distance:function(e,t,n){var r,i,o,a=Math.PI/180;if(n){r=e.lat*a,i=t.lat*a;var s=e.lon*a,u=t.lon*a,l=i-r,c=u-s,f=l/2,h=c/2;o=Math.sin(f)*Math.sin(f)+Math.cos(r)*Math.cos(i)*Math.sin(h)*Math.sin(h);var p=2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o));return this.R*p}return r=e.lat*a,i=t.lat*a,o=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lon-e.lon)*a),this.R*Math.acos(Math.min(o,1))},pointScale:function(e,t){return this.projection.pointScale?this.projection.pointScale(e,t):[1,1]},metresToProjected:function(e,t){return e*t[1]},projectedToMetres:function(e,t){return e/t[1]},metresToWorld:function(e,t,n){var r=this.metresToProjected(e,t),i=this.scale(n);n&&(i/=2);var o=i*(this.transformScale*r);return n&&(o/=t[1]),o},worldToMetres:function(e,t,n){var r=this.scale(n);n&&(r/=2);var i=e/r/this.transformScale,o=this.projectedToMetres(i,t);return n&&(o*=t[1]),o}});t["default"]=(0,o["default"])({},s["default"],u),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(10),o=n(11),a=n(12),s=r(a),u={scaleFactor:1e6,latLonToPoint:function(e,t){var n=this.projection.project(e),r=this.scale(t);return t&&(r/=2),this.transformation._transform(n,r)},pointToLatLon:function(e,t){var n=this.scale(t);t&&(n/=2);var r=this.transformation.untransform(e,n);return this.projection.unproject(r)},project:function(e){return this.projection.project(e)},unproject:function(e){return this.projection.unproject(e)},scale:function(e){return e>=0?256*Math.pow(2,e):this.scaleFactor},zoom:function(e){return Math.log(e/256)/Math.LN2},getProjectedBounds:function(e){if(this.infinite)return null;var t=this.projection.bounds,n=this.scale(e);e&&(n/=2);var r=this.transformation.transform((0,o.point)(t[0]),n),i=this.transformation.transform((0,o.point)(t[1]),n);return[r,i]},wrapLatLon:function(e){var t=this.wrapLat?(0,s["default"])(e.lat,this.wrapLat,!0):e.lat,n=this.wrapLon?(0,s["default"])(e.lon,this.wrapLon,!0):e.lon,r=e.alt;return(0,i.latLon)(t,n,r)}};t["default"]=u,e.exports=t["default"]},function(e,t){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;nl&&Math.abs(c)>1e-7;l++)t=a*Math.sin(u),t=Math.pow((1-t)/(1+t),a/2),c=Math.PI/2-2*Math.atan(s*t)-u,u+=c;return(0,r.latLon)(u*n,e.x*n/i)},pointScale:function(e){var t=Math.PI/180,n=e.lat*t,r=Math.sin(n),i=r*r,o=Math.cos(n),a=Math.sqrt(1-this.ECC2*i)/o;return[a,a]},bounds:[[-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]]};t["default"]=o,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(8),s=r(a),u=n(18),l=r(u),c=n(14),f=r(c),h={code:"EPSG:4326",projection:l["default"],transformScale:1/180,transformation:new f["default"](1/180,0,-1/180,0)},p=(0,o["default"])({},s["default"],h);t["default"]=p,e.exports=t["default"]},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),i=n(11),o={project:function(e){return(0,i.point)(e.lon,e.lat)},unproject:function(e){return(0,r.latLon)(e.y,e.x)},pointScale:function(e){var t=111132.92,n=-559.82,r=1.175,i=-.0023,o=111412.84,a=-93.5,s=.118,u=Math.PI/180,l=e.lat*u,c=t+n*Math.cos(2*l)+r*Math.cos(4*l)+i*Math.cos(6*l),f=o*Math.cos(l)+a*Math.cos(3*l)+s*Math.cos(5*l);return[1/c,1/f]},bounds:[[-180,-90],[180,90]]};t["default"]=o,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(9),s=r(a),u=n(18),l=r(u),c=n(14),f=r(c),h={projection:l["default"],transformation:new f["default"](1,0,1,0),scale:function(e){return e?Math.pow(2,e):1},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var n=t.lon-e.lon,r=t.lat-e.lat;return Math.sqrt(n*n+r*r)},infinite:!0},p=(0,o["default"])({},s["default"],h);t["default"]=p,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(8),s=r(a),u=n(21),l=r(u),c=n(14),f=r(c),h=function(e,t,n){var r=(0,l["default"])(t,n),i=r.bounds[1][0]-r.bounds[0][0],o=r.bounds[1][1]-r.bounds[0][1],a=i/2,s=o/2,u=1/a,c=1/s,h=Math.min(u,c),p=h*(r.bounds[0][0]+a),d=h*(r.bounds[0][1]+s);return{code:e,projection:r,transformScale:h,transformation:new f["default"](h,-p,-h,d)}},p=function(e,t,n){return(0,o["default"])({},s["default"],h(e,t,n))};t["default"]=p,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(22),o=r(i),a=n(10),s=n(11),u=function(e,t){var n=(0,o["default"])(e),r=function(e){return(0,s.point)(n.forward([e.lon,e.lat]))},i=function(e){var t=n.inverse([e.x,e.y]);return(0,a.latLon)(t[1],t[0])};return{project:r,unproject:i,pointScale:function(e,t){return[1,1]},bounds:function(){if(t)return t;var e=r([-90,-180]),n=r([90,180]);return[e,n]}()}};t["default"]=u,e.exports=t["default"]},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE_22__},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n=0;t--)e=this._scene.children[t],e&&(this._scene.remove(e),e.geometry&&(e.geometry.dispose(),e.geometry=null),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));for(var t=this._domScene3D.children.length-1;t>=0;t--)e=this._domScene3D.children[t],e&&this._domScene3D.remove(e);for(var t=this._domScene2D.children.length-1;t>=0;t--)e=this._domScene2D.children[t],e&&this._domScene2D.remove(e);this._picking.destroy(),this._picking=null,this._world=null,this._scene=null,this._domScene3D=null,this._domScene2D=null,this._renderer=null,this._domRenderer3D=null,this._domRenderer2D=null,this._camera=null,this._clock=null,this._frustum=null}}]),t}(l["default"]);t["default"]=P,e.exports=t["default"]},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE_24__},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=n(25);r(a);t["default"]=function(e){var t=new o["default"].WebGLRenderer({antialias:!0});t.setClearColor(16777215,1),t.setPixelRatio(window.devicePixelRatio),t.gammaInput=!0,t.gammaOutput=!0,t.shadowMap.enabled=!0,t.shadowMap.cullFace=o["default"].CullFaceBack,e.appendChild(t.domElement);var n=function(){t.setSize(e.clientWidth,e.clientHeight)};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=(r(i),n(30)),a=n(26);r(a);t["default"]=function(e){var t=new o.CSS3DRenderer;t.domElement.style.position="absolute",t.domElement.style.top=0,e.appendChild(t.domElement);var n=function(){t.setSize(e.clientWidth,e.clientHeight)};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e){o["default"].Object3D.call(this),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",function(e){null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)})};a.prototype=Object.create(o["default"].Object3D.prototype),a.prototype.constructor=a;var s=function(e){a.call(this,e)};s.prototype=Object.create(a.prototype),s.prototype.constructor=s;var u=function(){console.log("THREE.CSS3DRenderer",o["default"].REVISION);var e,t,n,r,i=new o["default"].Matrix4,u={camera:{fov:0,style:""},objects:{}},l=document.createElement("div");l.style.overflow="hidden",l.style.WebkitTransformStyle="preserve-3d",l.style.MozTransformStyle="preserve-3d",l.style.oTransformStyle="preserve-3d",l.style.transformStyle="preserve-3d",this.domElement=l;var c=document.createElement("div");c.style.WebkitTransformStyle="preserve-3d",c.style.MozTransformStyle="preserve-3d",c.style.oTransformStyle="preserve-3d",c.style.transformStyle="preserve-3d",l.appendChild(c),this.setClearColor=function(){},this.getSize=function(){return{width:e,height:t}},this.setSize=function(i,o){e=i,t=o,n=e/2,r=t/2,l.style.width=i+"px",l.style.height=o+"px",c.style.width=i+"px",c.style.height=o+"px"};var f=function(e){return Math.abs(e)l;l++)v(e.children[l],t)};this.render=function(e,i){var a=.5/Math.tan(o["default"].Math.degToRad(.5*i.fov))*t;u.camera.fov!==a&&(l.style.WebkitPerspective=a+"px",l.style.MozPerspective=a+"px",l.style.oPerspective=a+"px",l.style.perspective=a+"px",u.camera.fov=a),e.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),i.matrixWorldInverse.getInverse(i.matrixWorld);var s="translate3d(0,0,"+a+"px)"+h(i.matrixWorldInverse)+" translate3d("+n+"px,"+r+"px, 0)";u.camera.style!==s&&(c.style.WebkitTransform=s,c.style.MozTransform=s,c.style.oTransform=s,c.style.transform=s,u.camera.style=s),d(e,i)}};t.CSS3DObject=a,t.CSS3DSprite=s,t.CSS3DRenderer=u,o["default"].CSS3DObject=a,o["default"].CSS3DSprite=s,o["default"].CSS3DRenderer=u},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=(r(i),n(32)),a=n(27);r(a);t["default"]=function(e){var t=new o.CSS2DRenderer;t.domElement.style.position="absolute",t.domElement.style.top=0,e.appendChild(t.domElement);var n=function(){t.setSize(e.clientWidth,e.clientHeight); -};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e){o["default"].Object3D.call(this),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",function(e){null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)})};a.prototype=Object.create(o["default"].Object3D.prototype),a.prototype.constructor=a;var s=function(){console.log("THREE.CSS2DRenderer",o["default"].REVISION);var e,t,n,r,i=new o["default"].Vector3,s=new o["default"].Matrix4,u=new o["default"].Matrix4,l=document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.setSize=function(i,o){e=i,t=o,n=e/2,r=t/2,l.style.width=i+"px",l.style.height=o+"px"};var c=function f(e,t){if(e instanceof a){i.setFromMatrixPosition(e.matrixWorld),i.applyProjection(u);var o=e.element,s="translate(-50%,-50%) translate("+(i.x*n+n)+"px,"+(-i.y*r+r)+"px)";o.style.WebkitTransform=s,o.style.MozTransform=s,o.style.oTransform=s,o.style.transform=s,o.parentNode!==l&&l.appendChild(o)}for(var c=0,h=e.children.length;h>c;c++)f(e.children[c],t)};this.render=function(e,t){e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),s.copy(t.matrixWorldInverse.getInverse(t.matrixWorld)),u.multiplyMatrices(t.projectionMatrix,s),c(e,t)}};t.CSS2DObject=a,t.CSS2DRenderer=s,o["default"].CSS2DObject=a,o["default"].CSS2DRenderer=s},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(e){var t=new o["default"].PerspectiveCamera(45,1,1,2e5);t.position.y=400,t.position.z=400;var n=function(){t.aspect=e.clientWidth/e.clientHeight,t.updateProjectionMatrix()};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n0&&(i=o[0].point.clone()),this._world.emit("pick",r,a,i,o),this._world.emit("pick-"+r,a,i,o)}}},{key:"add",value:function(e){this._pickingScene.add(e),this._needUpdate=!0}},{key:"remove",value:function(e){this._pickingScene.remove(e),this._needUpdate=!0}},{key:"getNextId",value:function(){return f++}},{key:"destroy",value:function(){if(window.removeEventListener("resize",this._resizeTexture,!1),this._renderer.domElement.removeEventListener("mouseup",this._onMouseUp,!1),this._world.off("move",this._onWorldMove),this._pickingScene.children)for(var e,t=this._pickingScene.children.length-1;t>=0;t--)e=this._pickingScene.children[t],e&&(this._pickingScene.remove(e),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));this._pickingScene=null,this._pickingTexture=null,this._pixelBuffer=null,this._world=null,this._renderer=null,this._camera=null}}]),e}();t["default"]=function(e,t,n){return new h(e,t,n)},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n=0;t--)e=this._object3D.children[t],e&&(this.remove(e),e.geometry&&(e.geometry.dispose(),e.geometry=null),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));if(this._domObject3D&&this._domObject3D.children)for(var e,t=this._domObject3D.children.length-1;t>=0;t--)e=this._domObject3D.children[t],e&&this.removeDOM3D(e);if(this._domObject2D&&this._domObject2D.children)for(var e,t=this._domObject2D.children.length-1;t>=0;t--)e=this._domObject2D.children[t],e&&this.removeDOM2D(e);this._domObject3D=null,this._domObject2D=null,this._world=null,this._object3D=null}}]),t}(l["default"]);t["default"]=m;var _=function(e){return new m(e)};t.layer=_},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n degrees, and the cosine of that","// earth shadow hack","const float cutoffAngle = pi/1.95;","const float steepness = 1.5;","vec3 totalRayleigh(vec3 lambda)","{","return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));","}","// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE","vec3 simplifiedRayleigh()","{","return 0.0005 / vec3(94, 40, 18);","}","float rayleighPhase(float cosTheta)","{ ","return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));","}","vec3 totalMie(vec3 lambda, vec3 K, float T)","{","float c = (0.2 * T ) * 10E-18;","return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;","}","float hgPhase(float cosTheta, float g)","{","return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));","}","float sunIntensity(float zenithAngleCos)","{","return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));","}","// float logLuminance(vec3 c)","// {","// return log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);","// }","// Filmic ToneMapping http://filmicgames.com/archives/75","float A = 0.15;","float B = 0.50;","float C = 0.10;","float D = 0.20;","float E = 0.02;","float F = 0.30;","float W = 1000.0;","vec3 Uncharted2Tonemap(vec3 x)","{","return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;","}","void main() ","{","float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);","// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;","// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);","float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));","vec3 sunDirection = normalize(sunPosition);","float sunE = sunIntensity(dot(sunDirection, up));","// extinction (absorbtion + out scattering) ","// rayleigh coefficients","vec3 betaR = simplifiedRayleigh() * reileighCoefficient;","// mie coefficients","vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;","// optical length","// cutoff angle at 90 to avoid singularity in next formula.","float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));","float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","// combined extinction factor ","vec3 Fex = exp(-(betaR * sR + betaM * sM));","// in scattering","float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);","float rPhase = rayleighPhase(cosTheta*0.5+0.5);","vec3 betaRTheta = betaR * rPhase;","float mPhase = hgPhase(cosTheta, mieDirectionalG);","vec3 betaMTheta = betaM * mPhase;","vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));","Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));","//nightsky","vec3 direction = normalize(vWorldPosition - cameraPos);","float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]","float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]","vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);","// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;","vec3 L0 = vec3(0.1) * Fex;","// composition + solar disc","//if (cosTheta > sunAngularDiameterCos)","float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);","// if (normalize(vWorldPosition - cameraPos).y>0.0)","L0 += (sunE * 19000.0 * Fex)*sundisk;","vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));","vec3 texColor = (Lin+L0); ","texColor *= 0.04 ;","texColor += vec3(0.0,0.001,0.0025)*0.3;","float g_fMaxLuminance = 1.0;","float fLumScaled = 0.1 / luminance; ","float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ","float ExposureBias = fLumCompressed;","vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);","vec3 color = curr*whiteScale;","vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));","gl_FragColor.rgb = retColor;","gl_FragColor.a = 1.0;","}"].join("\n")};var a=function(){var e=o["default"].ShaderLib.sky,t=o["default"].UniformsUtils.clone(e.uniforms),n=new o["default"].ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:t,side:o["default"].BackSide}),r=new o["default"].SphereBufferGeometry(45e4,32,15),i=new o["default"].Mesh(r,n);this.mesh=i,this.uniforms=t};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e,t,n){var r=!0,s=!0;if("function"!=typeof e)throw new TypeError(a);return i(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),o(e,t,{leading:r,maxWait:t,trailing:s})}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var o=n(41),a="Expected a function";e.exports=r},function(e,t){function n(e,t,n){function r(){g&&clearTimeout(g),p&&clearTimeout(p),w=0,h=p=y=g=b=void 0}function s(t,n){n&&clearTimeout(n),p=g=b=void 0,t&&(w=_(),d=e.apply(y,h),g||p||(h=y=void 0))}function u(){var e=t-(_()-v);0>=e||e>t?s(b,p):g=setTimeout(u,e)}function l(){return(g&&b||p&&O)&&(d=e.apply(y,h)),r(),d}function c(){s(O,g)}function f(){if(h=arguments,v=_(),y=this,b=O&&(g||!x),k===!1)var n=x&&!g;else{p||x||(w=v);var r=k-(v-w),i=0>=r||r>k;i?(p&&(p=clearTimeout(p)),w=v,d=e.apply(y,h)):p||(p=setTimeout(c,r))}return i&&g?g=clearTimeout(g):g||t===k||(g=setTimeout(u,t)),n&&(i=!0,d=e.apply(y,h)),!i||g||p||(h=y=void 0),d}var h,p,d,v,y,g,b,w=0,x=!1,k=!1,O=!0;if("function"!=typeof e)throw new TypeError(a);return t=o(t)||0,i(n)&&(x=!!n.leading,k="maxWait"in n&&m(o(n.maxWait)||0,t),O="trailing"in n?!!n.trailing:O),f.cancel=r,f.flush=l,f}function r(e){var t=i(e)?y.call(e):"";return t==u||t==l}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){if(i(e)){var t=r(e.valueOf)?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=h.test(e);return n||p.test(e)?d(e.slice(2),n?2:8):f.test(e)?s:+e}var a="Expected a function",s=NaN,u="[object Function]",l="[object GeneratorFunction]",c=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,d=parseInt,v=Object.prototype,y=v.toString,m=Math.max,_=Date.now;e.exports=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(43),o=r(i),a={Orbit:o["default"],orbit:i.orbit,orbit:i.orbit};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0?u(r()):re.y<0&&l(r()),te.copy(ne),B.update()}function v(e){Q.set(e.clientX,e.clientY),ee.subVectors(Q,$),ae(ee.x,ee.y),$.copy(Q),B.update()}function y(e){}function m(e){var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?l(r()):0>t&&u(r()),B.update()}function _(e){switch(e.keyCode){case B.keys.UP:ae(0,B.keyPanSpeed),B.update();break;case B.keys.BOTTOM:ae(0,-B.keyPanSpeed),B.update();break;case B.keys.LEFT:ae(B.keyPanSpeed,0),B.update();break;case B.keys.RIGHT:ae(-B.keyPanSpeed,0),B.update()}}function g(e){Y.set(e.pointers[0].pageX,e.pointers[0].pageY)}function b(e){var t=e.pointers[0].pageX-e.pointers[1].pageX,n=e.pointers[0].pageY-e.pointers[1].pageY,r=Math.sqrt(t*t+n*n);te.set(0,r)}function w(e){$.set(e.deltaX,e.deltaY)}function x(e){J.set(e.pointers[0].pageX,e.pointers[0].pageY),K.subVectors(J,Y);var t=B.domElement===document?B.domElement.body:B.domElement;i(2*Math.PI*K.x/t.clientWidth*B.rotateSpeed),a(2*Math.PI*K.y/t.clientHeight*B.rotateSpeed),Y.copy(J),B.update()}function k(e){var t=e.pointers[0].pageX-e.pointers[1].pageX,n=e.pointers[0].pageY-e.pointers[1].pageY,i=Math.sqrt(t*t+n*n);ne.set(0,i),re.subVectors(ne,te),re.y>0?l(r()):re.y<0&&u(r()),te.copy(ne),B.update()}function O(e){Q.set(e.deltaX,e.deltaY),ee.subVectors(Q,$),ae(ee.x,ee.y),$.copy(Q),B.update()}function E(e){}function M(e){if(B.enabled!==!1){if(e.preventDefault(),e.button===B.mouseButtons.ORBIT){if(B.enableRotate===!1)return;c(e),W=N.ROTATE}else if(e.button===B.mouseButtons.ZOOM){if(B.enableZoom===!1)return;f(e),W=N.DOLLY}else if(e.button===B.mouseButtons.PAN){if(B.enablePan===!1)return;h(e),W=N.PAN}W!==N.NONE&&(document.addEventListener("mousemove",T,!1),document.addEventListener("mouseup",P,!1),document.addEventListener("mouseout",P,!1),B.dispatchEvent(z))}}function T(e){if(B.enabled!==!1)if(e.preventDefault(),W===N.ROTATE){if(B.enableRotate===!1)return;p(e)}else if(W===N.DOLLY){if(B.enableZoom===!1)return;d(e)}else if(W===N.PAN){if(B.enablePan===!1)return;v(e)}}function P(e){B.enabled!==!1&&(y(e),document.removeEventListener("mousemove",T,!1),document.removeEventListener("mouseup",P,!1),document.removeEventListener("mouseout",P,!1),B.dispatchEvent(H),W=N.NONE)}function j(e){B.enabled!==!1&&B.enableZoom!==!1&&W===N.NONE&&(e.preventDefault(),e.stopPropagation(),m(e),B.dispatchEvent(z),B.dispatchEvent(H))}function S(e){B.enabled!==!1&&B.enableKeys!==!1&&B.enablePan!==!1&&_(e)}function C(e){if(B.enabled!==!1){switch(e.touches.length){case 1:if(B.enableRotate===!1)return;g(e),W=N.TOUCH_ROTATE;break;case 2:if(B.enableZoom===!1)return;b(e),W=N.TOUCH_DOLLY;break;case 3:if(B.enablePan===!1)return;w(e),W=N.TOUCH_PAN;break;default:W=N.NONE}W!==N.NONE&&B.dispatchEvent(z)}}function A(e){if(B.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(B.enableRotate===!1)return;if(W!==N.TOUCH_ROTATE)return;x(e);break;case 2:if(B.enableZoom===!1)return;if(W!==N.TOUCH_DOLLY)return;k(e);break;case 3:if(B.enablePan===!1)return;if(W!==N.TOUCH_PAN)return;O(e);break;default:W=N.NONE}}function L(e){B.enabled!==!1&&(E(e),B.dispatchEvent(H),W=N.NONE)}function D(e){e.preventDefault()}this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new o["default"].Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:o["default"].MOUSE.LEFT, -ZOOM:o["default"].MOUSE.MIDDLE,PAN:o["default"].MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return I},this.getAzimuthalAngle=function(){return R},this.reset=function(){B.target.copy(B.target0),B.object.position.copy(B.position0),B.object.zoom=B.zoom0,B.object.updateProjectionMatrix(),B.dispatchEvent(F),B.update(),W=N.NONE},this.update=function(){var t=new o["default"].Vector3,r=(new o["default"].Quaternion).setFromUnitVectors(e.up,new o["default"].Vector3(0,1,0)),a=r.clone().inverse(),s=new o["default"].Vector3,u=new o["default"].Quaternion;return function(){var e=B.object.position;t.copy(e).sub(B.target),t.applyQuaternion(r),R=Math.atan2(t.x,t.z),I=Math.atan2(Math.sqrt(t.x*t.x+t.z*t.z),t.y),B.autoRotate&&W===N.NONE&&i(n()),R+=V,I+=U,R=Math.max(B.minAzimuthAngle,Math.min(B.maxAzimuthAngle,R)),I=Math.max(B.minPolarAngle,Math.min(B.maxPolarAngle,I)),I=Math.max(q,Math.min(Math.PI-q,I));var o=t.length()*G;return o=Math.max(B.minDistance,Math.min(B.maxDistance,o)),B.target.add(Z),t.x=o*Math.sin(I)*Math.sin(R),t.y=o*Math.cos(I),t.z=o*Math.sin(I)*Math.cos(R),t.applyQuaternion(a),e.copy(B.target).add(t),B.object.lookAt(B.target),B.enableDamping===!0?(V*=1-B.dampingFactor,U*=1-B.dampingFactor):(V=0,U=0),G=1,Z.set(0,0,0),X||s.distanceToSquared(B.object.position)>q||8*(1-u.dot(B.object.quaternion))>q?(B.dispatchEvent(F),s.copy(B.object.position),u.copy(B.object.quaternion),X=!1,!0):!1}}(),this.dispose=function(){B.domElement.removeEventListener("contextmenu",D,!1),B.domElement.removeEventListener("mousedown",M,!1),B.domElement.removeEventListener("mousewheel",j,!1),B.domElement.removeEventListener("MozMousePixelScroll",j,!1),B.domElement.removeEventListener("touchstart",C,!1),B.domElement.removeEventListener("touchend",L,!1),B.domElement.removeEventListener("touchmove",A,!1),document.removeEventListener("mousemove",T,!1),document.removeEventListener("mouseup",P,!1),document.removeEventListener("mouseout",P,!1),window.removeEventListener("keydown",S,!1)};var R,I,B=this,F={type:"change"},z={type:"start"},H={type:"end"},N={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},W=N.NONE,q=1e-6,U=0,V=0,G=1,Z=new o["default"].Vector3,X=!1,Y=new o["default"].Vector2,J=new o["default"].Vector2,K=new o["default"].Vector2,$=new o["default"].Vector2,Q=new o["default"].Vector2,ee=new o["default"].Vector2,te=new o["default"].Vector2,ne=new o["default"].Vector2,re=new o["default"].Vector2,ie=function(){var e=new o["default"].Vector3;return function(t,n){var r=n.elements;e.set(r[0],0,r[2]),e.multiplyScalar(-t),Z.add(e)}}(),oe=function(){var e=new o["default"].Vector3;return function(t,n){var r=n.elements,i=t/Math.cos(I);e.set(r[4],0,r[6]),e.multiplyScalar(i),Z.add(e)}}(),ae=function(){var e=new o["default"].Vector3;return function(t,n){var r=B.domElement===document?B.domElement.body:B.domElement;if(B.object instanceof o["default"].PerspectiveCamera){var i=B.object.position;e.copy(i).sub(B.target);var a=e.length();a*=Math.tan(B.object.fov/2*Math.PI/180),ie(2*t*a/r.clientHeight,B.object.matrix),oe(2*n*a/r.clientHeight,B.object.matrix)}else B.object instanceof o["default"].OrthographicCamera?(ie(t*(B.object.right-B.object.left)/r.clientWidth,B.object.matrix),oe(n*(B.object.top-B.object.bottom)/r.clientHeight,B.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),B.enablePan=!1)}}();B.domElement.addEventListener("contextmenu",D,!1),B.domElement.addEventListener("mousedown",M,!1),B.domElement.addEventListener("mousewheel",j,!1),B.domElement.addEventListener("MozMousePixelScroll",j,!1),B.hammer=new s["default"](B.domElement),B.hammer.get("pan").set({pointers:0,direction:s["default"].DIRECTION_ALL}),B.hammer.get("pinch").set({enable:!0,threshold:.1}),B.hammer.on("panstart",function(e){if(B.enabled!==!1&&"mouse"!==e.pointerType){if(1===e.pointers.length){if(B.enablePan===!1)return;w(e),W=N.TOUCH_PAN}else if(2===e.pointers.length){if(B.enableRotate===!1)return;g(e),W=N.TOUCH_ROTATE}W!==N.NONE&&B.dispatchEvent(z)}}),B.hammer.on("panend",function(e){"mouse"!==e.pointerType&&L(e)}),B.hammer.on("panmove",function(e){if(B.enabled!==!1&&"mouse"!==e.pointerType)if(1===e.pointers.length){if(B.enablePan===!1)return;if(W!==N.TOUCH_PAN)return;O(e)}else if(2===e.pointers.length){if(B.enableRotate===!1)return;if(W!==N.TOUCH_ROTATE)return;x(e)}}),B.hammer.on("pinchstart",function(e){B.enabled!==!1&&"mouse"!==e.pointerType&&B.enableZoom!==!1&&(b(e),W=N.TOUCH_DOLLY,W!==N.NONE&&B.dispatchEvent(z))}),B.hammer.on("pinchend",function(e){"mouse"!==e.pointerType&&L(e)}),B.hammer.on("pinchmove",function(e){B.enabled!==!1&&"mouse"!==e.pointerType&&B.enableZoom!==!1&&W===N.TOUCH_DOLLY&&k(e)}),window.addEventListener("keydown",S,!1),this.update()};u.prototype=Object.create(o["default"].EventDispatcher.prototype),u.prototype.constructor=o["default"].OrbitControls,Object.defineProperties(u.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}}),t["default"]=u,e.exports=t["default"]},function(e,t,n){var r;!function(i,o,a,s){"use strict";function u(e,t,n){return setTimeout(p(e,n),t)}function l(e,t,n){return Array.isArray(e)?(c(e,n[t],n),!0):!1}function c(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==s)for(r=0;r\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,r,n),e.apply(this,arguments)}}function h(e,t,n){var r,i=t.prototype;r=e.prototype=Object.create(i),r.constructor=e,r._super=i,n&&fe(r,n)}function p(e,t){return function(){return e.apply(t,arguments)}}function d(e,t){return typeof e==de?e.apply(t?t[0]||s:s,t):e}function v(e,t){return e===s?t:e}function y(e,t,n){c(b(t),function(t){e.addEventListener(t,n,!1)})}function m(e,t,n){c(b(t),function(t){e.removeEventListener(t,n,!1)})}function _(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function g(e,t){return e.indexOf(t)>-1}function b(e){return e.trim().split(/\s+/g)}function w(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;rn[t]}):r.sort()),r}function O(e,t){for(var n,r,i=t[0].toUpperCase()+t.slice(1),o=0;o1&&!n.firstMultiple?n.firstMultiple=L(t):1===i&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,u=t.center=D(r);t.timeStamp=me(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=F(s,u),t.distance=B(s,u),C(n,t),t.offsetDirection=I(t.deltaX,t.deltaY);var l=R(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=l.x,t.overallVelocityY=l.y,t.overallVelocity=ye(l.x)>ye(l.y)?l.x:l.y,t.scale=a?H(a.pointers,r):1,t.rotation=a?z(a.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,A(n,t);var c=e.element;_(t.srcEvent.target,c)&&(c=t.srcEvent.target),t.target=c}function C(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},o=e.prevInput||{};(t.eventType===Se||o.eventType===Ae)&&(i=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function A(e,t){var n,r,i,o,a=e.lastInterval||t,u=t.timeStamp-a.timeStamp;if(t.eventType!=Le&&(u>je||a.velocity===s)){var l=t.deltaX-a.deltaX,c=t.deltaY-a.deltaY,f=R(u,l,c);r=f.x,i=f.y,n=ye(f.x)>ye(f.y)?f.x:f.y,o=I(l,c),e.lastInterval=t}else n=a.velocity,r=a.velocityX,i=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=r,t.velocityY=i,t.direction=o}function L(e){for(var t=[],n=0;ni;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:ve(n/t),y:ve(r/t)}}function R(e,t,n){return{x:t/e||0,y:n/e||0}}function I(e,t){return e===t?De:ye(e)>=ye(t)?0>e?Re:Ie:0>t?Be:Fe}function B(e,t,n){n||(n=We);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function F(e,t,n){n||(n=We);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return 180*Math.atan2(i,r)/Math.PI}function z(e,t){return F(t[1],t[0],qe)+F(e[1],e[0],qe)}function H(e,t){return B(t[0],t[1],qe)/B(e[0],e[1],qe)}function N(){this.evEl=Ve,this.evWin=Ge,this.allow=!0,this.pressed=!1,T.apply(this,arguments)}function W(){this.evEl=Ye,this.evWin=Je,T.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function q(){this.evTarget=$e,this.evWin=Qe,this.started=!1,T.apply(this,arguments)}function U(e,t){var n=x(e.touches),r=x(e.changedTouches);return t&(Ae|Le)&&(n=k(n.concat(r),"identifier",!0)),[n,r]}function V(){this.evTarget=tt,this.targetIds={},T.apply(this,arguments)}function G(e,t){var n=x(e.touches),r=this.targetIds;if(t&(Se|Ce)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=x(e.changedTouches),s=[],u=this.target;if(o=n.filter(function(e){return _(e.target,u)}),t===Se)for(i=0;is&&(t.push(e),s=t.length-1):i&(Ae|Le)&&(n=!0),0>s||(t[s]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var Ke={touchstart:Se,touchmove:Ce,touchend:Ae,touchcancel:Le},$e="touchstart",Qe="touchstart touchmove touchend touchcancel";h(q,T,{handler:function(e){var t=Ke[e.type];if(t===Se&&(this.started=!0),this.started){var n=U.call(this,e,t);t&(Ae|Le)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Ee,srcEvent:e})}}});var et={touchstart:Se,touchmove:Ce,touchend:Ae,touchcancel:Le},tt="touchstart touchmove touchend touchcancel";h(V,T,{handler:function(e){var t=et[e.type],n=G.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Ee,srcEvent:e})}}),h(Z,T,{handler:function(e,t,n){var r=n.pointerType==Ee,i=n.pointerType==Te;if(r)this.mouse.allow=!1;else if(i&&!this.mouse.allow)return;t&(Ae|Le)&&(this.mouse.allow=!0),this.callback(e,t,n)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var nt=O(pe.style,"touchAction"),rt=nt!==s,it="compute",ot="auto",at="manipulation",st="none",ut="pan-x",lt="pan-y";X.prototype={set:function(e){e==it&&(e=this.compute()),rt&&this.manager.element.style&&(this.manager.element.style[nt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return c(this.manager.recognizers,function(t){d(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),Y(e.join(" "))},preventDefaults:function(e){if(!rt){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)return void t.preventDefault();var r=this.actions,i=g(r,st),o=g(r,lt),a=g(r,ut);if(i){var s=1===e.pointers.length,u=e.distance<2,l=e.deltaTime<250;if(s&&u&&l)return}if(!a||!o)return i||o&&n&ze||a&&n&He?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var ct=1,ft=2,ht=4,pt=8,dt=pt,vt=16,yt=32;J.prototype={defaults:{},set:function(e){return fe(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(l(e,"recognizeWith",this))return this;var t=this.simultaneous;return e=Q(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return l(e,"dropRecognizeWith",this)?this:(e=Q(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(l(e,"requireFailure",this))return this;var t=this.requireFail;return e=Q(e,this),-1===w(t,e)&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(l(e,"dropRequireFailure",this))return this;e=Q(e,this);var t=w(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){n.manager.emit(t,e)}var n=this,r=this.state;pt>r&&t(n.options.event+K(r)),t(n.options.event),e.additionalEvent&&t(e.additionalEvent),r>=pt&&t(n.options.event+K(r))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=yt)},canEmit:function(){for(var e=0;eo?Re:Ie,n=o!=this.pX,r=Math.abs(e.deltaX)):(i=0===a?De:0>a?Be:Fe,n=a!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return ee.prototype.attrTest.call(this,e)&&(this.state&ft||!(this.state&ft)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=$(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),h(ne,ee,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&ft)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),h(re,J,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ot]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distancet.time;if(this._input=e,!r||!n||e.eventType&(Ae|Le)&&!i)this.reset();else if(e.eventType&Se)this.reset(),this._timer=u(function(){this.state=dt,this.tryEmit()},t.time,this);else if(e.eventType&Ae)return dt;return yt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===dt&&(e&&e.eventType&Ae?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=me(),this.manager.emit(this.options.event,this._input)))}}),h(ie,ee,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&ft)}}),h(oe,ee,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ze|He,pointers:1},getTouchAction:function(){return te.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(ze|He)?t=e.overallVelocity:n&ze?t=e.overallVelocityX:n&He&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&ye(t)>this.options.velocity&&e.eventType&Ae},emit:function(e){var t=$(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),h(ae,J,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[at]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance0){var i=n.getCenter(),o=new v["default"].Vector3(i[0],0,i[1]).sub(t.position).length();if(o>e._options.distance)return!1}return n.getMesh()||n.requestTileAsync(),!0})}}},{key:"_divide",value:function(e){for(var t,n,r=0;r!=e.length;)t=e[r],n=t.getQuadcode(),t.length!==this._maxLOD&&this._screenSpaceError(t)?(e.splice(r,1),e.push(this._requestTile(n+"0",this)),e.push(this._requestTile(n+"1",this)),e.push(this._requestTile(n+"2",this)),e.push(this._requestTile(n+"3",this))):r++}},{key:"_screenSpaceError",value:function(e){var t=this._minLOD,n=this._maxLOD,r=e.getQuadcode(),i=this._world.getCamera(),o=3;if(r.length===n)return!1;if(r.length1}},{key:"_removeTiles",value:function(){if(this._tiles&&this._tiles.children){for(var e=this._tiles.children.length-1;e>=0;e--)this._tiles.remove(this._tiles.children[e]);if(this._tilesPicking&&this._tilesPicking.children)for(var e=this._tilesPicking.children.length-1;e>=0;e--)this._tilesPicking.remove(this._tilesPicking.children[e])}}},{key:"_createTile",value:function(e,t){}},{key:"_requestTile",value:function(e,t){var n=this._tileCache.getTile(e);return n||(n=this._createTile(e,t),this._tileCache.setTile(e,n)),n}},{key:"_destroyTile",value:function(e){this._tiles.remove(e.getMesh()),e.destroy()}},{key:"destroy",value:function(){if(this._tiles.children)for(var e=this._tiles.children.length-1;e>=0;e--)this._tiles.remove(this._tiles.children[e]);if(this.removeFromPicking(this._tilesPicking),this._tilesPicking.children)for(var e=this._tilesPicking.children.length-1;e>=0;e--)this._tilesPicking.remove(this._tilesPicking.children[e]);this._tileCache.destroy(),this._tileCache=null,this._tiles=null,this._tilesPicking=null,this._frustum=null,s(Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(l["default"]);t["default"]=y,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=t)&&r(this,"max",1/0);var n=e.length||i;"function"!=typeof n&&(n=i),r(this,"lengthCalculator",n),r(this,"allowStale",e.stale||!1),r(this,"maxAge",e.maxAge||0),r(this,"dispose",e.dispose),this.reset()}function a(e,t,n,i){var o=n.value;u(e,o)&&(c(e,n),r(e,"allowStale")||(o=void 0)),o&&t.call(i,o.value,o.key,e)}function s(e,t,n){var i=r(e,"cache").get(t);if(i){var o=i.value;u(e,o)?(c(e,i),r(e,"allowStale")||(o=void 0)):n&&r(e,"lruList").unshiftNode(i),o&&(o=o.value)}return o}function u(e,t){if(!t||!t.maxAge&&!r(e,"maxAge"))return!1;var n=!1,i=Date.now()-t.now;return n=t.maxAge?i>t.maxAge:r(e,"maxAge")&&i>r(e,"maxAge")}function l(e){if(r(e,"length")>r(e,"max"))for(var t=r(e,"lruList").tail;r(e,"length")>r(e,"max")&&null!==t;){var n=t.prev;c(e,t),t=n}}function c(e,t){if(t){var n=t.value;r(e,"dispose")&&r(e,"dispose").call(this,n.key,n.value),r(e,"length",r(e,"length")-n.length),r(e,"cache")["delete"](n.key),r(e,"lruList").removeNode(t)}}function f(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}e.exports=o;var h,p=n(50),d=n(53),v=n(56),y={},m="function"==typeof Symbol;h=m?function(e){return Symbol["for"](e)}:function(e){return"_"+e},Object.defineProperty(o.prototype,"max",{set:function(e){(!e||"number"!=typeof e||0>=e)&&(e=1/0),r(this,"max",e),l(this)},get:function(){return r(this,"max")},enumerable:!0}),Object.defineProperty(o.prototype,"allowStale",{set:function(e){r(this,"allowStale",!!e)},get:function(){return r(this,"allowStale")},enumerable:!0}),Object.defineProperty(o.prototype,"maxAge",{set:function(e){(!e||"number"!=typeof e||0>e)&&(e=0),r(this,"maxAge",e),l(this)},get:function(){return r(this,"maxAge")},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(e){"function"!=typeof e&&(e=i),e!==r(this,"lengthCalculator")&&(r(this,"lengthCalculator",e),r(this,"length",0),r(this,"lruList").forEach(function(e){e.length=r(this,"lengthCalculator").call(this,e.value,e.key),r(this,"length",r(this,"length")+e.length)},this)),l(this)},get:function(){return r(this,"lengthCalculator")},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return r(this,"length")},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return r(this,"lruList").length},enumerable:!0}),o.prototype.rforEach=function(e,t){t=t||this;for(var n=r(this,"lruList").tail;null!==n;){var i=n.prev;a(this,e,n,t),n=i}},o.prototype.forEach=function(e,t){t=t||this;for(var n=r(this,"lruList").head;null!==n;){var i=n.next;a(this,e,n,t),n=i}},o.prototype.keys=function(){return r(this,"lruList").toArray().map(function(e){return e.key},this)},o.prototype.values=function(){return r(this,"lruList").toArray().map(function(e){return e.value},this)},o.prototype.reset=function(){r(this,"dispose")&&r(this,"lruList")&&r(this,"lruList").length&&r(this,"lruList").forEach(function(e){r(this,"dispose").call(this,e.key,e.value)},this),r(this,"cache",new p),r(this,"lruList",new v),r(this,"length",0)},o.prototype.dump=function(){return r(this,"lruList").map(function(e){return u(this,e)?void 0:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}},this).toArray().filter(function(e){return e})},o.prototype.dumpLru=function(){return r(this,"lruList")},o.prototype.inspect=function(e,t){var n="LRUCache {",o=!1,a=r(this,"allowStale");a&&(n+="\n allowStale: true",o=!0);var s=r(this,"max");s&&s!==1/0&&(o&&(n+=","),n+="\n max: "+d.inspect(s,t),o=!0);var l=r(this,"maxAge");l&&(o&&(n+=","),n+="\n maxAge: "+d.inspect(l,t),o=!0);var c=r(this,"lengthCalculator");c&&c!==i&&(o&&(n+=","),n+="\n length: "+d.inspect(r(this,"length"),t),o=!0);var f=!1;return r(this,"lruList").forEach(function(e){f?n+=",\n ":(o&&(n+=",\n"),f=!0,n+="\n ");var r=d.inspect(e.key).split("\n").join("\n "),a={value:e.value};e.maxAge!==l&&(a.maxAge=e.maxAge),c!==i&&(a.length=e.length),u(this,e)&&(a.stale=!0),a=d.inspect(a,t).split("\n").join("\n "),n+=r+" => "+a}),(f||o)&&(n+="\n"),n+="}"},o.prototype.set=function(e,t,n){n=n||r(this,"maxAge");var i=n?Date.now():0,o=r(this,"lengthCalculator").call(this,t,e);if(r(this,"cache").has(e)){if(o>r(this,"max"))return c(this,r(this,"cache").get(e)),!1;var a=r(this,"cache").get(e),s=a.value;return r(this,"dispose")&&r(this,"dispose").call(this,e,s.value),s.now=i,s.maxAge=n,s.value=t,r(this,"length",r(this,"length")+(o-s.length)),s.length=o,this.get(e),l(this),!0}var u=new f(e,t,o,i,n);return u.length>r(this,"max")?(r(this,"dispose")&&r(this,"dispose").call(this,e,t),!1):(r(this,"length",r(this,"length")+u.length),r(this,"lruList").unshift(u),r(this,"cache").set(e,r(this,"lruList").head),l(this),!0)},o.prototype.has=function(e){if(!r(this,"cache").has(e))return!1;var t=r(this,"cache").get(e).value;return u(this,t)?!1:!0},o.prototype.get=function(e){return s(this,e,!0)},o.prototype.peek=function(e){return s(this,e,!1)},o.prototype.pop=function(){var e=r(this,"lruList").tail;return e?(c(this,e),e.value):null},o.prototype.del=function(e){c(this,r(this,"cache").get(e))},o.prototype.load=function(e){this.reset();for(var t=Date.now(),n=e.length-1;n>=0;n--){var r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{var o=i-t;o>0&&this.set(r.k,r.v,o)}}},o.prototype.prune=function(){var e=this;r(this,"cache").forEach(function(t,n){s(e,n,!1)})}},function(e,t,n){(function(t){"pseudomap"===t.env.npm_package_name&&"test"===t.env.npm_lifecycle_script&&(t.env.TEST_PSEUDOMAP="true"),"function"!=typeof Map||t.env.TEST_PSEUDOMAP?e.exports=n(52):e.exports=Map}).call(t,n(51))},function(e,t){function n(){l=!1,a.length?u=a.concat(u):c=-1,u.length&&r()}function r(){if(!l){var e=setTimeout(n);l=!0;for(var t=u.length;t;){for(a=u,u=[];++c1)for(var n=1;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,n,r){if(e.customInspect&&n&&M(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return g(i)||(i=u(e,i,r)),i}var o=l(e,n);if(o)return o;var a=Object.keys(n),v=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),E(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(n);if(0===a.length){if(M(n)){var y=n.name?": "+n.name:"";return e.stylize("[Function"+y+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(O(n))return e.stylize(Date.prototype.toString.call(n),"date");if(E(n))return c(n)}var m="",_=!1,b=["{","}"];if(d(n)&&(_=!0,b=["[","]"]),M(n)){var w=n.name?": "+n.name:"";m=" [Function"+w+"]"}if(x(n)&&(m=" "+RegExp.prototype.toString.call(n)),O(n)&&(m=" "+Date.prototype.toUTCString.call(n)),E(n)&&(m=" "+c(n)),0===a.length&&(!_||0==n.length))return b[0]+m+b[1];if(0>r)return x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var k;return k=_?f(e,n,r,v,a):a.map(function(t){return h(e,n,r,v,t,_)}),e.seen.pop(),p(k,m,b)}function l(e,t){if(w(t))return e.stylize("undefined","undefined");if(g(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):v(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i){for(var o=[],a=0,s=t.length;s>a;++a)C(t,String(a))?o.push(h(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))}),o}function h(e,t,n,r,i,o){var a,s,l;if(l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},l.get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),C(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=y(n)?u(e,l.value,null):u(e,l.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function d(e){return Array.isArray(e)}function v(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return null==e}function _(e){return"number"==typeof e}function g(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function w(e){return void 0===e}function x(e){return k(e)&&"[object RegExp]"===P(e)}function k(e){return"object"==typeof e&&null!==e}function O(e){return k(e)&&"[object Date]"===P(e)}function E(e){return k(e)&&("[object Error]"===P(e)||e instanceof Error)}function M(e){return"function"==typeof e}function T(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function P(e){return Object.prototype.toString.call(e)}function j(e){return 10>e?"0"+e.toString(10):e.toString(10)}function S(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var A=/%[sdj%]/g;t.format=function(e){if(!g(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),s=r[n];o>n;s=r[++n])a+=y(s)||!k(s)?" "+s:" "+i(s);return a},t.deprecate=function(n,i){function o(){if(!a){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return n.apply(this,arguments)}if(w(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var a=!1;return o};var L,D={};t.debuglog=function(e){if(w(L)&&(L=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!D[e])if(new RegExp("\\b"+e+"\\b","i").test(L)){var n=r.pid;D[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else D[e]=function(){};return D[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=v,t.isNull=y,t.isNullOrUndefined=m,t.isNumber=_,t.isString=g,t.isSymbol=b,t.isUndefined=w,t.isRegExp=x,t.isObject=k,t.isDate=O,t.isError=E,t.isFunction=M,t.isPrimitive=T,t.isBuffer=n(54);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",S(),t.format.apply(t,arguments))},t.inherits=n(55),t._extend=function(e,t){if(!t||!k(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(51))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;i>r;r++)t.push(arguments[r]);return t}function r(e,t){e.tail=new o(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function i(e,t){e.head=new o(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function o(e,t,n,r){return this instanceof o?(this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,void(n?(n.prev=this,this.next=n):this.next=null)):new o(e,t,n,r)}e.exports=n,n.Node=o,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;t>e;e++)r(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;t>e;e++)i(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail.next=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head.prev=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;null!==n;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;null!==n;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&e>t;t++)n=n.next;return t===e&&null!==n?n.value:void 0},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&e>t;t++)n=n.prev;return t===e&&null!==n?n.value:void 0},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t=t||this.length,0>t&&(t+=this.length),e=e||0,0>e&&(e+=this.length);var r=new n;if(e>t||0>t)return r;0>e&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&e>i;i++)o=o.next;for(;null!==o&&t>i;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){t=t||this.length,0>t&&(t+=this.length),e=e||0,0>e&&(e+=this.length);var r=new n;if(e>t||0>t)return r;0>e&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this}},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0;i--){var o=1<0&&(l=x["default"].createLineGeometry(s,o),c=new h["default"].LineBasicMaterial({vertexColors:h["default"].VertexColors,linewidth:i.lineWidth,transparent:i.lineTransparent,opacity:i.lineOpacity,blending:i.lineBlending}),f=new h["default"].LineSegments(l,c),void 0!==i.lineRenderOrder&&(c.depthWrite=!1,f.renderOrder=i.lineRenderOrder),this._mesh.add(f),this._options.picking)){c=new O["default"],c.side=h["default"].BackSide,c.linewidth=i.lineWidth+c.linePadding;var p=new h["default"].LineSegments(l,c);this._pickingMesh.add(p)}if(a.facesCount>0&&(l=x["default"].createGeometry(a,o),this._world._environment._skybox?(c=new h["default"].MeshStandardMaterial({vertexColors:h["default"].VertexColors,side:h["default"].BackSide}),c.roughness=1,c.metalness=.1,c.envMapIntensity=3,c.envMap=this._world._environment._skybox.getRenderTarget()):c=new h["default"].MeshPhongMaterial({vertexColors:h["default"].VertexColors,side:h["default"].BackSide}),f=new h["default"].Mesh(l,c),f.castShadow=!0,f.receiveShadow=!0,a.allFlat&&(c.depthWrite=!1,f.renderOrder=1),this._mesh.add(f),this._options.picking)){c=new O["default"],c.side=h["default"].BackSide;var p=new h["default"].Mesh(l,c);this._pickingMesh.add(p)}this._ready=!0,console.timeEnd(this._tile),console.log(this._tile+": "+r.length+" features")}},{key:"_abortRequest",value:function(){this._request&&this._request.abort()}}]),t}(l["default"]);t["default"]=E;var M=function(e,t,n,r){return new E(e,t,n,r)};t.geoJSONTile=M},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__;!function(e,t,n){"undefined"!=typeof module&&module.exports?module.exports=n():(__WEBPACK_AMD_DEFINE_FACTORY__=n,__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof __WEBPACK_AMD_DEFINE_FACTORY__?__WEBPACK_AMD_DEFINE_FACTORY__.call(exports,__webpack_require__,exports,module):__WEBPACK_AMD_DEFINE_FACTORY__,!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}("reqwest",this,function(){function succeed(e){var t=protocolRe.exec(e.url);return t=t&&t[1]||context.location.protocol,httpsRe.test(t)?twoHundo.test(e.request.status):!!e.request.response}function handleReadyState(e,t,n){return function(){return e._aborted?n(e.request):e._timedOut?n(e.request,"Request is aborted: timeout"):void(e.request&&4==e.request[readyState]&&(e.request.onreadystatechange=noop,succeed(e)?t(e.request):n(e.request)))}}function setHeaders(e,t){var n,r=t.headers||{};r.Accept=r.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"];var i="undefined"!=typeof FormData&&t.data instanceof FormData;t.crossOrigin||r[requestedWith]||(r[requestedWith]=defaultHeaders.requestedWith),r[contentType]||i||(r[contentType]=t.contentType||defaultHeaders.contentType);for(n in r)r.hasOwnProperty(n)&&"setRequestHeader"in e&&e.setRequestHeader(n,r[n])}function setCredentials(e,t){"undefined"!=typeof t.withCredentials&&"undefined"!=typeof e.withCredentials&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var i=uniqid++,o=e.jsonpCallback||"callback",a=e.jsonpCallbackName||reqwest.getcallbackPrefix(i),s=new RegExp("((^|\\?|&)"+o+")=([^&]+)"),u=r.match(s),l=doc.createElement("script"),c=0,f=-1!==navigator.userAgent.indexOf("MSIE 10.0");return u?"?"===u[3]?r=r.replace(s,"$1="+a):a=u[3]:r=urlappend(r,o+"="+a),context[a]=generalCallback,l.type="text/javascript",l.src=r,l.async=!0,"undefined"==typeof l.onreadystatechange||f||(l.htmlFor=l.id="_reqwest_"+i),l.onload=l.onreadystatechange=function(){return l[readyState]&&"complete"!==l[readyState]&&"loaded"!==l[readyState]||c?!1:(l.onload=l.onreadystatechange=null,l.onclick&&l.onclick(),t(lastValue),lastValue=void 0,head.removeChild(l),void(c=1))},head.appendChild(l),{abort:function(){l.onload=l.onreadystatechange=null,n({},"Request is aborted: timeout",{}),lastValue=void 0,head.removeChild(l),c=1}}}function getRequest(e,t){var n,r=this.o,i=(r.method||"GET").toUpperCase(),o="string"==typeof r?r:r.url,a=r.processData!==!1&&r.data&&"string"!=typeof r.data?reqwest.toQueryString(r.data):r.data||null,s=!1;return"jsonp"!=r.type&&"GET"!=i||!a||(o=urlappend(o,a),a=null),"jsonp"==r.type?handleJsonp(r,e,t,o):(n=r.xhr&&r.xhr(r)||xhr(r),n.open(i,o,r.async===!1?!1:!0),setHeaders(n,r),setCredentials(n,r),context[xDomainRequest]&&n instanceof context[xDomainRequest]?(n.onload=e,n.onerror=t,n.onprogress=function(){},s=!0):n.onreadystatechange=handleReadyState(this,e,t),r.before&&r.before(n),s?setTimeout(function(){n.send(a)},200):n.send(a),n)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){return null!==e?e.match("json")?"json":e.match("javascript")?"js":e.match("text")?"html":e.match("xml")?"xml":void 0:void 0}function init(o,fn){function complete(e){for(o.timeout&&clearTimeout(self.timeout),self.timeout=null;self._completeHandlers.length>0;)self._completeHandlers.shift()(e)}function success(resp){var type=o.type||resp&&setType(resp.getResponseHeader("Content-Type"));resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=context.JSON?context.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function timedOut(){self._timedOut=!0,self.request.abort()}function error(e,t,n){for(e=self.request,self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(e,t,n);complete(e)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){timedOut()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n,r,i,o,a=e.name,s=e.tagName.toLowerCase(),u=function(e){e&&!e.disabled&&t(a,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(!e.disabled&&a)switch(s){case"input":/reset|button|image|file/i.test(e.type)||(n=/checkbox/i.test(e.type),r=/radio/i.test(e.type),i=e.value,(!(n||r)||e.checked)&&t(a,normalize(n&&""===i?"on":i)));break;case"textarea":t(a,normalize(e.value));break;case"select":if("select-one"===e.type.toLowerCase())u(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(o=0;e.length&&on;){var i=n+r>>>1;e[i]e?~e:e],o=0,a=r.length;a>o;++o)t.push(n=r[o].slice()),c(n,o);0>e&&i(t,a)}function o(e){return e=e.slice(),c(e,0),e}function a(e){for(var t=[],n=0,i=e.length;i>n;++n)r(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0].slice());return t}function u(e){return e.map(s)}function l(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(l)}:t in h?{type:t,coordinates:h[t](e)}:null}var c=n(e.transform),f=e.arcs,h={Point:function(e){return o(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(o)},LineString:function(e){return a(e.arcs)},MultiLineString:function(e){return e.arcs.map(a)},Polygon:function(e){return u(e.arcs)},MultiPolygon:function(e){return e.arcs.map(u)}};return l(t)}function l(e,t){function n(t){var n,r=e.arcs[0>t?~t:t],i=r[0];return e.transform?(n=[0,0],r.forEach(function(e){n[0]+=e[0],n[1]+=e[1]})):n=r[r.length-1],0>t?[n,i]:[i,n]}function r(e,t){for(var n in e){var r=e[n];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){i[0>e?~e:e]=1}),s.push(r)}}var i={},o={},a={},s=[],u=-1;return t.forEach(function(n,r){var i,o=e.arcs[0>n?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=t[++u],t[u]=n,t[r]=i)}),t.forEach(function(e){var t,r,i=n(e),s=i[0],u=i[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=u,r=o[u]){delete o[r.start];var l=r===t?t:t.concat(r);o[l.start=t.start]=a[l.end=r.end]=l}else o[t.start]=a[t.end]=t;else if(t=o[u])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=u]=t}),r(a,o),r(o,a),t.forEach(function(e){i[0>e?~e:e]||s.push([e])}),s}function c(e){return u(e,f.apply(this,arguments))}function f(e,t,n){function r(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function i(e){e.forEach(r)}function o(e){e.forEach(i)}function a(e){"GeometryCollection"===e.type?e.geometries.forEach(a):e.type in f&&(u=e,f[e.type](e.arcs))}var s=[];if(arguments.length>1){var u,c=[],f={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(e){e.forEach(o)}};a(t),c.forEach(arguments.length<3?function(e){s.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&s.push(e[0].i)})}else for(var h=0,p=e.arcs.length;p>h;++h)s.push(h);return{type:"MultiLineString",arcs:l(e,s)}}function h(e){var t=e[0],n=e[1],r=e[2];return Math.abs((t[0]-r[0])*(n[1]-t[1])-(t[0]-n[0])*(r[1]-t[1]))}function p(e){for(var t,n=-1,r=e.length,i=e[r-1],o=0;++nt?~t:t]||(i[t]=[])).push(e)})}),o.push(e)}function r(t){return p(u(e,{type:"Polygon",arcs:[t]}).coordinates[0])>0}var i={},o=[],a=[];return t.forEach(function(e){"Polygon"===e.type?n(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(n)}),o.forEach(function(e){if(!e._){var t=[],n=[e];for(e._=1,a.push(t);e=n.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].forEach(function(e){e._||(e._=1,n.push(e))})})})}}),o.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:a.map(function(t){var n,o=[];if(t.forEach(function(e){e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].length<2&&o.push(e)})})}),o=l(e,o),(n=o.length)>1)for(var a,s=r(t[0][0]),u=0;n>u;++u)if(s===r(o[u])){a=o[0],o[0]=o[u],o[u]=a;break}return o})}}function y(e){function t(e,t){e.forEach(function(e){0>e&&(e=~e);var n=i[e];n?n.push(t):i[e]=[t]})}function n(e,n){e.forEach(function(e){t(e,n)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in s&&s[e.type](e.arcs,t)}var i={},a=e.map(function(){return[]}),s={LineString:t,MultiLineString:n,Polygon:n,MultiPolygon:function(e,t){e.forEach(function(e){n(e,t)})}};e.forEach(r);for(var u in i)for(var l=i[u],c=l.length,f=0;c>f;++f)for(var h=f+1;c>h;++h){var p,d=l[f],v=l[h];(p=a[d])[u=o(p,v)]!==v&&p.splice(u,0,v),(p=a[v])[u=o(p,d)]!==d&&p.splice(u,0,d)}return a}function m(e,t){return e[1][2]-t[1][2]}function _(){function e(e,t){for(;t>0;){var n=(t+1>>1)-1,i=r[n];if(m(e,i)>=0)break;r[i._=t]=i,r[e._=t=n]=e}}function t(e,t){for(;;){var n=t+1<<1,o=n-1,a=t,s=r[a];if(i>o&&m(r[o],s)<0&&(s=r[a=o]),i>n&&m(r[n],s)<0&&(s=r[a=n]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var n={},r=[],i=0;return n.push=function(t){return e(r[t._=i]=t,i++),i},n.pop=function(){if(!(0>=i)){var e,n=r[0];return--i>0&&(e=r[i],t(r[e._=0]=e,0)),n}},n.remove=function(n){var o,a=n._;if(r[a]===n)return a!==--i&&(o=r[i],(m(o,n)<0?e:t)(r[o._=a]=o,a)),a},n}function g(e,t){function i(e){s.remove(e),e[1][2]=t(e),s.push(e)}var o=n(e.transform),a=r(e.transform),s=_();return t||(t=h),e.arcs.forEach(function(e){var n,r,u,l,c=[],f=0;for(r=0,u=e.length;u>r;++r)l=e[r],o(e[r]=[l[0],l[1],1/0],r);for(r=1,u=e.length-1;u>r;++r)n=e.slice(r-1,r+2),n[1][2]=t(n),c.push(n),s.push(n);for(r=0,u=c.length;u>r;++r)n=c[r],n.previous=c[r-1],n.next=c[r+1];for(;n=s.pop();){var h=n.previous,p=n.next;n[1][2]0){var c=m["default"].mergeAttributes(a);this._setPolygonMesh(c,s),this.add(this._polygonMesh)}if(u.length>0){var h=m["default"].mergeAttributes(u);this._setPolylineMesh(h),this.add(this._polylineMesh)}if(l.length>0){var p=m["default"].mergeAttributes(l);this._setPointMesh(p),this.add(this._pointMesh)}}}},{key:"_setPolygonMesh",value:function(e,t){var n=new THREE.BufferGeometry;n.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),n.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),n.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&n.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),n.computeBoundingBox();var r;if(this._world._environment._skybox?(r=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide}),r.roughness=1,r.metalness=.1,r.envMapIntensity=3,r.envMap=this._world._environment._skybox.getRenderTarget()):r=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide}),mesh=new THREE.Mesh(n,r),mesh.castShadow=!0,mesh.receiveShadow=!0,t&&(r.depthWrite=!1,mesh.renderOrder=1),this._options.interactive&&this._pickingMesh){r=new g["default"],r.side=THREE.BackSide;var i=new THREE.Mesh(n,r);this._pickingMesh.add(i)}this._polygonMesh=mesh}},{key:"_setPolylineMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n="function"==typeof this._options.style?this._options.style(this._geojson.features[0]):this._options.style;n=(0,f["default"])({},v["default"].defaultStyle,n);var r=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,linewidth:n.lineWidth,transparent:n.lineTransparent,opacity:n.lineOpacity,blending:n.lineBlending}),i=new THREE.LineSegments(t,r);if(void 0!==n.lineRenderOrder&&(r.depthWrite=!1,i.renderOrder=n.lineRenderOrder),i.castShadow=!0,this._options.interactive&&this._pickingMesh){r=new g["default"],r.linewidth=n.lineWidth+r.linePadding;var o=new THREE.LineSegments(t,r);this._pickingMesh.add(o)}this._polylineMesh=i}},{key:"_setPointMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),t.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n;if(this._world._environment._skybox?(n=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors}),n.roughness=1,n.metalness=.1,n.envMapIntensity=3,n.envMap=this._world._environment._skybox.getRenderTarget()):n=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors}),mesh=new THREE.Mesh(t,n),mesh.castShadow=!0,this._options.interactive&&this._pickingMesh){n=new g["default"];var r=new THREE.Mesh(t,n);this._pickingMesh.add(r)}this._pointMesh=mesh}},{key:"_featureToLayer",value:function(e,t){var n=e.geometry,r=n.coordinates?n.coordinates:null;return r&&n?"Polygon"===n.type||"MultiPolygon"===n.type?new w["default"](r,t):"LineString"===n.type||"MultiLineString"===n.type?new k["default"](r,t):"Point"===n.type||"MultiPoint"===n.type?("function"==typeof this._options.pointGeometry&&(t.geometry=this._options.pointGeometry(e)),new E["default"](r,t)):void 0:void 0}},{key:"_abortRequest",value:function(){this._request&&this._request.abort()}},{key:"destroy",value:function(){this._abortRequest(),this._request=null,this._pickingMesh&&(this._pickingMesh=null),s(Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(l["default"]);t["default"]=M;var T=function(e,t){return new M(e,t)};t.geoJSONLayer=T},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n-1&&this._layers.splice(t,1),this._world.removeLayer(e)}},{key:"_onAdd",value:function(e){}},{key:"destroy",value:function(){for(var e=0;e0&&(r+=e[i-1].length,n.holes.push(r))}return n}},{key:"_triangulate",value:function(e,t,n){var r=(0,_["default"])(e,t,n),o=[];for(i=0,il=r.length;i80*n){l=h=e[0],f=p=e[1];for(var m=n;a>m;m+=n)d=e[m],v=e[m+1],l>d&&(l=d),f>v&&(f=v),d>h&&(h=d),v>p&&(p=v);y=Math.max(h-l,p-f)}return o(s,u,n,l,f,y),u}function r(e,t,n,r,i){var o,a,s,u=0;for(o=t,a=n-r;n>o;o+=r)u+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;if(i===u>0)for(o=t;n>o;o+=r)s=T(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=T(o,e[o],e[o+1],s);return s}function i(e,t){if(!e)return e;t||(t=e);var n,r=e;do if(n=!1,r.steiner||!w(r,r.next)&&0!==b(r.prev,r,r.next))r=r.next;else{if(P(r),r=t=r.prev,r===r.next)return null;n=!0}while(n||r!==t);return t}function o(e,t,n,r,c,f,h){if(e){!h&&f&&d(e,r,c,f);for(var p,v,y=e;e.prev!==e.next;)if(p=e.prev,v=e.next,f?s(e,r,c,f):a(e))t.push(p.i/n),t.push(e.i/n),t.push(v.i/n),P(e),e=v.next,y=v.next;else if(e=v,e===y){h?1===h?(e=u(e,t,n),o(e,t,n,r,c,f,2)):2===h&&l(e,t,n,r,c,f):o(i(e),t,n,r,c,f,1);break}}}function a(e){var t=e.prev,n=e,r=e.next;if(b(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(_(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function s(e,t,n,r){var i=e.prev,o=e,a=e.next;if(b(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=y(s,u,t,n,r),h=y(l,c,t,n,r),p=e.nextZ;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&_(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=e.prevZ;p&&p.z>=f;){if(p!==e.prev&&p!==e.next&&_(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function u(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;x(i,r,r.next,o)&&O(i,o)&&O(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),P(r),P(r.next),r=e=o),r=r.next}while(r!==e);return r}function l(e,t,n,r,a,s){var u=e;do{for(var l=u.next.next;l!==u.prev;){if(u.i!==l.i&&g(u,l)){var c=M(u,l);return u=i(u,u.next),c=i(c,c.next),o(u,t,n,r,a,s),void o(c,t,n,r,a,s)}l=l.next}u=u.next}while(u!==e)}function c(e,t,n,o){var a,s,u,l,c,p=[];for(a=0,s=t.length;s>a;a++)u=t[a]*o,l=s-1>a?t[a+1]*o:e.length,c=r(e,u,l,o,!1),c===c.next&&(c.steiner=!0),p.push(m(c));for(p.sort(f),a=0;a=r.next.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);i>=s&&s>a&&(a=s,n=r.x=r.x&&r.x>=n.x&&_(ou||u===c&&r.x>n.x)&&O(r,e)&&(n=r,c=u)),r=r.next;return n}function d(e,t,n,r){var i=e;do null===i.z&&(i.z=y(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,v(i)}function v(e){var t,n,r,i,o,a,s,u,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,r=n,s=0,t=0;l>t&&(s++,r=r.nextZ,r);t++);for(u=l;s>0||u>0&&r;)0===s?(i=r,r=r.nextZ,u--):0!==u&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--):(i=n,n=n.nextZ,s--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(a>1);return e}function y(e,t,n,r,i){return e=32767*(e-n)/i,t=32767*(t-r)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function m(e){var t=e,n=e;do t.x=0&&(e-a)*(r-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function g(e,t){return w(e,t)||e.next.i!==t.i&&e.prev.i!==t.i&&!k(e,t)&&O(e,t)&&O(t,e)&&E(e,t)}function b(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function w(e,t){return e.x===t.x&&e.y===t.y}function x(e,t,n,r){return b(e,t,n)>0!=b(e,t,r)>0&&b(n,r,e)>0!=b(n,r,t)>0}function k(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&x(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function O(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function E(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function M(e,t){var n=new j(e.i,e.x,e.y),r=new j(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function T(e,t,n,r){var i=new j(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function P(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function j(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.exports=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=function(e,t,n){function r(){a=e.map(function(e){return[e[0],h.top,e[1]]}),s=t,u=t}function i(){a=[],e.forEach(function(e){a.push([e[0],h.top,e[1]])}),e.forEach(function(e){a.push([e[0],h.bottom,e[1]])}),s=[];for(var n=0;p>n;n++)n===p-1?(s.push([n+p,p,n]),s.push([0,n,p])):(s.push([n+p,n+p+1,n]),s.push([n+1,n,n+p+1]));if(c=[].concat(s),h.closed){var r=t,i=r.map(function(e){return e.map(function(e){return e+p})});i=i.map(function(e){return[e[0],e[2],e[1]]}),s=s.concat(r).concat(i),u=r,l=i}}var a,s,u,l,c,f={top:1,bottom:0,closed:!0},h=(0,o["default"])({},f,n),p=e.length;return h.top===h.bottom?r():i(),{positions:a,faces:s,top:u,bottom:l,sides:c}};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n-1&&this._layers.splice(t,1),e.isOutput()&&(this._engine._scene.remove(e._object3D),this._engine._domScene3D.remove(e._domObject3D),this._engine._domScene2D.remove(e._domObject2D)),this.emit("layerRemoved"),this}},{key:"addControls",value:function(e){return e._addToWorld(this),this._controls.push(e),this.emit("controlsAdded",e),this}},{key:"removeControls",value:function(e){var t=this._controls.indexOf(t);return t>-1&&this._controls.splice(t,1),this.emit("controlsRemoved",e),this}},{key:"stop",value:function(){this._pause=!0}},{key:"start",value:function(){this._pause=!1,this._update()}},{key:"destroy",value:function(){this.stop(),this.off("controlsMoveEnd",this._onControlsMoveEnd);var e,t;for(e=this._controls.length-1;e>=0;e--)t=this._controls[0],this.removeControls(t),t.destroy();var n;for(e=this._layers.length-1;e>=0;e--)n=this._layers[0],this.removeLayer(n),n.destroy();this._environment=null,this._engine.destroy(),this._engine=null,this._container=null}}]),t}(l["default"]);t["default"]=b;var w=function(e,t){return new b(e,t)};t.world=w},function(e,t,n){"use strict";function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(){}var o="function"!=typeof Object.create?"~":!1;i.prototype._events=void 0,i.prototype.listeners=function(e,t){var n=o?o+e:e,r=this._events&&this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,s=new Array(a);a>i;i++)s[i]=r[i].fn;return s},i.prototype.emit=function(e,t,n,r,i,a){var s=o?o+e:e;if(!this._events||!this._events[s])return!1;var u,l,c=this._events[s],f=arguments.length;if("function"==typeof c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,a),!0}for(l=1,u=new Array(f-1);f>l;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var h,p=c.length;for(l=0;p>l;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),f){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;default:if(!u)for(h=1,u=new Array(f-1);f>h;h++)u[h-1]=arguments[h];c[l].fn.apply(c[l].context,u)}}return!0},i.prototype.on=function(e,t,n){var i=new r(t,n||this),a=o?o+e:e;return this._events||(this._events=o?{}:Object.create(null)),this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],i]:this._events[a].push(i):this._events[a]=i,this},i.prototype.once=function(e,t,n){var i=new r(t,n||this,!0),a=o?o+e:e;return this._events||(this._events=o?{}:Object.create(null)),this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],i]:this._events[a].push(i):this._events[a]=i,this},i.prototype.removeListener=function(e,t,n,r){var i=o?o+e:e;if(!this._events||!this._events[i])return this;var a=this._events[i],s=[];if(t)if(a.fn)(a.fn!==t||r&&!a.once||n&&a.context!==n)&&s.push(a);else for(var u=0,l=a.length;l>u;u++)(a[u].fn!==t||r&&!a[u].once||n&&a[u].context!==n)&&s.push(a[u]);return s.length?this._events[i]=1===s.length?s[0]:s:delete this._events[i],this},i.prototype.removeAllListeners=function(e){return this._events?(e?delete this._events[o?o+e:e]:this._events=o?{}:Object.create(null),this):this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prototype.setMaxListeners=function(){return this},i.prefixed=o,e.exports=i},function(e,t,n){function r(e,t){return e="number"==typeof e||b.test(e)?+e:-1,t=null==t?_:t,e>-1&&e%1==0&&t>e}function i(e,t,n){var r=e[t];(!c(r,n)||c(r,w[t])&&!x.call(e,t)||void 0===n&&!(t in e))&&(e[t]=n)}function o(e){return function(t){return null==t?void 0:t[e]}}function a(e,t,n){return s(e,t,n)}function s(e,t,n,r){n||(n={});for(var o=-1,a=t.length;++o1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o="function"==typeof o?(i--,o):void 0,a&&l(n[0],n[1],a)&&(o=3>i?void 0:o,i=1),t=Object(t);++r-1&&e%1==0&&_>=e}function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var v=n(4),y=n(5),_=9007199254740991,m="[object Function]",g="[object GeneratorFunction]",b=/^(?:0|[1-9]\d*)$/,w=Object.prototype,x=w.hasOwnProperty,k=w.toString,M=o("length"),O=u(function(e,t){a(t,v(t),e)});e.exports=O},function(e,t){function n(e,t){for(var n=-1,r=Array(e);++n-1&&e%1==0&&t>e}function i(e,t){return O.call(e,t)||"object"==typeof e&&t in e&&null===P(e)}function o(e){return j(Object(e))}function a(e){return function(t){return null==t?void 0:t[e]}}function s(e){var t=e?e.length:void 0;return p(t)&&(C(e)||y(e)||l(e))?n(t,String):null}function u(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||M;return e===n}function l(e){return f(e)&&O.call(e,"callee")&&(!T.call(e,"callee")||E.call(e)==g)}function c(e){return null!=e&&!("function"==typeof e&&h(e))&&p(S(e))}function f(e){return v(e)&&c(e)}function h(e){var t=d(e)?E.call(e):"";return t==b||t==w}function p(e){return"number"==typeof e&&e>-1&&e%1==0&&m>=e}function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){return!!e&&"object"==typeof e}function y(e){return"string"==typeof e||!C(e)&&v(e)&&E.call(e)==x}function _(e){var t=u(e);if(!t&&!c(e))return o(e);var n=s(e),a=!!n,l=n||[],f=l.length;for(var h in e)!i(e,h)||a&&("length"==h||r(h,f))||t&&"constructor"==h||l.push(h);return l}var m=9007199254740991,g="[object Arguments]",b="[object Function]",w="[object GeneratorFunction]",x="[object String]",k=/^(?:0|[1-9]\d*)$/,M=Object.prototype,O=M.hasOwnProperty,E=M.toString,P=Object.getPrototypeOf,T=M.propertyIsEnumerable,j=Object.keys,S=a("length"),C=Array.isArray;e.exports=_},function(e,t){function n(e,t,n){var r=n.length;switch(r){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function r(e,t){if("function"!=typeof e)throw new TypeError(u);return t=w(void 0===t?e.length-1:a(t),0),function(){for(var r=arguments,i=-1,o=w(r.length-t,0),a=Array(o);++ie?-1:1;return t*c}var n=e%1;return e===e?n?e-n:e:0}function s(e){if(o(e)){var t=i(e.valueOf)?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(d,"");var n=y.test(e);return n||_.test(e)?m(e.slice(2),n?2:8):v.test(e)?f:+e}var u="Expected a function",l=1/0,c=1.7976931348623157e308,f=NaN,h="[object Function]",p="[object GeneratorFunction]",d=/^\s+|\s+$/g,v=/^[-+]0x[0-9a-f]+$/i,y=/^0b[01]+$/i,_=/^0o[0-7]+$/i,m=parseInt,g=Object.prototype,b=g.toString,w=Math.max;e.exports=r},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),o=r(i),a=n(15),s=r(a),u=n(17),l=r(u),c=n(19),f=r(c),h=n(20),p=r(h),d={};d.EPSG3857=o["default"],d.EPSG900913=i.EPSG900913,d.EPSG3395=s["default"],d.EPSG4326=l["default"],d.Simple=f["default"],d.Proj4=p["default"],t["default"]=d,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(8),s=r(a),u=n(13),l=r(u),c=n(14),f=r(c),h={code:"EPSG:3857",projection:l["default"],transformScale:1/(Math.PI*l["default"].R),transformation:function(){var e=1/(Math.PI*l["default"].R);return new f["default"](e,0,-e,0)}()},p=(0,o["default"])({},s["default"],h),d=(0,o["default"])({},p,{code:"EPSG:900913"});t.EPSG900913=d,t["default"]=p},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(9),s=r(a),u=(n(10),{wrapLon:[-180,180],R:6378137,distance:function(e,t,n){var r,i,o,a=Math.PI/180;if(n){r=e.lat*a,i=t.lat*a;var s=e.lon*a,u=t.lon*a,l=i-r,c=u-s,f=l/2,h=c/2;o=Math.sin(f)*Math.sin(f)+Math.cos(r)*Math.cos(i)*Math.sin(h)*Math.sin(h);var p=2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o));return this.R*p}return r=e.lat*a,i=t.lat*a,o=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lon-e.lon)*a),this.R*Math.acos(Math.min(o,1))},pointScale:function(e,t){return this.projection.pointScale?this.projection.pointScale(e,t):[1,1]},metresToProjected:function(e,t){return e*t[1]},projectedToMetres:function(e,t){return e/t[1]},metresToWorld:function(e,t,n){var r=this.metresToProjected(e,t),i=this.scale(n);n&&(i/=2);var o=i*(this.transformScale*r);return n&&(o/=t[1]),o},worldToMetres:function(e,t,n){var r=this.scale(n);n&&(r/=2);var i=e/r/this.transformScale,o=this.projectedToMetres(i,t);return n&&(o*=t[1]),o}});t["default"]=(0,o["default"])({},s["default"],u),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(10),o=n(11),a=n(12),s=r(a),u={scaleFactor:1e6,latLonToPoint:function(e,t){var n=this.projection.project(e),r=this.scale(t);return t&&(r/=2),this.transformation._transform(n,r)},pointToLatLon:function(e,t){var n=this.scale(t);t&&(n/=2);var r=this.transformation.untransform(e,n);return this.projection.unproject(r)},project:function(e){return this.projection.project(e)},unproject:function(e){return this.projection.unproject(e)},scale:function(e){return e>=0?256*Math.pow(2,e):this.scaleFactor},zoom:function(e){return Math.log(e/256)/Math.LN2},getProjectedBounds:function(e){if(this.infinite)return null;var t=this.projection.bounds,n=this.scale(e);e&&(n/=2);var r=this.transformation.transform((0,o.point)(t[0]),n),i=this.transformation.transform((0,o.point)(t[1]),n);return[r,i]},wrapLatLon:function(e){var t=this.wrapLat?(0,s["default"])(e.lat,this.wrapLat,!0):e.lat,n=this.wrapLon?(0,s["default"])(e.lon,this.wrapLon,!0):e.lon,r=e.alt;return(0,i.latLon)(t,n,r)}};t["default"]=u,e.exports=t["default"]},function(e,t){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;nl&&Math.abs(c)>1e-7;l++)t=a*Math.sin(u),t=Math.pow((1-t)/(1+t),a/2),c=Math.PI/2-2*Math.atan(s*t)-u,u+=c;return(0,r.latLon)(u*n,e.x*n/i)},pointScale:function(e){var t=Math.PI/180,n=e.lat*t,r=Math.sin(n),i=r*r,o=Math.cos(n),a=Math.sqrt(1-this.ECC2*i)/o;return[a,a]},bounds:[[-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]]};t["default"]=o,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(8),s=r(a),u=n(18),l=r(u),c=n(14),f=r(c),h={code:"EPSG:4326",projection:l["default"],transformScale:1/180,transformation:new f["default"](1/180,0,-1/180,0)},p=(0,o["default"])({},s["default"],h);t["default"]=p,e.exports=t["default"]},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(10),i=n(11),o={project:function(e){return(0,i.point)(e.lon,e.lat)},unproject:function(e){return(0,r.latLon)(e.y,e.x)},pointScale:function(e){var t=111132.92,n=-559.82,r=1.175,i=-.0023,o=111412.84,a=-93.5,s=.118,u=Math.PI/180,l=e.lat*u,c=t+n*Math.cos(2*l)+r*Math.cos(4*l)+i*Math.cos(6*l),f=o*Math.cos(l)+a*Math.cos(3*l)+s*Math.cos(5*l);return[1/c,1/f]},bounds:[[-180,-90],[180,90]]};t["default"]=o,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(9),s=r(a),u=n(18),l=r(u),c=n(14),f=r(c),h={projection:l["default"],transformation:new f["default"](1,0,1,0),scale:function(e){return e?Math.pow(2,e):1},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var n=t.lon-e.lon,r=t.lat-e.lat;return Math.sqrt(n*n+r*r)},infinite:!0},p=(0,o["default"])({},s["default"],h);t["default"]=p,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=n(8),s=r(a),u=n(21),l=r(u),c=n(14),f=r(c),h=function(e,t,n){var r=(0,l["default"])(t,n),i=r.bounds[1][0]-r.bounds[0][0],o=r.bounds[1][1]-r.bounds[0][1],a=i/2,s=o/2,u=1/a,c=1/s,h=Math.min(u,c),p=h*(r.bounds[0][0]+a),d=h*(r.bounds[0][1]+s);return{code:e,projection:r,transformScale:h,transformation:new f["default"](h,-p,-h,d)}},p=function(e,t,n){return(0,o["default"])({},s["default"],h(e,t,n))};t["default"]=p,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(22),o=r(i),a=n(10),s=n(11),u=function(e,t){var n=(0,o["default"])(e),r=function(e){return(0,s.point)(n.forward([e.lon,e.lat]))},i=function(e){var t=n.inverse([e.x,e.y]);return(0,a.latLon)(t[1],t[0])};return{project:r,unproject:i,pointScale:function(e,t){return[1,1]},bounds:function(){if(t)return t;var e=r([-90,-180]),n=r([90,180]);return[e,n]}()}};t["default"]=u,e.exports=t["default"]},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE_22__},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n=0;t--)e=this._scene.children[t],e&&(this._scene.remove(e),e.geometry&&(e.geometry.dispose(),e.geometry=null),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));for(var t=this._domScene3D.children.length-1;t>=0;t--)e=this._domScene3D.children[t],e&&this._domScene3D.remove(e);for(var t=this._domScene2D.children.length-1;t>=0;t--)e=this._domScene2D.children[t],e&&this._domScene2D.remove(e);this._picking.destroy(),this._picking=null,this._world=null,this._scene=null,this._domScene3D=null,this._domScene2D=null,this._renderer=null,this._domRenderer3D=null,this._domRenderer2D=null,this._camera=null,this._clock=null,this._frustum=null}}]),t}(l["default"]);t["default"]=T,e.exports=t["default"]},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE_24__},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=n(25);r(a);t["default"]=function(e){var t=new o["default"].WebGLRenderer({antialias:!0});t.setClearColor(16777215,1),t.setPixelRatio(window.devicePixelRatio),t.gammaInput=!0,t.gammaOutput=!0,t.shadowMap.enabled=!0,t.shadowMap.cullFace=o["default"].CullFaceBack,e.appendChild(t.domElement);var n=function(){t.setSize(e.clientWidth,e.clientHeight)};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=(r(i),n(30)),a=n(26);r(a);t["default"]=function(e){var t=new o.CSS3DRenderer;t.domElement.style.position="absolute",t.domElement.style.top=0,e.appendChild(t.domElement);var n=function(){t.setSize(e.clientWidth,e.clientHeight)};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e){o["default"].Object3D.call(this),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",function(e){null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)})};a.prototype=Object.create(o["default"].Object3D.prototype),a.prototype.constructor=a;var s=function(e){a.call(this,e)};s.prototype=Object.create(a.prototype),s.prototype.constructor=s;var u=function(){console.log("THREE.CSS3DRenderer",o["default"].REVISION);var e,t,n,r,i=new o["default"].Matrix4,u={camera:{fov:0,style:""},objects:{}},l=document.createElement("div");l.style.overflow="hidden",l.style.WebkitTransformStyle="preserve-3d",l.style.MozTransformStyle="preserve-3d",l.style.oTransformStyle="preserve-3d",l.style.transformStyle="preserve-3d",this.domElement=l;var c=document.createElement("div");c.style.WebkitTransformStyle="preserve-3d",c.style.MozTransformStyle="preserve-3d",c.style.oTransformStyle="preserve-3d",c.style.transformStyle="preserve-3d",l.appendChild(c),this.setClearColor=function(){},this.getSize=function(){return{width:e,height:t}},this.setSize=function(i,o){e=i,t=o,n=e/2,r=t/2,l.style.width=i+"px",l.style.height=o+"px",c.style.width=i+"px",c.style.height=o+"px"};var f=function(e){return Math.abs(e)l;l++)v(e.children[l],t)};this.render=function(e,i){var a=.5/Math.tan(o["default"].Math.degToRad(.5*i.fov))*t;u.camera.fov!==a&&(l.style.WebkitPerspective=a+"px",l.style.MozPerspective=a+"px",l.style.oPerspective=a+"px",l.style.perspective=a+"px",u.camera.fov=a),e.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),i.matrixWorldInverse.getInverse(i.matrixWorld);var s="translate3d(0,0,"+a+"px)"+h(i.matrixWorldInverse)+" translate3d("+n+"px,"+r+"px, 0)";u.camera.style!==s&&(c.style.WebkitTransform=s,c.style.MozTransform=s,c.style.oTransform=s,c.style.transform=s,u.camera.style=s),d(e,i)}};t.CSS3DObject=a,t.CSS3DSprite=s,t.CSS3DRenderer=u,o["default"].CSS3DObject=a,o["default"].CSS3DSprite=s,o["default"].CSS3DRenderer=u},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=(r(i),n(32)),a=n(27);r(a);t["default"]=function(e){var t=new o.CSS2DRenderer;t.domElement.style.position="absolute",t.domElement.style.top=0,e.appendChild(t.domElement);var n=function(){t.setSize(e.clientWidth,e.clientHeight); +};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e){o["default"].Object3D.call(this),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",function(e){null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)})};a.prototype=Object.create(o["default"].Object3D.prototype),a.prototype.constructor=a;var s=function(){console.log("THREE.CSS2DRenderer",o["default"].REVISION);var e,t,n,r,i=new o["default"].Vector3,s=new o["default"].Matrix4,u=new o["default"].Matrix4,l=document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.setSize=function(i,o){e=i,t=o,n=e/2,r=t/2,l.style.width=i+"px",l.style.height=o+"px"};var c=function f(e,t){if(e instanceof a){i.setFromMatrixPosition(e.matrixWorld),i.applyProjection(u);var o=e.element,s="translate(-50%,-50%) translate("+(i.x*n+n)+"px,"+(-i.y*r+r)+"px)";o.style.WebkitTransform=s,o.style.MozTransform=s,o.style.oTransform=s,o.style.transform=s,o.parentNode!==l&&l.appendChild(o)}for(var c=0,h=e.children.length;h>c;c++)f(e.children[c],t)};this.render=function(e,t){e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),s.copy(t.matrixWorldInverse.getInverse(t.matrixWorld)),u.multiplyMatrices(t.projectionMatrix,s),c(e,t)}};t.CSS2DObject=a,t.CSS2DRenderer=s,o["default"].CSS2DObject=a,o["default"].CSS2DRenderer=s},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(e){var t=new o["default"].PerspectiveCamera(45,1,1,2e5);t.position.y=400,t.position.z=400;var n=function(){t.aspect=e.clientWidth/e.clientHeight,t.updateProjectionMatrix()};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n0&&(i=o[0].point.clone()),this._world.emit("pick",r,a,i,o),this._world.emit("pick-"+r,a,i,o)}}},{key:"add",value:function(e){this._pickingScene.add(e),this._needUpdate=!0}},{key:"remove",value:function(e){this._pickingScene.remove(e),this._needUpdate=!0}},{key:"getNextId",value:function(){return f++}},{key:"destroy",value:function(){if(window.removeEventListener("resize",this._resizeTexture,!1),this._renderer.domElement.removeEventListener("mouseup",this._onMouseUp,!1),this._world.off("move",this._onWorldMove),this._pickingScene.children)for(var e,t=this._pickingScene.children.length-1;t>=0;t--)e=this._pickingScene.children[t],e&&(this._pickingScene.remove(e),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));this._pickingScene=null,this._pickingTexture=null,this._pixelBuffer=null,this._world=null,this._renderer=null,this._camera=null}}]),e}();t["default"]=function(e,t,n){return new h(e,t,n)},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n=0;t--)e=this._object3D.children[t],e&&(this.remove(e),e.geometry&&(e.geometry.dispose(),e.geometry=null),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));if(this._domObject3D&&this._domObject3D.children)for(var e,t=this._domObject3D.children.length-1;t>=0;t--)e=this._domObject3D.children[t],e&&this.removeDOM3D(e);if(this._domObject2D&&this._domObject2D.children)for(var e,t=this._domObject2D.children.length-1;t>=0;t--)e=this._domObject2D.children[t],e&&this.removeDOM2D(e);this._domObject3D=null,this._domObject2D=null,this._world=null,this._object3D=null}}]),t}(l["default"]);t["default"]=_;var m=function(e){return new _(e)};t.layer=m},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n degrees, and the cosine of that","// earth shadow hack","const float cutoffAngle = pi/1.95;","const float steepness = 1.5;","vec3 totalRayleigh(vec3 lambda)","{","return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));","}","// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE","vec3 simplifiedRayleigh()","{","return 0.0005 / vec3(94, 40, 18);","}","float rayleighPhase(float cosTheta)","{ ","return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));","}","vec3 totalMie(vec3 lambda, vec3 K, float T)","{","float c = (0.2 * T ) * 10E-18;","return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;","}","float hgPhase(float cosTheta, float g)","{","return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));","}","float sunIntensity(float zenithAngleCos)","{","return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));","}","// float logLuminance(vec3 c)","// {","// return log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);","// }","// Filmic ToneMapping http://filmicgames.com/archives/75","float A = 0.15;","float B = 0.50;","float C = 0.10;","float D = 0.20;","float E = 0.02;","float F = 0.30;","float W = 1000.0;","vec3 Uncharted2Tonemap(vec3 x)","{","return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;","}","void main() ","{","float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);","// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;","// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);","float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));","vec3 sunDirection = normalize(sunPosition);","float sunE = sunIntensity(dot(sunDirection, up));","// extinction (absorbtion + out scattering) ","// rayleigh coefficients","vec3 betaR = simplifiedRayleigh() * reileighCoefficient;","// mie coefficients","vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;","// optical length","// cutoff angle at 90 to avoid singularity in next formula.","float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));","float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","// combined extinction factor ","vec3 Fex = exp(-(betaR * sR + betaM * sM));","// in scattering","float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);","float rPhase = rayleighPhase(cosTheta*0.5+0.5);","vec3 betaRTheta = betaR * rPhase;","float mPhase = hgPhase(cosTheta, mieDirectionalG);","vec3 betaMTheta = betaM * mPhase;","vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));","Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));","//nightsky","vec3 direction = normalize(vWorldPosition - cameraPos);","float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]","float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]","vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);","// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;","vec3 L0 = vec3(0.1) * Fex;","// composition + solar disc","//if (cosTheta > sunAngularDiameterCos)","float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);","// if (normalize(vWorldPosition - cameraPos).y>0.0)","L0 += (sunE * 19000.0 * Fex)*sundisk;","vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));","vec3 texColor = (Lin+L0); ","texColor *= 0.04 ;","texColor += vec3(0.0,0.001,0.0025)*0.3;","float g_fMaxLuminance = 1.0;","float fLumScaled = 0.1 / luminance; ","float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ","float ExposureBias = fLumCompressed;","vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);","vec3 color = curr*whiteScale;","vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));","gl_FragColor.rgb = retColor;","gl_FragColor.a = 1.0;","}"].join("\n")};var a=function(){var e=o["default"].ShaderLib.sky,t=o["default"].UniformsUtils.clone(e.uniforms),n=new o["default"].ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:t,side:o["default"].BackSide}),r=new o["default"].SphereBufferGeometry(45e4,32,15),i=new o["default"].Mesh(r,n);this.mesh=i,this.uniforms=t};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e,t,n){var r=!0,s=!0;if("function"!=typeof e)throw new TypeError(a);return i(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),o(e,t,{leading:r,maxWait:t,trailing:s})}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var o=n(41),a="Expected a function";e.exports=r},function(e,t){function n(e,t,n){function r(){g&&clearTimeout(g),p&&clearTimeout(p),w=0,h=p=y=g=b=void 0}function s(t,n){n&&clearTimeout(n),p=g=b=void 0,t&&(w=m(),d=e.apply(y,h),g||p||(h=y=void 0))}function u(){var e=t-(m()-v);0>=e||e>t?s(b,p):g=setTimeout(u,e)}function l(){return(g&&b||p&&M)&&(d=e.apply(y,h)),r(),d}function c(){s(M,g)}function f(){if(h=arguments,v=m(),y=this,b=M&&(g||!x),k===!1)var n=x&&!g;else{p||x||(w=v);var r=k-(v-w),i=0>=r||r>k;i?(p&&(p=clearTimeout(p)),w=v,d=e.apply(y,h)):p||(p=setTimeout(c,r))}return i&&g?g=clearTimeout(g):g||t===k||(g=setTimeout(u,t)),n&&(i=!0,d=e.apply(y,h)),!i||g||p||(h=y=void 0),d}var h,p,d,v,y,g,b,w=0,x=!1,k=!1,M=!0;if("function"!=typeof e)throw new TypeError(a);return t=o(t)||0,i(n)&&(x=!!n.leading,k="maxWait"in n&&_(o(n.maxWait)||0,t),M="trailing"in n?!!n.trailing:M),f.cancel=r,f.flush=l,f}function r(e){var t=i(e)?y.call(e):"";return t==u||t==l}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){if(i(e)){var t=r(e.valueOf)?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=h.test(e);return n||p.test(e)?d(e.slice(2),n?2:8):f.test(e)?s:+e}var a="Expected a function",s=NaN,u="[object Function]",l="[object GeneratorFunction]",c=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,d=parseInt,v=Object.prototype,y=v.toString,_=Math.max,m=Date.now;e.exports=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(43),o=r(i),a={Orbit:o["default"],orbit:i.orbit,orbit:i.orbit};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0?u(r()):re.y<0&&l(r()),te.copy(ne),B.update()}function v(e){Q.set(e.clientX,e.clientY),ee.subVectors(Q,$),ae(ee.x,ee.y),$.copy(Q),B.update()}function y(e){}function _(e){var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?l(r()):0>t&&u(r()),B.update()}function m(e){switch(e.keyCode){case B.keys.UP:ae(0,B.keyPanSpeed),B.update();break;case B.keys.BOTTOM:ae(0,-B.keyPanSpeed),B.update();break;case B.keys.LEFT:ae(B.keyPanSpeed,0),B.update();break;case B.keys.RIGHT:ae(-B.keyPanSpeed,0),B.update()}}function g(e){Y.set(e.pointers[0].pageX,e.pointers[0].pageY)}function b(e){var t=e.pointers[0].pageX-e.pointers[1].pageX,n=e.pointers[0].pageY-e.pointers[1].pageY,r=Math.sqrt(t*t+n*n);te.set(0,r)}function w(e){$.set(e.deltaX,e.deltaY)}function x(e){J.set(e.pointers[0].pageX,e.pointers[0].pageY),K.subVectors(J,Y);var t=B.domElement===document?B.domElement.body:B.domElement;i(2*Math.PI*K.x/t.clientWidth*B.rotateSpeed),a(2*Math.PI*K.y/t.clientHeight*B.rotateSpeed),Y.copy(J),B.update()}function k(e){var t=e.pointers[0].pageX-e.pointers[1].pageX,n=e.pointers[0].pageY-e.pointers[1].pageY,i=Math.sqrt(t*t+n*n);ne.set(0,i),re.subVectors(ne,te),re.y>0?l(r()):re.y<0&&u(r()),te.copy(ne),B.update()}function M(e){Q.set(e.deltaX,e.deltaY),ee.subVectors(Q,$),ae(ee.x,ee.y),$.copy(Q),B.update()}function O(e){}function E(e){if(B.enabled!==!1){if(e.preventDefault(),e.button===B.mouseButtons.ORBIT){if(B.enableRotate===!1)return;c(e),W=N.ROTATE}else if(e.button===B.mouseButtons.ZOOM){if(B.enableZoom===!1)return;f(e),W=N.DOLLY}else if(e.button===B.mouseButtons.PAN){if(B.enablePan===!1)return;h(e),W=N.PAN}W!==N.NONE&&(document.addEventListener("mousemove",P,!1),document.addEventListener("mouseup",T,!1),document.addEventListener("mouseout",T,!1),B.dispatchEvent(z))}}function P(e){if(B.enabled!==!1)if(e.preventDefault(),W===N.ROTATE){if(B.enableRotate===!1)return;p(e)}else if(W===N.DOLLY){if(B.enableZoom===!1)return;d(e)}else if(W===N.PAN){if(B.enablePan===!1)return;v(e)}}function T(e){B.enabled!==!1&&(y(e),document.removeEventListener("mousemove",P,!1),document.removeEventListener("mouseup",T,!1),document.removeEventListener("mouseout",T,!1),B.dispatchEvent(H),W=N.NONE)}function j(e){B.enabled!==!1&&B.enableZoom!==!1&&W===N.NONE&&(e.preventDefault(),e.stopPropagation(),_(e),B.dispatchEvent(z),B.dispatchEvent(H))}function S(e){B.enabled!==!1&&B.enableKeys!==!1&&B.enablePan!==!1&&m(e)}function C(e){if(B.enabled!==!1){switch(e.touches.length){case 1:if(B.enableRotate===!1)return;g(e),W=N.TOUCH_ROTATE;break;case 2:if(B.enableZoom===!1)return;b(e),W=N.TOUCH_DOLLY;break;case 3:if(B.enablePan===!1)return;w(e),W=N.TOUCH_PAN;break;default:W=N.NONE}W!==N.NONE&&B.dispatchEvent(z)}}function A(e){if(B.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(B.enableRotate===!1)return;if(W!==N.TOUCH_ROTATE)return;x(e);break;case 2:if(B.enableZoom===!1)return;if(W!==N.TOUCH_DOLLY)return;k(e);break;case 3:if(B.enablePan===!1)return;if(W!==N.TOUCH_PAN)return;M(e);break;default:W=N.NONE}}function L(e){B.enabled!==!1&&(O(e),B.dispatchEvent(H),W=N.NONE)}function D(e){e.preventDefault()}this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new o["default"].Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:o["default"].MOUSE.LEFT, +ZOOM:o["default"].MOUSE.MIDDLE,PAN:o["default"].MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return I},this.getAzimuthalAngle=function(){return R},this.reset=function(){B.target.copy(B.target0),B.object.position.copy(B.position0),B.object.zoom=B.zoom0,B.object.updateProjectionMatrix(),B.dispatchEvent(F),B.update(),W=N.NONE},this.update=function(){var t=new o["default"].Vector3,r=(new o["default"].Quaternion).setFromUnitVectors(e.up,new o["default"].Vector3(0,1,0)),a=r.clone().inverse(),s=new o["default"].Vector3,u=new o["default"].Quaternion;return function(){var e=B.object.position;t.copy(e).sub(B.target),t.applyQuaternion(r),R=Math.atan2(t.x,t.z),I=Math.atan2(Math.sqrt(t.x*t.x+t.z*t.z),t.y),B.autoRotate&&W===N.NONE&&i(n()),R+=V,I+=U,R=Math.max(B.minAzimuthAngle,Math.min(B.maxAzimuthAngle,R)),I=Math.max(B.minPolarAngle,Math.min(B.maxPolarAngle,I)),I=Math.max(q,Math.min(Math.PI-q,I));var o=t.length()*G;return o=Math.max(B.minDistance,Math.min(B.maxDistance,o)),B.target.add(Z),t.x=o*Math.sin(I)*Math.sin(R),t.y=o*Math.cos(I),t.z=o*Math.sin(I)*Math.cos(R),t.applyQuaternion(a),e.copy(B.target).add(t),B.object.lookAt(B.target),B.enableDamping===!0?(V*=1-B.dampingFactor,U*=1-B.dampingFactor):(V=0,U=0),G=1,Z.set(0,0,0),X||s.distanceToSquared(B.object.position)>q||8*(1-u.dot(B.object.quaternion))>q?(B.dispatchEvent(F),s.copy(B.object.position),u.copy(B.object.quaternion),X=!1,!0):!1}}(),this.dispose=function(){B.domElement.removeEventListener("contextmenu",D,!1),B.domElement.removeEventListener("mousedown",E,!1),B.domElement.removeEventListener("mousewheel",j,!1),B.domElement.removeEventListener("MozMousePixelScroll",j,!1),B.domElement.removeEventListener("touchstart",C,!1),B.domElement.removeEventListener("touchend",L,!1),B.domElement.removeEventListener("touchmove",A,!1),document.removeEventListener("mousemove",P,!1),document.removeEventListener("mouseup",T,!1),document.removeEventListener("mouseout",T,!1),window.removeEventListener("keydown",S,!1)};var R,I,B=this,F={type:"change"},z={type:"start"},H={type:"end"},N={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},W=N.NONE,q=1e-6,U=0,V=0,G=1,Z=new o["default"].Vector3,X=!1,Y=new o["default"].Vector2,J=new o["default"].Vector2,K=new o["default"].Vector2,$=new o["default"].Vector2,Q=new o["default"].Vector2,ee=new o["default"].Vector2,te=new o["default"].Vector2,ne=new o["default"].Vector2,re=new o["default"].Vector2,ie=function(){var e=new o["default"].Vector3;return function(t,n){var r=n.elements;e.set(r[0],0,r[2]),e.multiplyScalar(-t),Z.add(e)}}(),oe=function(){var e=new o["default"].Vector3;return function(t,n){var r=n.elements,i=t/Math.cos(I);e.set(r[4],0,r[6]),e.multiplyScalar(i),Z.add(e)}}(),ae=function(){var e=new o["default"].Vector3;return function(t,n){var r=B.domElement===document?B.domElement.body:B.domElement;if(B.object instanceof o["default"].PerspectiveCamera){var i=B.object.position;e.copy(i).sub(B.target);var a=e.length();a*=Math.tan(B.object.fov/2*Math.PI/180),ie(2*t*a/r.clientHeight,B.object.matrix),oe(2*n*a/r.clientHeight,B.object.matrix)}else B.object instanceof o["default"].OrthographicCamera?(ie(t*(B.object.right-B.object.left)/r.clientWidth,B.object.matrix),oe(n*(B.object.top-B.object.bottom)/r.clientHeight,B.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),B.enablePan=!1)}}();B.domElement.addEventListener("contextmenu",D,!1),B.domElement.addEventListener("mousedown",E,!1),B.domElement.addEventListener("mousewheel",j,!1),B.domElement.addEventListener("MozMousePixelScroll",j,!1),B.hammer=new s["default"](B.domElement),B.hammer.get("pan").set({pointers:0,direction:s["default"].DIRECTION_ALL}),B.hammer.get("pinch").set({enable:!0,threshold:.1}),B.hammer.on("panstart",function(e){if(B.enabled!==!1&&"mouse"!==e.pointerType){if(1===e.pointers.length){if(B.enablePan===!1)return;w(e),W=N.TOUCH_PAN}else if(2===e.pointers.length){if(B.enableRotate===!1)return;g(e),W=N.TOUCH_ROTATE}W!==N.NONE&&B.dispatchEvent(z)}}),B.hammer.on("panend",function(e){"mouse"!==e.pointerType&&L(e)}),B.hammer.on("panmove",function(e){if(B.enabled!==!1&&"mouse"!==e.pointerType)if(1===e.pointers.length){if(B.enablePan===!1)return;if(W!==N.TOUCH_PAN)return;M(e)}else if(2===e.pointers.length){if(B.enableRotate===!1)return;if(W!==N.TOUCH_ROTATE)return;x(e)}}),B.hammer.on("pinchstart",function(e){B.enabled!==!1&&"mouse"!==e.pointerType&&B.enableZoom!==!1&&(b(e),W=N.TOUCH_DOLLY,W!==N.NONE&&B.dispatchEvent(z))}),B.hammer.on("pinchend",function(e){"mouse"!==e.pointerType&&L(e)}),B.hammer.on("pinchmove",function(e){B.enabled!==!1&&"mouse"!==e.pointerType&&B.enableZoom!==!1&&W===N.TOUCH_DOLLY&&k(e)}),window.addEventListener("keydown",S,!1),this.update()};u.prototype=Object.create(o["default"].EventDispatcher.prototype),u.prototype.constructor=o["default"].OrbitControls,Object.defineProperties(u.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}}),t["default"]=u,e.exports=t["default"]},function(e,t,n){var r;!function(i,o,a,s){"use strict";function u(e,t,n){return setTimeout(p(e,n),t)}function l(e,t,n){return Array.isArray(e)?(c(e,n[t],n),!0):!1}function c(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==s)for(r=0;r\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,r,n),e.apply(this,arguments)}}function h(e,t,n){var r,i=t.prototype;r=e.prototype=Object.create(i),r.constructor=e,r._super=i,n&&fe(r,n)}function p(e,t){return function(){return e.apply(t,arguments)}}function d(e,t){return typeof e==de?e.apply(t?t[0]||s:s,t):e}function v(e,t){return e===s?t:e}function y(e,t,n){c(b(t),function(t){e.addEventListener(t,n,!1)})}function _(e,t,n){c(b(t),function(t){e.removeEventListener(t,n,!1)})}function m(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function g(e,t){return e.indexOf(t)>-1}function b(e){return e.trim().split(/\s+/g)}function w(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;rn[t]}):r.sort()),r}function M(e,t){for(var n,r,i=t[0].toUpperCase()+t.slice(1),o=0;o1&&!n.firstMultiple?n.firstMultiple=L(t):1===i&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,u=t.center=D(r);t.timeStamp=_e(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=F(s,u),t.distance=B(s,u),C(n,t),t.offsetDirection=I(t.deltaX,t.deltaY);var l=R(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=l.x,t.overallVelocityY=l.y,t.overallVelocity=ye(l.x)>ye(l.y)?l.x:l.y,t.scale=a?H(a.pointers,r):1,t.rotation=a?z(a.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,A(n,t);var c=e.element;m(t.srcEvent.target,c)&&(c=t.srcEvent.target),t.target=c}function C(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},o=e.prevInput||{};(t.eventType===Se||o.eventType===Ae)&&(i=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function A(e,t){var n,r,i,o,a=e.lastInterval||t,u=t.timeStamp-a.timeStamp;if(t.eventType!=Le&&(u>je||a.velocity===s)){var l=t.deltaX-a.deltaX,c=t.deltaY-a.deltaY,f=R(u,l,c);r=f.x,i=f.y,n=ye(f.x)>ye(f.y)?f.x:f.y,o=I(l,c),e.lastInterval=t}else n=a.velocity,r=a.velocityX,i=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=r,t.velocityY=i,t.direction=o}function L(e){for(var t=[],n=0;ni;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:ve(n/t),y:ve(r/t)}}function R(e,t,n){return{x:t/e||0,y:n/e||0}}function I(e,t){return e===t?De:ye(e)>=ye(t)?0>e?Re:Ie:0>t?Be:Fe}function B(e,t,n){n||(n=We);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function F(e,t,n){n||(n=We);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return 180*Math.atan2(i,r)/Math.PI}function z(e,t){return F(t[1],t[0],qe)+F(e[1],e[0],qe)}function H(e,t){return B(t[0],t[1],qe)/B(e[0],e[1],qe)}function N(){this.evEl=Ve,this.evWin=Ge,this.allow=!0,this.pressed=!1,P.apply(this,arguments)}function W(){this.evEl=Ye,this.evWin=Je,P.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function q(){this.evTarget=$e,this.evWin=Qe,this.started=!1,P.apply(this,arguments)}function U(e,t){var n=x(e.touches),r=x(e.changedTouches);return t&(Ae|Le)&&(n=k(n.concat(r),"identifier",!0)),[n,r]}function V(){this.evTarget=tt,this.targetIds={},P.apply(this,arguments)}function G(e,t){var n=x(e.touches),r=this.targetIds;if(t&(Se|Ce)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=x(e.changedTouches),s=[],u=this.target;if(o=n.filter(function(e){return m(e.target,u)}),t===Se)for(i=0;is&&(t.push(e),s=t.length-1):i&(Ae|Le)&&(n=!0),0>s||(t[s]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var Ke={touchstart:Se,touchmove:Ce,touchend:Ae,touchcancel:Le},$e="touchstart",Qe="touchstart touchmove touchend touchcancel";h(q,P,{handler:function(e){var t=Ke[e.type];if(t===Se&&(this.started=!0),this.started){var n=U.call(this,e,t);t&(Ae|Le)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Oe,srcEvent:e})}}});var et={touchstart:Se,touchmove:Ce,touchend:Ae,touchcancel:Le},tt="touchstart touchmove touchend touchcancel";h(V,P,{handler:function(e){var t=et[e.type],n=G.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Oe,srcEvent:e})}}),h(Z,P,{handler:function(e,t,n){var r=n.pointerType==Oe,i=n.pointerType==Pe;if(r)this.mouse.allow=!1;else if(i&&!this.mouse.allow)return;t&(Ae|Le)&&(this.mouse.allow=!0),this.callback(e,t,n)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var nt=M(pe.style,"touchAction"),rt=nt!==s,it="compute",ot="auto",at="manipulation",st="none",ut="pan-x",lt="pan-y";X.prototype={set:function(e){e==it&&(e=this.compute()),rt&&this.manager.element.style&&(this.manager.element.style[nt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return c(this.manager.recognizers,function(t){d(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),Y(e.join(" "))},preventDefaults:function(e){if(!rt){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)return void t.preventDefault();var r=this.actions,i=g(r,st),o=g(r,lt),a=g(r,ut);if(i){var s=1===e.pointers.length,u=e.distance<2,l=e.deltaTime<250;if(s&&u&&l)return}if(!a||!o)return i||o&&n&ze||a&&n&He?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var ct=1,ft=2,ht=4,pt=8,dt=pt,vt=16,yt=32;J.prototype={defaults:{},set:function(e){return fe(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(l(e,"recognizeWith",this))return this;var t=this.simultaneous;return e=Q(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return l(e,"dropRecognizeWith",this)?this:(e=Q(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(l(e,"requireFailure",this))return this;var t=this.requireFail;return e=Q(e,this),-1===w(t,e)&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(l(e,"dropRequireFailure",this))return this;e=Q(e,this);var t=w(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){n.manager.emit(t,e)}var n=this,r=this.state;pt>r&&t(n.options.event+K(r)),t(n.options.event),e.additionalEvent&&t(e.additionalEvent),r>=pt&&t(n.options.event+K(r))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=yt)},canEmit:function(){for(var e=0;eo?Re:Ie,n=o!=this.pX,r=Math.abs(e.deltaX)):(i=0===a?De:0>a?Be:Fe,n=a!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return ee.prototype.attrTest.call(this,e)&&(this.state&ft||!(this.state&ft)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=$(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),h(ne,ee,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&ft)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),h(re,J,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ot]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distancet.time;if(this._input=e,!r||!n||e.eventType&(Ae|Le)&&!i)this.reset();else if(e.eventType&Se)this.reset(),this._timer=u(function(){this.state=dt,this.tryEmit()},t.time,this);else if(e.eventType&Ae)return dt;return yt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===dt&&(e&&e.eventType&Ae?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=_e(),this.manager.emit(this.options.event,this._input)))}}),h(ie,ee,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&ft)}}),h(oe,ee,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:ze|He,pointers:1},getTouchAction:function(){return te.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(ze|He)?t=e.overallVelocity:n&ze?t=e.overallVelocityX:n&He&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&ye(t)>this.options.velocity&&e.eventType&Ae},emit:function(e){var t=$(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),h(ae,J,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[at]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance0){var i=n.getCenter(),o=new v["default"].Vector3(i[0],0,i[1]).sub(t.position).length();if(o>e._options.distance)return!1}return n.getMesh()||n.requestTileAsync(),!0})}}},{key:"_divide",value:function(e){for(var t,n,r=0;r!=e.length;)t=e[r],n=t.getQuadcode(),t.length!==this._maxLOD&&this._screenSpaceError(t)?(e.splice(r,1),e.push(this._requestTile(n+"0",this)),e.push(this._requestTile(n+"1",this)),e.push(this._requestTile(n+"2",this)),e.push(this._requestTile(n+"3",this))):r++}},{key:"_screenSpaceError",value:function(e){var t=this._minLOD,n=this._maxLOD,r=e.getQuadcode(),i=this._world.getCamera(),o=3;if(r.length===n)return!1;if(r.length1}},{key:"_removeTiles",value:function(){if(this._tiles&&this._tiles.children){for(var e=this._tiles.children.length-1;e>=0;e--)this._tiles.remove(this._tiles.children[e]);if(this._tilesPicking&&this._tilesPicking.children)for(var e=this._tilesPicking.children.length-1;e>=0;e--)this._tilesPicking.remove(this._tilesPicking.children[e])}}},{key:"_createTile",value:function(e,t){}},{key:"_requestTile",value:function(e,t){var n=this._tileCache.getTile(e);return n||(n=this._createTile(e,t),this._tileCache.setTile(e,n)),n}},{key:"_destroyTile",value:function(e){this._tiles.remove(e.getMesh()),e.destroy()}},{key:"destroy",value:function(){if(this._tiles.children)for(var e=this._tiles.children.length-1;e>=0;e--)this._tiles.remove(this._tiles.children[e]);if(this.removeFromPicking(this._tilesPicking),this._tilesPicking.children)for(var e=this._tilesPicking.children.length-1;e>=0;e--)this._tilesPicking.remove(this._tilesPicking.children[e]);this._tileCache.destroy(),this._tileCache=null,this._tiles=null,this._tilesPicking=null,this._frustum=null,s(Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(l["default"]);t["default"]=y,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=t)&&r(this,"max",1/0);var n=e.length||i;"function"!=typeof n&&(n=i),r(this,"lengthCalculator",n),r(this,"allowStale",e.stale||!1),r(this,"maxAge",e.maxAge||0),r(this,"dispose",e.dispose),this.reset()}function a(e,t,n,i){var o=n.value;u(e,o)&&(c(e,n),r(e,"allowStale")||(o=void 0)),o&&t.call(i,o.value,o.key,e)}function s(e,t,n){var i=r(e,"cache").get(t);if(i){var o=i.value;u(e,o)?(c(e,i),r(e,"allowStale")||(o=void 0)):n&&r(e,"lruList").unshiftNode(i),o&&(o=o.value)}return o}function u(e,t){if(!t||!t.maxAge&&!r(e,"maxAge"))return!1;var n=!1,i=Date.now()-t.now;return n=t.maxAge?i>t.maxAge:r(e,"maxAge")&&i>r(e,"maxAge")}function l(e){if(r(e,"length")>r(e,"max"))for(var t=r(e,"lruList").tail;r(e,"length")>r(e,"max")&&null!==t;){var n=t.prev;c(e,t),t=n}}function c(e,t){if(t){var n=t.value;r(e,"dispose")&&r(e,"dispose").call(this,n.key,n.value),r(e,"length",r(e,"length")-n.length),r(e,"cache")["delete"](n.key),r(e,"lruList").removeNode(t)}}function f(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}e.exports=o;var h,p=n(50),d=n(53),v=n(56),y={},_="function"==typeof Symbol;h=_?function(e){return Symbol["for"](e)}:function(e){return"_"+e},Object.defineProperty(o.prototype,"max",{set:function(e){(!e||"number"!=typeof e||0>=e)&&(e=1/0),r(this,"max",e),l(this)},get:function(){return r(this,"max")},enumerable:!0}),Object.defineProperty(o.prototype,"allowStale",{set:function(e){r(this,"allowStale",!!e)},get:function(){return r(this,"allowStale")},enumerable:!0}),Object.defineProperty(o.prototype,"maxAge",{set:function(e){(!e||"number"!=typeof e||0>e)&&(e=0),r(this,"maxAge",e),l(this)},get:function(){return r(this,"maxAge")},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(e){"function"!=typeof e&&(e=i),e!==r(this,"lengthCalculator")&&(r(this,"lengthCalculator",e),r(this,"length",0),r(this,"lruList").forEach(function(e){e.length=r(this,"lengthCalculator").call(this,e.value,e.key),r(this,"length",r(this,"length")+e.length)},this)),l(this)},get:function(){return r(this,"lengthCalculator")},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return r(this,"length")},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return r(this,"lruList").length},enumerable:!0}),o.prototype.rforEach=function(e,t){t=t||this;for(var n=r(this,"lruList").tail;null!==n;){var i=n.prev;a(this,e,n,t),n=i}},o.prototype.forEach=function(e,t){t=t||this;for(var n=r(this,"lruList").head;null!==n;){var i=n.next;a(this,e,n,t),n=i}},o.prototype.keys=function(){return r(this,"lruList").toArray().map(function(e){return e.key},this)},o.prototype.values=function(){return r(this,"lruList").toArray().map(function(e){return e.value},this)},o.prototype.reset=function(){r(this,"dispose")&&r(this,"lruList")&&r(this,"lruList").length&&r(this,"lruList").forEach(function(e){r(this,"dispose").call(this,e.key,e.value)},this),r(this,"cache",new p),r(this,"lruList",new v),r(this,"length",0)},o.prototype.dump=function(){return r(this,"lruList").map(function(e){return u(this,e)?void 0:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}},this).toArray().filter(function(e){return e})},o.prototype.dumpLru=function(){return r(this,"lruList")},o.prototype.inspect=function(e,t){var n="LRUCache {",o=!1,a=r(this,"allowStale");a&&(n+="\n allowStale: true",o=!0);var s=r(this,"max");s&&s!==1/0&&(o&&(n+=","),n+="\n max: "+d.inspect(s,t),o=!0);var l=r(this,"maxAge");l&&(o&&(n+=","),n+="\n maxAge: "+d.inspect(l,t),o=!0);var c=r(this,"lengthCalculator");c&&c!==i&&(o&&(n+=","),n+="\n length: "+d.inspect(r(this,"length"),t),o=!0);var f=!1;return r(this,"lruList").forEach(function(e){f?n+=",\n ":(o&&(n+=",\n"),f=!0,n+="\n ");var r=d.inspect(e.key).split("\n").join("\n "),a={value:e.value};e.maxAge!==l&&(a.maxAge=e.maxAge),c!==i&&(a.length=e.length),u(this,e)&&(a.stale=!0),a=d.inspect(a,t).split("\n").join("\n "),n+=r+" => "+a}),(f||o)&&(n+="\n"),n+="}"},o.prototype.set=function(e,t,n){n=n||r(this,"maxAge");var i=n?Date.now():0,o=r(this,"lengthCalculator").call(this,t,e);if(r(this,"cache").has(e)){if(o>r(this,"max"))return c(this,r(this,"cache").get(e)),!1;var a=r(this,"cache").get(e),s=a.value;return r(this,"dispose")&&r(this,"dispose").call(this,e,s.value),s.now=i,s.maxAge=n,s.value=t,r(this,"length",r(this,"length")+(o-s.length)),s.length=o,this.get(e),l(this),!0}var u=new f(e,t,o,i,n);return u.length>r(this,"max")?(r(this,"dispose")&&r(this,"dispose").call(this,e,t),!1):(r(this,"length",r(this,"length")+u.length),r(this,"lruList").unshift(u),r(this,"cache").set(e,r(this,"lruList").head),l(this),!0)},o.prototype.has=function(e){if(!r(this,"cache").has(e))return!1;var t=r(this,"cache").get(e).value;return u(this,t)?!1:!0},o.prototype.get=function(e){return s(this,e,!0)},o.prototype.peek=function(e){return s(this,e,!1)},o.prototype.pop=function(){var e=r(this,"lruList").tail;return e?(c(this,e),e.value):null},o.prototype.del=function(e){c(this,r(this,"cache").get(e))},o.prototype.load=function(e){this.reset();for(var t=Date.now(),n=e.length-1;n>=0;n--){var r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{var o=i-t;o>0&&this.set(r.k,r.v,o)}}},o.prototype.prune=function(){var e=this;r(this,"cache").forEach(function(t,n){s(e,n,!1)})}},function(e,t,n){(function(t){"pseudomap"===t.env.npm_package_name&&"test"===t.env.npm_lifecycle_script&&(t.env.TEST_PSEUDOMAP="true"),"function"!=typeof Map||t.env.TEST_PSEUDOMAP?e.exports=n(52):e.exports=Map}).call(t,n(51))},function(e,t){function n(){l=!1,a.length?u=a.concat(u):c=-1,u.length&&r()}function r(){if(!l){var e=setTimeout(n);l=!0;for(var t=u.length;t;){for(a=u,u=[];++c1)for(var n=1;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,n,r){if(e.customInspect&&n&&E(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return g(i)||(i=u(e,i,r)),i}var o=l(e,n);if(o)return o;var a=Object.keys(n),v=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),O(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(n);if(0===a.length){if(E(n)){var y=n.name?": "+n.name:"";return e.stylize("[Function"+y+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(M(n))return e.stylize(Date.prototype.toString.call(n),"date");if(O(n))return c(n)}var _="",m=!1,b=["{","}"];if(d(n)&&(m=!0,b=["[","]"]),E(n)){var w=n.name?": "+n.name:"";_=" [Function"+w+"]"}if(x(n)&&(_=" "+RegExp.prototype.toString.call(n)),M(n)&&(_=" "+Date.prototype.toUTCString.call(n)),O(n)&&(_=" "+c(n)),0===a.length&&(!m||0==n.length))return b[0]+_+b[1];if(0>r)return x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var k;return k=m?f(e,n,r,v,a):a.map(function(t){return h(e,n,r,v,t,m)}),e.seen.pop(),p(k,_,b)}function l(e,t){if(w(t))return e.stylize("undefined","undefined");if(g(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return m(t)?e.stylize(""+t,"number"):v(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i){for(var o=[],a=0,s=t.length;s>a;++a)C(t,String(a))?o.push(h(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))}),o}function h(e,t,n,r,i,o){var a,s,l;if(l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},l.get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),C(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=y(n)?u(e,l.value,null):u(e,l.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function d(e){return Array.isArray(e)}function v(e){return"boolean"==typeof e}function y(e){return null===e}function _(e){return null==e}function m(e){return"number"==typeof e}function g(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function w(e){return void 0===e}function x(e){return k(e)&&"[object RegExp]"===T(e)}function k(e){return"object"==typeof e&&null!==e}function M(e){return k(e)&&"[object Date]"===T(e)}function O(e){return k(e)&&("[object Error]"===T(e)||e instanceof Error)}function E(e){return"function"==typeof e}function P(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function T(e){return Object.prototype.toString.call(e)}function j(e){return 10>e?"0"+e.toString(10):e.toString(10)}function S(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var A=/%[sdj%]/g;t.format=function(e){if(!g(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),s=r[n];o>n;s=r[++n])a+=y(s)||!k(s)?" "+s:" "+i(s);return a},t.deprecate=function(n,i){function o(){if(!a){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return n.apply(this,arguments)}if(w(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var a=!1;return o};var L,D={};t.debuglog=function(e){if(w(L)&&(L=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!D[e])if(new RegExp("\\b"+e+"\\b","i").test(L)){var n=r.pid;D[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else D[e]=function(){};return D[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=v,t.isNull=y,t.isNullOrUndefined=_,t.isNumber=m,t.isString=g,t.isSymbol=b,t.isUndefined=w,t.isRegExp=x,t.isObject=k,t.isDate=M,t.isError=O,t.isFunction=E,t.isPrimitive=P,t.isBuffer=n(54);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",S(),t.format.apply(t,arguments))},t.inherits=n(55),t._extend=function(e,t){if(!t||!k(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(51))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;i>r;r++)t.push(arguments[r]);return t}function r(e,t){e.tail=new o(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function i(e,t){e.head=new o(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function o(e,t,n,r){return this instanceof o?(this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,void(n?(n.prev=this,this.next=n):this.next=null)):new o(e,t,n,r)}e.exports=n,n.Node=o,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;t>e;e++)r(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;t>e;e++)i(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail.next=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head.prev=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;null!==n;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;null!==n;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&e>t;t++)n=n.next;return t===e&&null!==n?n.value:void 0},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&e>t;t++)n=n.prev;return t===e&&null!==n?n.value:void 0},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t=t||this.length,0>t&&(t+=this.length),e=e||0,0>e&&(e+=this.length);var r=new n;if(e>t||0>t)return r;0>e&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&e>i;i++)o=o.next;for(;null!==o&&t>i;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){t=t||this.length,0>t&&(t+=this.length),e=e||0,0>e&&(e+=this.length);var r=new n;if(e>t||0>t)return r;0>e&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this}},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0;i--){var o=1<0&&(l=x["default"].createLineGeometry(s,o),c=new h["default"].LineBasicMaterial({vertexColors:h["default"].VertexColors,linewidth:i.lineWidth,transparent:i.lineTransparent,opacity:i.lineOpacity,blending:i.lineBlending}),f=new h["default"].LineSegments(l,c),void 0!==i.lineRenderOrder&&(c.depthWrite=!1,f.renderOrder=i.lineRenderOrder),this._mesh.add(f),this._options.picking)){c=new M["default"],c.side=h["default"].BackSide,c.linewidth=i.lineWidth+c.linePadding;var p=new h["default"].LineSegments(l,c);this._pickingMesh.add(p)}if(a.facesCount>0&&(l=x["default"].createGeometry(a,o),this._world._environment._skybox?(c=new h["default"].MeshStandardMaterial({vertexColors:h["default"].VertexColors,side:h["default"].BackSide}),c.roughness=1,c.metalness=.1,c.envMapIntensity=3,c.envMap=this._world._environment._skybox.getRenderTarget()):c=new h["default"].MeshPhongMaterial({vertexColors:h["default"].VertexColors,side:h["default"].BackSide}),f=new h["default"].Mesh(l,c),f.castShadow=!0,f.receiveShadow=!0,a.allFlat&&(c.depthWrite=!1,f.renderOrder=1),this._mesh.add(f),this._options.picking)){c=new M["default"],c.side=h["default"].BackSide;var p=new h["default"].Mesh(l,c);this._pickingMesh.add(p)}this._ready=!0,console.timeEnd(this._tile),console.log(this._tile+": "+r.length+" features")}},{key:"_abortRequest",value:function(){this._request&&this._request.abort()}}]),t}(l["default"]);t["default"]=O;var E=function(e,t,n,r){return new O(e,t,n,r)};t.geoJSONTile=E},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__;!function(e,t,n){"undefined"!=typeof module&&module.exports?module.exports=n():(__WEBPACK_AMD_DEFINE_FACTORY__=n,__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof __WEBPACK_AMD_DEFINE_FACTORY__?__WEBPACK_AMD_DEFINE_FACTORY__.call(exports,__webpack_require__,exports,module):__WEBPACK_AMD_DEFINE_FACTORY__,!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}("reqwest",this,function(){function succeed(e){var t=protocolRe.exec(e.url);return t=t&&t[1]||context.location.protocol,httpsRe.test(t)?twoHundo.test(e.request.status):!!e.request.response}function handleReadyState(e,t,n){return function(){return e._aborted?n(e.request):e._timedOut?n(e.request,"Request is aborted: timeout"):void(e.request&&4==e.request[readyState]&&(e.request.onreadystatechange=noop,succeed(e)?t(e.request):n(e.request)))}}function setHeaders(e,t){var n,r=t.headers||{};r.Accept=r.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"];var i="undefined"!=typeof FormData&&t.data instanceof FormData;t.crossOrigin||r[requestedWith]||(r[requestedWith]=defaultHeaders.requestedWith),r[contentType]||i||(r[contentType]=t.contentType||defaultHeaders.contentType);for(n in r)r.hasOwnProperty(n)&&"setRequestHeader"in e&&e.setRequestHeader(n,r[n])}function setCredentials(e,t){"undefined"!=typeof t.withCredentials&&"undefined"!=typeof e.withCredentials&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var i=uniqid++,o=e.jsonpCallback||"callback",a=e.jsonpCallbackName||reqwest.getcallbackPrefix(i),s=new RegExp("((^|\\?|&)"+o+")=([^&]+)"),u=r.match(s),l=doc.createElement("script"),c=0,f=-1!==navigator.userAgent.indexOf("MSIE 10.0");return u?"?"===u[3]?r=r.replace(s,"$1="+a):a=u[3]:r=urlappend(r,o+"="+a),context[a]=generalCallback,l.type="text/javascript",l.src=r,l.async=!0,"undefined"==typeof l.onreadystatechange||f||(l.htmlFor=l.id="_reqwest_"+i),l.onload=l.onreadystatechange=function(){return l[readyState]&&"complete"!==l[readyState]&&"loaded"!==l[readyState]||c?!1:(l.onload=l.onreadystatechange=null,l.onclick&&l.onclick(),t(lastValue),lastValue=void 0,head.removeChild(l),void(c=1))},head.appendChild(l),{abort:function(){l.onload=l.onreadystatechange=null,n({},"Request is aborted: timeout",{}),lastValue=void 0,head.removeChild(l),c=1}}}function getRequest(e,t){var n,r=this.o,i=(r.method||"GET").toUpperCase(),o="string"==typeof r?r:r.url,a=r.processData!==!1&&r.data&&"string"!=typeof r.data?reqwest.toQueryString(r.data):r.data||null,s=!1;return"jsonp"!=r.type&&"GET"!=i||!a||(o=urlappend(o,a),a=null),"jsonp"==r.type?handleJsonp(r,e,t,o):(n=r.xhr&&r.xhr(r)||xhr(r),n.open(i,o,r.async===!1?!1:!0),setHeaders(n,r),setCredentials(n,r),context[xDomainRequest]&&n instanceof context[xDomainRequest]?(n.onload=e,n.onerror=t,n.onprogress=function(){},s=!0):n.onreadystatechange=handleReadyState(this,e,t),r.before&&r.before(n),s?setTimeout(function(){n.send(a)},200):n.send(a),n)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){return null!==e?e.match("json")?"json":e.match("javascript")?"js":e.match("text")?"html":e.match("xml")?"xml":void 0:void 0}function init(o,fn){function complete(e){for(o.timeout&&clearTimeout(self.timeout),self.timeout=null;self._completeHandlers.length>0;)self._completeHandlers.shift()(e)}function success(resp){var type=o.type||resp&&setType(resp.getResponseHeader("Content-Type"));resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=context.JSON?context.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function timedOut(){self._timedOut=!0,self.request.abort()}function error(e,t,n){for(e=self.request,self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(e,t,n);complete(e)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){timedOut()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n,r,i,o,a=e.name,s=e.tagName.toLowerCase(),u=function(e){e&&!e.disabled&&t(a,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(!e.disabled&&a)switch(s){case"input":/reset|button|image|file/i.test(e.type)||(n=/checkbox/i.test(e.type),r=/radio/i.test(e.type),i=e.value,(!(n||r)||e.checked)&&t(a,normalize(n&&""===i?"on":i)));break;case"textarea":t(a,normalize(e.value));break;case"select":if("select-one"===e.type.toLowerCase())u(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(o=0;e.length&&on;){var i=n+r>>>1;e[i]e?~e:e],o=0,a=r.length;a>o;++o)t.push(n=r[o].slice()),c(n,o);0>e&&i(t,a)}function o(e){return e=e.slice(),c(e,0),e}function a(e){for(var t=[],n=0,i=e.length;i>n;++n)r(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0].slice());return t}function u(e){return e.map(s)}function l(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(l)}:t in h?{type:t,coordinates:h[t](e)}:null}var c=n(e.transform),f=e.arcs,h={Point:function(e){return o(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(o)},LineString:function(e){return a(e.arcs)},MultiLineString:function(e){return e.arcs.map(a)},Polygon:function(e){return u(e.arcs)},MultiPolygon:function(e){return e.arcs.map(u)}};return l(t)}function l(e,t){function n(t){var n,r=e.arcs[0>t?~t:t],i=r[0];return e.transform?(n=[0,0],r.forEach(function(e){n[0]+=e[0],n[1]+=e[1]})):n=r[r.length-1],0>t?[n,i]:[i,n]}function r(e,t){for(var n in e){var r=e[n];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){i[0>e?~e:e]=1}),s.push(r)}}var i={},o={},a={},s=[],u=-1;return t.forEach(function(n,r){var i,o=e.arcs[0>n?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=t[++u],t[u]=n,t[r]=i)}),t.forEach(function(e){var t,r,i=n(e),s=i[0],u=i[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=u,r=o[u]){delete o[r.start];var l=r===t?t:t.concat(r);o[l.start=t.start]=a[l.end=r.end]=l}else o[t.start]=a[t.end]=t;else if(t=o[u])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=u]=t}),r(a,o),r(o,a),t.forEach(function(e){i[0>e?~e:e]||s.push([e])}),s}function c(e){return u(e,f.apply(this,arguments))}function f(e,t,n){function r(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function i(e){e.forEach(r)}function o(e){e.forEach(i)}function a(e){"GeometryCollection"===e.type?e.geometries.forEach(a):e.type in f&&(u=e,f[e.type](e.arcs))}var s=[];if(arguments.length>1){var u,c=[],f={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(e){e.forEach(o)}};a(t),c.forEach(arguments.length<3?function(e){s.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&s.push(e[0].i)})}else for(var h=0,p=e.arcs.length;p>h;++h)s.push(h);return{type:"MultiLineString",arcs:l(e,s)}}function h(e){var t=e[0],n=e[1],r=e[2];return Math.abs((t[0]-r[0])*(n[1]-t[1])-(t[0]-n[0])*(r[1]-t[1]))}function p(e){for(var t,n=-1,r=e.length,i=e[r-1],o=0;++nt?~t:t]||(i[t]=[])).push(e)})}),o.push(e)}function r(t){return p(u(e,{type:"Polygon",arcs:[t]}).coordinates[0])>0}var i={},o=[],a=[];return t.forEach(function(e){"Polygon"===e.type?n(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(n)}),o.forEach(function(e){if(!e._){var t=[],n=[e];for(e._=1,a.push(t);e=n.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].forEach(function(e){e._||(e._=1,n.push(e))})})})}}),o.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:a.map(function(t){var n,o=[];if(t.forEach(function(e){e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].length<2&&o.push(e)})})}),o=l(e,o),(n=o.length)>1)for(var a,s=r(t[0][0]),u=0;n>u;++u)if(s===r(o[u])){a=o[0],o[0]=o[u],o[u]=a;break}return o})}}function y(e){function t(e,t){e.forEach(function(e){0>e&&(e=~e);var n=i[e];n?n.push(t):i[e]=[t]})}function n(e,n){e.forEach(function(e){t(e,n)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in s&&s[e.type](e.arcs,t)}var i={},a=e.map(function(){return[]}),s={LineString:t,MultiLineString:n,Polygon:n,MultiPolygon:function(e,t){e.forEach(function(e){n(e,t)})}};e.forEach(r);for(var u in i)for(var l=i[u],c=l.length,f=0;c>f;++f)for(var h=f+1;c>h;++h){var p,d=l[f],v=l[h];(p=a[d])[u=o(p,v)]!==v&&p.splice(u,0,v),(p=a[v])[u=o(p,d)]!==d&&p.splice(u,0,d)}return a}function _(e,t){return e[1][2]-t[1][2]}function m(){function e(e,t){for(;t>0;){var n=(t+1>>1)-1,i=r[n];if(_(e,i)>=0)break;r[i._=t]=i,r[e._=t=n]=e}}function t(e,t){for(;;){var n=t+1<<1,o=n-1,a=t,s=r[a];if(i>o&&_(r[o],s)<0&&(s=r[a=o]),i>n&&_(r[n],s)<0&&(s=r[a=n]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var n={},r=[],i=0;return n.push=function(t){return e(r[t._=i]=t,i++),i},n.pop=function(){if(!(0>=i)){var e,n=r[0];return--i>0&&(e=r[i],t(r[e._=0]=e,0)),n}},n.remove=function(n){var o,a=n._;if(r[a]===n)return a!==--i&&(o=r[i],(_(o,n)<0?e:t)(r[o._=a]=o,a)),a},n}function g(e,t){function i(e){s.remove(e),e[1][2]=t(e),s.push(e)}var o=n(e.transform),a=r(e.transform),s=m();return t||(t=h),e.arcs.forEach(function(e){var n,r,u,l,c=[],f=0;for(r=0,u=e.length;u>r;++r)l=e[r],o(e[r]=[l[0],l[1],1/0],r);for(r=1,u=e.length-1;u>r;++r)n=e.slice(r-1,r+2),n[1][2]=t(n),c.push(n),s.push(n);for(r=0,u=c.length;u>r;++r)n=c[r],n.previous=c[r-1],n.next=c[r+1];for(;n=s.pop();){var h=n.previous,p=n.next;n[1][2]0){var c=_["default"].mergeAttributes(a);this._setPolygonMesh(c,s),this.add(this._polygonMesh)}if(u.length>0){var h=_["default"].mergeAttributes(u);this._setPolylineMesh(h),this.add(this._polylineMesh)}if(l.length>0){var p=_["default"].mergeAttributes(l);this._setPointMesh(p),this.add(this._pointMesh)}}}},{key:"_setPolygonMesh",value:function(e,t){var n=new THREE.BufferGeometry;n.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),n.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),n.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&n.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),n.computeBoundingBox();var r;if(this._options.polygonMaterial&&this._options.polygonMaterial instanceof THREE.Material?r=this._options.material:this._world._environment._skybox?(r=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide}),r.roughness=1,r.metalness=.1,r.envMapIntensity=3,r.envMap=this._world._environment._skybox.getRenderTarget()):r=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide}),mesh=new THREE.Mesh(n,r),mesh.castShadow=!0,mesh.receiveShadow=!0,t&&(r.depthWrite=!1,mesh.renderOrder=1),this._options.interactive&&this._pickingMesh){r=new g["default"],r.side=THREE.BackSide;var i=new THREE.Mesh(n,r);this._pickingMesh.add(i)}"function"==typeof this._options.onPolygonMesh&&this._options.onPolygonMesh(mesh),this._polygonMesh=mesh}},{key:"_setPolylineMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n="function"==typeof this._options.style?this._options.style(this._geojson.features[0]):this._options.style;n=(0,f["default"])({},v["default"].defaultStyle,n);var r;r=this._options.polylineMaterial&&this._options.polylineMaterial instanceof THREE.Material?this._options.material:new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,linewidth:n.lineWidth,transparent:n.lineTransparent,opacity:n.lineOpacity,blending:n.lineBlending});var i=new THREE.LineSegments(t,r);if(void 0!==n.lineRenderOrder&&(r.depthWrite=!1,i.renderOrder=n.lineRenderOrder),i.castShadow=!0,this._options.interactive&&this._pickingMesh){r=new g["default"],r.linewidth=n.lineWidth+r.linePadding;var o=new THREE.LineSegments(t,r);this._pickingMesh.add(o)}"function"==typeof this._options.onPolylineMesh&&this._options.onPolylineMesh(i),this._polylineMesh=i}},{key:"_setPointMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),t.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n;if(this._options.pointMaterial&&this._options.pointMaterial instanceof THREE.Material?n=this._options.material:this._world._environment._skybox?(n=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors}),n.roughness=1,n.metalness=.1,n.envMapIntensity=3,n.envMap=this._world._environment._skybox.getRenderTarget()):n=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors}),mesh=new THREE.Mesh(t,n),mesh.castShadow=!0,this._options.interactive&&this._pickingMesh){n=new g["default"];var r=new THREE.Mesh(t,n);this._pickingMesh.add(r)}"function"==typeof this._options.onPointMesh&&this._options.onPointMesh(mesh),this._pointMesh=mesh}},{key:"_featureToLayer",value:function(e,t){var n=e.geometry,r=n.coordinates?n.coordinates:null;return r&&n?"Polygon"===n.type||"MultiPolygon"===n.type?("function"==typeof this._options.polygonMaterial&&(t.geometry=this._options.polygonMaterial(e)),"function"==typeof this._options.onPolygonMesh&&(t.onMesh=this._options.onPolygonMesh),"function"==typeof this._options.onPolygonBufferAttributes&&(t.onBufferAttributes=this._options.onPolygonBufferAttributes),new w["default"](r,t)):"LineString"===n.type||"MultiLineString"===n.type?("function"==typeof this._options.lineMaterial&&(t.geometry=this._options.lineMaterial(e)),"function"==typeof this._options.onPolylineMesh&&(t.onMesh=this._options.onPolylineMesh),"function"==typeof this._options.onPolylineBufferAttributes&&(t.onBufferAttributes=this._options.onPolylineBufferAttributes),new k["default"](r,t)):"Point"===n.type||"MultiPoint"===n.type?("function"==typeof this._options.pointGeometry&&(t.geometry=this._options.pointGeometry(e)),"function"==typeof this._options.pointMaterial&&(t.geometry=this._options.pointMaterial(e)),"function"==typeof this._options.onPointMesh&&(t.onMesh=this._options.onPointMesh),new O["default"](r,t)):void 0:void 0}},{key:"_abortRequest",value:function(){this._request&&this._request.abort()}},{key:"destroy",value:function(){this._abortRequest(),this._request=null,this._pickingMesh&&(this._pickingMesh=null),s(Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(l["default"]);t["default"]=E;var P=function(e,t){return new E(e,t)};t.geoJSONLayer=P},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n-1&&this._layers.splice(t,1),this._world.removeLayer(e)}},{key:"_onAdd",value:function(e){}},{key:"destroy",value:function(){for(var e=0;e0&&(r+=e[i-1].length,n.holes.push(r))}return n}},{key:"_triangulate",value:function(e,t,n){var r=(0,m["default"])(e,t,n),o=[];for(i=0,il=r.length;i80*n){l=h=e[0],f=p=e[1];for(var _=n;a>_;_+=n)d=e[_],v=e[_+1],l>d&&(l=d),f>v&&(f=v),d>h&&(h=d),v>p&&(p=v);y=Math.max(h-l,p-f)}return o(s,u,n,l,f,y),u}function r(e,t,n,r,i){var o,a,s,u=0;for(o=t,a=n-r;n>o;o+=r)u+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;if(i===u>0)for(o=t;n>o;o+=r)s=P(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=P(o,e[o],e[o+1],s);return s}function i(e,t){if(!e)return e;t||(t=e);var n,r=e;do if(n=!1,r.steiner||!w(r,r.next)&&0!==b(r.prev,r,r.next))r=r.next;else{if(T(r),r=t=r.prev,r===r.next)return null;n=!0}while(n||r!==t);return t}function o(e,t,n,r,c,f,h){if(e){!h&&f&&d(e,r,c,f);for(var p,v,y=e;e.prev!==e.next;)if(p=e.prev,v=e.next,f?s(e,r,c,f):a(e))t.push(p.i/n),t.push(e.i/n),t.push(v.i/n),T(e),e=v.next,y=v.next;else if(e=v,e===y){h?1===h?(e=u(e,t,n),o(e,t,n,r,c,f,2)):2===h&&l(e,t,n,r,c,f):o(i(e),t,n,r,c,f,1);break}}}function a(e){var t=e.prev,n=e,r=e.next;if(b(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(m(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function s(e,t,n,r){var i=e.prev,o=e,a=e.next;if(b(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=y(s,u,t,n,r),h=y(l,c,t,n,r),p=e.nextZ;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&m(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=e.prevZ;p&&p.z>=f;){if(p!==e.prev&&p!==e.next&&m(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&b(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function u(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;x(i,r,r.next,o)&&M(i,o)&&M(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),T(r),T(r.next),r=e=o),r=r.next}while(r!==e);return r}function l(e,t,n,r,a,s){var u=e;do{for(var l=u.next.next;l!==u.prev;){if(u.i!==l.i&&g(u,l)){var c=E(u,l);return u=i(u,u.next),c=i(c,c.next),o(u,t,n,r,a,s),void o(c,t,n,r,a,s)}l=l.next}u=u.next}while(u!==e)}function c(e,t,n,o){var a,s,u,l,c,p=[];for(a=0,s=t.length;s>a;a++)u=t[a]*o,l=s-1>a?t[a+1]*o:e.length,c=r(e,u,l,o,!1),c===c.next&&(c.steiner=!0),p.push(_(c));for(p.sort(f),a=0;a=r.next.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);i>=s&&s>a&&(a=s,n=r.x=r.x&&r.x>=n.x&&m(ou||u===c&&r.x>n.x)&&M(r,e)&&(n=r,c=u)),r=r.next;return n}function d(e,t,n,r){var i=e;do null===i.z&&(i.z=y(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,v(i)}function v(e){var t,n,r,i,o,a,s,u,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,r=n,s=0,t=0;l>t&&(s++,r=r.nextZ,r);t++);for(u=l;s>0||u>0&&r;)0===s?(i=r,r=r.nextZ,u--):0!==u&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--):(i=n,n=n.nextZ,s--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(a>1);return e}function y(e,t,n,r,i){return e=32767*(e-n)/i,t=32767*(t-r)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function _(e){var t=e,n=e;do t.x=0&&(e-a)*(r-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function g(e,t){return w(e,t)||e.next.i!==t.i&&e.prev.i!==t.i&&!k(e,t)&&M(e,t)&&M(t,e)&&O(e,t)}function b(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function w(e,t){return e.x===t.x&&e.y===t.y}function x(e,t,n,r){return b(e,t,n)>0!=b(e,t,r)>0&&b(n,r,e)>0!=b(n,r,t)>0}function k(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&x(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function M(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function O(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function E(e,t){var n=new j(e.i,e.x,e.y),r=new j(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function P(e,t,n,r){var i=new j(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function T(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function j(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.exports=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=function(e,t,n){function r(){a=e.map(function(e){return[e[0],h.top,e[1]]}),s=t,u=t}function i(){a=[],e.forEach(function(e){a.push([e[0],h.top,e[1]])}),e.forEach(function(e){a.push([e[0],h.bottom,e[1]])}),s=[];for(var n=0;p>n;n++)n===p-1?(s.push([n+p,p,n]),s.push([0,n,p])):(s.push([n+p,n+p+1,n]),s.push([n+1,n,n+p+1]));if(c=[].concat(s),h.closed){var r=t,i=r.map(function(e){return e.map(function(e){return e+p})});i=i.map(function(e){return[e[0],e[2],e[1]]}),s=s.concat(r).concat(i),u=r,l=i}}var a,s,u,l,c,f={top:1,bottom:0,closed:!0},h=(0,o["default"])({},f,n),p=e.length;return h.top===h.bottom?r():i(),{positions:a,faces:s,top:u,bottom:l,sides:c}};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n {});\n\t // this._engine.on('postRender', () => {});\n\t }\n\t }, {\n\t key: '_initEnvironment',\n\t value: function _initEnvironment() {\n\t // Not sure if I want to keep this as a private API\n\t //\n\t // Makes sense to allow others to customise their environment so perhaps\n\t // add some method of disable / overriding the environment settings\n\t this._environment = new _layerEnvironmentEnvironmentLayer2['default']({\n\t skybox: this.options.skybox\n\t }).addTo(this);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t this.on('controlsMoveEnd', this._onControlsMoveEnd);\n\t }\n\t }, {\n\t key: '_onControlsMoveEnd',\n\t value: function _onControlsMoveEnd(point) {\n\t var _point = (0, _geoPoint.point)(point.x, point.z);\n\t this._resetView(this.pointToLatLon(_point), _point);\n\t }\n\t\n\t // Reset world view\n\t }, {\n\t key: '_resetView',\n\t value: function _resetView(latlon, point) {\n\t this.emit('preResetView');\n\t\n\t this._moveStart();\n\t this._move(latlon, point);\n\t this._moveEnd();\n\t\n\t this.emit('postResetView');\n\t }\n\t }, {\n\t key: '_moveStart',\n\t value: function _moveStart() {\n\t this.emit('moveStart');\n\t }\n\t }, {\n\t key: '_move',\n\t value: function _move(latlon, point) {\n\t this._lastPosition = latlon;\n\t this.emit('move', latlon, point);\n\t }\n\t }, {\n\t key: '_moveEnd',\n\t value: function _moveEnd() {\n\t this.emit('moveEnd');\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._pause) {\n\t return;\n\t }\n\t\n\t var delta = this._engine.clock.getDelta();\n\t\n\t // Once _update is called it will run forever, for now\n\t window.requestAnimationFrame(this._update.bind(this));\n\t\n\t // Update controls\n\t this._controls.forEach(function (controls) {\n\t controls.update();\n\t });\n\t\n\t this.emit('preUpdate', delta);\n\t this._engine.update(delta);\n\t this.emit('postUpdate', delta);\n\t }\n\t\n\t // Set world view\n\t }, {\n\t key: 'setView',\n\t value: function setView(latlon) {\n\t // Store initial geographic coordinate for the [0,0,0] world position\n\t //\n\t // The origin point doesn't move in three.js / 3D space so only set it once\n\t // here instead of every time _resetView is called\n\t //\n\t // If it was updated every time then coorindates would shift over time and\n\t // would be out of place / context with previously-placed points (0,0 would\n\t // refer to a different point each time)\n\t this._originLatlon = latlon;\n\t this._originPoint = this.project(latlon);\n\t\n\t this._resetView(latlon);\n\t return this;\n\t }\n\t\n\t // Return world geographic position\n\t }, {\n\t key: 'getPosition',\n\t value: function getPosition() {\n\t return this._lastPosition;\n\t }\n\t\n\t // Transform geographic coordinate to world point\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the origin point of the projection (not the world)\n\t }, {\n\t key: 'project',\n\t value: function project(latlon) {\n\t return this.options.crs.latLonToPoint((0, _geoLatLon.latLon)(latlon));\n\t }\n\t\n\t // Transform world point to geographic coordinate\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a point relative to the origin point of the\n\t // projection (not the world) and returns a geographic coordinate\n\t }, {\n\t key: 'unproject',\n\t value: function unproject(point) {\n\t return this.options.crs.pointToLatLon((0, _geoPoint.point)(point));\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the three.js / 3D origin (0,0)\n\t }, {\n\t key: 'latLonToPoint',\n\t value: function latLonToPoint(latlon) {\n\t var projectedPoint = this.project((0, _geoLatLon.latLon)(latlon));\n\t return projectedPoint._subtract(this._originPoint);\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a point relative to the three.js / 3D origin (0,0)\n\t // and returns the exact geographic coordinate at that point\n\t }, {\n\t key: 'pointToLatLon',\n\t value: function pointToLatLon(point) {\n\t var projectedPoint = (0, _geoPoint.point)(point).add(this._originPoint);\n\t return this.unproject(projectedPoint);\n\t }\n\t\n\t // Return pointscale for a given geographic coordinate\n\t }, {\n\t key: 'pointScale',\n\t value: function pointScale(latlon, accurate) {\n\t return this.options.crs.pointScale(latlon, accurate);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'metresToWorld',\n\t value: function metresToWorld(metres, pointScale, zoom) {\n\t return this.options.crs.metresToWorld(metres, pointScale, zoom);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'worldToMetres',\n\t value: function worldToMetres(worldUnits, pointScale, zoom) {\n\t return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n\t }\n\t\n\t // Unsure if it's a good idea to expose this here for components like\n\t // GridLayer to use (eg. to keep track of a frustum)\n\t }, {\n\t key: 'getCamera',\n\t value: function getCamera() {\n\t return this._engine._camera;\n\t }\n\t }, {\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t layer._addToWorld(this);\n\t\n\t this._layers.push(layer);\n\t\n\t if (layer.isOutput()) {\n\t // Could move this into Layer but it'll do here for now\n\t this._engine._scene.add(layer._object3D);\n\t this._engine._domScene3D.add(layer._domObject3D);\n\t this._engine._domScene2D.add(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerAdded', layer);\n\t return this;\n\t }\n\t\n\t // Remove layer from world and scene but don't destroy it entirely\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t if (layer.isOutput()) {\n\t this._engine._scene.remove(layer._object3D);\n\t this._engine._domScene3D.remove(layer._domObject3D);\n\t this._engine._domScene2D.remove(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerRemoved');\n\t return this;\n\t }\n\t }, {\n\t key: 'addControls',\n\t value: function addControls(controls) {\n\t controls._addToWorld(this);\n\t\n\t this._controls.push(controls);\n\t\n\t this.emit('controlsAdded', controls);\n\t return this;\n\t }\n\t\n\t // Remove controls from world but don't destroy them entirely\n\t }, {\n\t key: 'removeControls',\n\t value: function removeControls(controls) {\n\t var controlsIndex = this._controls.indexOf(controlsIndex);\n\t\n\t if (controlsIndex > -1) {\n\t this._controls.splice(controlsIndex, 1);\n\t };\n\t\n\t this.emit('controlsRemoved', controls);\n\t return this;\n\t }\n\t }, {\n\t key: 'stop',\n\t value: function stop() {\n\t this._pause = true;\n\t }\n\t }, {\n\t key: 'start',\n\t value: function start() {\n\t this._pause = false;\n\t this._update();\n\t }\n\t\n\t // Destroys the world(!) and removes it from the scene and memory\n\t //\n\t // TODO: World out why so much three.js stuff is left in the heap after this\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this.stop();\n\t\n\t // Remove listeners\n\t this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\t\n\t var i;\n\t\n\t // Remove all controls\n\t var controls;\n\t for (i = this._controls.length - 1; i >= 0; i--) {\n\t controls = this._controls[0];\n\t this.removeControls(controls);\n\t controls.destroy();\n\t };\n\t\n\t // Remove all layers\n\t var layer;\n\t for (i = this._layers.length - 1; i >= 0; i--) {\n\t layer = this._layers[0];\n\t this.removeLayer(layer);\n\t layer.destroy();\n\t };\n\t\n\t // Environment layer is removed with the other layers\n\t this._environment = null;\n\t\n\t this._engine.destroy();\n\t this._engine = null;\n\t\n\t // TODO: Probably should clean the container too / remove the canvas\n\t this._container = null;\n\t }\n\t }]);\n\t\n\t return World;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = World;\n\t\n\tvar noNew = function noNew(domId, options) {\n\t return new World(domId, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.world = noNew;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\t//\n\t// We store our EE objects in a plain object whose properties are event names.\n\t// If `Object.create(null)` is not supported we prefix the event names with a\n\t// `~` to make sure that the built-in object properties are not overridden or\n\t// used as an attack vector.\n\t// We also assume that `Object.create(null)` is available when the event name\n\t// is an ES6 Symbol.\n\t//\n\tvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\t\n\t/**\n\t * Representation of a single EventEmitter function.\n\t *\n\t * @param {Function} fn Event handler to be called.\n\t * @param {Mixed} context Context for function execution.\n\t * @param {Boolean} once Only emit once\n\t * @api private\n\t */\n\tfunction EE(fn, context, once) {\n\t this.fn = fn;\n\t this.context = context;\n\t this.once = once || false;\n\t}\n\t\n\t/**\n\t * Minimal EventEmitter interface that is molded against the Node.js\n\t * EventEmitter interface.\n\t *\n\t * @constructor\n\t * @api public\n\t */\n\tfunction EventEmitter() { /* Nothing to set */ }\n\t\n\t/**\n\t * Holds the assigned EventEmitters by name.\n\t *\n\t * @type {Object}\n\t * @private\n\t */\n\tEventEmitter.prototype._events = undefined;\n\t\n\t/**\n\t * Return a list of assigned event listeners.\n\t *\n\t * @param {String} event The events that should be listed.\n\t * @param {Boolean} exists We only need to know if there are listeners.\n\t * @returns {Array|Boolean}\n\t * @api public\n\t */\n\tEventEmitter.prototype.listeners = function listeners(event, exists) {\n\t var evt = prefix ? prefix + event : event\n\t , available = this._events && this._events[evt];\n\t\n\t if (exists) return !!available;\n\t if (!available) return [];\n\t if (available.fn) return [available.fn];\n\t\n\t for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n\t ee[i] = available[i].fn;\n\t }\n\t\n\t return ee;\n\t};\n\t\n\t/**\n\t * Emit an event to all registered event listeners.\n\t *\n\t * @param {String} event The name of the event.\n\t * @returns {Boolean} Indication if we've emitted an event.\n\t * @api public\n\t */\n\tEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return false;\n\t\n\t var listeners = this._events[evt]\n\t , len = arguments.length\n\t , args\n\t , i;\n\t\n\t if ('function' === typeof listeners.fn) {\n\t if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: return listeners.fn.call(listeners.context), true;\n\t case 2: return listeners.fn.call(listeners.context, a1), true;\n\t case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n\t case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n\t case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n\t case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n\t }\n\t\n\t for (i = 1, args = new Array(len -1); i < len; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t\n\t listeners.fn.apply(listeners.context, args);\n\t } else {\n\t var length = listeners.length\n\t , j;\n\t\n\t for (i = 0; i < length; i++) {\n\t if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: listeners[i].fn.call(listeners[i].context); break;\n\t case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n\t case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n\t default:\n\t if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n\t args[j - 1] = arguments[j];\n\t }\n\t\n\t listeners[i].fn.apply(listeners[i].context, args);\n\t }\n\t }\n\t }\n\t\n\t return true;\n\t};\n\t\n\t/**\n\t * Register a new EventListener for the given event.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Functon} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.on = function on(event, fn, context) {\n\t var listener = new EE(fn, context || this)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Add an EventListener that's only called once.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Function} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.once = function once(event, fn, context) {\n\t var listener = new EE(fn, context || this, true)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove event listeners.\n\t *\n\t * @param {String} event The event we want to remove.\n\t * @param {Function} fn The listener that we need to find.\n\t * @param {Mixed} context Only remove listeners matching this context.\n\t * @param {Boolean} once Only remove once listeners.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return this;\n\t\n\t var listeners = this._events[evt]\n\t , events = [];\n\t\n\t if (fn) {\n\t if (listeners.fn) {\n\t if (\n\t listeners.fn !== fn\n\t || (once && !listeners.once)\n\t || (context && listeners.context !== context)\n\t ) {\n\t events.push(listeners);\n\t }\n\t } else {\n\t for (var i = 0, length = listeners.length; i < length; i++) {\n\t if (\n\t listeners[i].fn !== fn\n\t || (once && !listeners[i].once)\n\t || (context && listeners[i].context !== context)\n\t ) {\n\t events.push(listeners[i]);\n\t }\n\t }\n\t }\n\t }\n\t\n\t //\n\t // Reset the array, or remove it completely if we have no more listeners.\n\t //\n\t if (events.length) {\n\t this._events[evt] = events.length === 1 ? events[0] : events;\n\t } else {\n\t delete this._events[evt];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove all listeners or only the listeners for the specified event.\n\t *\n\t * @param {String} event The event want to remove all listeners for.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n\t if (!this._events) return this;\n\t\n\t if (event) delete this._events[prefix ? prefix + event : event];\n\t else this._events = prefix ? {} : Object.create(null);\n\t\n\t return this;\n\t};\n\t\n\t//\n\t// Alias methods names because people roll like that.\n\t//\n\tEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\tEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\t\n\t//\n\t// This function doesn't apply anymore.\n\t//\n\tEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n\t return this;\n\t};\n\t\n\t//\n\t// Expose the prefix.\n\t//\n\tEventEmitter.prefixed = prefix;\n\t\n\t//\n\t// Expose the module.\n\t//\n\tif (true) {\n\t module.exports = EventEmitter;\n\t}\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar keys = __webpack_require__(4),\n\t rest = __webpack_require__(5);\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/**\n\t * Assigns `value` to `key` of `object` if the existing value is not equivalent\n\t * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * for equality comparisons.\n\t *\n\t * @private\n\t * @param {Object} object The object to modify.\n\t * @param {string} key The key of the property to assign.\n\t * @param {*} value The value to assign.\n\t */\n\tfunction assignValue(object, key, value) {\n\t var objValue = object[key];\n\t if ((!eq(objValue, value) ||\n\t (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n\t (value === undefined && !(key in object))) {\n\t object[key] = value;\n\t }\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Copies properties of `source` to `object`.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObject(source, props, object) {\n\t return copyObjectWith(source, props, object);\n\t}\n\t\n\t/**\n\t * This function is like `copyObject` except that it accepts a function to\n\t * customize copied values.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @param {Function} [customizer] The function to customize copied values.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObjectWith(source, props, object, customizer) {\n\t object || (object = {});\n\t\n\t var index = -1,\n\t length = props.length;\n\t\n\t while (++index < length) {\n\t var key = props[index],\n\t newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\t\n\t assignValue(object, key, newValue);\n\t }\n\t return object;\n\t}\n\t\n\t/**\n\t * Creates a function like `_.assign`.\n\t *\n\t * @private\n\t * @param {Function} assigner The function to assign values.\n\t * @returns {Function} Returns the new assigner function.\n\t */\n\tfunction createAssigner(assigner) {\n\t return rest(function(object, sources) {\n\t var index = -1,\n\t length = sources.length,\n\t customizer = length > 1 ? sources[length - 1] : undefined,\n\t guard = length > 2 ? sources[2] : undefined;\n\t\n\t customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n\t if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n\t customizer = length < 3 ? undefined : customizer;\n\t length = 1;\n\t }\n\t object = Object(object);\n\t while (++index < length) {\n\t var source = sources[index];\n\t if (source) {\n\t assigner(object, source, index, customizer);\n\t }\n\t }\n\t return object;\n\t });\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Checks if the provided arguments are from an iteratee call.\n\t *\n\t * @private\n\t * @param {*} value The potential iteratee value argument.\n\t * @param {*} index The potential iteratee index or key argument.\n\t * @param {*} object The potential iteratee object argument.\n\t * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n\t */\n\tfunction isIterateeCall(value, index, object) {\n\t if (!isObject(object)) {\n\t return false;\n\t }\n\t var type = typeof index;\n\t if (type == 'number'\n\t ? (isArrayLike(object) && isIndex(index, object.length))\n\t : (type == 'string' && index in object)) {\n\t return eq(object[index], value);\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * comparison between two values to determine if they are equivalent.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to compare.\n\t * @param {*} other The other value to compare.\n\t * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n\t * @example\n\t *\n\t * var object = { 'user': 'fred' };\n\t * var other = { 'user': 'fred' };\n\t *\n\t * _.eq(object, object);\n\t * // => true\n\t *\n\t * _.eq(object, other);\n\t * // => false\n\t *\n\t * _.eq('a', 'a');\n\t * // => true\n\t *\n\t * _.eq('a', Object('a'));\n\t * // => false\n\t *\n\t * _.eq(NaN, NaN);\n\t * // => true\n\t */\n\tfunction eq(value, other) {\n\t return value === other || (value !== value && other !== other);\n\t}\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Assigns own enumerable properties of source objects to the destination\n\t * object. Source objects are applied from left to right. Subsequent sources\n\t * overwrite property assignments of previous sources.\n\t *\n\t * **Note:** This method mutates `object` and is loosely based on\n\t * [`Object.assign`](https://mdn.io/Object/assign).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The destination object.\n\t * @param {...Object} [sources] The source objects.\n\t * @returns {Object} Returns `object`.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.c = 3;\n\t * }\n\t *\n\t * function Bar() {\n\t * this.e = 5;\n\t * }\n\t *\n\t * Foo.prototype.d = 4;\n\t * Bar.prototype.f = 6;\n\t *\n\t * _.assign({ 'a': 1 }, new Foo, new Bar);\n\t * // => { 'a': 1, 'c': 3, 'e': 5 }\n\t */\n\tvar assign = createAssigner(function(object, source) {\n\t copyObject(source, keys(source), object);\n\t});\n\t\n\tmodule.exports = assign;\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar argsTag = '[object Arguments]',\n\t funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]',\n\t stringTag = '[object String]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * The base implementation of `_.times` without support for iteratee shorthands\n\t * or max array length checks.\n\t *\n\t * @private\n\t * @param {number} n The number of times to invoke `iteratee`.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Array} Returns the array of results.\n\t */\n\tfunction baseTimes(n, iteratee) {\n\t var index = -1,\n\t result = Array(n);\n\t\n\t while (++index < n) {\n\t result[index] = iteratee(index);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/** Built-in value references. */\n\tvar getPrototypeOf = Object.getPrototypeOf,\n\t propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeKeys = Object.keys;\n\t\n\t/**\n\t * The base implementation of `_.has` without support for deep paths.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {Array|string} key The key to check.\n\t * @returns {boolean} Returns `true` if `key` exists, else `false`.\n\t */\n\tfunction baseHas(object, key) {\n\t // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n\t // that are composed entirely of index properties, return `false` for\n\t // `hasOwnProperty` checks of them.\n\t return hasOwnProperty.call(object, key) ||\n\t (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n\t}\n\t\n\t/**\n\t * The base implementation of `_.keys` which doesn't skip the constructor\n\t * property of prototypes or treat sparse arrays as dense.\n\t *\n\t * @private\n\t * @type Function\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t */\n\tfunction baseKeys(object) {\n\t return nativeKeys(Object(object));\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Creates an array of index keys for `object` values of arrays,\n\t * `arguments` objects, and strings, otherwise `null` is returned.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {Array|null} Returns index keys, else `null`.\n\t */\n\tfunction indexKeys(object) {\n\t var length = object ? object.length : undefined;\n\t if (isLength(length) &&\n\t (isArray(object) || isString(object) || isArguments(object))) {\n\t return baseTimes(length, String);\n\t }\n\t return null;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely a prototype object.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n\t */\n\tfunction isPrototype(value) {\n\t var Ctor = value && value.constructor,\n\t proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\t\n\t return value === proto;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely an `arguments` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArguments(function() { return arguments; }());\n\t * // => true\n\t *\n\t * _.isArguments([1, 2, 3]);\n\t * // => false\n\t */\n\tfunction isArguments(value) {\n\t // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n\t return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n\t (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as an `Array` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArray([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArray(document.body.children);\n\t * // => false\n\t *\n\t * _.isArray('abc');\n\t * // => false\n\t *\n\t * _.isArray(_.noop);\n\t * // => false\n\t */\n\tvar isArray = Array.isArray;\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * This method is like `_.isArrayLike` except that it also checks if `value`\n\t * is an object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLikeObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject('abc');\n\t * // => false\n\t *\n\t * _.isArrayLikeObject(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLikeObject(value) {\n\t return isObjectLike(value) && isArrayLike(value);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Checks if `value` is object-like. A value is object-like if it's not `null`\n\t * and has a `typeof` result of \"object\".\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n\t * @example\n\t *\n\t * _.isObjectLike({});\n\t * // => true\n\t *\n\t * _.isObjectLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObjectLike(_.noop);\n\t * // => false\n\t *\n\t * _.isObjectLike(null);\n\t * // => false\n\t */\n\tfunction isObjectLike(value) {\n\t return !!value && typeof value == 'object';\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `String` primitive or object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isString('abc');\n\t * // => true\n\t *\n\t * _.isString(1);\n\t * // => false\n\t */\n\tfunction isString(value) {\n\t return typeof value == 'string' ||\n\t (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n\t}\n\t\n\t/**\n\t * Creates an array of the own enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects. See the\n\t * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n\t * for more details.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keys(new Foo);\n\t * // => ['a', 'b'] (iteration order is not guaranteed)\n\t *\n\t * _.keys('hi');\n\t * // => ['0', '1']\n\t */\n\tfunction keys(object) {\n\t var isProto = isPrototype(object);\n\t if (!(isProto || isArrayLike(object))) {\n\t return baseKeys(object);\n\t }\n\t var indexes = indexKeys(object),\n\t skipIndexes = !!indexes,\n\t result = indexes || [],\n\t length = result.length;\n\t\n\t for (var key in object) {\n\t if (baseHas(object, key) &&\n\t !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n\t !(isProto && key == 'constructor')) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = keys;\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar INFINITY = 1 / 0,\n\t MAX_INTEGER = 1.7976931348623157e+308,\n\t NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/**\n\t * A faster alternative to `Function#apply`, this function invokes `func`\n\t * with the `this` binding of `thisArg` and the arguments of `args`.\n\t *\n\t * @private\n\t * @param {Function} func The function to invoke.\n\t * @param {*} thisArg The `this` binding of `func`.\n\t * @param {...*} args The arguments to invoke `func` with.\n\t * @returns {*} Returns the result of `func`.\n\t */\n\tfunction apply(func, thisArg, args) {\n\t var length = args.length;\n\t switch (length) {\n\t case 0: return func.call(thisArg);\n\t case 1: return func.call(thisArg, args[0]);\n\t case 2: return func.call(thisArg, args[0], args[1]);\n\t case 3: return func.call(thisArg, args[0], args[1], args[2]);\n\t }\n\t return func.apply(thisArg, args);\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Creates a function that invokes `func` with the `this` binding of the\n\t * created function and arguments from `start` and beyond provided as an array.\n\t *\n\t * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to apply a rest parameter to.\n\t * @param {number} [start=func.length-1] The start position of the rest parameter.\n\t * @returns {Function} Returns the new function.\n\t * @example\n\t *\n\t * var say = _.rest(function(what, names) {\n\t * return what + ' ' + _.initial(names).join(', ') +\n\t * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n\t * });\n\t *\n\t * say('hello', 'fred', 'barney', 'pebbles');\n\t * // => 'hello fred, barney, & pebbles'\n\t */\n\tfunction rest(func, start) {\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n\t return function() {\n\t var args = arguments,\n\t index = -1,\n\t length = nativeMax(args.length - start, 0),\n\t array = Array(length);\n\t\n\t while (++index < length) {\n\t array[index] = args[start + index];\n\t }\n\t switch (start) {\n\t case 0: return func.call(this, array);\n\t case 1: return func.call(this, args[0], array);\n\t case 2: return func.call(this, args[0], args[1], array);\n\t }\n\t var otherArgs = Array(start + 1);\n\t index = -1;\n\t while (++index < start) {\n\t otherArgs[index] = args[index];\n\t }\n\t otherArgs[start] = array;\n\t return apply(func, this, otherArgs);\n\t };\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to an integer.\n\t *\n\t * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to convert.\n\t * @returns {number} Returns the converted integer.\n\t * @example\n\t *\n\t * _.toInteger(3);\n\t * // => 3\n\t *\n\t * _.toInteger(Number.MIN_VALUE);\n\t * // => 0\n\t *\n\t * _.toInteger(Infinity);\n\t * // => 1.7976931348623157e+308\n\t *\n\t * _.toInteger('3');\n\t * // => 3\n\t */\n\tfunction toInteger(value) {\n\t if (!value) {\n\t return value === 0 ? value : 0;\n\t }\n\t value = toNumber(value);\n\t if (value === INFINITY || value === -INFINITY) {\n\t var sign = (value < 0 ? -1 : 1);\n\t return sign * MAX_INTEGER;\n\t }\n\t var remainder = value % 1;\n\t return value === value ? (remainder ? value - remainder : value) : 0;\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = rest;\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _CRSEPSG3857 = __webpack_require__(7);\n\t\n\tvar _CRSEPSG38572 = _interopRequireDefault(_CRSEPSG3857);\n\t\n\tvar _CRSEPSG3395 = __webpack_require__(15);\n\t\n\tvar _CRSEPSG33952 = _interopRequireDefault(_CRSEPSG3395);\n\t\n\tvar _CRSEPSG4326 = __webpack_require__(17);\n\t\n\tvar _CRSEPSG43262 = _interopRequireDefault(_CRSEPSG4326);\n\t\n\tvar _CRSSimple = __webpack_require__(19);\n\t\n\tvar _CRSSimple2 = _interopRequireDefault(_CRSSimple);\n\t\n\tvar _CRSProj4 = __webpack_require__(20);\n\t\n\tvar _CRSProj42 = _interopRequireDefault(_CRSProj4);\n\t\n\tvar CRS = {};\n\t\n\tCRS.EPSG3857 = _CRSEPSG38572['default'];\n\tCRS.EPSG900913 = _CRSEPSG3857.EPSG900913;\n\tCRS.EPSG3395 = _CRSEPSG33952['default'];\n\tCRS.EPSG4326 = _CRSEPSG43262['default'];\n\tCRS.Simple = _CRSSimple2['default'];\n\tCRS.Proj4 = _CRSProj42['default'];\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionSphericalMercator = __webpack_require__(13);\n\t\n\tvar _projectionProjectionSphericalMercator2 = _interopRequireDefault(_projectionProjectionSphericalMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3857 = {\n\t code: 'EPSG:3857',\n\t projection: _projectionProjectionSphericalMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3857 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3857);\n\t\n\tvar EPSG900913 = (0, _lodashAssign2['default'])({}, EPSG3857, {\n\t code: 'EPSG:900913'\n\t});\n\t\n\texports.EPSG900913 = EPSG900913;\n\texports['default'] = EPSG3857;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Earth is the base class for all CRS representing Earth.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar Earth = {\n\t wrapLon: [-180, 180],\n\t\n\t R: 6378137,\n\t\n\t // Distance between two geographical points using spherical law of cosines\n\t // approximation or Haversine\n\t //\n\t // See: http://www.movable-type.co.uk/scripts/latlong.html\n\t distance: function distance(latlon1, latlon2, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var lat1;\n\t var lat2;\n\t\n\t var a;\n\t\n\t if (!accurate) {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\t\n\t return this.R * Math.acos(Math.min(a, 1));\n\t } else {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t var lon1 = latlon1.lon * rad;\n\t var lon2 = latlon2.lon * rad;\n\t\n\t var deltaLat = lat2 - lat1;\n\t var deltaLon = lon2 - lon1;\n\t\n\t var halfDeltaLat = deltaLat / 2;\n\t var halfDeltaLon = deltaLon / 2;\n\t\n\t a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\t\n\t var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\t\n\t return this.R * c;\n\t }\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Defaults to a scale factor of 1 if no calculation method exists\n\t //\n\t // Probably need to run this through the CRS transformation or similar so the\n\t // resulting scale is relative to the dimensions of the world space\n\t // Eg. 1 metre in projected space is likly scaled up or down to some other\n\t // number\n\t pointScale: function pointScale(latlon, accurate) {\n\t return this.projection.pointScale ? this.projection.pointScale(latlon, accurate) : [1, 1];\n\t },\n\t\n\t // Convert real metres to projected units\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t metresToProjected: function metresToProjected(metres, pointScale) {\n\t return metres * pointScale[1];\n\t },\n\t\n\t // Convert projected units to real metres\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t projectedToMetres: function projectedToMetres(projectedUnits, pointScale) {\n\t return projectedUnits / pointScale[1];\n\t },\n\t\n\t // Convert real metres to a value in world (WebGL) units\n\t metresToWorld: function metresToWorld(metres, pointScale, zoom) {\n\t // Transform metres to projected metres using the latitude point scale\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t var projectedMetres = this.metresToProjected(metres, pointScale);\n\t\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t // Scale projected metres\n\t var scaledMetres = scale * (this.transformScale * projectedMetres);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t scaledMetres /= pointScale[1];\n\t }\n\t\n\t return scaledMetres;\n\t },\n\t\n\t // Convert world (WebGL) units to a value in real metres\n\t worldToMetres: function worldToMetres(worldUnits, pointScale, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var projectedUnits = worldUnits / scale / this.transformScale;\n\t var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t realMetres *= pointScale[1];\n\t }\n\t\n\t return realMetres;\n\t }\n\t};\n\t\n\texports['default'] = (0, _lodashAssign2['default'])({}, _CRS2['default'], Earth);\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar _utilWrapNum = __webpack_require__(12);\n\t\n\tvar _utilWrapNum2 = _interopRequireDefault(_utilWrapNum);\n\t\n\tvar CRS = {\n\t // Scale factor determines final dimensions of world space\n\t //\n\t // Projection transformation in range -1 to 1 is multiplied by scale factor to\n\t // find final world coordinates\n\t //\n\t // Scale factor can be considered as half the amount of the desired dimension\n\t // for the largest side when transformation is equal to 1 or -1, or as the\n\t // distance between 0 and 1 on the largest side\n\t //\n\t // For example, if you want the world dimensions to be between -1000 and 1000\n\t // then the scale factor will be 1000\n\t scaleFactor: 1000000,\n\t\n\t // Converts geo coords to pixel / WebGL ones\n\t latLonToPoint: function latLonToPoint(latlon, zoom) {\n\t var projectedPoint = this.projection.project(latlon);\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t return this.transformation._transform(projectedPoint, scale);\n\t },\n\t\n\t // Converts pixel / WebGL coords to geo coords\n\t pointToLatLon: function pointToLatLon(point, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var untransformedPoint = this.transformation.untransform(point, scale);\n\t\n\t return this.projection.unproject(untransformedPoint);\n\t },\n\t\n\t // Converts geo coords to projection-specific coords (e.g. in meters)\n\t project: function project(latlon) {\n\t return this.projection.project(latlon);\n\t },\n\t\n\t // Converts projected coords to geo coords\n\t unproject: function unproject(point) {\n\t return this.projection.unproject(point);\n\t },\n\t\n\t // If zoom is provided, returns the map width in pixels for a given zoom\n\t // Else, provides fixed scale value\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom >= 0) {\n\t return 256 * Math.pow(2, zoom);\n\t // Else, return fixed scale value to expand projected coordinates from\n\t // their 0 to 1 range into something more practical\n\t } else {\n\t return this.scaleFactor;\n\t }\n\t },\n\t\n\t // Returns zoom level for a given scale value\n\t // This only works with a scale value that is based on map pixel width\n\t zoom: function zoom(scale) {\n\t return Math.log(scale / 256) / Math.LN2;\n\t },\n\t\n\t // Returns the bounds of the world in projected coords if applicable\n\t getProjectedBounds: function getProjectedBounds(zoom) {\n\t if (this.infinite) {\n\t return null;\n\t }\n\t\n\t var b = this.projection.bounds;\n\t var s = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t s /= 2;\n\t }\n\t\n\t // Bottom left\n\t var min = this.transformation.transform((0, _Point.point)(b[0]), s);\n\t\n\t // Top right\n\t var max = this.transformation.transform((0, _Point.point)(b[1]), s);\n\t\n\t return [min, max];\n\t },\n\t\n\t // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n\t // wrapLon: [min, max],\n\t // wrapLat: [min, max],\n\t\n\t // If true, the coordinate space will be unbounded (infinite in all directions)\n\t // infinite: false,\n\t\n\t // Wraps geo coords in certain ranges if applicable\n\t wrapLatLon: function wrapLatLon(latlon) {\n\t var lat = this.wrapLat ? (0, _utilWrapNum2['default'])(latlon.lat, this.wrapLat, true) : latlon.lat;\n\t var lon = this.wrapLon ? (0, _utilWrapNum2['default'])(latlon.lon, this.wrapLon, true) : latlon.lon;\n\t var alt = latlon.alt;\n\t\n\t return (0, _LatLon.latLon)(lat, lon, alt);\n\t }\n\t};\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * LatLon is a helper class for ensuring consistent geographic coordinates.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n\t */\n\t\n\tvar LatLon = (function () {\n\t function LatLon(lat, lon, alt) {\n\t _classCallCheck(this, LatLon);\n\t\n\t if (isNaN(lat) || isNaN(lon)) {\n\t throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n\t }\n\t\n\t this.lat = +lat;\n\t this.lon = +lon;\n\t\n\t if (alt !== undefined) {\n\t this.alt = +alt;\n\t }\n\t }\n\t\n\t _createClass(LatLon, [{\n\t key: 'clone',\n\t value: function clone() {\n\t return new LatLon(this.lat, this.lon, this.alt);\n\t }\n\t }]);\n\t\n\t return LatLon;\n\t})();\n\t\n\texports['default'] = LatLon;\n\t\n\t// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n\t// Also converts between lng and lon\n\tvar noNew = function noNew(a, b, c) {\n\t if (a instanceof LatLon) {\n\t return a;\n\t }\n\t if (Array.isArray(a) && typeof a[0] !== 'object') {\n\t if (a.length === 3) {\n\t return new LatLon(a[0], a[1], a[2]);\n\t }\n\t if (a.length === 2) {\n\t return new LatLon(a[0], a[1]);\n\t }\n\t return null;\n\t }\n\t if (a === undefined || a === null) {\n\t return a;\n\t }\n\t if (typeof a === 'object' && 'lat' in a) {\n\t return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n\t }\n\t if (b === undefined) {\n\t return null;\n\t }\n\t return new LatLon(a, b, c);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.latLon = noNew;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*\n\t * Point is a helper class for ensuring consistent world positions.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n\t */\n\t\n\tvar Point = (function () {\n\t function Point(x, y, round) {\n\t _classCallCheck(this, Point);\n\t\n\t this.x = round ? Math.round(x) : x;\n\t this.y = round ? Math.round(y) : y;\n\t }\n\t\n\t _createClass(Point, [{\n\t key: \"clone\",\n\t value: function clone() {\n\t return new Point(this.x, this.y);\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"add\",\n\t value: function add(point) {\n\t return this.clone()._add(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_add\",\n\t value: function _add(point) {\n\t this.x += point.x;\n\t this.y += point.y;\n\t return this;\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"subtract\",\n\t value: function subtract(point) {\n\t return this.clone()._subtract(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_subtract\",\n\t value: function _subtract(point) {\n\t this.x -= point.x;\n\t this.y -= point.y;\n\t return this;\n\t }\n\t }]);\n\t\n\t return Point;\n\t})();\n\t\n\texports[\"default\"] = Point;\n\t\n\t// Accepts (point), ([x, y]) and (x, y, round)\n\tvar _point = function _point(x, y, round) {\n\t if (x instanceof Point) {\n\t return x;\n\t }\n\t if (Array.isArray(x)) {\n\t return new Point(x[0], x[1]);\n\t }\n\t if (x === undefined || x === null) {\n\t return x;\n\t }\n\t return new Point(x, y, round);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.point = _point;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t/*\n\t * Wrap the given number to lie within a certain range (eg. longitude)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n\t */\n\t\n\tvar wrapNum = function wrapNum(x, range, includeMax) {\n\t var max = range[1];\n\t var min = range[0];\n\t var d = max - min;\n\t return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n\t};\n\t\n\texports[\"default\"] = wrapNum;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n\t * used by default.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar SphericalMercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t MAX_LATITUDE: 85.0511287798,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var max = this.MAX_LATITUDE;\n\t var lat = Math.max(Math.min(max, latlon.lat), -max);\n\t var sin = Math.sin(lat * d);\n\t\n\t return (0, _Point.point)(this.R * latlon.lon * d, this.R * Math.log((1 + sin) / (1 - sin)) / 2);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t\n\t return (0, _LatLon.latLon)((2 * Math.atan(Math.exp(point.y / this.R)) - Math.PI / 2) * d, point.x * d / this.R);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Accurate scale factor uses proper Web Mercator scaling\n\t // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t // See: http://jsfiddle.net/robhawkes/yws924cf/\n\t pointScale: function pointScale(latlon, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var k;\n\t\n\t if (!accurate) {\n\t k = 1 / Math.cos(latlon.lat * rad);\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t } else {\n\t var lat = latlon.lat * rad;\n\t var lon = latlon.lon * rad;\n\t\n\t var a = this.R;\n\t\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t\n\t var cosLat = Math.cos(lat);\n\t\n\t // Radius meridian\n\t var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\t\n\t // Radius prime meridian\n\t var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\t\n\t // Scale N/S\n\t var h = a / p / cosLat;\n\t\n\t // Scale E/W\n\t k = a / v / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, h];\n\t }\n\t },\n\t\n\t // Not using this.R due to scoping\n\t bounds: (function () {\n\t var d = 6378137 * Math.PI;\n\t return [[-d, -d], [d, d]];\n\t })()\n\t};\n\t\n\texports['default'] = SphericalMercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * Transformation is an utility class to perform simple point transformations\n\t * through a 2d-matrix.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n\t */\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar Transformation = (function () {\n\t function Transformation(a, b, c, d) {\n\t _classCallCheck(this, Transformation);\n\t\n\t this._a = a;\n\t this._b = b;\n\t this._c = c;\n\t this._d = d;\n\t }\n\t\n\t _createClass(Transformation, [{\n\t key: 'transform',\n\t value: function transform(point, scale) {\n\t // Copy input point as to not destroy the original data\n\t return this._transform(point.clone(), scale);\n\t }\n\t\n\t // Destructive transform (faster)\n\t }, {\n\t key: '_transform',\n\t value: function _transform(point, scale) {\n\t scale = scale || 1;\n\t\n\t point.x = scale * (this._a * point.x + this._b);\n\t point.y = scale * (this._c * point.y + this._d);\n\t return point;\n\t }\n\t }, {\n\t key: 'untransform',\n\t value: function untransform(point, scale) {\n\t scale = scale || 1;\n\t return (0, _geoPoint.point)((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);\n\t }\n\t }]);\n\t\n\t return Transformation;\n\t})();\n\t\n\texports['default'] = Transformation;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionMercator = __webpack_require__(16);\n\t\n\tvar _projectionProjectionMercator2 = _interopRequireDefault(_projectionProjectionMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3395 = {\n\t code: 'EPSG:3395',\n\t projection: _projectionProjectionMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3395 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3395);\n\t\n\texports['default'] = EPSG3395;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Mercator projection that takes into account that the Earth is not a perfect\n\t * sphere. Less popular than spherical mercator; used by projections like\n\t * EPSG:3395.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Mercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t R_MINOR: 6356752.314245179,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var r = this.R;\n\t var y = latlon.lat * d;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var con = e * Math.sin(y);\n\t\n\t var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n\t y = -r * Math.log(Math.max(ts, 1E-10));\n\t\n\t return (0, _Point.point)(latlon.lon * d * r, y);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t var r = this.R;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var ts = Math.exp(-point.y / r);\n\t var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\t\n\t for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n\t con = e * Math.sin(phi);\n\t con = Math.pow((1 - con) / (1 + con), e / 2);\n\t dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n\t phi += dphi;\n\t }\n\t\n\t return (0, _LatLon.latLon)(phi * d, point.x * d / r);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t pointScale: function pointScale(latlon) {\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t var cosLat = Math.cos(lat);\n\t\n\t var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t },\n\t\n\t bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n\t};\n\t\n\texports['default'] = Mercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG4326 = {\n\t code: 'EPSG:4326',\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / 180,\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t //\n\t // TODO: Cannot use this.transformScale due to scope\n\t transformation: new _utilTransformation2['default'](1 / 180, 0, -1 / 180, 0)\n\t};\n\t\n\tvar EPSG4326 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG4326);\n\t\n\texports['default'] = EPSG4326;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n\t * and Simple.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar ProjectionLatLon = {\n\t project: function project(latlon) {\n\t return (0, _Point.point)(latlon.lon, latlon.lat);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t return (0, _LatLon.latLon)(point.y, point.x);\n\t },\n\t\n\t // Scale factor for converting between real metres and degrees\n\t //\n\t // degrees = realMetres * pointScale\n\t // realMetres = degrees / pointScale\n\t //\n\t // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n\t // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n\t pointScale: function pointScale(latlon) {\n\t var m1 = 111132.92;\n\t var m2 = -559.82;\n\t var m3 = 1.175;\n\t var m4 = -0.0023;\n\t var p1 = 111412.84;\n\t var p2 = -93.5;\n\t var p3 = 0.118;\n\t\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t\n\t var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n\t var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\t\n\t return [1 / latlen, 1 / lonlen];\n\t },\n\t\n\t bounds: [[-180, -90], [180, 90]]\n\t};\n\t\n\texports['default'] = ProjectionLatLon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n\t * maps.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Simple = {\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Straight 1:1 mapping (-1, -1 would be top-left)\n\t transformation: new _utilTransformation2['default'](1, 0, 1, 0),\n\t\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom) {\n\t return Math.pow(2, zoom);\n\t // Else, make no change to scale – may need to increase this or make it a\n\t // user-definable variable\n\t } else {\n\t return 1;\n\t }\n\t },\n\t\n\t zoom: function zoom(scale) {\n\t return Math.log(scale) / Math.LN2;\n\t },\n\t\n\t distance: function distance(latlon1, latlon2) {\n\t var dx = latlon2.lon - latlon1.lon;\n\t var dy = latlon2.lat - latlon1.lat;\n\t\n\t return Math.sqrt(dx * dx + dy * dy);\n\t },\n\t\n\t infinite: true\n\t};\n\t\n\tvar Simple = (0, _lodashAssign2['default'])({}, _CRS2['default'], _Simple);\n\t\n\texports['default'] = Simple;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Proj4 for any Proj4-supported CRS.\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionProj4 = __webpack_require__(21);\n\t\n\tvar _projectionProjectionProj42 = _interopRequireDefault(_projectionProjectionProj4);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Proj4 = function _Proj4(code, def, bounds) {\n\t var projection = (0, _projectionProjectionProj42['default'])(def, bounds);\n\t\n\t // Transformation calcuations\n\t var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n\t var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\t\n\t var halfX = diffX / 2;\n\t var halfY = diffY / 2;\n\t\n\t // This is the raw scale factor\n\t var scaleX = 1 / halfX;\n\t var scaleY = 1 / halfY;\n\t\n\t // Find the minimum scale factor\n\t //\n\t // The minimum scale factor comes from the largest side and is the one\n\t // you want to use for both axis so they stay relative in dimension\n\t var scale = Math.min(scaleX, scaleY);\n\t\n\t // Find amount to offset each axis by to make the central point lie on\n\t // the [0,0] origin\n\t var offsetX = scale * (projection.bounds[0][0] + halfX);\n\t var offsetY = scale * (projection.bounds[0][1] + halfY);\n\t\n\t return {\n\t code: code,\n\t projection: projection,\n\t\n\t transformScale: scale,\n\t\n\t // Map the input to a [-1,1] range with [0,0] in the centre\n\t transformation: new _utilTransformation2['default'](scale, -offsetX, -scale, offsetY)\n\t };\n\t};\n\t\n\tvar Proj4 = function Proj4(code, def, bounds) {\n\t return (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _Proj4(code, def, bounds));\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 21 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Proj4 support for any projection.\n\t */\n\t\n\tvar _proj4 = __webpack_require__(22);\n\t\n\tvar _proj42 = _interopRequireDefault(_proj4);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Proj4 = function Proj4(def, bounds) {\n\t var proj = (0, _proj42['default'])(def);\n\t\n\t var project = function project(latlon) {\n\t return (0, _Point.point)(proj.forward([latlon.lon, latlon.lat]));\n\t };\n\t\n\t var unproject = function unproject(point) {\n\t var inverse = proj.inverse([point.x, point.y]);\n\t return (0, _LatLon.latLon)(inverse[1], inverse[0]);\n\t };\n\t\n\t return {\n\t project: project,\n\t unproject: unproject,\n\t\n\t // Scale factor for converting between real metres and projected metres\\\n\t //\n\t // Need to work out the best way to provide the pointScale calculations\n\t // for custom, unknown projections (if wanting to override default)\n\t //\n\t // For now, user can manually override crs.pointScale or\n\t // crs.projection.pointScale\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t pointScale: function pointScale(latlon, accurate) {\n\t return [1, 1];\n\t },\n\t\n\t // Try and calculate bounds if none are provided\n\t //\n\t // This will provide incorrect bounds for some projections, so perhaps make\n\t // bounds a required input instead\n\t bounds: (function () {\n\t if (bounds) {\n\t return bounds;\n\t } else {\n\t var bottomLeft = project([-90, -180]);\n\t var topRight = project([90, 180]);\n\t\n\t return [bottomLeft, topRight];\n\t }\n\t })()\n\t };\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n/***/ },\n/* 23 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\tvar _Renderer = __webpack_require__(28);\n\t\n\tvar _Renderer2 = _interopRequireDefault(_Renderer);\n\t\n\tvar _DOMRenderer3D = __webpack_require__(29);\n\t\n\tvar _DOMRenderer3D2 = _interopRequireDefault(_DOMRenderer3D);\n\t\n\tvar _DOMRenderer2D = __webpack_require__(31);\n\t\n\tvar _DOMRenderer2D2 = _interopRequireDefault(_DOMRenderer2D);\n\t\n\tvar _Camera = __webpack_require__(33);\n\t\n\tvar _Camera2 = _interopRequireDefault(_Camera);\n\t\n\tvar _Picking = __webpack_require__(34);\n\t\n\tvar _Picking2 = _interopRequireDefault(_Picking);\n\t\n\tvar Engine = (function (_EventEmitter) {\n\t _inherits(Engine, _EventEmitter);\n\t\n\t function Engine(container, world) {\n\t _classCallCheck(this, Engine);\n\t\n\t console.log('Init Engine');\n\t\n\t _get(Object.getPrototypeOf(Engine.prototype), 'constructor', this).call(this);\n\t\n\t this._world = world;\n\t\n\t this._scene = _Scene2['default'];\n\t this._domScene3D = _DOMScene3D2['default'];\n\t this._domScene2D = _DOMScene2D2['default'];\n\t\n\t this._renderer = (0, _Renderer2['default'])(container);\n\t this._domRenderer3D = (0, _DOMRenderer3D2['default'])(container);\n\t this._domRenderer2D = (0, _DOMRenderer2D2['default'])(container);\n\t\n\t this._camera = (0, _Camera2['default'])(container);\n\t\n\t // TODO: Make this optional\n\t this._picking = (0, _Picking2['default'])(this._world, this._renderer, this._camera);\n\t\n\t this.clock = new _three2['default'].Clock();\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t }\n\t\n\t _createClass(Engine, [{\n\t key: 'update',\n\t value: function update(delta) {\n\t this.emit('preRender');\n\t\n\t this._renderer.render(this._scene, this._camera);\n\t\n\t // Render picking scene\n\t // this._renderer.render(this._picking._pickingScene, this._camera);\n\t\n\t // Render DOM scenes\n\t this._domRenderer3D.render(this._domScene3D, this._camera);\n\t this._domRenderer2D.render(this._domScene2D, this._camera);\n\t\n\t this.emit('postRender');\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Remove any remaining objects from scene\n\t var child;\n\t for (var i = this._scene.children.length - 1; i >= 0; i--) {\n\t child = this._scene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._scene.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t };\n\t\n\t for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene3D.remove(child);\n\t };\n\t\n\t for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene2D.remove(child);\n\t };\n\t\n\t this._picking.destroy();\n\t this._picking = null;\n\t\n\t this._world = null;\n\t this._scene = null;\n\t this._domScene3D = null;\n\t this._domScene2D = null;\n\t this._renderer = null;\n\t this._domRenderer3D = null;\n\t this._domRenderer2D = null;\n\t this._camera = null;\n\t this._clock = null;\n\t this._frustum = null;\n\t }\n\t }]);\n\t\n\t return Engine;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Engine;\n\t\n\t// // Initialise without requiring new keyword\n\t// export default function(container, world) {\n\t// return new Engine(container, world);\n\t// };\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 28 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _three2['default'].WebGLRenderer({\n\t antialias: true\n\t });\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // renderer.setClearColor(Scene.fog.color, 1);\n\t\n\t renderer.setClearColor(0xffffff, 1);\n\t renderer.setPixelRatio(window.devicePixelRatio);\n\t\n\t // Gamma settings make things look nicer\n\t renderer.gammaInput = true;\n\t renderer.gammaOutput = true;\n\t\n\t renderer.shadowMap.enabled = true;\n\t renderer.shadowMap.cullFace = _three2['default'].CullFaceBack;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS3DRenderer.CSS3DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS3DObject = function CSS3DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS3DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS3DObject.prototype.constructor = CSS3DObject;\n\t\n\tvar CSS3DSprite = function CSS3DSprite(element) {\n\t\n\t\tCSS3DObject.call(this, element);\n\t};\n\t\n\tCSS3DSprite.prototype = Object.create(CSS3DObject.prototype);\n\tCSS3DSprite.prototype.constructor = CSS3DSprite;\n\t\n\t//\n\t\n\tvar CSS3DRenderer = function CSS3DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS3DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar matrix = new _three2['default'].Matrix4();\n\t\n\t\tvar cache = {\n\t\t\tcamera: { fov: 0, style: '' },\n\t\t\tobjects: {}\n\t\t};\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\t\tdomElement.style.oTransformStyle = 'preserve-3d';\n\t\tdomElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tvar cameraElement = document.createElement('div');\n\t\n\t\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tdomElement.appendChild(cameraElement);\n\t\n\t\tthis.setClearColor = function () {};\n\t\n\t\tthis.getSize = function () {\n\t\n\t\t\treturn {\n\t\t\t\twidth: _width,\n\t\t\t\theight: _height\n\t\t\t};\n\t\t};\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\n\t\t\tcameraElement.style.width = width + 'px';\n\t\t\tcameraElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar epsilon = function epsilon(value) {\n\t\n\t\t\treturn Math.abs(value) < Number.EPSILON ? 0 : value;\n\t\t};\n\t\n\t\tvar getCameraCSSMatrix = function getCameraCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'matrix3d(' + epsilon(elements[0]) + ',' + epsilon(-elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(elements[6]) + ',' + epsilon(elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(-elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(-elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar getObjectCSSMatrix = function getObjectCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' + epsilon(elements[0]) + ',' + epsilon(elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(-elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(-elements[6]) + ',' + epsilon(-elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS3DObject) {\n\t\n\t\t\t\tvar style;\n\t\n\t\t\t\tif (object instanceof CSS3DSprite) {\n\t\n\t\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\t\n\t\t\t\t\tmatrix.copy(camera.matrixWorldInverse);\n\t\t\t\t\tmatrix.transpose();\n\t\t\t\t\tmatrix.copyPosition(object.matrixWorld);\n\t\t\t\t\tmatrix.scale(object.scale);\n\t\n\t\t\t\t\tmatrix.elements[3] = 0;\n\t\t\t\t\tmatrix.elements[7] = 0;\n\t\t\t\t\tmatrix.elements[11] = 0;\n\t\t\t\t\tmatrix.elements[15] = 1;\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(object.matrixWorld);\n\t\t\t\t}\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar cachedStyle = cache.objects[object.id];\n\t\n\t\t\t\tif (cachedStyle === undefined || cachedStyle !== style) {\n\t\n\t\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\t\telement.style.MozTransform = style;\n\t\t\t\t\telement.style.oTransform = style;\n\t\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\t\tcache.objects[object.id] = style;\n\t\t\t\t}\n\t\n\t\t\t\tif (element.parentNode !== cameraElement) {\n\t\n\t\t\t\t\tcameraElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tvar fov = 0.5 / Math.tan(_three2['default'].Math.degToRad(camera.fov * 0.5)) * _height;\n\t\n\t\t\tif (cache.camera.fov !== fov) {\n\t\n\t\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\t\tdomElement.style.perspective = fov + 'px';\n\t\n\t\t\t\tcache.camera.fov = fov;\n\t\t\t}\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse) + ' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\t\n\t\t\tif (cache.camera.style !== style) {\n\t\n\t\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\t\tcameraElement.style.MozTransform = style;\n\t\t\t\tcameraElement.style.oTransform = style;\n\t\t\t\tcameraElement.style.transform = style;\n\t\n\t\t\t\tcache.camera.style = style;\n\t\t\t}\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS3DObject = CSS3DObject;\n\texports.CSS3DSprite = CSS3DSprite;\n\texports.CSS3DRenderer = CSS3DRenderer;\n\t\n\t_three2['default'].CSS3DObject = CSS3DObject;\n\t_three2['default'].CSS3DSprite = CSS3DSprite;\n\t_three2['default'].CSS3DRenderer = CSS3DRenderer;\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS2DRenderer.CSS2DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS2DObject = function CSS2DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS2DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS2DObject.prototype.constructor = CSS2DObject;\n\t\n\t//\n\t\n\tvar CSS2DRenderer = function CSS2DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS2DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar vector = new _three2['default'].Vector3();\n\t\tvar viewMatrix = new _three2['default'].Matrix4();\n\t\tvar viewProjectionMatrix = new _three2['default'].Matrix4();\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS2DObject) {\n\t\n\t\t\t\tvector.setFromMatrixPosition(object.matrixWorld);\n\t\t\t\tvector.applyProjection(viewProjectionMatrix);\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar style = 'translate(-50%,-50%) translate(' + (vector.x * _widthHalf + _widthHalf) + 'px,' + (-vector.y * _heightHalf + _heightHalf) + 'px)';\n\t\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\tif (element.parentNode !== domElement) {\n\t\n\t\t\t\t\tdomElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tviewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\n\t\t\tviewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, viewMatrix);\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS2DObject = CSS2DObject;\n\texports.CSS2DRenderer = CSS2DRenderer;\n\t\n\t_three2['default'].CSS2DObject = CSS2DObject;\n\t_three2['default'].CSS2DRenderer = CSS2DRenderer;\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can only be accessed from Engine.camera if you want to reference the\n\t// same scene in multiple places\n\t\n\t// TODO: Ensure that FOV looks natural on all aspect ratios\n\t// http://stackoverflow.com/q/26655930/997339\n\t\n\texports['default'] = function (container) {\n\t var camera = new _three2['default'].PerspectiveCamera(45, 1, 1, 200000);\n\t camera.position.y = 400;\n\t camera.position.z = 400;\n\t\n\t var updateSize = function updateSize() {\n\t camera.aspect = container.clientWidth / container.clientHeight;\n\t camera.updateProjectionMatrix();\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return camera;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _PickingScene = __webpack_require__(35);\n\t\n\tvar _PickingScene2 = _interopRequireDefault(_PickingScene);\n\t\n\t// TODO: Look into a way of setting this up without passing in a renderer and\n\t// camera from the engine\n\t\n\t// TODO: Add a basic indicator on or around the mouse pointer when it is over\n\t// something pickable / clickable\n\t//\n\t// A simple transparent disc or ring at the mouse point should work to start, or\n\t// even just changing the cursor to the CSS 'pointer' style\n\t//\n\t// Probably want this on mousemove with a throttled update as not to spam the\n\t// picking method\n\t//\n\t// Relies upon the picking method not redrawing the scene every call due to\n\t// the way TileLayer invalidates the picking scene\n\t\n\tvar nextId = 1;\n\t\n\tvar Picking = (function () {\n\t function Picking(world, renderer, camera) {\n\t _classCallCheck(this, Picking);\n\t\n\t this._world = world;\n\t this._renderer = renderer;\n\t this._camera = camera;\n\t\n\t this._raycaster = new _three2['default'].Raycaster();\n\t\n\t // TODO: Match this with the line width used in the picking layers\n\t this._raycaster.linePrecision = 3;\n\t\n\t this._pickingScene = _PickingScene2['default'];\n\t this._pickingTexture = new _three2['default'].WebGLRenderTarget();\n\t this._pickingTexture.texture.minFilter = _three2['default'].LinearFilter;\n\t this._pickingTexture.texture.generateMipmaps = false;\n\t\n\t this._nextId = 1;\n\t\n\t this._resizeTexture();\n\t this._initEvents();\n\t }\n\t\n\t // Initialise without requiring new keyword\n\t\n\t _createClass(Picking, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\t\n\t // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n\t this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\t\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onMouseUp',\n\t value: function _onMouseUp(event) {\n\t // Only react to main button click\n\t if (event.button !== 0) {\n\t return;\n\t }\n\t\n\t var point = (0, _geoPoint.point)(event.clientX, event.clientY);\n\t\n\t var normalisedPoint = (0, _geoPoint.point)(0, 0);\n\t normalisedPoint.x = point.x / this._width * 2 - 1;\n\t normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\t\n\t this._pick(point, normalisedPoint);\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove() {\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n\t }, {\n\t key: '_resizeTexture',\n\t value: function _resizeTexture() {\n\t var size = this._renderer.getSize();\n\t\n\t this._width = size.width;\n\t this._height = size.height;\n\t\n\t this._pickingTexture.setSize(this._width, this._height);\n\t this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\t\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Make this only re-draw the scene if both an update is needed and the\n\t // camera has moved since the last update\n\t //\n\t // Otherwise it re-draws the scene on every click due to the way LOD updates\n\t // work in TileLayer – spamming this.add() and this.remove()\n\t //\n\t // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n\t // be a point in time where the user cares for picking functionality\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._needUpdate) {\n\t var texture = this._pickingTexture;\n\t\n\t this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\t\n\t // Read the rendering texture\n\t this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\t\n\t this._needUpdate = false;\n\t }\n\t }\n\t }, {\n\t key: '_pick',\n\t value: function _pick(point, normalisedPoint) {\n\t this._update();\n\t\n\t var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\t\n\t // Interpret the pixel as an ID\n\t var id = this._pixelBuffer[index * 4 + 2] * 255 * 255 + this._pixelBuffer[index * 4 + 1] * 255 + this._pixelBuffer[index * 4 + 0];\n\t\n\t // Skip if ID is 16646655 (white) as the background returns this\n\t if (id === 16646655) {\n\t return;\n\t }\n\t\n\t this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\t\n\t // Perform ray intersection on picking scene\n\t //\n\t // TODO: Only perform intersection test on the relevant picking mesh\n\t var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\t\n\t var _point2d = point.clone();\n\t\n\t var _point3d;\n\t if (intersects.length > 0) {\n\t _point3d = intersects[0].point.clone();\n\t }\n\t\n\t // Pass along as much data as possible for now until we know more about how\n\t // people use the picking API and what the returned data should be\n\t //\n\t // TODO: Look into the leak potential for passing so much by reference here\n\t this._world.emit('pick', id, _point2d, _point3d, intersects);\n\t this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n\t }\n\t\n\t // Add mesh to picking scene\n\t //\n\t // Picking ID should already be added as an attribute\n\t }, {\n\t key: 'add',\n\t value: function add(mesh) {\n\t this._pickingScene.add(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Remove mesh from picking scene\n\t }, {\n\t key: 'remove',\n\t value: function remove(mesh) {\n\t this._pickingScene.remove(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Returns next ID to use for picking\n\t }, {\n\t key: 'getNextId',\n\t value: function getNextId() {\n\t return nextId++;\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Find a way to properly remove these listeners as they stay\n\t // active at the moment\n\t window.removeEventListener('resize', this._resizeTexture, false);\n\t this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t if (this._pickingScene.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n\t child = this._pickingScene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._pickingScene.remove(child);\n\t\n\t // Probably not a good idea to dispose of geometry due to it being\n\t // shared with the non-picking scene\n\t // if (child.geometry) {\n\t // // Dispose of mesh and materials\n\t // child.geometry.dispose();\n\t // child.geometry = null;\n\t // }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t this._pickingScene = null;\n\t this._pickingTexture = null;\n\t this._pixelBuffer = null;\n\t\n\t this._world = null;\n\t this._renderer = null;\n\t this._camera = null;\n\t }\n\t }]);\n\t\n\t return Picking;\n\t})();\n\t\n\texports['default'] = function (world, renderer, camera) {\n\t return new Picking(world, renderer, camera);\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.pickingScene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Skybox = __webpack_require__(38);\n\t\n\tvar _Skybox2 = _interopRequireDefault(_Skybox);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar EnvironmentLayer = (function (_Layer) {\n\t _inherits(EnvironmentLayer, _Layer);\n\t\n\t function EnvironmentLayer(options) {\n\t _classCallCheck(this, EnvironmentLayer);\n\t\n\t var defaults = {\n\t skybox: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'constructor', this).call(this, _options);\n\t }\n\t\n\t _createClass(EnvironmentLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd() {\n\t this._initLights();\n\t\n\t if (this._options.skybox) {\n\t this._initSkybox();\n\t }\n\t\n\t // this._initGrid();\n\t }\n\t\n\t // Not fleshed out or thought through yet\n\t //\n\t // Lights could potentially be put it their own 'layer' to keep this class\n\t // much simpler and less messy\n\t }, {\n\t key: '_initLights',\n\t value: function _initLights() {\n\t // Position doesn't really matter (the angle is important), however it's\n\t // used here so the helpers look more natural.\n\t\n\t if (!this._options.skybox) {\n\t var directionalLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t directionalLight.position.x = 1000;\n\t directionalLight.position.y = 1000;\n\t directionalLight.position.z = 1000;\n\t\n\t // TODO: Get shadows working in non-PBR scenes\n\t\n\t // directionalLight.castShadow = true;\n\t //\n\t // var d = 100;\n\t // directionalLight.shadow.camera.left = -d;\n\t // directionalLight.shadow.camera.right = d;\n\t // directionalLight.shadow.camera.top = d;\n\t // directionalLight.shadow.camera.bottom = -d;\n\t //\n\t // directionalLight.shadow.camera.near = 10;\n\t // directionalLight.shadow.camera.far = 100;\n\t //\n\t // // TODO: Need to dial in on a good shadowmap size\n\t // directionalLight.shadow.mapSize.width = 2048;\n\t // directionalLight.shadow.mapSize.height = 2048;\n\t //\n\t // // directionalLight.shadowBias = -0.0010;\n\t // // directionalLight.shadow.darkness = 0.15;\n\t\n\t var directionalLight2 = new _three2['default'].DirectionalLight(0xffffff, 0.5);\n\t directionalLight2.position.x = -1000;\n\t directionalLight2.position.y = 1000;\n\t directionalLight2.position.z = -1000;\n\t\n\t // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n\t // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\t\n\t this.add(directionalLight);\n\t this.add(directionalLight2);\n\t\n\t // this.add(helper);\n\t // this.add(helper2);\n\t } else {\n\t // Directional light that will be projected from the sun\n\t this._skyboxLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t\n\t this._skyboxLight.castShadow = true;\n\t\n\t var d = 1000;\n\t this._skyboxLight.shadow.camera.left = -d;\n\t this._skyboxLight.shadow.camera.right = d;\n\t this._skyboxLight.shadow.camera.top = d;\n\t this._skyboxLight.shadow.camera.bottom = -d;\n\t\n\t this._skyboxLight.shadow.camera.near = 10000;\n\t this._skyboxLight.shadow.camera.far = 70000;\n\t\n\t // TODO: Need to dial in on a good shadowmap size\n\t this._skyboxLight.shadow.mapSize.width = 2048;\n\t this._skyboxLight.shadow.mapSize.height = 2048;\n\t\n\t // this._skyboxLight.shadowBias = -0.0010;\n\t // this._skyboxLight.shadow.darkness = 0.15;\n\t\n\t // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\t\n\t this.add(this._skyboxLight);\n\t }\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t this._skybox = new _Skybox2['default'](this._world, this._skyboxLight);\n\t this.add(this._skybox._mesh);\n\t }\n\t\n\t // Add grid helper for context during initial development\n\t }, {\n\t key: '_initGrid',\n\t value: function _initGrid() {\n\t var size = 4000;\n\t var step = 100;\n\t\n\t var gridHelper = new _three2['default'].GridHelper(size, step);\n\t this.add(gridHelper);\n\t }\n\t\n\t // Clean up environment\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._skyboxLight = null;\n\t\n\t this.remove(this._skybox._mesh);\n\t this._skybox.destroy();\n\t this._skybox = null;\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return EnvironmentLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = EnvironmentLayer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new EnvironmentLayer(options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.environmentLayer = noNew;\n\n/***/ },\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _engineScene = __webpack_require__(25);\n\t\n\tvar _engineScene2 = _interopRequireDefault(_engineScene);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Need a single move method that handles moving all the various object\n\t// layers so that the DOM layers stay in sync with the 3D layer\n\t\n\t// TODO: Double check that objects within the _object3D Object3D parent are frustum\n\t// culled even if the layer position stays at the default (0,0,0) and the child\n\t// objects are positioned much further away\n\t//\n\t// Or does the layer being at (0,0,0) prevent the child objects from being\n\t// culled because the layer parent is effectively always in view even if the\n\t// child is actually out of camera\n\t\n\tvar Layer = (function (_EventEmitter) {\n\t _inherits(Layer, _EventEmitter);\n\t\n\t function Layer(options) {\n\t _classCallCheck(this, Layer);\n\t\n\t _get(Object.getPrototypeOf(Layer.prototype), 'constructor', this).call(this);\n\t\n\t var defaults = {\n\t output: true\n\t };\n\t\n\t this._options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (this.isOutput()) {\n\t this._object3D = new _three2['default'].Object3D();\n\t\n\t this._dom3D = document.createElement('div');\n\t this._domObject3D = new _vendorCSS3DRenderer.CSS3DObject(this._dom3D);\n\t\n\t this._dom2D = document.createElement('div');\n\t this._domObject2D = new _vendorCSS2DRenderer.CSS2DObject(this._dom2D);\n\t }\n\t }\n\t\n\t // Add THREE object directly to layer\n\t\n\t _createClass(Layer, [{\n\t key: 'add',\n\t value: function add(object) {\n\t this._object3D.add(object);\n\t }\n\t\n\t // Remove THREE object from to layer\n\t }, {\n\t key: 'remove',\n\t value: function remove(object) {\n\t this._object3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM3D',\n\t value: function addDOM3D(object) {\n\t this._domObject3D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM3D',\n\t value: function removeDOM3D(object) {\n\t this._domObject3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM2D',\n\t value: function addDOM2D(object) {\n\t this._domObject2D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM2D',\n\t value: function removeDOM2D(object) {\n\t this._domObject2D.remove(object);\n\t }\n\t\n\t // Add layer to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addLayer(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addLayer to actually add the layer\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t this._onAdd(world);\n\t this.emit('added');\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t }, {\n\t key: 'getPickingId',\n\t value: function getPickingId() {\n\t if (this._world._engine._picking) {\n\t return this._world._engine._picking.getNextId();\n\t }\n\t\n\t return false;\n\t }\n\t\n\t // TODO: Tidy this up and don't access so many private properties to work\n\t }, {\n\t key: 'addToPicking',\n\t value: function addToPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.add(object);\n\t }\n\t }, {\n\t key: 'removeFromPicking',\n\t value: function removeFromPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.remove(object);\n\t }\n\t }, {\n\t key: 'isOutput',\n\t value: function isOutput() {\n\t return this._options.output;\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._object3D && this._object3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n\t child = this._object3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t if (this._domObject3D && this._domObject3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM3D(child);\n\t }\n\t }\n\t\n\t if (this._domObject2D && this._domObject2D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM2D(child);\n\t }\n\t }\n\t\n\t this._domObject3D = null;\n\t this._domObject2D = null;\n\t\n\t this._world = null;\n\t this._object3D = null;\n\t }\n\t }]);\n\t\n\t return Layer;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Layer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new Layer(options);\n\t};\n\t\n\texports.layer = noNew;\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Sky = __webpack_require__(39);\n\t\n\tvar _Sky2 = _interopRequireDefault(_Sky);\n\t\n\tvar _lodashThrottle = __webpack_require__(40);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar cubemap = {\n\t vertexShader: ['varying vec3 vPosition;', 'void main() {', 'vPosition = position;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t fragmentShader: ['uniform samplerCube cubemap;', 'varying vec3 vPosition;', 'void main() {', 'gl_FragColor = textureCube(cubemap, normalize(vPosition));', '}'].join('\\n')\n\t};\n\t\n\tvar Skybox = (function () {\n\t function Skybox(world, light) {\n\t _classCallCheck(this, Skybox);\n\t\n\t this._world = world;\n\t this._light = light;\n\t\n\t this._settings = {\n\t distance: 38000,\n\t turbidity: 10,\n\t reileigh: 2,\n\t mieCoefficient: 0.005,\n\t mieDirectionalG: 0.8,\n\t luminance: 1,\n\t // 0.48 is a cracking dusk / sunset\n\t // 0.4 is a beautiful early-morning / late-afternoon\n\t // 0.2 is a nice day time\n\t inclination: 0.48, // Elevation / inclination\n\t azimuth: 0.25 };\n\t\n\t // Facing front\n\t this._initSkybox();\n\t this._updateUniforms();\n\t this._initEvents();\n\t }\n\t\n\t _createClass(Skybox, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Throttled to 1 per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._update, 100);\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t // Cube camera for skybox\n\t this._cubeCamera = new _three2['default'].CubeCamera(1, 2000000, 128);\n\t\n\t // Cube material\n\t var cubeTarget = this._cubeCamera.renderTarget;\n\t\n\t // Add Sky Mesh\n\t this._sky = new _Sky2['default']();\n\t this._skyScene = new _three2['default'].Scene();\n\t this._skyScene.add(this._sky.mesh);\n\t\n\t // Add Sun Helper\n\t this._sunSphere = new _three2['default'].Mesh(new _three2['default'].SphereBufferGeometry(2000, 16, 8), new _three2['default'].MeshBasicMaterial({\n\t color: 0xffffff\n\t }));\n\t\n\t // TODO: This isn't actually visible because it's not added to the layer\n\t // this._sunSphere.visible = true;\n\t\n\t var skyboxUniforms = {\n\t cubemap: { type: 't', value: cubeTarget }\n\t };\n\t\n\t var skyboxMat = new _three2['default'].ShaderMaterial({\n\t uniforms: skyboxUniforms,\n\t vertexShader: cubemap.vertexShader,\n\t fragmentShader: cubemap.fragmentShader,\n\t side: _three2['default'].BackSide\n\t });\n\t\n\t this._mesh = new _three2['default'].Mesh(new _three2['default'].BoxGeometry(190000, 190000, 190000), skyboxMat);\n\t\n\t this._updateSkybox = true;\n\t }\n\t }, {\n\t key: '_updateUniforms',\n\t value: function _updateUniforms() {\n\t var settings = this._settings;\n\t var uniforms = this._sky.uniforms;\n\t uniforms.turbidity.value = settings.turbidity;\n\t uniforms.reileigh.value = settings.reileigh;\n\t uniforms.luminance.value = settings.luminance;\n\t uniforms.mieCoefficient.value = settings.mieCoefficient;\n\t uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\t\n\t var theta = Math.PI * (settings.inclination - 0.5);\n\t var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\t\n\t this._sunSphere.position.x = settings.distance * Math.cos(phi);\n\t this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n\t this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\t\n\t // Move directional light to sun position\n\t this._light.position.copy(this._sunSphere.position);\n\t\n\t this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update(delta) {\n\t if (this._updateSkybox) {\n\t this._updateSkybox = false;\n\t } else {\n\t return;\n\t }\n\t\n\t // if (!this._angle) {\n\t // this._angle = 0;\n\t // }\n\t //\n\t // // Animate inclination\n\t // this._angle += Math.PI * delta;\n\t // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\t\n\t // Update light intensity depending on elevation of sun (day to night)\n\t this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\t\n\t // // console.log(delta, this._angle, this._settings.inclination);\n\t //\n\t // TODO: Only do this when the uniforms have been changed\n\t this._updateUniforms();\n\t\n\t // TODO: Only do this when the cubemap has actually changed\n\t this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n\t }\n\t }, {\n\t key: 'getRenderTarget',\n\t value: function getRenderTarget() {\n\t return this._cubeCamera.renderTarget;\n\t }\n\t }, {\n\t key: 'setInclination',\n\t value: function setInclination(inclination) {\n\t this._settings.inclination = inclination;\n\t this._updateSkybox = true;\n\t }\n\t\n\t // Destroy the skybox and remove it from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._throttledWorldUpdate = null;\n\t\n\t this._world = null;\n\t this._light = null;\n\t\n\t this._cubeCamera = null;\n\t\n\t this._sky.mesh.geometry.dispose();\n\t this._sky.mesh.geometry = null;\n\t\n\t if (this._sky.mesh.material.map) {\n\t this._sky.mesh.material.map.dispose();\n\t this._sky.mesh.material.map = null;\n\t }\n\t\n\t this._sky.mesh.material.dispose();\n\t this._sky.mesh.material = null;\n\t\n\t this._sky.mesh = null;\n\t this._sky = null;\n\t\n\t this._skyScene = null;\n\t\n\t this._sunSphere.geometry.dispose();\n\t this._sunSphere.geometry = null;\n\t\n\t if (this._sunSphere.material.map) {\n\t this._sunSphere.material.map.dispose();\n\t this._sunSphere.material.map = null;\n\t }\n\t\n\t this._sunSphere.material.dispose();\n\t this._sunSphere.material = null;\n\t\n\t this._sunSphere = null;\n\t\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }]);\n\t\n\t return Skybox;\n\t})();\n\t\n\texports['default'] = Skybox;\n\t\n\tvar noNew = function noNew(world, light) {\n\t return new Skybox(world, light);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.skybox = noNew;\n\n/***/ },\n/* 39 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * @author zz85 / https://github.com/zz85\n\t *\n\t * Based on 'A Practical Analytic Model for Daylight'\n\t * aka The Preetham Model, the de facto standard analytic skydome model\n\t * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n\t *\n\t * First implemented by Simon Wallner\n\t * http://www.simonwallner.at/projects/atmospheric-scattering\n\t *\n\t * Improved by Martin Upitis\n\t * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n\t *\n\t * Three.js integration by zz85 http://twitter.com/blurspline\n\t*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t_three2['default'].ShaderLib['sky'] = {\n\t\n\t\tuniforms: {\n\t\n\t\t\tluminance: { type: 'f', value: 1 },\n\t\t\tturbidity: { type: 'f', value: 2 },\n\t\t\treileigh: { type: 'f', value: 1 },\n\t\t\tmieCoefficient: { type: 'f', value: 0.005 },\n\t\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\t\tsunPosition: { type: 'v3', value: new _three2['default'].Vector3() }\n\t\n\t\t},\n\t\n\t\tvertexShader: ['varying vec3 vWorldPosition;', 'void main() {', 'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );', 'vWorldPosition = worldPosition.xyz;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['uniform sampler2D skySampler;', 'uniform vec3 sunPosition;', 'varying vec3 vWorldPosition;', 'vec3 cameraPos = vec3(0., 0., 0.);', '// uniform sampler2D sDiffuse;', '// const float turbidity = 10.0; //', '// const float reileigh = 2.; //', '// const float luminance = 1.0; //', '// const float mieCoefficient = 0.005;', '// const float mieDirectionalG = 0.8;', 'uniform float luminance;', 'uniform float turbidity;', 'uniform float reileigh;', 'uniform float mieCoefficient;', 'uniform float mieDirectionalG;', '// constants for atmospheric scattering', 'const float e = 2.71828182845904523536028747135266249775724709369995957;', 'const float pi = 3.141592653589793238462643383279502884197169;', 'const float n = 1.0003; // refractive index of air', 'const float N = 2.545E25; // number of molecules per unit volume for air at', '// 288.15K and 1013mb (sea level -45 celsius)', 'const float pn = 0.035;\t// depolatization factor for standard air', '// wavelength of used primaries, according to preetham', 'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);', '// mie stuff', '// K coefficient for the primaries', 'const vec3 K = vec3(0.686, 0.678, 0.666);', 'const float v = 4.0;', '// optical length at zenith for molecules', 'const float rayleighZenithLength = 8.4E3;', 'const float mieZenithLength = 1.25E3;', 'const vec3 up = vec3(0.0, 1.0, 0.0);', 'const float EE = 1000.0;', 'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;', '// 66 arc seconds -> degrees, and the cosine of that', '// earth shadow hack', 'const float cutoffAngle = pi/1.95;', 'const float steepness = 1.5;', 'vec3 totalRayleigh(vec3 lambda)', '{', 'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));', '}',\n\t\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE', 'vec3 simplifiedRayleigh()', '{', 'return 0.0005 / vec3(94, 40, 18);',\n\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}', 'float rayleighPhase(float cosTheta)', '{\t ', 'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));', '}', 'vec3 totalMie(vec3 lambda, vec3 K, float T)', '{', 'float c = (0.2 * T ) * 10E-18;', 'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;', '}', 'float hgPhase(float cosTheta, float g)', '{', 'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));', '}', 'float sunIntensity(float zenithAngleCos)', '{', 'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));', '}', '// float logLuminance(vec3 c)', '// {', '// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);', '// }', '// Filmic ToneMapping http://filmicgames.com/archives/75', 'float A = 0.15;', 'float B = 0.50;', 'float C = 0.10;', 'float D = 0.20;', 'float E = 0.02;', 'float F = 0.30;', 'float W = 1000.0;', 'vec3 Uncharted2Tonemap(vec3 x)', '{', 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;', '}', 'void main() ', '{', 'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);', '// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;', '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);', 'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));', 'vec3 sunDirection = normalize(sunPosition);', 'float sunE = sunIntensity(dot(sunDirection, up));', '// extinction (absorbtion + out scattering) ', '// rayleigh coefficients',\n\t\n\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;', '// mie coefficients', 'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;', '// optical length', '// cutoff angle at 90 to avoid singularity in next formula.', 'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));', 'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', 'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', '// combined extinction factor\t', 'vec3 Fex = exp(-(betaR * sR + betaM * sM));', '// in scattering', 'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);', 'float rPhase = rayleighPhase(cosTheta*0.5+0.5);', 'vec3 betaRTheta = betaR * rPhase;', 'float mPhase = hgPhase(cosTheta, mieDirectionalG);', 'vec3 betaMTheta = betaM * mPhase;', 'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));', 'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));', '//nightsky', 'vec3 direction = normalize(vWorldPosition - cameraPos);', 'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]', 'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]', 'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);', '// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;', 'vec3 L0 = vec3(0.1) * Fex;', '// composition + solar disc', '//if (cosTheta > sunAngularDiameterCos)', 'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);', '// if (normalize(vWorldPosition - cameraPos).y>0.0)', 'L0 += (sunE * 19000.0 * Fex)*sundisk;', 'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));', 'vec3 texColor = (Lin+L0); ', 'texColor *= 0.04 ;', 'texColor += vec3(0.0,0.001,0.0025)*0.3;', 'float g_fMaxLuminance = 1.0;', 'float fLumScaled = 0.1 / luminance; ', 'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ', 'float ExposureBias = fLumCompressed;', 'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);', 'vec3 color = curr*whiteScale;', 'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));', 'gl_FragColor.rgb = retColor;', 'gl_FragColor.a = 1.0;', '}'].join('\\n')\n\t\n\t};\n\t\n\tvar Sky = function Sky() {\n\t\n\t\tvar skyShader = _three2['default'].ShaderLib['sky'];\n\t\tvar skyUniforms = _three2['default'].UniformsUtils.clone(skyShader.uniforms);\n\t\n\t\tvar skyMat = new _three2['default'].ShaderMaterial({\n\t\t\tfragmentShader: skyShader.fragmentShader,\n\t\t\tvertexShader: skyShader.vertexShader,\n\t\t\tuniforms: skyUniforms,\n\t\t\tside: _three2['default'].BackSide\n\t\t});\n\t\n\t\tvar skyGeo = new _three2['default'].SphereBufferGeometry(450000, 32, 15);\n\t\tvar skyMesh = new _three2['default'].Mesh(skyGeo, skyMat);\n\t\n\t\t// Expose variables\n\t\tthis.mesh = skyMesh;\n\t\tthis.uniforms = skyUniforms;\n\t};\n\t\n\texports['default'] = Sky;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.0 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar debounce = __webpack_require__(41);\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/**\n\t * Creates a throttled function that only invokes `func` at most once per\n\t * every `wait` milliseconds. The throttled function comes with a `cancel`\n\t * method to cancel delayed `func` invocations and a `flush` method to\n\t * immediately invoke them. Provide an options object to indicate whether\n\t * `func` should be invoked on the leading and/or trailing edge of the `wait`\n\t * timeout. The `func` is invoked with the last arguments provided to the\n\t * throttled function. Subsequent calls to the throttled function return the\n\t * result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the throttled function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.throttle` and `_.debounce`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to throttle.\n\t * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=true] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new throttled function.\n\t * @example\n\t *\n\t * // avoid excessively updating the position while scrolling\n\t * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n\t *\n\t * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n\t * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n\t * jQuery(element).on('click', throttled);\n\t *\n\t * // cancel a trailing throttled invocation\n\t * jQuery(window).on('popstate', throttled.cancel);\n\t */\n\tfunction throttle(func, wait, options) {\n\t var leading = true,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t if (isObject(options)) {\n\t leading = 'leading' in options ? !!options.leading : leading;\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t // Avoid a V8 JIT bug in Chrome 19-20.\n\t // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\tmodule.exports = throttle;\n\n\n/***/ },\n/* 41 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Gets the timestamp of the number of milliseconds that have elapsed since\n\t * the Unix epoch (1 January 1970 00:00:00 UTC).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Date\n\t * @returns {number} Returns the timestamp.\n\t * @example\n\t *\n\t * _.defer(function(stamp) {\n\t * console.log(_.now() - stamp);\n\t * }, _.now());\n\t * // => logs the number of milliseconds it took for the deferred function to be invoked\n\t */\n\tvar now = Date.now;\n\t\n\t/**\n\t * Creates a debounced function that delays invoking `func` until after `wait`\n\t * milliseconds have elapsed since the last time the debounced function was\n\t * invoked. The debounced function comes with a `cancel` method to cancel\n\t * delayed `func` invocations and a `flush` method to immediately invoke them.\n\t * Provide an options object to indicate whether `func` should be invoked on\n\t * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n\t * with the last arguments provided to the debounced function. Subsequent calls\n\t * to the debounced function return the result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the debounced function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.debounce` and `_.throttle`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to debounce.\n\t * @param {number} [wait=0] The number of milliseconds to delay.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=false] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n\t * delayed before it's invoked.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new debounced function.\n\t * @example\n\t *\n\t * // Avoid costly calculations while the window size is in flux.\n\t * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n\t *\n\t * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n\t * jQuery(element).on('click', _.debounce(sendMail, 300, {\n\t * 'leading': true,\n\t * 'trailing': false\n\t * }));\n\t *\n\t * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n\t * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n\t * var source = new EventSource('/stream');\n\t * jQuery(source).on('message', debounced);\n\t *\n\t * // Cancel the trailing debounced invocation.\n\t * jQuery(window).on('popstate', debounced.cancel);\n\t */\n\tfunction debounce(func, wait, options) {\n\t var args,\n\t maxTimeoutId,\n\t result,\n\t stamp,\n\t thisArg,\n\t timeoutId,\n\t trailingCall,\n\t lastCalled = 0,\n\t leading = false,\n\t maxWait = false,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t wait = toNumber(wait) || 0;\n\t if (isObject(options)) {\n\t leading = !!options.leading;\n\t maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t\n\t function cancel() {\n\t if (timeoutId) {\n\t clearTimeout(timeoutId);\n\t }\n\t if (maxTimeoutId) {\n\t clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = 0;\n\t args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n\t }\n\t\n\t function complete(isCalled, id) {\n\t if (id) {\n\t clearTimeout(id);\n\t }\n\t maxTimeoutId = timeoutId = trailingCall = undefined;\n\t if (isCalled) {\n\t lastCalled = now();\n\t result = func.apply(thisArg, args);\n\t if (!timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t }\n\t }\n\t\n\t function delayed() {\n\t var remaining = wait - (now() - stamp);\n\t if (remaining <= 0 || remaining > wait) {\n\t complete(trailingCall, maxTimeoutId);\n\t } else {\n\t timeoutId = setTimeout(delayed, remaining);\n\t }\n\t }\n\t\n\t function flush() {\n\t if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n\t result = func.apply(thisArg, args);\n\t }\n\t cancel();\n\t return result;\n\t }\n\t\n\t function maxDelayed() {\n\t complete(trailing, timeoutId);\n\t }\n\t\n\t function debounced() {\n\t args = arguments;\n\t stamp = now();\n\t thisArg = this;\n\t trailingCall = trailing && (timeoutId || !leading);\n\t\n\t if (maxWait === false) {\n\t var leadingCall = leading && !timeoutId;\n\t } else {\n\t if (!maxTimeoutId && !leading) {\n\t lastCalled = stamp;\n\t }\n\t var remaining = maxWait - (stamp - lastCalled),\n\t isCalled = remaining <= 0 || remaining > maxWait;\n\t\n\t if (isCalled) {\n\t if (maxTimeoutId) {\n\t maxTimeoutId = clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = stamp;\n\t result = func.apply(thisArg, args);\n\t }\n\t else if (!maxTimeoutId) {\n\t maxTimeoutId = setTimeout(maxDelayed, remaining);\n\t }\n\t }\n\t if (isCalled && timeoutId) {\n\t timeoutId = clearTimeout(timeoutId);\n\t }\n\t else if (!timeoutId && wait !== maxWait) {\n\t timeoutId = setTimeout(delayed, wait);\n\t }\n\t if (leadingCall) {\n\t isCalled = true;\n\t result = func.apply(thisArg, args);\n\t }\n\t if (isCalled && !timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t return result;\n\t }\n\t debounced.cancel = cancel;\n\t debounced.flush = flush;\n\t return debounced;\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = debounce;\n\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _ControlsOrbit = __webpack_require__(43);\n\t\n\tvar _ControlsOrbit2 = _interopRequireDefault(_ControlsOrbit);\n\t\n\tvar Controls = {\n\t Orbit: _ControlsOrbit2['default'],\n\t orbit: _ControlsOrbit.orbit, orbit: _ControlsOrbit.orbit\n\t};\n\t\n\texports['default'] = Controls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorOrbitControls = __webpack_require__(44);\n\t\n\tvar _vendorOrbitControls2 = _interopRequireDefault(_vendorOrbitControls);\n\t\n\tvar Orbit = (function (_EventEmitter) {\n\t _inherits(Orbit, _EventEmitter);\n\t\n\t function Orbit() {\n\t _classCallCheck(this, Orbit);\n\t\n\t _get(Object.getPrototypeOf(Orbit.prototype), 'constructor', this).call(this);\n\t }\n\t\n\t // Proxy control events\n\t //\n\t // There's currently no distinction between pan, orbit and zoom events\n\t\n\t _createClass(Orbit, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t var _this = this;\n\t\n\t this._controls.addEventListener('start', function (event) {\n\t _this._world.emit('controlsMoveStart', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('change', function (event) {\n\t _this._world.emit('controlsMove', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('end', function (event) {\n\t _this._world.emit('controlsMoveEnd', event.target.target);\n\t });\n\t }\n\t\n\t // Moving the camera along the [x,y,z] axis based on a target position\n\t }, {\n\t key: '_panTo',\n\t value: function _panTo(point, animate) {}\n\t }, {\n\t key: '_panBy',\n\t value: function _panBy(pointDelta, animate) {}\n\t\n\t // Zooming the camera in and out\n\t }, {\n\t key: '_zoomTo',\n\t value: function _zoomTo(metres, animate) {}\n\t }, {\n\t key: '_zoomBy',\n\t value: function _zoomBy(metresDelta, animate) {}\n\t\n\t // Force camera to look at something other than the target\n\t }, {\n\t key: '_lookAt',\n\t value: function _lookAt(point, animate) {}\n\t\n\t // Make camera look at the target\n\t }, {\n\t key: '_lookAtTarget',\n\t value: function _lookAtTarget() {}\n\t\n\t // Tilt (up and down)\n\t }, {\n\t key: '_tiltTo',\n\t value: function _tiltTo(angle, animate) {}\n\t }, {\n\t key: '_tiltBy',\n\t value: function _tiltBy(angleDelta, animate) {}\n\t\n\t // Rotate (left and right)\n\t }, {\n\t key: '_rotateTo',\n\t value: function _rotateTo(angle, animate) {}\n\t }, {\n\t key: '_rotateBy',\n\t value: function _rotateBy(angleDelta, animate) {}\n\t\n\t // Fly to the given point, animating pan and tilt/rotation to final position\n\t // with nice zoom out and in\n\t //\n\t // Calling flyTo a second time before the previous animation has completed\n\t // will immediately start the new animation from wherever the previous one\n\t // has got to\n\t }, {\n\t key: '_flyTo',\n\t value: function _flyTo(point, noZoom) {}\n\t\n\t // Proxy to OrbitControls.update()\n\t }, {\n\t key: 'update',\n\t value: function update() {\n\t this._controls.update();\n\t }\n\t\n\t // Add controls to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addControls(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addControls to actually add the controls\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t\n\t // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n\t // See: http://stackoverflow.com/a/26188674/997339\n\t this._controls = new _vendorOrbitControls2['default'](world._engine._camera, world._container);\n\t\n\t // Disable keys for now as no events are fired for them anyway\n\t this._controls.keys = false;\n\t\n\t // 89 degrees\n\t this._controls.maxPolarAngle = 1.5533;\n\t\n\t // this._controls.enableDamping = true;\n\t // this._controls.dampingFactor = 0.25;\n\t\n\t this._initEvents();\n\t\n\t this.emit('added');\n\t }\n\t\n\t // Destroys the controls and removes them from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Remove event listeners\n\t\n\t this._controls.dispose();\n\t\n\t this._world = null;\n\t this._controls = null;\n\t }\n\t }]);\n\t\n\t return Orbit;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Orbit;\n\t\n\tvar noNew = function noNew() {\n\t return new Orbit();\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.orbit = noNew;\n\n/***/ },\n/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _hammerjs = __webpack_require__(45);\n\t\n\tvar _hammerjs2 = _interopRequireDefault(_hammerjs);\n\t\n\t/**\n\t * @author qiao / https://github.com/qiao\n\t * @author mrdoob / http://mrdoob.com\n\t * @author alteredq / http://alteredqualia.com/\n\t * @author WestLangley / http://github.com/WestLangley\n\t * @author erich666 / http://erichaines.com\n\t */\n\t\n\t// This set of controls performs orbiting, dollying (zooming), and panning.\n\t// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n\t//\n\t// Orbit - left mouse / touch: one finger move\n\t// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n\t// Pan - right mouse, or arrow keys / touch: three finter swipe\n\t\n\tvar OrbitControls = function OrbitControls(object, domElement) {\n\t\n\t\tthis.object = object;\n\t\n\t\tthis.domElement = domElement !== undefined ? domElement : document;\n\t\n\t\t// Set to false to disable this control\n\t\tthis.enabled = true;\n\t\n\t\t// \"target\" sets the location of focus, where the object orbits around\n\t\tthis.target = new _three2['default'].Vector3();\n\t\n\t\t// How far you can dolly in and out ( PerspectiveCamera only )\n\t\tthis.minDistance = 0;\n\t\tthis.maxDistance = Infinity;\n\t\n\t\t// How far you can zoom in and out ( OrthographicCamera only )\n\t\tthis.minZoom = 0;\n\t\tthis.maxZoom = Infinity;\n\t\n\t\t// How far you can orbit vertically, upper and lower limits.\n\t\t// Range is 0 to Math.PI radians.\n\t\tthis.minPolarAngle = 0; // radians\n\t\tthis.maxPolarAngle = Math.PI; // radians\n\t\n\t\t// How far you can orbit horizontally, upper and lower limits.\n\t\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\t\tthis.minAzimuthAngle = -Infinity; // radians\n\t\tthis.maxAzimuthAngle = Infinity; // radians\n\t\n\t\t// Set to true to enable damping (inertia)\n\t\t// If damping is enabled, you must call controls.update() in your animation loop\n\t\tthis.enableDamping = false;\n\t\tthis.dampingFactor = 0.25;\n\t\n\t\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t\t// Set to false to disable zooming\n\t\tthis.enableZoom = true;\n\t\tthis.zoomSpeed = 1.0;\n\t\n\t\t// Set to false to disable rotating\n\t\tthis.enableRotate = true;\n\t\tthis.rotateSpeed = 1.0;\n\t\n\t\t// Set to false to disable panning\n\t\tthis.enablePan = true;\n\t\tthis.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\t\n\t\t// Set to true to automatically rotate around the target\n\t\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\t\tthis.autoRotate = false;\n\t\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\t\n\t\t// Set to false to disable use of the keys\n\t\tthis.enableKeys = true;\n\t\n\t\t// The four arrow keys\n\t\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\t\n\t\t// Mouse buttons\n\t\tthis.mouseButtons = { ORBIT: _three2['default'].MOUSE.LEFT, ZOOM: _three2['default'].MOUSE.MIDDLE, PAN: _three2['default'].MOUSE.RIGHT };\n\t\n\t\t// for reset\n\t\tthis.target0 = this.target.clone();\n\t\tthis.position0 = this.object.position.clone();\n\t\tthis.zoom0 = this.object.zoom;\n\t\n\t\t//\n\t\t// public methods\n\t\t//\n\t\n\t\tthis.getPolarAngle = function () {\n\t\n\t\t\treturn phi;\n\t\t};\n\t\n\t\tthis.getAzimuthalAngle = function () {\n\t\n\t\t\treturn theta;\n\t\t};\n\t\n\t\tthis.reset = function () {\n\t\n\t\t\tscope.target.copy(scope.target0);\n\t\t\tscope.object.position.copy(scope.position0);\n\t\t\tscope.object.zoom = scope.zoom0;\n\t\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\tscope.update();\n\t\n\t\t\tstate = STATE.NONE;\n\t\t};\n\t\n\t\t// this method is exposed, but perhaps it would be better if we can make it private...\n\t\tthis.update = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\t// so camera.up is the orbit axis\n\t\t\tvar quat = new _three2['default'].Quaternion().setFromUnitVectors(object.up, new _three2['default'].Vector3(0, 1, 0));\n\t\t\tvar quatInverse = quat.clone().inverse();\n\t\n\t\t\tvar lastPosition = new _three2['default'].Vector3();\n\t\t\tvar lastQuaternion = new _three2['default'].Quaternion();\n\t\n\t\t\treturn function () {\n\t\n\t\t\t\tvar position = scope.object.position;\n\t\n\t\t\t\toffset.copy(position).sub(scope.target);\n\t\n\t\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\t\toffset.applyQuaternion(quat);\n\t\n\t\t\t\t// angle from z-axis around y-axis\n\t\n\t\t\t\ttheta = Math.atan2(offset.x, offset.z);\n\t\n\t\t\t\t// angle from y-axis\n\t\n\t\t\t\tphi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n\t\n\t\t\t\tif (scope.autoRotate && state === STATE.NONE) {\n\t\n\t\t\t\t\trotateLeft(getAutoRotationAngle());\n\t\t\t\t}\n\t\n\t\t\t\ttheta += thetaDelta;\n\t\t\t\tphi += phiDelta;\n\t\n\t\t\t\t// restrict theta to be between desired limits\n\t\t\t\ttheta = Math.max(scope.minAzimuthAngle, Math.min(scope.maxAzimuthAngle, theta));\n\t\n\t\t\t\t// restrict phi to be between desired limits\n\t\t\t\tphi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, phi));\n\t\n\t\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\t\tphi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n\t\n\t\t\t\tvar radius = offset.length() * scale;\n\t\n\t\t\t\t// restrict radius to be between desired limits\n\t\t\t\tradius = Math.max(scope.minDistance, Math.min(scope.maxDistance, radius));\n\t\n\t\t\t\t// move target to panned location\n\t\t\t\tscope.target.add(panOffset);\n\t\n\t\t\t\toffset.x = radius * Math.sin(phi) * Math.sin(theta);\n\t\t\t\toffset.y = radius * Math.cos(phi);\n\t\t\t\toffset.z = radius * Math.sin(phi) * Math.cos(theta);\n\t\n\t\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\t\toffset.applyQuaternion(quatInverse);\n\t\n\t\t\t\tposition.copy(scope.target).add(offset);\n\t\n\t\t\t\tscope.object.lookAt(scope.target);\n\t\n\t\t\t\tif (scope.enableDamping === true) {\n\t\n\t\t\t\t\tthetaDelta *= 1 - scope.dampingFactor;\n\t\t\t\t\tphiDelta *= 1 - scope.dampingFactor;\n\t\t\t\t} else {\n\t\n\t\t\t\t\tthetaDelta = 0;\n\t\t\t\t\tphiDelta = 0;\n\t\t\t\t}\n\t\n\t\t\t\tscale = 1;\n\t\t\t\tpanOffset.set(0, 0, 0);\n\t\n\t\t\t\t// update condition is:\n\t\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\t\n\t\t\t\tif (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {\n\t\n\t\t\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\t\t\tlastPosition.copy(scope.object.position);\n\t\t\t\t\tlastQuaternion.copy(scope.object.quaternion);\n\t\t\t\t\tzoomChanged = false;\n\t\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\n\t\t\t\treturn false;\n\t\t\t};\n\t\t})();\n\t\n\t\tthis.dispose = function () {\n\t\n\t\t\tscope.domElement.removeEventListener('contextmenu', onContextMenu, false);\n\t\t\tscope.domElement.removeEventListener('mousedown', onMouseDown, false);\n\t\t\tscope.domElement.removeEventListener('mousewheel', onMouseWheel, false);\n\t\t\tscope.domElement.removeEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t\tscope.domElement.removeEventListener('touchstart', onTouchStart, false);\n\t\t\tscope.domElement.removeEventListener('touchend', onTouchEnd, false);\n\t\t\tscope.domElement.removeEventListener('touchmove', onTouchMove, false);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\twindow.removeEventListener('keydown', onKeyDown, false);\n\t\n\t\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\t\t};\n\t\n\t\t//\n\t\t// internals\n\t\t//\n\t\n\t\tvar scope = this;\n\t\n\t\tvar changeEvent = { type: 'change' };\n\t\tvar startEvent = { type: 'start' };\n\t\tvar endEvent = { type: 'end' };\n\t\n\t\tvar STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };\n\t\n\t\tvar state = STATE.NONE;\n\t\n\t\tvar EPS = 0.000001;\n\t\n\t\t// current position in spherical coordinates\n\t\tvar theta;\n\t\tvar phi;\n\t\n\t\tvar phiDelta = 0;\n\t\tvar thetaDelta = 0;\n\t\tvar scale = 1;\n\t\tvar panOffset = new _three2['default'].Vector3();\n\t\tvar zoomChanged = false;\n\t\n\t\tvar rotateStart = new _three2['default'].Vector2();\n\t\tvar rotateEnd = new _three2['default'].Vector2();\n\t\tvar rotateDelta = new _three2['default'].Vector2();\n\t\n\t\tvar panStart = new _three2['default'].Vector2();\n\t\tvar panEnd = new _three2['default'].Vector2();\n\t\tvar panDelta = new _three2['default'].Vector2();\n\t\n\t\tvar dollyStart = new _three2['default'].Vector2();\n\t\tvar dollyEnd = new _three2['default'].Vector2();\n\t\tvar dollyDelta = new _three2['default'].Vector2();\n\t\n\t\tfunction getAutoRotationAngle() {\n\t\n\t\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\t\t}\n\t\n\t\tfunction getZoomScale() {\n\t\n\t\t\treturn Math.pow(0.95, scope.zoomSpeed);\n\t\t}\n\t\n\t\tfunction rotateLeft(angle) {\n\t\n\t\t\tthetaDelta -= angle;\n\t\t}\n\t\n\t\tfunction rotateUp(angle) {\n\t\n\t\t\tphiDelta -= angle;\n\t\t}\n\t\n\t\tvar panLeft = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panLeft( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get X column of objectMatrix\n\t\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( - distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\t// Fixed panning to x/y plane\n\t\t\treturn function panLeft(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\t// var adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[0], 0, te[2]);\n\t\t\t\tv.multiplyScalar(-distance);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// Fixed panning to x/y plane\n\t\tvar panUp = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panUp( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get Y column of objectMatrix\n\t\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\treturn function panUp(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\tvar adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[4], 0, te[6]);\n\t\t\t\tv.multiplyScalar(adjDist);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// deltaX and deltaY are in pixels; right and down are positive\n\t\tvar pan = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\treturn function (deltaX, deltaY) {\n\t\n\t\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\t\t// perspective\n\t\t\t\t\tvar position = scope.object.position;\n\t\t\t\t\toffset.copy(position).sub(scope.target);\n\t\t\t\t\tvar targetDistance = offset.length();\n\t\n\t\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\t\ttargetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0);\n\t\n\t\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\t\tpanLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t\tpanUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\t\t// orthographic\n\t\t\t\t\tpanLeft(deltaX * (scope.object.right - scope.object.left) / element.clientWidth, scope.object.matrix);\n\t\t\t\t\tpanUp(deltaY * (scope.object.top - scope.object.bottom) / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.');\n\t\t\t\t\tscope.enablePan = false;\n\t\t\t\t}\n\t\t\t};\n\t\t})();\n\t\n\t\tfunction dollyIn(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale /= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\tfunction dollyOut(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale *= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\t//\n\t\t// event callbacks - update the object state\n\t\t//\n\t\n\t\tfunction handleMouseDownRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownRotate' );\n\t\n\t\t\trotateStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownDolly' );\n\t\n\t\t\tdollyStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownPan(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownPan' );\n\t\n\t\t\tpanStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.clientX, event.clientY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveDolly' );\n\t\n\t\t\tdollyEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMovePan(event) {\n\t\n\t\t\t//console.log( 'handleMouseMovePan' );\n\t\n\t\t\tpanEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseUp(event) {\n\t\n\t\t\t//console.log( 'handleMouseUp' );\n\t\n\t\t}\n\t\n\t\tfunction handleMouseWheel(event) {\n\t\n\t\t\t//console.log( 'handleMouseWheel' );\n\t\n\t\t\tvar delta = 0;\n\t\n\t\t\tif (event.wheelDelta !== undefined) {\n\t\n\t\t\t\t// WebKit / Opera / Explorer 9\n\t\n\t\t\t\tdelta = event.wheelDelta;\n\t\t\t} else if (event.detail !== undefined) {\n\t\n\t\t\t\t// Firefox\n\t\n\t\t\t\tdelta = -event.detail;\n\t\t\t}\n\t\n\t\t\tif (delta > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (delta < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleKeyDown(event) {\n\t\n\t\t\t//console.log( 'handleKeyDown' );\n\t\n\t\t\tswitch (event.keyCode) {\n\t\n\t\t\t\tcase scope.keys.UP:\n\t\t\t\t\tpan(0, scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\t\tpan(0, -scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.LEFT:\n\t\t\t\t\tpan(scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.RIGHT:\n\t\t\t\t\tpan(-scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction handleTouchStartRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartRotate' );\n\t\n\t\t\trotateStart.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t}\n\t\n\t\tfunction handleTouchStartDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyStart.set(0, distance);\n\t\t}\n\t\n\t\tfunction handleTouchStartPan(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartPan' );\n\t\n\t\t\tpanStart.set(event.deltaX, event.deltaY);\n\t\t}\n\t\n\t\tfunction handleTouchMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyEnd.set(0, distance);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMovePan(event) {\n\t\n\t\t\t//console.log( 'handleTouchMovePan' );\n\t\n\t\t\tpanEnd.set(event.deltaX, event.deltaY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchEnd(event) {}\n\t\n\t\t//console.log( 'handleTouchEnd' );\n\t\n\t\t//\n\t\t// event handlers - FSM: listen for events and reset state\n\t\t//\n\t\n\t\tfunction onMouseDown(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (event.button === scope.mouseButtons.ORBIT) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseDownRotate(event);\n\t\n\t\t\t\tstate = STATE.ROTATE;\n\t\t\t} else if (event.button === scope.mouseButtons.ZOOM) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseDownDolly(event);\n\t\n\t\t\t\tstate = STATE.DOLLY;\n\t\t\t} else if (event.button === scope.mouseButtons.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseDownPan(event);\n\t\n\t\t\t\tstate = STATE.PAN;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tdocument.addEventListener('mousemove', onMouseMove, false);\n\t\t\t\tdocument.addEventListener('mouseup', onMouseUp, false);\n\t\t\t\tdocument.addEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (state === STATE.ROTATE) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseMoveRotate(event);\n\t\t\t} else if (state === STATE.DOLLY) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseMoveDolly(event);\n\t\t\t} else if (state === STATE.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseMovePan(event);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseUp(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleMouseUp(event);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onMouseWheel(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\thandleMouseWheel(event);\n\t\n\t\t\tscope.dispatchEvent(startEvent); // not sure why these are here...\n\t\t\tscope.dispatchEvent(endEvent);\n\t\t}\n\t\n\t\tfunction onKeyDown(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableKeys === false || scope.enablePan === false) return;\n\t\n\t\t\thandleKeyDown(event);\n\t\t}\n\t\n\t\tfunction onTouchStart(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\t\thandleTouchStartPan(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchEnd(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleTouchEnd(event);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onContextMenu(event) {\n\t\n\t\t\tevent.preventDefault();\n\t\t}\n\t\n\t\t//\n\t\n\t\tscope.domElement.addEventListener('contextmenu', onContextMenu, false);\n\t\n\t\tscope.domElement.addEventListener('mousedown', onMouseDown, false);\n\t\tscope.domElement.addEventListener('mousewheel', onMouseWheel, false);\n\t\tscope.domElement.addEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\t\n\t\tscope.hammer = new _hammerjs2['default'](scope.domElement);\n\t\n\t\tscope.hammer.get('pan').set({\n\t\t\tpointers: 0,\n\t\t\tdirection: _hammerjs2['default'].DIRECTION_ALL\n\t\t});\n\t\n\t\tscope.hammer.get('pinch').set({\n\t\t\tenable: true,\n\t\t\tthreshold: 0.1\n\t\t});\n\t\n\t\tscope.hammer.on('panstart', function (event) {\n\t\t\tif (scope.enabled === false) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\thandleTouchStartPan(event);\n\t\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\t\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('panend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('panmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t\t//\n\t\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t\t//\n\t\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t\t//\n\t\t\t\t// panStart.copy( panEnd );\n\t\t\t\t//\n\t\t\t\t// scope.update();\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchstart', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyStart.set( 0, distance );\n\t\t\t//\n\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('pinchmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyEnd.set( 0, distance );\n\t\t\t//\n\t\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t\t//\n\t\t\t// if ( dollyDelta.y > 0 ) {\n\t\t\t//\n\t\t\t// \tdollyOut( getZoomScale() );\n\t\t\t//\n\t\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t\t//\n\t\t\t// \tdollyIn( getZoomScale() );\n\t\t\t//\n\t\t\t// }\n\t\t\t//\n\t\t\t// dollyStart.copy( dollyEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t});\n\t\n\t\twindow.addEventListener('keydown', onKeyDown, false);\n\t\n\t\t// force an update at start\n\t\n\t\tthis.update();\n\t};\n\t\n\tOrbitControls.prototype = Object.create(_three2['default'].EventDispatcher.prototype);\n\tOrbitControls.prototype.constructor = _three2['default'].OrbitControls;\n\t\n\tObject.defineProperties(OrbitControls.prototype, {\n\t\n\t\tcenter: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .center has been renamed to .target');\n\t\t\t\treturn this.target;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\t// backward compatibility\n\t\n\t\tnoZoom: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\treturn !this.enableZoom;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\tthis.enableZoom = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoRotate: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\treturn !this.enableRotate;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\tthis.enableRotate = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoPan: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\treturn !this.enablePan;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\tthis.enablePan = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoKeys: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\treturn !this.enableKeys;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\tthis.enableKeys = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tstaticMoving: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\treturn !this.constraint.enableDamping;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\tthis.constraint.enableDamping = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tdynamicDampingFactor: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\treturn this.constraint.dampingFactor;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\tthis.constraint.dampingFactor = value;\n\t\t\t}\n\t\n\t\t}\n\t\n\t});\n\t\n\texports['default'] = OrbitControls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 45 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.6 - 2015-12-23\n\t * http://hammerjs.github.io/\n\t *\n\t * Copyright (c) 2015 Jorik Tangelder;\n\t * Licensed under the license */\n\t(function(window, document, exportName, undefined) {\n\t 'use strict';\n\t\n\tvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n\tvar TEST_ELEMENT = document.createElement('div');\n\t\n\tvar TYPE_FUNCTION = 'function';\n\t\n\tvar round = Math.round;\n\tvar abs = Math.abs;\n\tvar now = Date.now;\n\t\n\t/**\n\t * set a timeout with a given scope\n\t * @param {Function} fn\n\t * @param {Number} timeout\n\t * @param {Object} context\n\t * @returns {number}\n\t */\n\tfunction setTimeoutContext(fn, timeout, context) {\n\t return setTimeout(bindFn(fn, context), timeout);\n\t}\n\t\n\t/**\n\t * if the argument is an array, we want to execute the fn on each entry\n\t * if it aint an array we don't want to do a thing.\n\t * this is used by all the methods that accept a single and array argument.\n\t * @param {*|Array} arg\n\t * @param {String} fn\n\t * @param {Object} [context]\n\t * @returns {Boolean}\n\t */\n\tfunction invokeArrayArg(arg, fn, context) {\n\t if (Array.isArray(arg)) {\n\t each(arg, context[fn], context);\n\t return true;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * walk objects and arrays\n\t * @param {Object} obj\n\t * @param {Function} iterator\n\t * @param {Object} context\n\t */\n\tfunction each(obj, iterator, context) {\n\t var i;\n\t\n\t if (!obj) {\n\t return;\n\t }\n\t\n\t if (obj.forEach) {\n\t obj.forEach(iterator, context);\n\t } else if (obj.length !== undefined) {\n\t i = 0;\n\t while (i < obj.length) {\n\t iterator.call(context, obj[i], i, obj);\n\t i++;\n\t }\n\t } else {\n\t for (i in obj) {\n\t obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * wrap a method with a deprecation warning and stack trace\n\t * @param {Function} method\n\t * @param {String} name\n\t * @param {String} message\n\t * @returns {Function} A new function wrapping the supplied method.\n\t */\n\tfunction deprecate(method, name, message) {\n\t var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n\t return function() {\n\t var e = new Error('get-stack-trace');\n\t var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n\t .replace(/^\\s+at\\s+/gm, '')\n\t .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\t\n\t var log = window.console && (window.console.warn || window.console.log);\n\t if (log) {\n\t log.call(window.console, deprecationMessage, stack);\n\t }\n\t return method.apply(this, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} target\n\t * @param {...Object} objects_to_assign\n\t * @returns {Object} target\n\t */\n\tvar assign;\n\tif (typeof Object.assign !== 'function') {\n\t assign = function assign(target) {\n\t if (target === undefined || target === null) {\n\t throw new TypeError('Cannot convert undefined or null to object');\n\t }\n\t\n\t var output = Object(target);\n\t for (var index = 1; index < arguments.length; index++) {\n\t var source = arguments[index];\n\t if (source !== undefined && source !== null) {\n\t for (var nextKey in source) {\n\t if (source.hasOwnProperty(nextKey)) {\n\t output[nextKey] = source[nextKey];\n\t }\n\t }\n\t }\n\t }\n\t return output;\n\t };\n\t} else {\n\t assign = Object.assign;\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @param {Boolean=false} [merge]\n\t * @returns {Object} dest\n\t */\n\tvar extend = deprecate(function extend(dest, src, merge) {\n\t var keys = Object.keys(src);\n\t var i = 0;\n\t while (i < keys.length) {\n\t if (!merge || (merge && dest[keys[i]] === undefined)) {\n\t dest[keys[i]] = src[keys[i]];\n\t }\n\t i++;\n\t }\n\t return dest;\n\t}, 'extend', 'Use `assign`.');\n\t\n\t/**\n\t * merge the values from src in the dest.\n\t * means that properties that exist in dest will not be overwritten by src\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @returns {Object} dest\n\t */\n\tvar merge = deprecate(function merge(dest, src) {\n\t return extend(dest, src, true);\n\t}, 'merge', 'Use `assign`.');\n\t\n\t/**\n\t * simple class inheritance\n\t * @param {Function} child\n\t * @param {Function} base\n\t * @param {Object} [properties]\n\t */\n\tfunction inherit(child, base, properties) {\n\t var baseP = base.prototype,\n\t childP;\n\t\n\t childP = child.prototype = Object.create(baseP);\n\t childP.constructor = child;\n\t childP._super = baseP;\n\t\n\t if (properties) {\n\t assign(childP, properties);\n\t }\n\t}\n\t\n\t/**\n\t * simple function bind\n\t * @param {Function} fn\n\t * @param {Object} context\n\t * @returns {Function}\n\t */\n\tfunction bindFn(fn, context) {\n\t return function boundFn() {\n\t return fn.apply(context, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * let a boolean value also be a function that must return a boolean\n\t * this first item in args will be used as the context\n\t * @param {Boolean|Function} val\n\t * @param {Array} [args]\n\t * @returns {Boolean}\n\t */\n\tfunction boolOrFn(val, args) {\n\t if (typeof val == TYPE_FUNCTION) {\n\t return val.apply(args ? args[0] || undefined : undefined, args);\n\t }\n\t return val;\n\t}\n\t\n\t/**\n\t * use the val2 when val1 is undefined\n\t * @param {*} val1\n\t * @param {*} val2\n\t * @returns {*}\n\t */\n\tfunction ifUndefined(val1, val2) {\n\t return (val1 === undefined) ? val2 : val1;\n\t}\n\t\n\t/**\n\t * addEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction addEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.addEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * removeEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction removeEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.removeEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * find if a node is in the given parent\n\t * @method hasParent\n\t * @param {HTMLElement} node\n\t * @param {HTMLElement} parent\n\t * @return {Boolean} found\n\t */\n\tfunction hasParent(node, parent) {\n\t while (node) {\n\t if (node == parent) {\n\t return true;\n\t }\n\t node = node.parentNode;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * small indexOf wrapper\n\t * @param {String} str\n\t * @param {String} find\n\t * @returns {Boolean} found\n\t */\n\tfunction inStr(str, find) {\n\t return str.indexOf(find) > -1;\n\t}\n\t\n\t/**\n\t * split string on whitespace\n\t * @param {String} str\n\t * @returns {Array} words\n\t */\n\tfunction splitStr(str) {\n\t return str.trim().split(/\\s+/g);\n\t}\n\t\n\t/**\n\t * find if a array contains the object using indexOf or a simple polyFill\n\t * @param {Array} src\n\t * @param {String} find\n\t * @param {String} [findByKey]\n\t * @return {Boolean|Number} false when not found, or the index\n\t */\n\tfunction inArray(src, find, findByKey) {\n\t if (src.indexOf && !findByKey) {\n\t return src.indexOf(find);\n\t } else {\n\t var i = 0;\n\t while (i < src.length) {\n\t if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n\t return i;\n\t }\n\t i++;\n\t }\n\t return -1;\n\t }\n\t}\n\t\n\t/**\n\t * convert array-like objects to real arrays\n\t * @param {Object} obj\n\t * @returns {Array}\n\t */\n\tfunction toArray(obj) {\n\t return Array.prototype.slice.call(obj, 0);\n\t}\n\t\n\t/**\n\t * unique array with objects based on a key (like 'id') or just by the array's value\n\t * @param {Array} src [{id:1},{id:2},{id:1}]\n\t * @param {String} [key]\n\t * @param {Boolean} [sort=False]\n\t * @returns {Array} [{id:1},{id:2}]\n\t */\n\tfunction uniqueArray(src, key, sort) {\n\t var results = [];\n\t var values = [];\n\t var i = 0;\n\t\n\t while (i < src.length) {\n\t var val = key ? src[i][key] : src[i];\n\t if (inArray(values, val) < 0) {\n\t results.push(src[i]);\n\t }\n\t values[i] = val;\n\t i++;\n\t }\n\t\n\t if (sort) {\n\t if (!key) {\n\t results = results.sort();\n\t } else {\n\t results = results.sort(function sortUniqueArray(a, b) {\n\t return a[key] > b[key];\n\t });\n\t }\n\t }\n\t\n\t return results;\n\t}\n\t\n\t/**\n\t * get the prefixed property\n\t * @param {Object} obj\n\t * @param {String} property\n\t * @returns {String|Undefined} prefixed\n\t */\n\tfunction prefixed(obj, property) {\n\t var prefix, prop;\n\t var camelProp = property[0].toUpperCase() + property.slice(1);\n\t\n\t var i = 0;\n\t while (i < VENDOR_PREFIXES.length) {\n\t prefix = VENDOR_PREFIXES[i];\n\t prop = (prefix) ? prefix + camelProp : property;\n\t\n\t if (prop in obj) {\n\t return prop;\n\t }\n\t i++;\n\t }\n\t return undefined;\n\t}\n\t\n\t/**\n\t * get a unique id\n\t * @returns {number} uniqueId\n\t */\n\tvar _uniqueId = 1;\n\tfunction uniqueId() {\n\t return _uniqueId++;\n\t}\n\t\n\t/**\n\t * get the window object of an element\n\t * @param {HTMLElement} element\n\t * @returns {DocumentView|Window}\n\t */\n\tfunction getWindowForElement(element) {\n\t var doc = element.ownerDocument || element;\n\t return (doc.defaultView || doc.parentWindow || window);\n\t}\n\t\n\tvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\t\n\tvar SUPPORT_TOUCH = ('ontouchstart' in window);\n\tvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n\tvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\t\n\tvar INPUT_TYPE_TOUCH = 'touch';\n\tvar INPUT_TYPE_PEN = 'pen';\n\tvar INPUT_TYPE_MOUSE = 'mouse';\n\tvar INPUT_TYPE_KINECT = 'kinect';\n\t\n\tvar COMPUTE_INTERVAL = 25;\n\t\n\tvar INPUT_START = 1;\n\tvar INPUT_MOVE = 2;\n\tvar INPUT_END = 4;\n\tvar INPUT_CANCEL = 8;\n\t\n\tvar DIRECTION_NONE = 1;\n\tvar DIRECTION_LEFT = 2;\n\tvar DIRECTION_RIGHT = 4;\n\tvar DIRECTION_UP = 8;\n\tvar DIRECTION_DOWN = 16;\n\t\n\tvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n\tvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n\tvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\t\n\tvar PROPS_XY = ['x', 'y'];\n\tvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\t\n\t/**\n\t * create new input type manager\n\t * @param {Manager} manager\n\t * @param {Function} callback\n\t * @returns {Input}\n\t * @constructor\n\t */\n\tfunction Input(manager, callback) {\n\t var self = this;\n\t this.manager = manager;\n\t this.callback = callback;\n\t this.element = manager.element;\n\t this.target = manager.options.inputTarget;\n\t\n\t // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n\t // so when disabled the input events are completely bypassed.\n\t this.domHandler = function(ev) {\n\t if (boolOrFn(manager.options.enable, [manager])) {\n\t self.handler(ev);\n\t }\n\t };\n\t\n\t this.init();\n\t\n\t}\n\t\n\tInput.prototype = {\n\t /**\n\t * should handle the inputEvent data and trigger the callback\n\t * @virtual\n\t */\n\t handler: function() { },\n\t\n\t /**\n\t * bind the events\n\t */\n\t init: function() {\n\t this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t },\n\t\n\t /**\n\t * unbind the events\n\t */\n\t destroy: function() {\n\t this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t }\n\t};\n\t\n\t/**\n\t * create new input type manager\n\t * called by the Manager constructor\n\t * @param {Hammer} manager\n\t * @returns {Input}\n\t */\n\tfunction createInputInstance(manager) {\n\t var Type;\n\t var inputClass = manager.options.inputClass;\n\t\n\t if (inputClass) {\n\t Type = inputClass;\n\t } else if (SUPPORT_POINTER_EVENTS) {\n\t Type = PointerEventInput;\n\t } else if (SUPPORT_ONLY_TOUCH) {\n\t Type = TouchInput;\n\t } else if (!SUPPORT_TOUCH) {\n\t Type = MouseInput;\n\t } else {\n\t Type = TouchMouseInput;\n\t }\n\t return new (Type)(manager, inputHandler);\n\t}\n\t\n\t/**\n\t * handle input events\n\t * @param {Manager} manager\n\t * @param {String} eventType\n\t * @param {Object} input\n\t */\n\tfunction inputHandler(manager, eventType, input) {\n\t var pointersLen = input.pointers.length;\n\t var changedPointersLen = input.changedPointers.length;\n\t var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n\t var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\t\n\t input.isFirst = !!isFirst;\n\t input.isFinal = !!isFinal;\n\t\n\t if (isFirst) {\n\t manager.session = {};\n\t }\n\t\n\t // source event is the normalized value of the domEvents\n\t // like 'touchstart, mouseup, pointerdown'\n\t input.eventType = eventType;\n\t\n\t // compute scale, rotation etc\n\t computeInputData(manager, input);\n\t\n\t // emit secret event\n\t manager.emit('hammer.input', input);\n\t\n\t manager.recognize(input);\n\t manager.session.prevInput = input;\n\t}\n\t\n\t/**\n\t * extend the data with some usable properties like scale, rotate, velocity etc\n\t * @param {Object} manager\n\t * @param {Object} input\n\t */\n\tfunction computeInputData(manager, input) {\n\t var session = manager.session;\n\t var pointers = input.pointers;\n\t var pointersLength = pointers.length;\n\t\n\t // store the first input to calculate the distance and direction\n\t if (!session.firstInput) {\n\t session.firstInput = simpleCloneInputData(input);\n\t }\n\t\n\t // to compute scale and rotation we need to store the multiple touches\n\t if (pointersLength > 1 && !session.firstMultiple) {\n\t session.firstMultiple = simpleCloneInputData(input);\n\t } else if (pointersLength === 1) {\n\t session.firstMultiple = false;\n\t }\n\t\n\t var firstInput = session.firstInput;\n\t var firstMultiple = session.firstMultiple;\n\t var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\t\n\t var center = input.center = getCenter(pointers);\n\t input.timeStamp = now();\n\t input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\t\n\t input.angle = getAngle(offsetCenter, center);\n\t input.distance = getDistance(offsetCenter, center);\n\t\n\t computeDeltaXY(session, input);\n\t input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\t\n\t var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n\t input.overallVelocityX = overallVelocity.x;\n\t input.overallVelocityY = overallVelocity.y;\n\t input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\t\n\t input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n\t input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\t\n\t input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n\t session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\t\n\t computeIntervalInputData(session, input);\n\t\n\t // find the correct target\n\t var target = manager.element;\n\t if (hasParent(input.srcEvent.target, target)) {\n\t target = input.srcEvent.target;\n\t }\n\t input.target = target;\n\t}\n\t\n\tfunction computeDeltaXY(session, input) {\n\t var center = input.center;\n\t var offset = session.offsetDelta || {};\n\t var prevDelta = session.prevDelta || {};\n\t var prevInput = session.prevInput || {};\n\t\n\t if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n\t prevDelta = session.prevDelta = {\n\t x: prevInput.deltaX || 0,\n\t y: prevInput.deltaY || 0\n\t };\n\t\n\t offset = session.offsetDelta = {\n\t x: center.x,\n\t y: center.y\n\t };\n\t }\n\t\n\t input.deltaX = prevDelta.x + (center.x - offset.x);\n\t input.deltaY = prevDelta.y + (center.y - offset.y);\n\t}\n\t\n\t/**\n\t * velocity is calculated every x ms\n\t * @param {Object} session\n\t * @param {Object} input\n\t */\n\tfunction computeIntervalInputData(session, input) {\n\t var last = session.lastInterval || input,\n\t deltaTime = input.timeStamp - last.timeStamp,\n\t velocity, velocityX, velocityY, direction;\n\t\n\t if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n\t var deltaX = input.deltaX - last.deltaX;\n\t var deltaY = input.deltaY - last.deltaY;\n\t\n\t var v = getVelocity(deltaTime, deltaX, deltaY);\n\t velocityX = v.x;\n\t velocityY = v.y;\n\t velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n\t direction = getDirection(deltaX, deltaY);\n\t\n\t session.lastInterval = input;\n\t } else {\n\t // use latest velocity info if it doesn't overtake a minimum period\n\t velocity = last.velocity;\n\t velocityX = last.velocityX;\n\t velocityY = last.velocityY;\n\t direction = last.direction;\n\t }\n\t\n\t input.velocity = velocity;\n\t input.velocityX = velocityX;\n\t input.velocityY = velocityY;\n\t input.direction = direction;\n\t}\n\t\n\t/**\n\t * create a simple clone from the input used for storage of firstInput and firstMultiple\n\t * @param {Object} input\n\t * @returns {Object} clonedInputData\n\t */\n\tfunction simpleCloneInputData(input) {\n\t // make a simple copy of the pointers because we will get a reference if we don't\n\t // we only need clientXY for the calculations\n\t var pointers = [];\n\t var i = 0;\n\t while (i < input.pointers.length) {\n\t pointers[i] = {\n\t clientX: round(input.pointers[i].clientX),\n\t clientY: round(input.pointers[i].clientY)\n\t };\n\t i++;\n\t }\n\t\n\t return {\n\t timeStamp: now(),\n\t pointers: pointers,\n\t center: getCenter(pointers),\n\t deltaX: input.deltaX,\n\t deltaY: input.deltaY\n\t };\n\t}\n\t\n\t/**\n\t * get the center of all the pointers\n\t * @param {Array} pointers\n\t * @return {Object} center contains `x` and `y` properties\n\t */\n\tfunction getCenter(pointers) {\n\t var pointersLength = pointers.length;\n\t\n\t // no need to loop when only one touch\n\t if (pointersLength === 1) {\n\t return {\n\t x: round(pointers[0].clientX),\n\t y: round(pointers[0].clientY)\n\t };\n\t }\n\t\n\t var x = 0, y = 0, i = 0;\n\t while (i < pointersLength) {\n\t x += pointers[i].clientX;\n\t y += pointers[i].clientY;\n\t i++;\n\t }\n\t\n\t return {\n\t x: round(x / pointersLength),\n\t y: round(y / pointersLength)\n\t };\n\t}\n\t\n\t/**\n\t * calculate the velocity between two points. unit is in px per ms.\n\t * @param {Number} deltaTime\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Object} velocity `x` and `y`\n\t */\n\tfunction getVelocity(deltaTime, x, y) {\n\t return {\n\t x: x / deltaTime || 0,\n\t y: y / deltaTime || 0\n\t };\n\t}\n\t\n\t/**\n\t * get the direction between two points\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Number} direction\n\t */\n\tfunction getDirection(x, y) {\n\t if (x === y) {\n\t return DIRECTION_NONE;\n\t }\n\t\n\t if (abs(x) >= abs(y)) {\n\t return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t }\n\t return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n\t}\n\t\n\t/**\n\t * calculate the absolute distance between two points\n\t * @param {Object} p1 {x, y}\n\t * @param {Object} p2 {x, y}\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} distance\n\t */\n\tfunction getDistance(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t\n\t return Math.sqrt((x * x) + (y * y));\n\t}\n\t\n\t/**\n\t * calculate the angle between two coordinates\n\t * @param {Object} p1\n\t * @param {Object} p2\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} angle\n\t */\n\tfunction getAngle(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t return Math.atan2(y, x) * 180 / Math.PI;\n\t}\n\t\n\t/**\n\t * calculate the rotation degrees between two pointersets\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} rotation\n\t */\n\tfunction getRotation(start, end) {\n\t return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n\t}\n\t\n\t/**\n\t * calculate the scale factor between two pointersets\n\t * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} scale\n\t */\n\tfunction getScale(start, end) {\n\t return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n\t}\n\t\n\tvar MOUSE_INPUT_MAP = {\n\t mousedown: INPUT_START,\n\t mousemove: INPUT_MOVE,\n\t mouseup: INPUT_END\n\t};\n\t\n\tvar MOUSE_ELEMENT_EVENTS = 'mousedown';\n\tvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\t\n\t/**\n\t * Mouse events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction MouseInput() {\n\t this.evEl = MOUSE_ELEMENT_EVENTS;\n\t this.evWin = MOUSE_WINDOW_EVENTS;\n\t\n\t this.allow = true; // used by Input.TouchMouse to disable mouse events\n\t this.pressed = false; // mousedown state\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(MouseInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function MEhandler(ev) {\n\t var eventType = MOUSE_INPUT_MAP[ev.type];\n\t\n\t // on start we want to have the left mouse button down\n\t if (eventType & INPUT_START && ev.button === 0) {\n\t this.pressed = true;\n\t }\n\t\n\t if (eventType & INPUT_MOVE && ev.which !== 1) {\n\t eventType = INPUT_END;\n\t }\n\t\n\t // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n\t if (!this.pressed || !this.allow) {\n\t return;\n\t }\n\t\n\t if (eventType & INPUT_END) {\n\t this.pressed = false;\n\t }\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: [ev],\n\t changedPointers: [ev],\n\t pointerType: INPUT_TYPE_MOUSE,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\tvar POINTER_INPUT_MAP = {\n\t pointerdown: INPUT_START,\n\t pointermove: INPUT_MOVE,\n\t pointerup: INPUT_END,\n\t pointercancel: INPUT_CANCEL,\n\t pointerout: INPUT_CANCEL\n\t};\n\t\n\t// in IE10 the pointer types is defined as an enum\n\tvar IE10_POINTER_TYPE_ENUM = {\n\t 2: INPUT_TYPE_TOUCH,\n\t 3: INPUT_TYPE_PEN,\n\t 4: INPUT_TYPE_MOUSE,\n\t 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\t};\n\t\n\tvar POINTER_ELEMENT_EVENTS = 'pointerdown';\n\tvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\t\n\t// IE10 has prefixed support, and case-sensitive\n\tif (window.MSPointerEvent && !window.PointerEvent) {\n\t POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n\t POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n\t}\n\t\n\t/**\n\t * Pointer events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction PointerEventInput() {\n\t this.evEl = POINTER_ELEMENT_EVENTS;\n\t this.evWin = POINTER_WINDOW_EVENTS;\n\t\n\t Input.apply(this, arguments);\n\t\n\t this.store = (this.manager.session.pointerEvents = []);\n\t}\n\t\n\tinherit(PointerEventInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function PEhandler(ev) {\n\t var store = this.store;\n\t var removePointer = false;\n\t\n\t var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n\t var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n\t var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\t\n\t var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\t\n\t // get index of the event in the store\n\t var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\t\n\t // start and mouse must be down\n\t if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n\t if (storeIndex < 0) {\n\t store.push(ev);\n\t storeIndex = store.length - 1;\n\t }\n\t } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n\t removePointer = true;\n\t }\n\t\n\t // it not found, so the pointer hasn't been down (so it's probably a hover)\n\t if (storeIndex < 0) {\n\t return;\n\t }\n\t\n\t // update the event in the store\n\t store[storeIndex] = ev;\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: store,\n\t changedPointers: [ev],\n\t pointerType: pointerType,\n\t srcEvent: ev\n\t });\n\t\n\t if (removePointer) {\n\t // remove from the store\n\t store.splice(storeIndex, 1);\n\t }\n\t }\n\t});\n\t\n\tvar SINGLE_TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n\tvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction SingleTouchInput() {\n\t this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n\t this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n\t this.started = false;\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(SingleTouchInput, Input, {\n\t handler: function TEhandler(ev) {\n\t var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\t\n\t // should we handle the touch events?\n\t if (type === INPUT_START) {\n\t this.started = true;\n\t }\n\t\n\t if (!this.started) {\n\t return;\n\t }\n\t\n\t var touches = normalizeSingleTouches.call(this, ev, type);\n\t\n\t // when done, reset the started state\n\t if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n\t this.started = false;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction normalizeSingleTouches(ev, type) {\n\t var all = toArray(ev.touches);\n\t var changed = toArray(ev.changedTouches);\n\t\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t all = uniqueArray(all.concat(changed), 'identifier', true);\n\t }\n\t\n\t return [all, changed];\n\t}\n\t\n\tvar TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Multi-user touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchInput() {\n\t this.evTarget = TOUCH_TARGET_EVENTS;\n\t this.targetIds = {};\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(TouchInput, Input, {\n\t handler: function MTEhandler(ev) {\n\t var type = TOUCH_INPUT_MAP[ev.type];\n\t var touches = getTouches.call(this, ev, type);\n\t if (!touches) {\n\t return;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction getTouches(ev, type) {\n\t var allTouches = toArray(ev.touches);\n\t var targetIds = this.targetIds;\n\t\n\t // when there is only one touch, the process can be simplified\n\t if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n\t targetIds[allTouches[0].identifier] = true;\n\t return [allTouches, allTouches];\n\t }\n\t\n\t var i,\n\t targetTouches,\n\t changedTouches = toArray(ev.changedTouches),\n\t changedTargetTouches = [],\n\t target = this.target;\n\t\n\t // get target touches from touches\n\t targetTouches = allTouches.filter(function(touch) {\n\t return hasParent(touch.target, target);\n\t });\n\t\n\t // collect touches\n\t if (type === INPUT_START) {\n\t i = 0;\n\t while (i < targetTouches.length) {\n\t targetIds[targetTouches[i].identifier] = true;\n\t i++;\n\t }\n\t }\n\t\n\t // filter changed touches to only contain touches that exist in the collected target ids\n\t i = 0;\n\t while (i < changedTouches.length) {\n\t if (targetIds[changedTouches[i].identifier]) {\n\t changedTargetTouches.push(changedTouches[i]);\n\t }\n\t\n\t // cleanup removed touches\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t delete targetIds[changedTouches[i].identifier];\n\t }\n\t i++;\n\t }\n\t\n\t if (!changedTargetTouches.length) {\n\t return;\n\t }\n\t\n\t return [\n\t // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n\t uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n\t changedTargetTouches\n\t ];\n\t}\n\t\n\t/**\n\t * Combined touch and mouse input\n\t *\n\t * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n\t * This because touch devices also emit mouse events while doing a touch.\n\t *\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchMouseInput() {\n\t Input.apply(this, arguments);\n\t\n\t var handler = bindFn(this.handler, this);\n\t this.touch = new TouchInput(this.manager, handler);\n\t this.mouse = new MouseInput(this.manager, handler);\n\t}\n\t\n\tinherit(TouchMouseInput, Input, {\n\t /**\n\t * handle mouse and touch events\n\t * @param {Hammer} manager\n\t * @param {String} inputEvent\n\t * @param {Object} inputData\n\t */\n\t handler: function TMEhandler(manager, inputEvent, inputData) {\n\t var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n\t isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\t\n\t // when we're in a touch event, so block all upcoming mouse events\n\t // most mobile browser also emit mouseevents, right after touchstart\n\t if (isTouch) {\n\t this.mouse.allow = false;\n\t } else if (isMouse && !this.mouse.allow) {\n\t return;\n\t }\n\t\n\t // reset the allowMouse when we're done\n\t if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n\t this.mouse.allow = true;\n\t }\n\t\n\t this.callback(manager, inputEvent, inputData);\n\t },\n\t\n\t /**\n\t * remove the event listeners\n\t */\n\t destroy: function destroy() {\n\t this.touch.destroy();\n\t this.mouse.destroy();\n\t }\n\t});\n\t\n\tvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n\tvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\t\n\t// magical touchAction value\n\tvar TOUCH_ACTION_COMPUTE = 'compute';\n\tvar TOUCH_ACTION_AUTO = 'auto';\n\tvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\tvar TOUCH_ACTION_NONE = 'none';\n\tvar TOUCH_ACTION_PAN_X = 'pan-x';\n\tvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\t\n\t/**\n\t * Touch Action\n\t * sets the touchAction property or uses the js alternative\n\t * @param {Manager} manager\n\t * @param {String} value\n\t * @constructor\n\t */\n\tfunction TouchAction(manager, value) {\n\t this.manager = manager;\n\t this.set(value);\n\t}\n\t\n\tTouchAction.prototype = {\n\t /**\n\t * set the touchAction value on the element or enable the polyfill\n\t * @param {String} value\n\t */\n\t set: function(value) {\n\t // find out the touch-action by the event handlers\n\t if (value == TOUCH_ACTION_COMPUTE) {\n\t value = this.compute();\n\t }\n\t\n\t if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n\t this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n\t }\n\t this.actions = value.toLowerCase().trim();\n\t },\n\t\n\t /**\n\t * just re-set the touchAction value\n\t */\n\t update: function() {\n\t this.set(this.manager.options.touchAction);\n\t },\n\t\n\t /**\n\t * compute the value for the touchAction property based on the recognizer's settings\n\t * @returns {String} value\n\t */\n\t compute: function() {\n\t var actions = [];\n\t each(this.manager.recognizers, function(recognizer) {\n\t if (boolOrFn(recognizer.options.enable, [recognizer])) {\n\t actions = actions.concat(recognizer.getTouchAction());\n\t }\n\t });\n\t return cleanTouchActions(actions.join(' '));\n\t },\n\t\n\t /**\n\t * this method is called on each input cycle and provides the preventing of the browser behavior\n\t * @param {Object} input\n\t */\n\t preventDefaults: function(input) {\n\t // not needed with native support for the touchAction property\n\t if (NATIVE_TOUCH_ACTION) {\n\t return;\n\t }\n\t\n\t var srcEvent = input.srcEvent;\n\t var direction = input.offsetDirection;\n\t\n\t // if the touch action did prevented once this session\n\t if (this.manager.session.prevented) {\n\t srcEvent.preventDefault();\n\t return;\n\t }\n\t\n\t var actions = this.actions;\n\t var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t\n\t if (hasNone) {\n\t //do not prevent defaults if this is a tap gesture\n\t\n\t var isTapPointer = input.pointers.length === 1;\n\t var isTapMovement = input.distance < 2;\n\t var isTapTouchTime = input.deltaTime < 250;\n\t\n\t if (isTapPointer && isTapMovement && isTapTouchTime) {\n\t return;\n\t }\n\t }\n\t\n\t if (hasPanX && hasPanY) {\n\t // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n\t return;\n\t }\n\t\n\t if (hasNone ||\n\t (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n\t (hasPanX && direction & DIRECTION_VERTICAL)) {\n\t return this.preventSrc(srcEvent);\n\t }\n\t },\n\t\n\t /**\n\t * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n\t * @param {Object} srcEvent\n\t */\n\t preventSrc: function(srcEvent) {\n\t this.manager.session.prevented = true;\n\t srcEvent.preventDefault();\n\t }\n\t};\n\t\n\t/**\n\t * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n\t * @param {String} actions\n\t * @returns {*}\n\t */\n\tfunction cleanTouchActions(actions) {\n\t // none\n\t if (inStr(actions, TOUCH_ACTION_NONE)) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t\n\t // if both pan-x and pan-y are set (different recognizers\n\t // for different directions, e.g. horizontal pan but vertical swipe?)\n\t // we need none (as otherwise with pan-x pan-y combined none of these\n\t // recognizers will work, since the browser would handle all panning\n\t if (hasPanX && hasPanY) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t // pan-x OR pan-y\n\t if (hasPanX || hasPanY) {\n\t return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n\t }\n\t\n\t // manipulation\n\t if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n\t return TOUCH_ACTION_MANIPULATION;\n\t }\n\t\n\t return TOUCH_ACTION_AUTO;\n\t}\n\t\n\t/**\n\t * Recognizer flow explained; *\n\t * All recognizers have the initial state of POSSIBLE when a input session starts.\n\t * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n\t * Example session for mouse-input: mousedown -> mousemove -> mouseup\n\t *\n\t * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n\t * which determines with state it should be.\n\t *\n\t * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n\t * POSSIBLE to give it another change on the next cycle.\n\t *\n\t * Possible\n\t * |\n\t * +-----+---------------+\n\t * | |\n\t * +-----+-----+ |\n\t * | | |\n\t * Failed Cancelled |\n\t * +-------+------+\n\t * | |\n\t * Recognized Began\n\t * |\n\t * Changed\n\t * |\n\t * Ended/Recognized\n\t */\n\tvar STATE_POSSIBLE = 1;\n\tvar STATE_BEGAN = 2;\n\tvar STATE_CHANGED = 4;\n\tvar STATE_ENDED = 8;\n\tvar STATE_RECOGNIZED = STATE_ENDED;\n\tvar STATE_CANCELLED = 16;\n\tvar STATE_FAILED = 32;\n\t\n\t/**\n\t * Recognizer\n\t * Every recognizer needs to extend from this class.\n\t * @constructor\n\t * @param {Object} options\n\t */\n\tfunction Recognizer(options) {\n\t this.options = assign({}, this.defaults, options || {});\n\t\n\t this.id = uniqueId();\n\t\n\t this.manager = null;\n\t\n\t // default is enable true\n\t this.options.enable = ifUndefined(this.options.enable, true);\n\t\n\t this.state = STATE_POSSIBLE;\n\t\n\t this.simultaneous = {};\n\t this.requireFail = [];\n\t}\n\t\n\tRecognizer.prototype = {\n\t /**\n\t * @virtual\n\t * @type {Object}\n\t */\n\t defaults: {},\n\t\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @return {Recognizer}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // also update the touchAction, in case something changed about the directions/enabled state\n\t this.manager && this.manager.touchAction.update();\n\t return this;\n\t },\n\t\n\t /**\n\t * recognize simultaneous with an other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t recognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t var simultaneous = this.simultaneous;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (!simultaneous[otherRecognizer.id]) {\n\t simultaneous[otherRecognizer.id] = otherRecognizer;\n\t otherRecognizer.recognizeWith(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRecognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t delete this.simultaneous[otherRecognizer.id];\n\t return this;\n\t },\n\t\n\t /**\n\t * recognizer can only run when an other is failing\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t requireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n\t return this;\n\t }\n\t\n\t var requireFail = this.requireFail;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (inArray(requireFail, otherRecognizer) === -1) {\n\t requireFail.push(otherRecognizer);\n\t otherRecognizer.requireFailure(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the requireFailure link. it does not remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRequireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t var index = inArray(this.requireFail, otherRecognizer);\n\t if (index > -1) {\n\t this.requireFail.splice(index, 1);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * has require failures boolean\n\t * @returns {boolean}\n\t */\n\t hasRequireFailures: function() {\n\t return this.requireFail.length > 0;\n\t },\n\t\n\t /**\n\t * if the recognizer can recognize simultaneous with an other recognizer\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Boolean}\n\t */\n\t canRecognizeWith: function(otherRecognizer) {\n\t return !!this.simultaneous[otherRecognizer.id];\n\t },\n\t\n\t /**\n\t * You should use `tryEmit` instead of `emit` directly to check\n\t * that all the needed recognizers has failed before emitting.\n\t * @param {Object} input\n\t */\n\t emit: function(input) {\n\t var self = this;\n\t var state = this.state;\n\t\n\t function emit(event) {\n\t self.manager.emit(event, input);\n\t }\n\t\n\t // 'panstart' and 'panmove'\n\t if (state < STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t\n\t emit(self.options.event); // simple 'eventName' events\n\t\n\t if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n\t emit(input.additionalEvent);\n\t }\n\t\n\t // panend and pancancel\n\t if (state >= STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t },\n\t\n\t /**\n\t * Check that all the require failure recognizers has failed,\n\t * if true, it emits a gesture event,\n\t * otherwise, setup the state to FAILED.\n\t * @param {Object} input\n\t */\n\t tryEmit: function(input) {\n\t if (this.canEmit()) {\n\t return this.emit(input);\n\t }\n\t // it's failing anyway\n\t this.state = STATE_FAILED;\n\t },\n\t\n\t /**\n\t * can we emit?\n\t * @returns {boolean}\n\t */\n\t canEmit: function() {\n\t var i = 0;\n\t while (i < this.requireFail.length) {\n\t if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n\t return false;\n\t }\n\t i++;\n\t }\n\t return true;\n\t },\n\t\n\t /**\n\t * update the recognizer\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t // make a new copy of the inputData\n\t // so we can change the inputData without messing up the other recognizers\n\t var inputDataClone = assign({}, inputData);\n\t\n\t // is is enabled and allow recognizing?\n\t if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n\t this.reset();\n\t this.state = STATE_FAILED;\n\t return;\n\t }\n\t\n\t // reset when we've reached the end\n\t if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n\t this.state = STATE_POSSIBLE;\n\t }\n\t\n\t this.state = this.process(inputDataClone);\n\t\n\t // the recognizer has recognized a gesture\n\t // so trigger an event\n\t if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n\t this.tryEmit(inputDataClone);\n\t }\n\t },\n\t\n\t /**\n\t * return the state of the recognizer\n\t * the actual recognizing happens in this method\n\t * @virtual\n\t * @param {Object} inputData\n\t * @returns {Const} STATE\n\t */\n\t process: function(inputData) { }, // jshint ignore:line\n\t\n\t /**\n\t * return the preferred touch-action\n\t * @virtual\n\t * @returns {Array}\n\t */\n\t getTouchAction: function() { },\n\t\n\t /**\n\t * called when the gesture isn't allowed to recognize\n\t * like when another is being recognized or it is disabled\n\t * @virtual\n\t */\n\t reset: function() { }\n\t};\n\t\n\t/**\n\t * get a usable string, used as event postfix\n\t * @param {Const} state\n\t * @returns {String} state\n\t */\n\tfunction stateStr(state) {\n\t if (state & STATE_CANCELLED) {\n\t return 'cancel';\n\t } else if (state & STATE_ENDED) {\n\t return 'end';\n\t } else if (state & STATE_CHANGED) {\n\t return 'move';\n\t } else if (state & STATE_BEGAN) {\n\t return 'start';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * direction cons to string\n\t * @param {Const} direction\n\t * @returns {String}\n\t */\n\tfunction directionStr(direction) {\n\t if (direction == DIRECTION_DOWN) {\n\t return 'down';\n\t } else if (direction == DIRECTION_UP) {\n\t return 'up';\n\t } else if (direction == DIRECTION_LEFT) {\n\t return 'left';\n\t } else if (direction == DIRECTION_RIGHT) {\n\t return 'right';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * get a recognizer by name if it is bound to a manager\n\t * @param {Recognizer|String} otherRecognizer\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer}\n\t */\n\tfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n\t var manager = recognizer.manager;\n\t if (manager) {\n\t return manager.get(otherRecognizer);\n\t }\n\t return otherRecognizer;\n\t}\n\t\n\t/**\n\t * This recognizer is just used as a base for the simple attribute recognizers.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction AttrRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(AttrRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof AttrRecognizer\n\t */\n\t defaults: {\n\t /**\n\t * @type {Number}\n\t * @default 1\n\t */\n\t pointers: 1\n\t },\n\t\n\t /**\n\t * Used to check if it the recognizer receives valid input, like input.distance > 10.\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {Boolean} recognized\n\t */\n\t attrTest: function(input) {\n\t var optionPointers = this.options.pointers;\n\t return optionPointers === 0 || input.pointers.length === optionPointers;\n\t },\n\t\n\t /**\n\t * Process the input and return the state for the recognizer\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {*} State\n\t */\n\t process: function(input) {\n\t var state = this.state;\n\t var eventType = input.eventType;\n\t\n\t var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n\t var isValid = this.attrTest(input);\n\t\n\t // on cancel input and we've recognized before, return STATE_CANCELLED\n\t if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n\t return state | STATE_CANCELLED;\n\t } else if (isRecognized || isValid) {\n\t if (eventType & INPUT_END) {\n\t return state | STATE_ENDED;\n\t } else if (!(state & STATE_BEGAN)) {\n\t return STATE_BEGAN;\n\t }\n\t return state | STATE_CHANGED;\n\t }\n\t return STATE_FAILED;\n\t }\n\t});\n\t\n\t/**\n\t * Pan\n\t * Recognized when the pointer is down and moved in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PanRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t\n\t this.pX = null;\n\t this.pY = null;\n\t}\n\t\n\tinherit(PanRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PanRecognizer\n\t */\n\t defaults: {\n\t event: 'pan',\n\t threshold: 10,\n\t pointers: 1,\n\t direction: DIRECTION_ALL\n\t },\n\t\n\t getTouchAction: function() {\n\t var direction = this.options.direction;\n\t var actions = [];\n\t if (direction & DIRECTION_HORIZONTAL) {\n\t actions.push(TOUCH_ACTION_PAN_Y);\n\t }\n\t if (direction & DIRECTION_VERTICAL) {\n\t actions.push(TOUCH_ACTION_PAN_X);\n\t }\n\t return actions;\n\t },\n\t\n\t directionTest: function(input) {\n\t var options = this.options;\n\t var hasMoved = true;\n\t var distance = input.distance;\n\t var direction = input.direction;\n\t var x = input.deltaX;\n\t var y = input.deltaY;\n\t\n\t // lock to axis?\n\t if (!(direction & options.direction)) {\n\t if (options.direction & DIRECTION_HORIZONTAL) {\n\t direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t hasMoved = x != this.pX;\n\t distance = Math.abs(input.deltaX);\n\t } else {\n\t direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n\t hasMoved = y != this.pY;\n\t distance = Math.abs(input.deltaY);\n\t }\n\t }\n\t input.direction = direction;\n\t return hasMoved && distance > options.threshold && direction & options.direction;\n\t },\n\t\n\t attrTest: function(input) {\n\t return AttrRecognizer.prototype.attrTest.call(this, input) &&\n\t (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n\t },\n\t\n\t emit: function(input) {\n\t\n\t this.pX = input.deltaX;\n\t this.pY = input.deltaY;\n\t\n\t var direction = directionStr(input.direction);\n\t\n\t if (direction) {\n\t input.additionalEvent = this.options.event + direction;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Pinch\n\t * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PinchRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(PinchRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'pinch',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n\t },\n\t\n\t emit: function(input) {\n\t if (input.scale !== 1) {\n\t var inOut = input.scale < 1 ? 'in' : 'out';\n\t input.additionalEvent = this.options.event + inOut;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Press\n\t * Recognized when the pointer is down for x ms without any movement.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction PressRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t this._timer = null;\n\t this._input = null;\n\t}\n\t\n\tinherit(PressRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PressRecognizer\n\t */\n\t defaults: {\n\t event: 'press',\n\t pointers: 1,\n\t time: 251, // minimal time of the pointer to be pressed\n\t threshold: 9 // a minimal movement is ok, but keep it low\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_AUTO];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTime = input.deltaTime > options.time;\n\t\n\t this._input = input;\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n\t this.reset();\n\t } else if (input.eventType & INPUT_START) {\n\t this.reset();\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.time, this);\n\t } else if (input.eventType & INPUT_END) {\n\t return STATE_RECOGNIZED;\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function(input) {\n\t if (this.state !== STATE_RECOGNIZED) {\n\t return;\n\t }\n\t\n\t if (input && (input.eventType & INPUT_END)) {\n\t this.manager.emit(this.options.event + 'up', input);\n\t } else {\n\t this._input.timeStamp = now();\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Rotate\n\t * Recognized when two or more pointer are moving in a circular motion.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction RotateRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(RotateRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof RotateRecognizer\n\t */\n\t defaults: {\n\t event: 'rotate',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n\t }\n\t});\n\t\n\t/**\n\t * Swipe\n\t * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction SwipeRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(SwipeRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof SwipeRecognizer\n\t */\n\t defaults: {\n\t event: 'swipe',\n\t threshold: 10,\n\t velocity: 0.3,\n\t direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n\t pointers: 1\n\t },\n\t\n\t getTouchAction: function() {\n\t return PanRecognizer.prototype.getTouchAction.call(this);\n\t },\n\t\n\t attrTest: function(input) {\n\t var direction = this.options.direction;\n\t var velocity;\n\t\n\t if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n\t velocity = input.overallVelocity;\n\t } else if (direction & DIRECTION_HORIZONTAL) {\n\t velocity = input.overallVelocityX;\n\t } else if (direction & DIRECTION_VERTICAL) {\n\t velocity = input.overallVelocityY;\n\t }\n\t\n\t return this._super.attrTest.call(this, input) &&\n\t direction & input.offsetDirection &&\n\t input.distance > this.options.threshold &&\n\t input.maxPointers == this.options.pointers &&\n\t abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n\t },\n\t\n\t emit: function(input) {\n\t var direction = directionStr(input.offsetDirection);\n\t if (direction) {\n\t this.manager.emit(this.options.event + direction, input);\n\t }\n\t\n\t this.manager.emit(this.options.event, input);\n\t }\n\t});\n\t\n\t/**\n\t * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n\t * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n\t * a single tap.\n\t *\n\t * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n\t * multi-taps being recognized.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction TapRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t // previous time and center,\n\t // used for tap counting\n\t this.pTime = false;\n\t this.pCenter = false;\n\t\n\t this._timer = null;\n\t this._input = null;\n\t this.count = 0;\n\t}\n\t\n\tinherit(TapRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'tap',\n\t pointers: 1,\n\t taps: 1,\n\t interval: 300, // max time between the multi-tap taps\n\t time: 250, // max time of the pointer to be down (like finger on the screen)\n\t threshold: 9, // a minimal movement is ok, but keep it low\n\t posThreshold: 10 // a multi-tap can be a bit off the initial position\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_MANIPULATION];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTouchTime = input.deltaTime < options.time;\n\t\n\t this.reset();\n\t\n\t if ((input.eventType & INPUT_START) && (this.count === 0)) {\n\t return this.failTimeout();\n\t }\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (validMovement && validTouchTime && validPointers) {\n\t if (input.eventType != INPUT_END) {\n\t return this.failTimeout();\n\t }\n\t\n\t var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n\t var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\t\n\t this.pTime = input.timeStamp;\n\t this.pCenter = input.center;\n\t\n\t if (!validMultiTap || !validInterval) {\n\t this.count = 1;\n\t } else {\n\t this.count += 1;\n\t }\n\t\n\t this._input = input;\n\t\n\t // if tap count matches we have recognized it,\n\t // else it has began recognizing...\n\t var tapCount = this.count % options.taps;\n\t if (tapCount === 0) {\n\t // no failing requirements, immediately trigger the tap event\n\t // or wait as long as the multitap interval to trigger\n\t if (!this.hasRequireFailures()) {\n\t return STATE_RECOGNIZED;\n\t } else {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.interval, this);\n\t return STATE_BEGAN;\n\t }\n\t }\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t failTimeout: function() {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_FAILED;\n\t }, this.options.interval, this);\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function() {\n\t if (this.state == STATE_RECOGNIZED) {\n\t this._input.tapCount = this.count;\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Simple way to create a manager with a default set of recognizers.\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Hammer(element, options) {\n\t options = options || {};\n\t options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n\t return new Manager(element, options);\n\t}\n\t\n\t/**\n\t * @const {string}\n\t */\n\tHammer.VERSION = '2.0.6';\n\t\n\t/**\n\t * default settings\n\t * @namespace\n\t */\n\tHammer.defaults = {\n\t /**\n\t * set if DOM events are being triggered.\n\t * But this is slower and unused by simple implementations, so disabled by default.\n\t * @type {Boolean}\n\t * @default false\n\t */\n\t domEvents: false,\n\t\n\t /**\n\t * The value for the touchAction property/fallback.\n\t * When set to `compute` it will magically set the correct value based on the added recognizers.\n\t * @type {String}\n\t * @default compute\n\t */\n\t touchAction: TOUCH_ACTION_COMPUTE,\n\t\n\t /**\n\t * @type {Boolean}\n\t * @default true\n\t */\n\t enable: true,\n\t\n\t /**\n\t * EXPERIMENTAL FEATURE -- can be removed/changed\n\t * Change the parent input target element.\n\t * If Null, then it is being set the to main element.\n\t * @type {Null|EventTarget}\n\t * @default null\n\t */\n\t inputTarget: null,\n\t\n\t /**\n\t * force an input class\n\t * @type {Null|Function}\n\t * @default null\n\t */\n\t inputClass: null,\n\t\n\t /**\n\t * Default recognizer setup when calling `Hammer()`\n\t * When creating a new Manager these will be skipped.\n\t * @type {Array}\n\t */\n\t preset: [\n\t // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n\t [RotateRecognizer, {enable: false}],\n\t [PinchRecognizer, {enable: false}, ['rotate']],\n\t [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n\t [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n\t [TapRecognizer],\n\t [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n\t [PressRecognizer]\n\t ],\n\t\n\t /**\n\t * Some CSS properties can be used to improve the working of Hammer.\n\t * Add them to this method and they will be set when creating a new Manager.\n\t * @namespace\n\t */\n\t cssProps: {\n\t /**\n\t * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userSelect: 'none',\n\t\n\t /**\n\t * Disable the Windows Phone grippers when pressing an element.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchSelect: 'none',\n\t\n\t /**\n\t * Disables the default callout shown when you touch and hold a touch target.\n\t * On iOS, when you touch and hold a touch target such as a link, Safari displays\n\t * a callout containing information about the link. This property allows you to disable that callout.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchCallout: 'none',\n\t\n\t /**\n\t * Specifies whether zooming is enabled. Used by IE10>\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t contentZooming: 'none',\n\t\n\t /**\n\t * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userDrag: 'none',\n\t\n\t /**\n\t * Overrides the highlight color shown when the user taps a link or a JavaScript\n\t * clickable element in iOS. This property obeys the alpha value, if specified.\n\t * @type {String}\n\t * @default 'rgba(0,0,0,0)'\n\t */\n\t tapHighlightColor: 'rgba(0,0,0,0)'\n\t }\n\t};\n\t\n\tvar STOP = 1;\n\tvar FORCED_STOP = 2;\n\t\n\t/**\n\t * Manager\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Manager(element, options) {\n\t this.options = assign({}, Hammer.defaults, options || {});\n\t\n\t this.options.inputTarget = this.options.inputTarget || element;\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.recognizers = [];\n\t\n\t this.element = element;\n\t this.input = createInputInstance(this);\n\t this.touchAction = new TouchAction(this, this.options.touchAction);\n\t\n\t toggleCssProps(this, true);\n\t\n\t each(this.options.recognizers, function(item) {\n\t var recognizer = this.add(new (item[0])(item[1]));\n\t item[2] && recognizer.recognizeWith(item[2]);\n\t item[3] && recognizer.requireFailure(item[3]);\n\t }, this);\n\t}\n\t\n\tManager.prototype = {\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @returns {Manager}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // Options that need a little more setup\n\t if (options.touchAction) {\n\t this.touchAction.update();\n\t }\n\t if (options.inputTarget) {\n\t // Clean up existing event listeners and reinitialize\n\t this.input.destroy();\n\t this.input.target = options.inputTarget;\n\t this.input.init();\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * stop recognizing for this session.\n\t * This session will be discarded, when a new [input]start event is fired.\n\t * When forced, the recognizer cycle is stopped immediately.\n\t * @param {Boolean} [force]\n\t */\n\t stop: function(force) {\n\t this.session.stopped = force ? FORCED_STOP : STOP;\n\t },\n\t\n\t /**\n\t * run the recognizers!\n\t * called by the inputHandler function on every movement of the pointers (touches)\n\t * it walks through all the recognizers and tries to detect the gesture that is being made\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t var session = this.session;\n\t if (session.stopped) {\n\t return;\n\t }\n\t\n\t // run the touch-action polyfill\n\t this.touchAction.preventDefaults(inputData);\n\t\n\t var recognizer;\n\t var recognizers = this.recognizers;\n\t\n\t // this holds the recognizer that is being recognized.\n\t // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n\t // if no recognizer is detecting a thing, it is set to `null`\n\t var curRecognizer = session.curRecognizer;\n\t\n\t // reset when the last recognizer is recognized\n\t // or when we're in a new session\n\t if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n\t curRecognizer = session.curRecognizer = null;\n\t }\n\t\n\t var i = 0;\n\t while (i < recognizers.length) {\n\t recognizer = recognizers[i];\n\t\n\t // find out if we are allowed try to recognize the input for this one.\n\t // 1. allow if the session is NOT forced stopped (see the .stop() method)\n\t // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n\t // that is being recognized.\n\t // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n\t // this can be setup with the `recognizeWith()` method on the recognizer.\n\t if (session.stopped !== FORCED_STOP && ( // 1\n\t !curRecognizer || recognizer == curRecognizer || // 2\n\t recognizer.canRecognizeWith(curRecognizer))) { // 3\n\t recognizer.recognize(inputData);\n\t } else {\n\t recognizer.reset();\n\t }\n\t\n\t // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n\t // current active recognizer. but only if we don't already have an active recognizer\n\t if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n\t curRecognizer = session.curRecognizer = recognizer;\n\t }\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * get a recognizer by its event name.\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Recognizer|Null}\n\t */\n\t get: function(recognizer) {\n\t if (recognizer instanceof Recognizer) {\n\t return recognizer;\n\t }\n\t\n\t var recognizers = this.recognizers;\n\t for (var i = 0; i < recognizers.length; i++) {\n\t if (recognizers[i].options.event == recognizer) {\n\t return recognizers[i];\n\t }\n\t }\n\t return null;\n\t },\n\t\n\t /**\n\t * add a recognizer to the manager\n\t * existing recognizers with the same event name will be removed\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer|Manager}\n\t */\n\t add: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'add', this)) {\n\t return this;\n\t }\n\t\n\t // remove existing\n\t var existing = this.get(recognizer.options.event);\n\t if (existing) {\n\t this.remove(existing);\n\t }\n\t\n\t this.recognizers.push(recognizer);\n\t recognizer.manager = this;\n\t\n\t this.touchAction.update();\n\t return recognizer;\n\t },\n\t\n\t /**\n\t * remove a recognizer by name or instance\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Manager}\n\t */\n\t remove: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'remove', this)) {\n\t return this;\n\t }\n\t\n\t recognizer = this.get(recognizer);\n\t\n\t // let's make sure this recognizer exists\n\t if (recognizer) {\n\t var recognizers = this.recognizers;\n\t var index = inArray(recognizers, recognizer);\n\t\n\t if (index !== -1) {\n\t recognizers.splice(index, 1);\n\t this.touchAction.update();\n\t }\n\t }\n\t\n\t return this;\n\t },\n\t\n\t /**\n\t * bind event\n\t * @param {String} events\n\t * @param {Function} handler\n\t * @returns {EventEmitter} this\n\t */\n\t on: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t handlers[event] = handlers[event] || [];\n\t handlers[event].push(handler);\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * unbind event, leave emit blank to remove all handlers\n\t * @param {String} events\n\t * @param {Function} [handler]\n\t * @returns {EventEmitter} this\n\t */\n\t off: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t if (!handler) {\n\t delete handlers[event];\n\t } else {\n\t handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * emit event to the listeners\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\t emit: function(event, data) {\n\t // we also want to trigger dom events\n\t if (this.options.domEvents) {\n\t triggerDomEvent(event, data);\n\t }\n\t\n\t // no handlers, so skip it all\n\t var handlers = this.handlers[event] && this.handlers[event].slice();\n\t if (!handlers || !handlers.length) {\n\t return;\n\t }\n\t\n\t data.type = event;\n\t data.preventDefault = function() {\n\t data.srcEvent.preventDefault();\n\t };\n\t\n\t var i = 0;\n\t while (i < handlers.length) {\n\t handlers[i](data);\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * destroy the manager and unbinds all events\n\t * it doesn't unbind dom events, that is the user own responsibility\n\t */\n\t destroy: function() {\n\t this.element && toggleCssProps(this, false);\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.input.destroy();\n\t this.element = null;\n\t }\n\t};\n\t\n\t/**\n\t * add/remove the css properties as defined in manager.options.cssProps\n\t * @param {Manager} manager\n\t * @param {Boolean} add\n\t */\n\tfunction toggleCssProps(manager, add) {\n\t var element = manager.element;\n\t if (!element.style) {\n\t return;\n\t }\n\t each(manager.options.cssProps, function(value, name) {\n\t element.style[prefixed(element.style, name)] = add ? value : '';\n\t });\n\t}\n\t\n\t/**\n\t * trigger dom event\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\tfunction triggerDomEvent(event, data) {\n\t var gestureEvent = document.createEvent('Event');\n\t gestureEvent.initEvent(event, true, true);\n\t gestureEvent.gesture = data;\n\t data.target.dispatchEvent(gestureEvent);\n\t}\n\t\n\tassign(Hammer, {\n\t INPUT_START: INPUT_START,\n\t INPUT_MOVE: INPUT_MOVE,\n\t INPUT_END: INPUT_END,\n\t INPUT_CANCEL: INPUT_CANCEL,\n\t\n\t STATE_POSSIBLE: STATE_POSSIBLE,\n\t STATE_BEGAN: STATE_BEGAN,\n\t STATE_CHANGED: STATE_CHANGED,\n\t STATE_ENDED: STATE_ENDED,\n\t STATE_RECOGNIZED: STATE_RECOGNIZED,\n\t STATE_CANCELLED: STATE_CANCELLED,\n\t STATE_FAILED: STATE_FAILED,\n\t\n\t DIRECTION_NONE: DIRECTION_NONE,\n\t DIRECTION_LEFT: DIRECTION_LEFT,\n\t DIRECTION_RIGHT: DIRECTION_RIGHT,\n\t DIRECTION_UP: DIRECTION_UP,\n\t DIRECTION_DOWN: DIRECTION_DOWN,\n\t DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n\t DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n\t DIRECTION_ALL: DIRECTION_ALL,\n\t\n\t Manager: Manager,\n\t Input: Input,\n\t TouchAction: TouchAction,\n\t\n\t TouchInput: TouchInput,\n\t MouseInput: MouseInput,\n\t PointerEventInput: PointerEventInput,\n\t TouchMouseInput: TouchMouseInput,\n\t SingleTouchInput: SingleTouchInput,\n\t\n\t Recognizer: Recognizer,\n\t AttrRecognizer: AttrRecognizer,\n\t Tap: TapRecognizer,\n\t Pan: PanRecognizer,\n\t Swipe: SwipeRecognizer,\n\t Pinch: PinchRecognizer,\n\t Rotate: RotateRecognizer,\n\t Press: PressRecognizer,\n\t\n\t on: addEventListeners,\n\t off: removeEventListeners,\n\t each: each,\n\t merge: merge,\n\t extend: extend,\n\t assign: assign,\n\t inherit: inherit,\n\t bindFn: bindFn,\n\t prefixed: prefixed\n\t});\n\t\n\t// this prevents errors when Hammer is loaded in the presence of an AMD\n\t// style loader but by script tag, not by the loader.\n\tvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\n\tfreeGlobal.Hammer = Hammer;\n\t\n\tif (true) {\n\t !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t return Hammer;\n\t }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else if (typeof module != 'undefined' && module.exports) {\n\t module.exports = Hammer;\n\t} else {\n\t window[exportName] = Hammer;\n\t}\n\t\n\t})(window, document, 'Hammer');\n\n\n/***/ },\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(47);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _ImageTile = __webpack_require__(57);\n\t\n\tvar _ImageTile2 = _interopRequireDefault(_ImageTile);\n\t\n\tvar _ImageTileLayerBaseMaterial = __webpack_require__(60);\n\t\n\tvar _ImageTileLayerBaseMaterial2 = _interopRequireDefault(_ImageTileLayerBaseMaterial);\n\t\n\tvar _lodashThrottle = __webpack_require__(40);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n\t// being removed and the new tiles being ready for display\n\t//\n\t// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n\t// of the basemap ground so it blends in a little more, or have a huge ground\n\t// plane underneath all the tiles that shows through between tile updates.\n\t//\n\t// Could keep the old tiles around until the new ones are ready, though they'd\n\t// probably need to be layered in a way so the old tiles don't overlap new ones,\n\t// which is similar to how Leaflet approaches this (it has 2 layers)\n\t//\n\t// Could keep the tile from the previous quadtree level visible until all 4\n\t// tiles at the new / current level have finished loading and are displayed.\n\t// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n\t// child quadcodes showing whether they are loaded and in view. If all true then\n\t// remove the parent tile, otherwise keep it on a lower layer.\n\t\n\t// TODO: Load and display a base layer separate to the LOD grid that is at a low\n\t// resolution – used as a backup / background to fill in empty areas / distance\n\t\n\t// DONE: Fix the issue where some tiles just don't load, or at least the texture\n\t// never shows up – tends to happen if you quickly zoom in / out past it while\n\t// it's still loading, leaving a blank space\n\t\n\t// TODO: Optimise the request of many image tiles – look at how Leaflet and\n\t// OpenWebGlobe approach this (eg. batching, queues, etc)\n\t\n\t// TODO: Cancel pending tile requests if they get removed from view before they\n\t// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n\t// images are re-requested when the tile is next in scene (even if from cache)\n\t\n\t// TODO: Consider not performing an LOD calculation on every frame, instead only\n\t// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n\t// possible for performance to tank if you pan, orbit or zoom rapidly while all\n\t// the LOD calculations are being made and new tiles requested.\n\t//\n\t// Pending tiles should continue to be requested and output to the scene on each\n\t// frame, but no new LOD calculations should be made.\n\t\n\t// This tile layer both updates the quadtree and outputs tiles on every frame\n\t// (throttled to some amount)\n\t//\n\t// This is because the computational complexity of image tiles is generally low\n\t// and so there isn't much jank when running these calculations and outputs in\n\t// realtime\n\t//\n\t// The benefit to doing this is that the underlying map layer continues to\n\t// refresh and update during movement, which is an arguably better experience\n\t\n\tvar ImageTileLayer = (function (_TileLayer) {\n\t _inherits(ImageTileLayer, _TileLayer);\n\t\n\t function ImageTileLayer(path, options) {\n\t _classCallCheck(this, ImageTileLayer);\n\t\n\t var defaults = {\n\t distance: 40000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(ImageTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Add base layer\n\t var geom = new _three2['default'].PlaneBufferGeometry(200000, 200000, 1);\n\t\n\t var baseMaterial;\n\t if (this._world._environment._skybox) {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n\t } else {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3');\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geom, baseMaterial);\n\t mesh.renderOrder = 0;\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t // TODO: It might be overkill to receive a shadow on the base layer as it's\n\t // rarely seen (good to have if performance difference is negligible)\n\t mesh.receiveShadow = true;\n\t\n\t this._baseLayer = mesh;\n\t this.add(mesh);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t this._calculateLOD();\n\t this._outputTiles();\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._moveBaseLayer(point);\n\t }\n\t }, {\n\t key: '_moveBaseLayer',\n\t value: function _moveBaseLayer(point) {\n\t this._baseLayer.position.x = point.x;\n\t this._baseLayer.position.z = point.y;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t return new _ImageTile2['default'](quadcode, this._path, layer);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Dispose of mesh and materials\n\t this._baseLayer.geometry.dispose();\n\t this._baseLayer.geometry = null;\n\t\n\t if (this._baseLayer.material.map) {\n\t this._baseLayer.material.map.dispose();\n\t this._baseLayer.material.map = null;\n\t }\n\t\n\t this._baseLayer.material.dispose();\n\t this._baseLayer.material = null;\n\t\n\t this._baseLayer = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return ImageTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = ImageTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new ImageTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTileLayer = noNew;\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _TileCache = __webpack_require__(48);\n\t\n\tvar _TileCache2 = _interopRequireDefault(_TileCache);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Consider removing picking from TileLayer instances as there aren't\n\t// (m)any situations where it would be practical\n\t//\n\t// For example, how would you even know what picking IDs to listen to and what\n\t// to do with them?\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider keeping a single TileLayer / LOD instance running by default\n\t// that keeps a standard LOD grid for other layers to utilise, rather than\n\t// having to create their own, unique LOD grid and duplicate calculations when\n\t// they're going to use the same grid setup anyway\n\t//\n\t// It still makes sense to be able to have a custom LOD grid for some layers as\n\t// they may want to customise things, maybe not even using a quadtree at all!\n\t//\n\t// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n\t// pass in the necessary parameters each time for the calculation step.\n\t//\n\t// Either way, it seems silly to force layers to have to create a new LOD grid\n\t// each time and create extra, duplicated processing every frame.\n\t\n\t// TODO: Allow passing in of options to define min/max LOD and a distance to use\n\t// for culling tiles beyond that distance.\n\t\n\t// DONE: Prevent tiles from being loaded if they are further than a certain\n\t// distance from the camera and are unlikely to be seen anyway\n\t\n\t// TODO: Avoid performing LOD calculation when it isn't required. For example,\n\t// when nothing has changed since the last frame and there are no tiles to be\n\t// loaded or in need of rendering\n\t\n\t// TODO: Only remove tiles from the layer that aren't to be rendered in the\n\t// current frame – it seems excessive to remove all tiles and re-add them on\n\t// every single frame, even if it's just array manipulation\n\t\n\t// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n\t// problems (eg. making min above 5 causes all sorts of issues)\n\t\n\t// TODO: Reuse THREE objects where possible instead of creating new instances\n\t// on every LOD calculation\n\t\n\t// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n\t// to avoid creating unnecessary memory for garbage collection\n\t\n\t// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n\t// closest to the camera) so visual inconsistancies during loading are minimised\n\t\n\tvar TileLayer = (function (_Layer) {\n\t _inherits(TileLayer, _Layer);\n\t\n\t function TileLayer(options) {\n\t var _this = this;\n\t\n\t _classCallCheck(this, TileLayer);\n\t\n\t var defaults = {\n\t picking: false,\n\t maxCache: 1000,\n\t maxLOD: 18\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._tileCache = new _TileCache2['default'](this._options.maxCache, function (tile) {\n\t _this._destroyTile(tile);\n\t });\n\t\n\t // List of tiles from the previous LOD calculation\n\t this._tileList = [];\n\t\n\t // TODO: Work out why changing the minLOD causes loads of issues\n\t this._minLOD = 3;\n\t this._maxLOD = this._options.maxLOD;\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t this._tiles = new _three2['default'].Object3D();\n\t this._tilesPicking = new _three2['default'].Object3D();\n\t }\n\t\n\t _createClass(TileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this.addToPicking(this._tilesPicking);\n\t this.add(this._tiles);\n\t }\n\t }, {\n\t key: '_updateFrustum',\n\t value: function _updateFrustum() {\n\t var camera = this._world.getCamera();\n\t var projScreenMatrix = new _three2['default'].Matrix4();\n\t projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\t\n\t this._frustum.setFromMatrix(camera.projectionMatrix);\n\t this._frustum.setFromMatrix(new _three2['default'].Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n\t }\n\t }, {\n\t key: '_tileInFrustum',\n\t value: function _tileInFrustum(tile) {\n\t var bounds = tile.getBounds();\n\t return this._frustum.intersectsBox(new _three2['default'].Box3(new _three2['default'].Vector3(bounds[0], 0, bounds[3]), new _three2['default'].Vector3(bounds[2], 0, bounds[1])));\n\t }\n\t\n\t // Update and output tiles from the previous LOD checklist\n\t }, {\n\t key: '_outputTiles',\n\t value: function _outputTiles() {\n\t var _this2 = this;\n\t\n\t if (!this._tiles) {\n\t return;\n\t }\n\t\n\t // Remove all tiles from layer\n\t this._removeTiles();\n\t\n\t // Add / re-add tiles\n\t this._tileList.forEach(function (tile) {\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t if (!tile.isReady()) {\n\t return;\n\t }\n\t\n\t // Add tile to layer (and to scene) if not already there\n\t _this2._tiles.add(tile.getMesh());\n\t\n\t if (tile.getPickingMesh()) {\n\t _this2._tilesPicking.add(tile.getPickingMesh());\n\t }\n\t });\n\t }\n\t\n\t // Works out tiles in the view frustum and stores them in an array\n\t //\n\t // Does not output the tiles, deferring this to _outputTiles()\n\t }, {\n\t key: '_calculateLOD',\n\t value: function _calculateLOD() {\n\t var _this3 = this;\n\t\n\t if (this._stop || !this._world) {\n\t return;\n\t }\n\t\n\t // var start = performance.now();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // 1. Update and retrieve camera frustum\n\t this._updateFrustum(this._frustum, camera);\n\t\n\t // 2. Add the four root items of the quadtree to a check list\n\t var checkList = this._checklist;\n\t checkList = [];\n\t checkList.push(this._requestTile('0', this));\n\t checkList.push(this._requestTile('1', this));\n\t checkList.push(this._requestTile('2', this));\n\t checkList.push(this._requestTile('3', this));\n\t\n\t // 3. Call Divide, passing in the check list\n\t this._divide(checkList);\n\t\n\t // // 4. Remove all tiles from layer\n\t //\n\t // Moved to _outputTiles() for now\n\t // this._removeTiles();\n\t\n\t // 5. Filter the tiles remaining in the check list\n\t this._tileList = checkList.filter(function (tile, index) {\n\t // Skip tile if it's not in the current view frustum\n\t if (!_this3._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t if (_this3._options.distance && _this3._options.distance > 0) {\n\t // TODO: Can probably speed this up\n\t var center = tile.getCenter();\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t // Manual distance limit to cut down on tiles so far away\n\t if (dist > _this3._options.distance) {\n\t return false;\n\t }\n\t }\n\t\n\t // Does the tile have a mesh?\n\t //\n\t // If yes, continue\n\t // If no, generate tile mesh, request texture and skip\n\t if (!tile.getMesh()) {\n\t tile.requestTileAsync();\n\t }\n\t\n\t return true;\n\t\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t // if (!tile.isReady()) {\n\t // return;\n\t // }\n\t //\n\t // // Add tile to layer (and to scene)\n\t // this._tiles.add(tile.getMesh());\n\t });\n\t\n\t // console.log(performance.now() - start);\n\t }\n\t }, {\n\t key: '_divide',\n\t value: function _divide(checkList) {\n\t var count = 0;\n\t var currentItem;\n\t var quadcode;\n\t\n\t // 1. Loop until count equals check list length\n\t while (count != checkList.length) {\n\t currentItem = checkList[count];\n\t quadcode = currentItem.getQuadcode();\n\t\n\t // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n\t if (currentItem.length === this._maxLOD) {\n\t count++;\n\t continue;\n\t }\n\t\n\t // 3. Else, calculate screen-space error metric for quadcode\n\t if (this._screenSpaceError(currentItem)) {\n\t // 4. If error is sufficient...\n\t\n\t // 4a. Remove parent item from the check list\n\t checkList.splice(count, 1);\n\t\n\t // 4b. Add 4 child items to the check list\n\t checkList.push(this._requestTile(quadcode + '0', this));\n\t checkList.push(this._requestTile(quadcode + '1', this));\n\t checkList.push(this._requestTile(quadcode + '2', this));\n\t checkList.push(this._requestTile(quadcode + '3', this));\n\t\n\t // 4d. Continue the loop without increasing count\n\t continue;\n\t } else {\n\t // 5. Else, increase count and continue loop\n\t count++;\n\t }\n\t }\n\t }\n\t }, {\n\t key: '_screenSpaceError',\n\t value: function _screenSpaceError(tile) {\n\t var minDepth = this._minLOD;\n\t var maxDepth = this._maxLOD;\n\t\n\t var quadcode = tile.getQuadcode();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // Tweak this value to refine specific point that each quad is subdivided\n\t //\n\t // It's used to multiple the dimensions of the tile sides before\n\t // comparing against the tile distance from camera\n\t var quality = 3.0;\n\t\n\t // 1. Return false if quadcode length equals maxDepth (stop dividing)\n\t if (quadcode.length === maxDepth) {\n\t return false;\n\t }\n\t\n\t // 2. Return true if quadcode length is less than minDepth\n\t if (quadcode.length < minDepth) {\n\t return true;\n\t }\n\t\n\t // 3. Return false if quadcode bounds are not in view frustum\n\t if (!this._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t var center = tile.getCenter();\n\t\n\t // 4. Calculate screen-space error metric\n\t // TODO: Use closest distance to one of the 4 tile corners\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t var error = quality * tile.getSide() / dist;\n\t\n\t // 5. Return true if error is greater than 1.0, else return false\n\t return error > 1.0;\n\t }\n\t }, {\n\t key: '_removeTiles',\n\t value: function _removeTiles() {\n\t if (!this._tiles || !this._tiles.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t\n\t if (!this._tilesPicking || !this._tilesPicking.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t // Return a new tile instance\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {}\n\t\n\t // Get a cached tile or request a new one if not in cache\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile(quadcode, layer) {\n\t var tile = this._tileCache.getTile(quadcode);\n\t\n\t if (!tile) {\n\t // Set up a brand new tile\n\t tile = this._createTile(quadcode, layer);\n\t\n\t // Add tile to cache, though it won't be ready yet as the data is being\n\t // requested from various places asynchronously\n\t this._tileCache.setTile(quadcode, tile);\n\t }\n\t\n\t return tile;\n\t }\n\t }, {\n\t key: '_destroyTile',\n\t value: function _destroyTile(tile) {\n\t // Remove tile from scene\n\t this._tiles.remove(tile.getMesh());\n\t\n\t // Delete any references to the tile within this component\n\t\n\t // Call destory on tile instance\n\t tile.destroy();\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._tiles.children) {\n\t // Remove all tiles\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t }\n\t\n\t // Remove tile from picking scene\n\t this.removeFromPicking(this._tilesPicking);\n\t\n\t if (this._tilesPicking.children) {\n\t // Remove all tiles\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t this._tileCache.destroy();\n\t this._tileCache = null;\n\t\n\t this._tiles = null;\n\t this._tilesPicking = null;\n\t this._frustum = null;\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return TileLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = TileLayer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _lruCache = __webpack_require__(49);\n\t\n\tvar _lruCache2 = _interopRequireDefault(_lruCache);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// This process is based on a similar approach taken by OpenWebGlobe\n\t// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\t\n\tvar TileCache = (function () {\n\t function TileCache(cacheLimit, onDestroyTile) {\n\t _classCallCheck(this, TileCache);\n\t\n\t this._cache = (0, _lruCache2['default'])({\n\t max: cacheLimit,\n\t dispose: function dispose(key, tile) {\n\t onDestroyTile(tile);\n\t }\n\t });\n\t }\n\t\n\t // Returns true if all specified tile providers are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(TileCache, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return false;\n\t }\n\t\n\t // Get a cached tile without requesting a new one\n\t }, {\n\t key: 'getTile',\n\t value: function getTile(quadcode) {\n\t return this._cache.get(quadcode);\n\t }\n\t\n\t // Add tile to cache\n\t }, {\n\t key: 'setTile',\n\t value: function setTile(quadcode, tile) {\n\t this._cache.set(quadcode, tile);\n\t }\n\t\n\t // Destroy the cache and remove it from memory\n\t //\n\t // TODO: Call destroy method on items in cache\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._cache.reset();\n\t this._cache = null;\n\t }\n\t }]);\n\t\n\t return TileCache;\n\t})();\n\t\n\texports['default'] = TileCache;\n\t\n\tvar noNew = function noNew(cacheLimit, onDestroyTile) {\n\t return new TileCache(cacheLimit, onDestroyTile);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.tileCache = noNew;\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = LRUCache\n\t\n\t// This will be a proper iterable 'Map' in engines that support it,\n\t// or a fakey-fake PseudoMap in older versions.\n\tvar Map = __webpack_require__(50)\n\tvar util = __webpack_require__(53)\n\t\n\t// A linked list to keep track of recently-used-ness\n\tvar Yallist = __webpack_require__(56)\n\t\n\t// use symbols if possible, otherwise just _props\n\tvar symbols = {}\n\tvar hasSymbol = typeof Symbol === 'function'\n\tvar makeSymbol\n\tif (hasSymbol) {\n\t makeSymbol = function (key) {\n\t return Symbol.for(key)\n\t }\n\t} else {\n\t makeSymbol = function (key) {\n\t return '_' + key\n\t }\n\t}\n\t\n\tfunction priv (obj, key, val) {\n\t var sym\n\t if (symbols[key]) {\n\t sym = symbols[key]\n\t } else {\n\t sym = makeSymbol(key)\n\t symbols[key] = sym\n\t }\n\t if (arguments.length === 2) {\n\t return obj[sym]\n\t } else {\n\t obj[sym] = val\n\t return val\n\t }\n\t}\n\t\n\tfunction naiveLength () { return 1 }\n\t\n\t// lruList is a yallist where the head is the youngest\n\t// item, and the tail is the oldest. the list contains the Hit\n\t// objects as the entries.\n\t// Each Hit object has a reference to its Yallist.Node. This\n\t// never changes.\n\t//\n\t// cache is a Map (or PseudoMap) that matches the keys to\n\t// the Yallist.Node object.\n\tfunction LRUCache (options) {\n\t if (!(this instanceof LRUCache)) {\n\t return new LRUCache(options)\n\t }\n\t\n\t if (typeof options === 'number') {\n\t options = { max: options }\n\t }\n\t\n\t if (!options) {\n\t options = {}\n\t }\n\t\n\t var max = priv(this, 'max', options.max)\n\t // Kind of weird to have a default max of Infinity, but oh well.\n\t if (!max ||\n\t !(typeof max === 'number') ||\n\t max <= 0) {\n\t priv(this, 'max', Infinity)\n\t }\n\t\n\t var lc = options.length || naiveLength\n\t if (typeof lc !== 'function') {\n\t lc = naiveLength\n\t }\n\t priv(this, 'lengthCalculator', lc)\n\t\n\t priv(this, 'allowStale', options.stale || false)\n\t priv(this, 'maxAge', options.maxAge || 0)\n\t priv(this, 'dispose', options.dispose)\n\t this.reset()\n\t}\n\t\n\t// resize the cache when the max changes.\n\tObject.defineProperty(LRUCache.prototype, 'max', {\n\t set: function (mL) {\n\t if (!mL || !(typeof mL === 'number') || mL <= 0) {\n\t mL = Infinity\n\t }\n\t priv(this, 'max', mL)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'max')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'allowStale', {\n\t set: function (allowStale) {\n\t priv(this, 'allowStale', !!allowStale)\n\t },\n\t get: function () {\n\t return priv(this, 'allowStale')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'maxAge', {\n\t set: function (mA) {\n\t if (!mA || !(typeof mA === 'number') || mA < 0) {\n\t mA = 0\n\t }\n\t priv(this, 'maxAge', mA)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'maxAge')\n\t },\n\t enumerable: true\n\t})\n\t\n\t// resize the cache when the lengthCalculator changes.\n\tObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n\t set: function (lC) {\n\t if (typeof lC !== 'function') {\n\t lC = naiveLength\n\t }\n\t if (lC !== priv(this, 'lengthCalculator')) {\n\t priv(this, 'lengthCalculator', lC)\n\t priv(this, 'length', 0)\n\t priv(this, 'lruList').forEach(function (hit) {\n\t hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t }, this)\n\t }\n\t trim(this)\n\t },\n\t get: function () { return priv(this, 'lengthCalculator') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'length', {\n\t get: function () { return priv(this, 'length') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'itemCount', {\n\t get: function () { return priv(this, 'lruList').length },\n\t enumerable: true\n\t})\n\t\n\tLRUCache.prototype.rforEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n\t var prev = walker.prev\n\t forEachStep(this, fn, walker, thisp)\n\t walker = prev\n\t }\n\t}\n\t\n\tfunction forEachStep (self, fn, node, thisp) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) {\n\t hit = undefined\n\t }\n\t }\n\t if (hit) {\n\t fn.call(thisp, hit.value, hit.key, self)\n\t }\n\t}\n\t\n\tLRUCache.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').head; walker !== null;) {\n\t var next = walker.next\n\t forEachStep(this, fn, walker, thisp)\n\t walker = next\n\t }\n\t}\n\t\n\tLRUCache.prototype.keys = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.key\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.values = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.value\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.reset = function () {\n\t if (priv(this, 'dispose') &&\n\t priv(this, 'lruList') &&\n\t priv(this, 'lruList').length) {\n\t priv(this, 'lruList').forEach(function (hit) {\n\t priv(this, 'dispose').call(this, hit.key, hit.value)\n\t }, this)\n\t }\n\t\n\t priv(this, 'cache', new Map()) // hash of items by key\n\t priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n\t priv(this, 'length', 0) // length of items in the list\n\t}\n\t\n\tLRUCache.prototype.dump = function () {\n\t return priv(this, 'lruList').map(function (hit) {\n\t if (!isStale(this, hit)) {\n\t return {\n\t k: hit.key,\n\t v: hit.value,\n\t e: hit.now + (hit.maxAge || 0)\n\t }\n\t }\n\t }, this).toArray().filter(function (h) {\n\t return h\n\t })\n\t}\n\t\n\tLRUCache.prototype.dumpLru = function () {\n\t return priv(this, 'lruList')\n\t}\n\t\n\tLRUCache.prototype.inspect = function (n, opts) {\n\t var str = 'LRUCache {'\n\t var extras = false\n\t\n\t var as = priv(this, 'allowStale')\n\t if (as) {\n\t str += '\\n allowStale: true'\n\t extras = true\n\t }\n\t\n\t var max = priv(this, 'max')\n\t if (max && max !== Infinity) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n max: ' + util.inspect(max, opts)\n\t extras = true\n\t }\n\t\n\t var maxAge = priv(this, 'maxAge')\n\t if (maxAge) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n\t extras = true\n\t }\n\t\n\t var lc = priv(this, 'lengthCalculator')\n\t if (lc && lc !== naiveLength) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n\t extras = true\n\t }\n\t\n\t var didFirst = false\n\t priv(this, 'lruList').forEach(function (item) {\n\t if (didFirst) {\n\t str += ',\\n '\n\t } else {\n\t if (extras) {\n\t str += ',\\n'\n\t }\n\t didFirst = true\n\t str += '\\n '\n\t }\n\t var key = util.inspect(item.key).split('\\n').join('\\n ')\n\t var val = { value: item.value }\n\t if (item.maxAge !== maxAge) {\n\t val.maxAge = item.maxAge\n\t }\n\t if (lc !== naiveLength) {\n\t val.length = item.length\n\t }\n\t if (isStale(this, item)) {\n\t val.stale = true\n\t }\n\t\n\t val = util.inspect(val, opts).split('\\n').join('\\n ')\n\t str += key + ' => ' + val\n\t })\n\t\n\t if (didFirst || extras) {\n\t str += '\\n'\n\t }\n\t str += '}'\n\t\n\t return str\n\t}\n\t\n\tLRUCache.prototype.set = function (key, value, maxAge) {\n\t maxAge = maxAge || priv(this, 'maxAge')\n\t\n\t var now = maxAge ? Date.now() : 0\n\t var len = priv(this, 'lengthCalculator').call(this, value, key)\n\t\n\t if (priv(this, 'cache').has(key)) {\n\t if (len > priv(this, 'max')) {\n\t del(this, priv(this, 'cache').get(key))\n\t return false\n\t }\n\t\n\t var node = priv(this, 'cache').get(key)\n\t var item = node.value\n\t\n\t // dispose of the old one before overwriting\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, item.value)\n\t }\n\t\n\t item.now = now\n\t item.maxAge = maxAge\n\t item.value = value\n\t priv(this, 'length', priv(this, 'length') + (len - item.length))\n\t item.length = len\n\t this.get(key)\n\t trim(this)\n\t return true\n\t }\n\t\n\t var hit = new Entry(key, value, len, now, maxAge)\n\t\n\t // oversized objects fall out of cache automatically.\n\t if (hit.length > priv(this, 'max')) {\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, value)\n\t }\n\t return false\n\t }\n\t\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t priv(this, 'lruList').unshift(hit)\n\t priv(this, 'cache').set(key, priv(this, 'lruList').head)\n\t trim(this)\n\t return true\n\t}\n\t\n\tLRUCache.prototype.has = function (key) {\n\t if (!priv(this, 'cache').has(key)) return false\n\t var hit = priv(this, 'cache').get(key).value\n\t if (isStale(this, hit)) {\n\t return false\n\t }\n\t return true\n\t}\n\t\n\tLRUCache.prototype.get = function (key) {\n\t return get(this, key, true)\n\t}\n\t\n\tLRUCache.prototype.peek = function (key) {\n\t return get(this, key, false)\n\t}\n\t\n\tLRUCache.prototype.pop = function () {\n\t var node = priv(this, 'lruList').tail\n\t if (!node) return null\n\t del(this, node)\n\t return node.value\n\t}\n\t\n\tLRUCache.prototype.del = function (key) {\n\t del(this, priv(this, 'cache').get(key))\n\t}\n\t\n\tLRUCache.prototype.load = function (arr) {\n\t // reset the cache\n\t this.reset()\n\t\n\t var now = Date.now()\n\t // A previous serialized cache has the most recent items first\n\t for (var l = arr.length - 1; l >= 0; l--) {\n\t var hit = arr[l]\n\t var expiresAt = hit.e || 0\n\t if (expiresAt === 0) {\n\t // the item was created without expiration in a non aged cache\n\t this.set(hit.k, hit.v)\n\t } else {\n\t var maxAge = expiresAt - now\n\t // dont add already expired items\n\t if (maxAge > 0) {\n\t this.set(hit.k, hit.v, maxAge)\n\t }\n\t }\n\t }\n\t}\n\t\n\tLRUCache.prototype.prune = function () {\n\t var self = this\n\t priv(this, 'cache').forEach(function (value, key) {\n\t get(self, key, false)\n\t })\n\t}\n\t\n\tfunction get (self, key, doUse) {\n\t var node = priv(self, 'cache').get(key)\n\t if (node) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) hit = undefined\n\t } else {\n\t if (doUse) {\n\t priv(self, 'lruList').unshiftNode(node)\n\t }\n\t }\n\t if (hit) hit = hit.value\n\t }\n\t return hit\n\t}\n\t\n\tfunction isStale (self, hit) {\n\t if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n\t return false\n\t }\n\t var stale = false\n\t var diff = Date.now() - hit.now\n\t if (hit.maxAge) {\n\t stale = diff > hit.maxAge\n\t } else {\n\t stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n\t }\n\t return stale\n\t}\n\t\n\tfunction trim (self) {\n\t if (priv(self, 'length') > priv(self, 'max')) {\n\t for (var walker = priv(self, 'lruList').tail;\n\t priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n\t // We know that we're about to delete this one, and also\n\t // what the next least recently used key will be, so just\n\t // go ahead and set it now.\n\t var prev = walker.prev\n\t del(self, walker)\n\t walker = prev\n\t }\n\t }\n\t}\n\t\n\tfunction del (self, node) {\n\t if (node) {\n\t var hit = node.value\n\t if (priv(self, 'dispose')) {\n\t priv(self, 'dispose').call(this, hit.key, hit.value)\n\t }\n\t priv(self, 'length', priv(self, 'length') - hit.length)\n\t priv(self, 'cache').delete(hit.key)\n\t priv(self, 'lruList').removeNode(node)\n\t }\n\t}\n\t\n\t// classy, since V8 prefers predictable objects.\n\tfunction Entry (key, value, length, now, maxAge) {\n\t this.key = key\n\t this.value = value\n\t this.length = length\n\t this.now = now\n\t this.maxAge = maxAge || 0\n\t}\n\n\n/***/ },\n/* 50 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {if (process.env.npm_package_name === 'pseudomap' &&\n\t process.env.npm_lifecycle_script === 'test')\n\t process.env.TEST_PSEUDOMAP = 'true'\n\t\n\tif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n\t module.exports = Map\n\t} else {\n\t module.exports = __webpack_require__(52)\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)))\n\n/***/ },\n/* 51 */\n/***/ function(module, exports) {\n\n\t// shim for using process in browser\n\t\n\tvar process = module.exports = {};\n\tvar queue = [];\n\tvar draining = false;\n\tvar currentQueue;\n\tvar queueIndex = -1;\n\t\n\tfunction cleanUpNextTick() {\n\t draining = false;\n\t if (currentQueue.length) {\n\t queue = currentQueue.concat(queue);\n\t } else {\n\t queueIndex = -1;\n\t }\n\t if (queue.length) {\n\t drainQueue();\n\t }\n\t}\n\t\n\tfunction drainQueue() {\n\t if (draining) {\n\t return;\n\t }\n\t var timeout = setTimeout(cleanUpNextTick);\n\t draining = true;\n\t\n\t var len = queue.length;\n\t while(len) {\n\t currentQueue = queue;\n\t queue = [];\n\t while (++queueIndex < len) {\n\t if (currentQueue) {\n\t currentQueue[queueIndex].run();\n\t }\n\t }\n\t queueIndex = -1;\n\t len = queue.length;\n\t }\n\t currentQueue = null;\n\t draining = false;\n\t clearTimeout(timeout);\n\t}\n\t\n\tprocess.nextTick = function (fun) {\n\t var args = new Array(arguments.length - 1);\n\t if (arguments.length > 1) {\n\t for (var i = 1; i < arguments.length; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t }\n\t queue.push(new Item(fun, args));\n\t if (queue.length === 1 && !draining) {\n\t setTimeout(drainQueue, 0);\n\t }\n\t};\n\t\n\t// v8 likes predictible objects\n\tfunction Item(fun, array) {\n\t this.fun = fun;\n\t this.array = array;\n\t}\n\tItem.prototype.run = function () {\n\t this.fun.apply(null, this.array);\n\t};\n\tprocess.title = 'browser';\n\tprocess.browser = true;\n\tprocess.env = {};\n\tprocess.argv = [];\n\tprocess.version = ''; // empty string to avoid regexp issues\n\tprocess.versions = {};\n\t\n\tfunction noop() {}\n\t\n\tprocess.on = noop;\n\tprocess.addListener = noop;\n\tprocess.once = noop;\n\tprocess.off = noop;\n\tprocess.removeListener = noop;\n\tprocess.removeAllListeners = noop;\n\tprocess.emit = noop;\n\t\n\tprocess.binding = function (name) {\n\t throw new Error('process.binding is not supported');\n\t};\n\t\n\tprocess.cwd = function () { return '/' };\n\tprocess.chdir = function (dir) {\n\t throw new Error('process.chdir is not supported');\n\t};\n\tprocess.umask = function() { return 0; };\n\n\n/***/ },\n/* 52 */\n/***/ function(module, exports) {\n\n\tvar hasOwnProperty = Object.prototype.hasOwnProperty\n\t\n\tmodule.exports = PseudoMap\n\t\n\tfunction PseudoMap (set) {\n\t if (!(this instanceof PseudoMap)) // whyyyyyyy\n\t throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\t\n\t this.clear()\n\t\n\t if (set) {\n\t if ((set instanceof PseudoMap) ||\n\t (typeof Map === 'function' && set instanceof Map))\n\t set.forEach(function (value, key) {\n\t this.set(key, value)\n\t }, this)\n\t else if (Array.isArray(set))\n\t set.forEach(function (kv) {\n\t this.set(kv[0], kv[1])\n\t }, this)\n\t else\n\t throw new TypeError('invalid argument')\n\t }\n\t}\n\t\n\tPseudoMap.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t Object.keys(this._data).forEach(function (k) {\n\t if (k !== 'size')\n\t fn.call(thisp, this._data[k].value, this._data[k].key)\n\t }, this)\n\t}\n\t\n\tPseudoMap.prototype.has = function (k) {\n\t return !!find(this._data, k)\n\t}\n\t\n\tPseudoMap.prototype.get = function (k) {\n\t var res = find(this._data, k)\n\t return res && res.value\n\t}\n\t\n\tPseudoMap.prototype.set = function (k, v) {\n\t set(this._data, k, v)\n\t}\n\t\n\tPseudoMap.prototype.delete = function (k) {\n\t var res = find(this._data, k)\n\t if (res) {\n\t delete this._data[res._index]\n\t this._data.size--\n\t }\n\t}\n\t\n\tPseudoMap.prototype.clear = function () {\n\t var data = Object.create(null)\n\t data.size = 0\n\t\n\t Object.defineProperty(this, '_data', {\n\t value: data,\n\t enumerable: false,\n\t configurable: true,\n\t writable: false\n\t })\n\t}\n\t\n\tObject.defineProperty(PseudoMap.prototype, 'size', {\n\t get: function () {\n\t return this._data.size\n\t },\n\t set: function (n) {},\n\t enumerable: true,\n\t configurable: true\n\t})\n\t\n\tPseudoMap.prototype.values =\n\tPseudoMap.prototype.keys =\n\tPseudoMap.prototype.entries = function () {\n\t throw new Error('iterators are not implemented in this version')\n\t}\n\t\n\t// Either identical, or both NaN\n\tfunction same (a, b) {\n\t return a === b || a !== a && b !== b\n\t}\n\t\n\tfunction Entry (k, v, i) {\n\t this.key = k\n\t this.value = v\n\t this._index = i\n\t}\n\t\n\tfunction find (data, k) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k))\n\t return data[key]\n\t }\n\t}\n\t\n\tfunction set (data, k, v) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k)) {\n\t data[key].value = v\n\t return\n\t }\n\t }\n\t data.size++\n\t data[key] = new Entry(k, v, key)\n\t}\n\n\n/***/ },\n/* 53 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\t\n\tvar formatRegExp = /%[sdj%]/g;\n\texports.format = function(f) {\n\t if (!isString(f)) {\n\t var objects = [];\n\t for (var i = 0; i < arguments.length; i++) {\n\t objects.push(inspect(arguments[i]));\n\t }\n\t return objects.join(' ');\n\t }\n\t\n\t var i = 1;\n\t var args = arguments;\n\t var len = args.length;\n\t var str = String(f).replace(formatRegExp, function(x) {\n\t if (x === '%%') return '%';\n\t if (i >= len) return x;\n\t switch (x) {\n\t case '%s': return String(args[i++]);\n\t case '%d': return Number(args[i++]);\n\t case '%j':\n\t try {\n\t return JSON.stringify(args[i++]);\n\t } catch (_) {\n\t return '[Circular]';\n\t }\n\t default:\n\t return x;\n\t }\n\t });\n\t for (var x = args[i]; i < len; x = args[++i]) {\n\t if (isNull(x) || !isObject(x)) {\n\t str += ' ' + x;\n\t } else {\n\t str += ' ' + inspect(x);\n\t }\n\t }\n\t return str;\n\t};\n\t\n\t\n\t// Mark that a method should not be used.\n\t// Returns a modified function which warns once by default.\n\t// If --no-deprecation is set, then it is a no-op.\n\texports.deprecate = function(fn, msg) {\n\t // Allow for deprecating things in the process of starting up.\n\t if (isUndefined(global.process)) {\n\t return function() {\n\t return exports.deprecate(fn, msg).apply(this, arguments);\n\t };\n\t }\n\t\n\t if (process.noDeprecation === true) {\n\t return fn;\n\t }\n\t\n\t var warned = false;\n\t function deprecated() {\n\t if (!warned) {\n\t if (process.throwDeprecation) {\n\t throw new Error(msg);\n\t } else if (process.traceDeprecation) {\n\t console.trace(msg);\n\t } else {\n\t console.error(msg);\n\t }\n\t warned = true;\n\t }\n\t return fn.apply(this, arguments);\n\t }\n\t\n\t return deprecated;\n\t};\n\t\n\t\n\tvar debugs = {};\n\tvar debugEnviron;\n\texports.debuglog = function(set) {\n\t if (isUndefined(debugEnviron))\n\t debugEnviron = process.env.NODE_DEBUG || '';\n\t set = set.toUpperCase();\n\t if (!debugs[set]) {\n\t if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n\t var pid = process.pid;\n\t debugs[set] = function() {\n\t var msg = exports.format.apply(exports, arguments);\n\t console.error('%s %d: %s', set, pid, msg);\n\t };\n\t } else {\n\t debugs[set] = function() {};\n\t }\n\t }\n\t return debugs[set];\n\t};\n\t\n\t\n\t/**\n\t * Echos the value of a value. Trys to print the value out\n\t * in the best way possible given the different types.\n\t *\n\t * @param {Object} obj The object to print out.\n\t * @param {Object} opts Optional options object that alters the output.\n\t */\n\t/* legacy: obj, showHidden, depth, colors*/\n\tfunction inspect(obj, opts) {\n\t // default options\n\t var ctx = {\n\t seen: [],\n\t stylize: stylizeNoColor\n\t };\n\t // legacy...\n\t if (arguments.length >= 3) ctx.depth = arguments[2];\n\t if (arguments.length >= 4) ctx.colors = arguments[3];\n\t if (isBoolean(opts)) {\n\t // legacy...\n\t ctx.showHidden = opts;\n\t } else if (opts) {\n\t // got an \"options\" object\n\t exports._extend(ctx, opts);\n\t }\n\t // set default options\n\t if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n\t if (isUndefined(ctx.depth)) ctx.depth = 2;\n\t if (isUndefined(ctx.colors)) ctx.colors = false;\n\t if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n\t if (ctx.colors) ctx.stylize = stylizeWithColor;\n\t return formatValue(ctx, obj, ctx.depth);\n\t}\n\texports.inspect = inspect;\n\t\n\t\n\t// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\n\tinspect.colors = {\n\t 'bold' : [1, 22],\n\t 'italic' : [3, 23],\n\t 'underline' : [4, 24],\n\t 'inverse' : [7, 27],\n\t 'white' : [37, 39],\n\t 'grey' : [90, 39],\n\t 'black' : [30, 39],\n\t 'blue' : [34, 39],\n\t 'cyan' : [36, 39],\n\t 'green' : [32, 39],\n\t 'magenta' : [35, 39],\n\t 'red' : [31, 39],\n\t 'yellow' : [33, 39]\n\t};\n\t\n\t// Don't use 'blue' not visible on cmd.exe\n\tinspect.styles = {\n\t 'special': 'cyan',\n\t 'number': 'yellow',\n\t 'boolean': 'yellow',\n\t 'undefined': 'grey',\n\t 'null': 'bold',\n\t 'string': 'green',\n\t 'date': 'magenta',\n\t // \"name\": intentionally not styling\n\t 'regexp': 'red'\n\t};\n\t\n\t\n\tfunction stylizeWithColor(str, styleType) {\n\t var style = inspect.styles[styleType];\n\t\n\t if (style) {\n\t return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n\t '\\u001b[' + inspect.colors[style][1] + 'm';\n\t } else {\n\t return str;\n\t }\n\t}\n\t\n\t\n\tfunction stylizeNoColor(str, styleType) {\n\t return str;\n\t}\n\t\n\t\n\tfunction arrayToHash(array) {\n\t var hash = {};\n\t\n\t array.forEach(function(val, idx) {\n\t hash[val] = true;\n\t });\n\t\n\t return hash;\n\t}\n\t\n\t\n\tfunction formatValue(ctx, value, recurseTimes) {\n\t // Provide a hook for user-specified inspect functions.\n\t // Check that value is an object with an inspect function on it\n\t if (ctx.customInspect &&\n\t value &&\n\t isFunction(value.inspect) &&\n\t // Filter out the util module, it's inspect function is special\n\t value.inspect !== exports.inspect &&\n\t // Also filter out any prototype objects using the circular check.\n\t !(value.constructor && value.constructor.prototype === value)) {\n\t var ret = value.inspect(recurseTimes, ctx);\n\t if (!isString(ret)) {\n\t ret = formatValue(ctx, ret, recurseTimes);\n\t }\n\t return ret;\n\t }\n\t\n\t // Primitive types cannot have properties\n\t var primitive = formatPrimitive(ctx, value);\n\t if (primitive) {\n\t return primitive;\n\t }\n\t\n\t // Look up the keys of the object.\n\t var keys = Object.keys(value);\n\t var visibleKeys = arrayToHash(keys);\n\t\n\t if (ctx.showHidden) {\n\t keys = Object.getOwnPropertyNames(value);\n\t }\n\t\n\t // IE doesn't make error fields non-enumerable\n\t // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n\t if (isError(value)\n\t && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n\t return formatError(value);\n\t }\n\t\n\t // Some type of object without properties can be shortcutted.\n\t if (keys.length === 0) {\n\t if (isFunction(value)) {\n\t var name = value.name ? ': ' + value.name : '';\n\t return ctx.stylize('[Function' + name + ']', 'special');\n\t }\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t }\n\t if (isDate(value)) {\n\t return ctx.stylize(Date.prototype.toString.call(value), 'date');\n\t }\n\t if (isError(value)) {\n\t return formatError(value);\n\t }\n\t }\n\t\n\t var base = '', array = false, braces = ['{', '}'];\n\t\n\t // Make Array say that they are Array\n\t if (isArray(value)) {\n\t array = true;\n\t braces = ['[', ']'];\n\t }\n\t\n\t // Make functions say that they are functions\n\t if (isFunction(value)) {\n\t var n = value.name ? ': ' + value.name : '';\n\t base = ' [Function' + n + ']';\n\t }\n\t\n\t // Make RegExps say that they are RegExps\n\t if (isRegExp(value)) {\n\t base = ' ' + RegExp.prototype.toString.call(value);\n\t }\n\t\n\t // Make dates with properties first say the date\n\t if (isDate(value)) {\n\t base = ' ' + Date.prototype.toUTCString.call(value);\n\t }\n\t\n\t // Make error with message first say the error\n\t if (isError(value)) {\n\t base = ' ' + formatError(value);\n\t }\n\t\n\t if (keys.length === 0 && (!array || value.length == 0)) {\n\t return braces[0] + base + braces[1];\n\t }\n\t\n\t if (recurseTimes < 0) {\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t } else {\n\t return ctx.stylize('[Object]', 'special');\n\t }\n\t }\n\t\n\t ctx.seen.push(value);\n\t\n\t var output;\n\t if (array) {\n\t output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n\t } else {\n\t output = keys.map(function(key) {\n\t return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n\t });\n\t }\n\t\n\t ctx.seen.pop();\n\t\n\t return reduceToSingleString(output, base, braces);\n\t}\n\t\n\t\n\tfunction formatPrimitive(ctx, value) {\n\t if (isUndefined(value))\n\t return ctx.stylize('undefined', 'undefined');\n\t if (isString(value)) {\n\t var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n\t .replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"') + '\\'';\n\t return ctx.stylize(simple, 'string');\n\t }\n\t if (isNumber(value))\n\t return ctx.stylize('' + value, 'number');\n\t if (isBoolean(value))\n\t return ctx.stylize('' + value, 'boolean');\n\t // For some reason typeof null is \"object\", so special case here.\n\t if (isNull(value))\n\t return ctx.stylize('null', 'null');\n\t}\n\t\n\t\n\tfunction formatError(value) {\n\t return '[' + Error.prototype.toString.call(value) + ']';\n\t}\n\t\n\t\n\tfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n\t var output = [];\n\t for (var i = 0, l = value.length; i < l; ++i) {\n\t if (hasOwnProperty(value, String(i))) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t String(i), true));\n\t } else {\n\t output.push('');\n\t }\n\t }\n\t keys.forEach(function(key) {\n\t if (!key.match(/^\\d+$/)) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t key, true));\n\t }\n\t });\n\t return output;\n\t}\n\t\n\t\n\tfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n\t var name, str, desc;\n\t desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n\t if (desc.get) {\n\t if (desc.set) {\n\t str = ctx.stylize('[Getter/Setter]', 'special');\n\t } else {\n\t str = ctx.stylize('[Getter]', 'special');\n\t }\n\t } else {\n\t if (desc.set) {\n\t str = ctx.stylize('[Setter]', 'special');\n\t }\n\t }\n\t if (!hasOwnProperty(visibleKeys, key)) {\n\t name = '[' + key + ']';\n\t }\n\t if (!str) {\n\t if (ctx.seen.indexOf(desc.value) < 0) {\n\t if (isNull(recurseTimes)) {\n\t str = formatValue(ctx, desc.value, null);\n\t } else {\n\t str = formatValue(ctx, desc.value, recurseTimes - 1);\n\t }\n\t if (str.indexOf('\\n') > -1) {\n\t if (array) {\n\t str = str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n').substr(2);\n\t } else {\n\t str = '\\n' + str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n');\n\t }\n\t }\n\t } else {\n\t str = ctx.stylize('[Circular]', 'special');\n\t }\n\t }\n\t if (isUndefined(name)) {\n\t if (array && key.match(/^\\d+$/)) {\n\t return str;\n\t }\n\t name = JSON.stringify('' + key);\n\t if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n\t name = name.substr(1, name.length - 2);\n\t name = ctx.stylize(name, 'name');\n\t } else {\n\t name = name.replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"')\n\t .replace(/(^\"|\"$)/g, \"'\");\n\t name = ctx.stylize(name, 'string');\n\t }\n\t }\n\t\n\t return name + ': ' + str;\n\t}\n\t\n\t\n\tfunction reduceToSingleString(output, base, braces) {\n\t var numLinesEst = 0;\n\t var length = output.reduce(function(prev, cur) {\n\t numLinesEst++;\n\t if (cur.indexOf('\\n') >= 0) numLinesEst++;\n\t return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n\t }, 0);\n\t\n\t if (length > 60) {\n\t return braces[0] +\n\t (base === '' ? '' : base + '\\n ') +\n\t ' ' +\n\t output.join(',\\n ') +\n\t ' ' +\n\t braces[1];\n\t }\n\t\n\t return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n\t}\n\t\n\t\n\t// NOTE: These type checking functions intentionally don't use `instanceof`\n\t// because it is fragile and can be easily faked with `Object.create()`.\n\tfunction isArray(ar) {\n\t return Array.isArray(ar);\n\t}\n\texports.isArray = isArray;\n\t\n\tfunction isBoolean(arg) {\n\t return typeof arg === 'boolean';\n\t}\n\texports.isBoolean = isBoolean;\n\t\n\tfunction isNull(arg) {\n\t return arg === null;\n\t}\n\texports.isNull = isNull;\n\t\n\tfunction isNullOrUndefined(arg) {\n\t return arg == null;\n\t}\n\texports.isNullOrUndefined = isNullOrUndefined;\n\t\n\tfunction isNumber(arg) {\n\t return typeof arg === 'number';\n\t}\n\texports.isNumber = isNumber;\n\t\n\tfunction isString(arg) {\n\t return typeof arg === 'string';\n\t}\n\texports.isString = isString;\n\t\n\tfunction isSymbol(arg) {\n\t return typeof arg === 'symbol';\n\t}\n\texports.isSymbol = isSymbol;\n\t\n\tfunction isUndefined(arg) {\n\t return arg === void 0;\n\t}\n\texports.isUndefined = isUndefined;\n\t\n\tfunction isRegExp(re) {\n\t return isObject(re) && objectToString(re) === '[object RegExp]';\n\t}\n\texports.isRegExp = isRegExp;\n\t\n\tfunction isObject(arg) {\n\t return typeof arg === 'object' && arg !== null;\n\t}\n\texports.isObject = isObject;\n\t\n\tfunction isDate(d) {\n\t return isObject(d) && objectToString(d) === '[object Date]';\n\t}\n\texports.isDate = isDate;\n\t\n\tfunction isError(e) {\n\t return isObject(e) &&\n\t (objectToString(e) === '[object Error]' || e instanceof Error);\n\t}\n\texports.isError = isError;\n\t\n\tfunction isFunction(arg) {\n\t return typeof arg === 'function';\n\t}\n\texports.isFunction = isFunction;\n\t\n\tfunction isPrimitive(arg) {\n\t return arg === null ||\n\t typeof arg === 'boolean' ||\n\t typeof arg === 'number' ||\n\t typeof arg === 'string' ||\n\t typeof arg === 'symbol' || // ES6 symbol\n\t typeof arg === 'undefined';\n\t}\n\texports.isPrimitive = isPrimitive;\n\t\n\texports.isBuffer = __webpack_require__(54);\n\t\n\tfunction objectToString(o) {\n\t return Object.prototype.toString.call(o);\n\t}\n\t\n\t\n\tfunction pad(n) {\n\t return n < 10 ? '0' + n.toString(10) : n.toString(10);\n\t}\n\t\n\t\n\tvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n\t 'Oct', 'Nov', 'Dec'];\n\t\n\t// 26 Feb 16:19:34\n\tfunction timestamp() {\n\t var d = new Date();\n\t var time = [pad(d.getHours()),\n\t pad(d.getMinutes()),\n\t pad(d.getSeconds())].join(':');\n\t return [d.getDate(), months[d.getMonth()], time].join(' ');\n\t}\n\t\n\t\n\t// log is just a thin wrapper to console.log that prepends a timestamp\n\texports.log = function() {\n\t console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n\t};\n\t\n\t\n\t/**\n\t * Inherit the prototype methods from one constructor into another.\n\t *\n\t * The Function.prototype.inherits from lang.js rewritten as a standalone\n\t * function (not on Function.prototype). NOTE: If this file is to be loaded\n\t * during bootstrapping this function needs to be rewritten using some native\n\t * functions as prototype setup using normal JavaScript does not work as\n\t * expected during bootstrapping (see mirror.js in r114903).\n\t *\n\t * @param {function} ctor Constructor function which needs to inherit the\n\t * prototype.\n\t * @param {function} superCtor Constructor function to inherit prototype from.\n\t */\n\texports.inherits = __webpack_require__(55);\n\t\n\texports._extend = function(origin, add) {\n\t // Don't do anything if add isn't an object\n\t if (!add || !isObject(add)) return origin;\n\t\n\t var keys = Object.keys(add);\n\t var i = keys.length;\n\t while (i--) {\n\t origin[keys[i]] = add[keys[i]];\n\t }\n\t return origin;\n\t};\n\t\n\tfunction hasOwnProperty(obj, prop) {\n\t return Object.prototype.hasOwnProperty.call(obj, prop);\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(51)))\n\n/***/ },\n/* 54 */\n/***/ function(module, exports) {\n\n\tmodule.exports = function isBuffer(arg) {\n\t return arg && typeof arg === 'object'\n\t && typeof arg.copy === 'function'\n\t && typeof arg.fill === 'function'\n\t && typeof arg.readUInt8 === 'function';\n\t}\n\n/***/ },\n/* 55 */\n/***/ function(module, exports) {\n\n\tif (typeof Object.create === 'function') {\n\t // implementation from standard node.js 'util' module\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t ctor.prototype = Object.create(superCtor.prototype, {\n\t constructor: {\n\t value: ctor,\n\t enumerable: false,\n\t writable: true,\n\t configurable: true\n\t }\n\t });\n\t };\n\t} else {\n\t // old school shim for old browsers\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t var TempCtor = function () {}\n\t TempCtor.prototype = superCtor.prototype\n\t ctor.prototype = new TempCtor()\n\t ctor.prototype.constructor = ctor\n\t }\n\t}\n\n\n/***/ },\n/* 56 */\n/***/ function(module, exports) {\n\n\tmodule.exports = Yallist\n\t\n\tYallist.Node = Node\n\tYallist.create = Yallist\n\t\n\tfunction Yallist (list) {\n\t var self = this\n\t if (!(self instanceof Yallist)) {\n\t self = new Yallist()\n\t }\n\t\n\t self.tail = null\n\t self.head = null\n\t self.length = 0\n\t\n\t if (list && typeof list.forEach === 'function') {\n\t list.forEach(function (item) {\n\t self.push(item)\n\t })\n\t } else if (arguments.length > 0) {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t self.push(arguments[i])\n\t }\n\t }\n\t\n\t return self\n\t}\n\t\n\tYallist.prototype.removeNode = function (node) {\n\t if (node.list !== this) {\n\t throw new Error('removing node which does not belong to this list')\n\t }\n\t\n\t var next = node.next\n\t var prev = node.prev\n\t\n\t if (next) {\n\t next.prev = prev\n\t }\n\t\n\t if (prev) {\n\t prev.next = next\n\t }\n\t\n\t if (node === this.head) {\n\t this.head = next\n\t }\n\t if (node === this.tail) {\n\t this.tail = prev\n\t }\n\t\n\t node.list.length --\n\t node.next = null\n\t node.prev = null\n\t node.list = null\n\t}\n\t\n\tYallist.prototype.unshiftNode = function (node) {\n\t if (node === this.head) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var head = this.head\n\t node.list = this\n\t node.next = head\n\t if (head) {\n\t head.prev = node\n\t }\n\t\n\t this.head = node\n\t if (!this.tail) {\n\t this.tail = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.pushNode = function (node) {\n\t if (node === this.tail) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var tail = this.tail\n\t node.list = this\n\t node.prev = tail\n\t if (tail) {\n\t tail.next = node\n\t }\n\t\n\t this.tail = node\n\t if (!this.head) {\n\t this.head = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.push = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t push(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.unshift = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t unshift(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.pop = function () {\n\t if (!this.tail)\n\t return undefined\n\t\n\t var res = this.tail.value\n\t this.tail = this.tail.prev\n\t this.tail.next = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.shift = function () {\n\t if (!this.head)\n\t return undefined\n\t\n\t var res = this.head.value\n\t this.head = this.head.next\n\t this.head.prev = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.head, i = 0; walker !== null; i++) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.next\n\t }\n\t}\n\t\n\tYallist.prototype.forEachReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.prev\n\t }\n\t}\n\t\n\tYallist.prototype.get = function (n) {\n\t for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.next\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.getReverse = function (n) {\n\t for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.prev\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.map = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.head; walker !== null; ) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.next\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.mapReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.tail; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.prev\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.reduce = function (fn, initial) {\n\t var acc\n\t var walker = this.head\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.head) {\n\t walker = this.head.next\n\t acc = this.head.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = 0; walker !== null; i++) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.next\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.reduceReverse = function (fn, initial) {\n\t var acc\n\t var walker = this.tail\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.tail) {\n\t walker = this.tail.prev\n\t acc = this.tail.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = this.length - 1; walker !== null; i--) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.prev\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.toArray = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.head; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.next\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.toArrayReverse = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.tail; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.prev\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.slice = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n\t walker = walker.next\n\t }\n\t for (; walker !== null && i < to; i++, walker = walker.next) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.sliceReverse = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n\t walker = walker.prev\n\t }\n\t for (; walker !== null && i > from; i--, walker = walker.prev) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.reverse = function () {\n\t var head = this.head\n\t var tail = this.tail\n\t for (var walker = head; walker !== null; walker = walker.prev) {\n\t var p = walker.prev\n\t walker.prev = walker.next\n\t walker.next = p\n\t }\n\t this.head = tail\n\t this.tail = head\n\t return this\n\t}\n\t\n\tfunction push (self, item) {\n\t self.tail = new Node(item, self.tail, null, self)\n\t if (!self.head) {\n\t self.head = self.tail\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction unshift (self, item) {\n\t self.head = new Node(item, null, self.head, self)\n\t if (!self.tail) {\n\t self.tail = self.head\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction Node (value, prev, next, list) {\n\t if (!(this instanceof Node)) {\n\t return new Node(value, prev, next, list)\n\t }\n\t\n\t this.list = list\n\t this.value = value\n\t\n\t if (prev) {\n\t prev.next = this\n\t this.prev = prev\n\t } else {\n\t this.prev = null\n\t }\n\t\n\t if (next) {\n\t next.prev = this\n\t this.next = next\n\t } else {\n\t this.next = null\n\t }\n\t}\n\n\n/***/ },\n/* 57 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(58);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(59);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar ImageTile = (function (_Tile) {\n\t _inherits(ImageTile, _Tile);\n\t\n\t function ImageTile(quadcode, path, layer) {\n\t _classCallCheck(this, ImageTile);\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(ImageTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear image reference\n\t this._image = null;\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t depthWrite: false\n\t });\n\t\n\t // var material = new THREE.MeshPhongMaterial({\n\t // depthWrite: false\n\t // });\n\t } else {\n\t // Other MeshStandardMaterial settings\n\t //\n\t // material.envMapIntensity will change the amount of colour reflected(?)\n\t // from the environment map – can be greater than 1 for more intensity\n\t\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var localMesh = new _three2['default'].Mesh(geom, material);\n\t localMesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t localMesh.receiveShadow = true;\n\t\n\t mesh.add(localMesh);\n\t mesh.renderOrder = 0.1;\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t // var box = new BoxHelper(localMesh);\n\t // mesh.add(box);\n\t //\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t var image = document.createElement('img');\n\t\n\t image.addEventListener('load', function (event) {\n\t var texture = new _three2['default'].Texture();\n\t\n\t texture.image = image;\n\t texture.needsUpdate = true;\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t // Something went wrong and the tile or its material is missing\n\t //\n\t // Possibly removed by the cache before the image loaded\n\t if (!_this2._mesh || !_this2._mesh.children[0] || !_this2._mesh.children[0].material) {\n\t return;\n\t }\n\t\n\t _this2._mesh.children[0].material.map = texture;\n\t _this2._mesh.children[0].material.needsUpdate = true;\n\t\n\t _this2._texture = texture;\n\t _this2._ready = true;\n\t }, false);\n\t\n\t // image.addEventListener('progress', event => {}, false);\n\t // image.addEventListener('error', event => {}, false);\n\t\n\t image.crossOrigin = '';\n\t\n\t // Load image\n\t image.src = url;\n\t\n\t this._image = image;\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._image) {\n\t return;\n\t }\n\t\n\t this._image.src = '';\n\t }\n\t }]);\n\t\n\t return ImageTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = ImageTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer) {\n\t return new ImageTile(quadcode, path, layer);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTile = noNew;\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// Manages a single tile and its layers\n\t\n\tvar r2d = 180 / Math.PI;\n\t\n\tvar tileURLRegex = /\\{([szxy])\\}/g;\n\t\n\tvar Tile = (function () {\n\t function Tile(quadcode, path, layer) {\n\t _classCallCheck(this, Tile);\n\t\n\t this._layer = layer;\n\t this._world = layer._world;\n\t this._quadcode = quadcode;\n\t this._path = path;\n\t\n\t this._ready = false;\n\t\n\t this._tile = this._quadcodeToTile(quadcode);\n\t\n\t // Bottom-left and top-right bounds in WGS84 coordinates\n\t this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\t\n\t // Bottom-left and top-right bounds in world coordinates\n\t this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\t\n\t // Tile center in world coordinates\n\t this._center = this._boundsToCenter(this._boundsWorld);\n\t\n\t // Tile center in projected coordinates\n\t this._centerLatlon = this._world.pointToLatLon((0, _geoPoint.point)(this._center[0], this._center[1]));\n\t\n\t // Length of a tile side in world coorindates\n\t this._side = this._getSide(this._boundsWorld);\n\t\n\t // Point scale for tile (for unit conversion)\n\t this._pointScale = this._world.pointScale(this._centerLatlon);\n\t }\n\t\n\t // Returns true if the tile mesh and texture are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(Tile, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return this._ready;\n\t }\n\t\n\t // Request data for the tile\n\t }, {\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {}\n\t }, {\n\t key: 'getQuadcode',\n\t value: function getQuadcode() {\n\t return this._quadcode;\n\t }\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {\n\t return this._boundsWorld;\n\t }\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t }, {\n\t key: 'getSide',\n\t value: function getSide() {\n\t return this._side;\n\t }\n\t }, {\n\t key: 'getMesh',\n\t value: function getMesh() {\n\t return this._mesh;\n\t }\n\t }, {\n\t key: 'getPickingMesh',\n\t value: function getPickingMesh() {\n\t return this._pickingMesh;\n\t }\n\t\n\t // Destroys the tile and removes it from the layer and memory\n\t //\n\t // Ensure that this leaves no trace of the tile – no textures, no meshes,\n\t // nothing in memory or the GPU\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Delete reference to layer and world\n\t this._layer = null;\n\t this._world = null;\n\t\n\t // Delete location references\n\t this._boundsLatLon = null;\n\t this._boundsWorld = null;\n\t this._center = null;\n\t\n\t // Done if no mesh\n\t if (!this._mesh) {\n\t return;\n\t }\n\t\n\t if (this._mesh.children) {\n\t // Dispose of mesh and materials\n\t this._mesh.children.forEach(function (child) {\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t });\n\t } else {\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {}\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {}\n\t }, {\n\t key: '_getTileURL',\n\t value: function _getTileURL(urlParams) {\n\t if (!urlParams.s) {\n\t // Default to a random choice of a, b or c\n\t urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n\t }\n\t\n\t tileURLRegex.lastIndex = 0;\n\t return this._path.replace(tileURLRegex, function (value, key) {\n\t // Replace with paramter, otherwise keep existing value\n\t return urlParams[key];\n\t });\n\t }\n\t\n\t // Convert from quadcode to TMS tile coordinates\n\t }, {\n\t key: '_quadcodeToTile',\n\t value: function _quadcodeToTile(quadcode) {\n\t var x = 0;\n\t var y = 0;\n\t var z = quadcode.length;\n\t\n\t for (var i = z; i > 0; i--) {\n\t var mask = 1 << i - 1;\n\t var q = +quadcode[z - i];\n\t if (q === 1) {\n\t x |= mask;\n\t }\n\t if (q === 2) {\n\t y |= mask;\n\t }\n\t if (q === 3) {\n\t x |= mask;\n\t y |= mask;\n\t }\n\t }\n\t\n\t return [x, y, z];\n\t }\n\t\n\t // Convert WGS84 tile bounds to world coordinates\n\t }, {\n\t key: '_tileBoundsFromWGS84',\n\t value: function _tileBoundsFromWGS84(boundsWGS84) {\n\t var sw = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[1], boundsWGS84[0]));\n\t var ne = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[3], boundsWGS84[2]));\n\t\n\t return [sw.x, sw.y, ne.x, ne.y];\n\t }\n\t\n\t // Get tile bounds in WGS84 coordinates\n\t }, {\n\t key: '_tileBoundsWGS84',\n\t value: function _tileBoundsWGS84(tile) {\n\t var e = this._tile2lon(tile[0] + 1, tile[2]);\n\t var w = this._tile2lon(tile[0], tile[2]);\n\t var s = this._tile2lat(tile[1] + 1, tile[2]);\n\t var n = this._tile2lat(tile[1], tile[2]);\n\t return [w, s, e, n];\n\t }\n\t }, {\n\t key: '_tile2lon',\n\t value: function _tile2lon(x, z) {\n\t return x / Math.pow(2, z) * 360 - 180;\n\t }\n\t }, {\n\t key: '_tile2lat',\n\t value: function _tile2lat(y, z) {\n\t var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n\t return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n\t }\n\t }, {\n\t key: '_boundsToCenter',\n\t value: function _boundsToCenter(bounds) {\n\t var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n\t var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\t\n\t return [x, y];\n\t }\n\t }, {\n\t key: '_getSide',\n\t value: function _getSide(bounds) {\n\t return new _three2['default'].Vector3(bounds[0], 0, bounds[3]).sub(new _three2['default'].Vector3(bounds[0], 0, bounds[1])).length();\n\t }\n\t }]);\n\t\n\t return Tile;\n\t})();\n\t\n\texports['default'] = Tile;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 59 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tBoxHelper = function (object) {\n\t\n\t\tvar indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]);\n\t\tvar positions = new Float32Array(8 * 3);\n\t\n\t\tvar geometry = new _three2['default'].BufferGeometry();\n\t\tgeometry.setIndex(new _three2['default'].BufferAttribute(indices, 1));\n\t\tgeometry.addAttribute('position', new _three2['default'].BufferAttribute(positions, 3));\n\t\n\t\t_three2['default'].LineSegments.call(this, geometry, new _three2['default'].LineBasicMaterial({ linewidth: 2, color: 0xff0000 }));\n\t\n\t\tif (object !== undefined) {\n\t\n\t\t\tthis.update(object);\n\t\t}\n\t};\n\t\n\tBoxHelper.prototype = Object.create(_three2['default'].LineSegments.prototype);\n\tBoxHelper.prototype.constructor = BoxHelper;\n\t\n\tBoxHelper.prototype.update = (function () {\n\t\n\t\tvar box = new _three2['default'].Box3();\n\t\n\t\treturn function (object) {\n\t\n\t\t\tbox.setFromObject(object);\n\t\n\t\t\tif (box.isEmpty()) return;\n\t\n\t\t\tvar min = box.min;\n\t\t\tvar max = box.max;\n\t\n\t\t\t/*\n\t 5____4\n\t 1/___0/|\n\t | 6__|_7\n\t 2/___3/\n\t \t0: max.x, max.y, max.z\n\t 1: min.x, max.y, max.z\n\t 2: min.x, min.y, max.z\n\t 3: max.x, min.y, max.z\n\t 4: max.x, max.y, min.z\n\t 5: min.x, max.y, min.z\n\t 6: min.x, min.y, min.z\n\t 7: max.x, min.y, min.z\n\t */\n\t\n\t\t\tvar position = this.geometry.attributes.position;\n\t\t\tvar array = position.array;\n\t\n\t\t\tarray[0] = max.x;array[1] = max.y;array[2] = max.z;\n\t\t\tarray[3] = min.x;array[4] = max.y;array[5] = max.z;\n\t\t\tarray[6] = min.x;array[7] = min.y;array[8] = max.z;\n\t\t\tarray[9] = max.x;array[10] = min.y;array[11] = max.z;\n\t\t\tarray[12] = max.x;array[13] = max.y;array[14] = min.z;\n\t\t\tarray[15] = min.x;array[16] = max.y;array[17] = min.z;\n\t\t\tarray[18] = min.x;array[19] = min.y;array[20] = min.z;\n\t\t\tarray[21] = max.x;array[22] = min.y;array[23] = min.z;\n\t\n\t\t\tposition.needsUpdate = true;\n\t\n\t\t\tthis.geometry.computeBoundingSphere();\n\t\t};\n\t})();\n\t\n\texports['default'] = BoxHelper;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 60 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\texports['default'] = function (colour, skyboxTarget) {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 1;\n\t canvas.height = 1;\n\t\n\t var context = canvas.getContext('2d');\n\t context.fillStyle = colour;\n\t context.fillRect(0, 0, canvas.width, canvas.height);\n\t // context.strokeStyle = '#D0D0CF';\n\t // context.strokeRect(0, 0, canvas.width, canvas.height);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t // //\n\t // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t\n\t // texture.wrapS = THREE.RepeatWrapping;\n\t // texture.wrapT = THREE.RepeatWrapping;\n\t // texture.repeat.set(segments, segments);\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material;\n\t\n\t if (!skyboxTarget) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t depthWrite: false\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = skyboxTarget;\n\t }\n\t\n\t return material;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 61 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(47);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _GeoJSONTile = __webpack_require__(62);\n\t\n\tvar _GeoJSONTile2 = _interopRequireDefault(_GeoJSONTile);\n\t\n\tvar _lodashThrottle = __webpack_require__(40);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n\t// tile grid using geojson-vt\n\t//\n\t// See: https://github.com/mapbox/geojson-vt\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider pausing per-frame output during movement so there's little to\n\t// no jank caused by previous tiles still processing\n\t\n\t// This tile layer only updates the quadtree after world movement has occurred\n\t//\n\t// Tiles from previous quadtree updates are updated and outputted every frame\n\t// (or at least every frame, throttled to some amount)\n\t//\n\t// This is because the complexity of TopoJSON tiles requires a lot of processing\n\t// and so makes movement janky if updates occur every frame – only updating\n\t// after movement means frame drops are less obvious due to heavy processing\n\t// occurring while the view is generally stationary\n\t//\n\t// The downside is that until new tiles are requested and outputted you will\n\t// see blank spaces as you orbit and move around\n\t//\n\t// An added benefit is that it dramatically reduces the number of tiles being\n\t// requested over a period of time and the time it takes to go from request to\n\t// screen output\n\t//\n\t// It may be possible to perform these updates per-frame once Web Worker\n\t// processing is added\n\t\n\tvar GeoJSONTileLayer = (function (_TileLayer) {\n\t _inherits(GeoJSONTileLayer, _TileLayer);\n\t\n\t function GeoJSONTileLayer(path, options) {\n\t _classCallCheck(this, GeoJSONTileLayer);\n\t\n\t var defaults = {\n\t maxLOD: 14,\n\t distance: 2000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(GeoJSONTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t this._world.on('controlsMove', this._onControlsMove, this);\n\t }\n\t\n\t // Update and output tiles each frame (throttled)\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t if (this._pauseOutput) {\n\t return;\n\t }\n\t\n\t this._outputTiles();\n\t }\n\t\n\t // Update tiles grid after world move, but don't output them\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._pauseOutput = false;\n\t this._calculateLOD();\n\t }\n\t\n\t // Pause updates during control movement for less visual jank\n\t }, {\n\t key: '_onControlsMove',\n\t value: function _onControlsMove() {\n\t this._pauseOutput = true;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t var options = {};\n\t\n\t if (this._options.filter) {\n\t options.filter = this._options.filter;\n\t }\n\t\n\t if (this._options.style) {\n\t options.style = this._options.style;\n\t }\n\t\n\t if (this._options.topojson) {\n\t options.topojson = true;\n\t }\n\t\n\t if (this._options.picking) {\n\t options.picking = true;\n\t }\n\t\n\t if (this._options.onClick) {\n\t options.onClick = this._options.onClick;\n\t }\n\t\n\t return new _GeoJSONTile2['default'](quadcode, this._path, layer, options);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = GeoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new GeoJSONTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTileLayer = noNew;\n\n/***/ },\n/* 62 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(58);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(59);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _reqwest = __webpack_require__(63);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// import Offset from 'polygon-offset';\n\t\n\tvar _utilGeoJSON = __webpack_require__(65);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\t// TODO: Look into using a GeoJSONLayer to represent and output the tile data\n\t// instead of duplicating a lot of effort within this class\n\t\n\t// TODO: Map picking IDs to some reference within the tile data / geometry so\n\t// that something useful can be done when an object is picked / clicked on\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Perform tile request and processing in a Web Worker\n\t//\n\t// Use Operative (https://github.com/padolsey/operative)\n\t//\n\t// Would it make sense to have the worker functionality defined in a static\n\t// method so it only gets initialised once and not on every tile instance?\n\t//\n\t// Otherwise, worker processing logic would have to go in the tile layer so not\n\t// to waste loads of time setting up a brand new worker with three.js for each\n\t// tile every single time.\n\t//\n\t// Unsure of the best way to get three.js and VIZI into the worker\n\t//\n\t// Would need to set up a CRS / projection identical to the world instance\n\t//\n\t// Is it possible to bypass requirements on external script by having multiple\n\t// simple worker methods that each take enough inputs to perform a single task\n\t// without requiring VIZI or three.js? So long as the heaviest logic is done in\n\t// the worker and transferrable objects are used then it should be better than\n\t// nothing. Would probably still need things like earcut...\n\t//\n\t// After all, the three.js logic and object creation will still need to be\n\t// done on the main thread regardless so the worker should try to do as much as\n\t// possible with as few dependencies as possible.\n\t//\n\t// Have a look at how this is done in Tangram before implementing anything as\n\t// the approach there is pretty similar and robust.\n\t\n\tvar GeoJSONTile = (function (_Tile) {\n\t _inherits(GeoJSONTile, _Tile);\n\t\n\t function GeoJSONTile(quadcode, path, layer, options) {\n\t _classCallCheck(this, GeoJSONTile);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t\n\t this._defaultStyle = _utilGeoJSON2['default'].defaultStyle;\n\t\n\t var defaults = {\n\t picking: false,\n\t topojson: false,\n\t filter: null,\n\t onClick: null,\n\t style: this._defaultStyle\n\t };\n\t\n\t this._options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t this._options.style = options.style;\n\t } else {\n\t this._options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(GeoJSONTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t\n\t if (_this._options.picking) {\n\t _this._pickingMesh = _this._createPickingMesh();\n\t }\n\t\n\t // this._shadowCanvas = this._createShadowCanvas();\n\t\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\t //\n\t // var material = new THREE.MeshBasicMaterial({\n\t // depthWrite: false\n\t // });\n\t //\n\t // var localMesh = new THREE.Mesh(geom, material);\n\t // localMesh.rotation.x = -90 * Math.PI / 180;\n\t //\n\t // mesh.add(localMesh);\n\t //\n\t // var box = new BoxHelper(localMesh);\n\t // mesh.add(box);\n\t //\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createPickingMesh',\n\t value: function _createPickingMesh() {\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createShadowCanvas',\n\t value: function _createShadowCanvas() {\n\t var canvas = document.createElement('canvas');\n\t\n\t // Rendered at a low resolution and later scaled up for a low-quality blur\n\t canvas.width = 512;\n\t canvas.height = 512;\n\t\n\t return canvas;\n\t }\n\t\n\t // _addShadow(coordinates) {\n\t // var ctx = this._shadowCanvas.getContext('2d');\n\t // var width = this._shadowCanvas.width;\n\t // var height = this._shadowCanvas.height;\n\t //\n\t // var _coords;\n\t // var _offset;\n\t // var offset = new Offset();\n\t //\n\t // // Transform coordinates to shadowCanvas space and draw on canvas\n\t // coordinates.forEach((ring, index) => {\n\t // ctx.beginPath();\n\t //\n\t // _coords = ring.map(coord => {\n\t // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t // return [xFrac * width, yFrac * height];\n\t // });\n\t //\n\t // if (index > 0) {\n\t // _offset = _coords;\n\t // } else {\n\t // _offset = offset.data(_coords).padding(1.3);\n\t // }\n\t //\n\t // // TODO: This is super flaky and crashes the browser if run on anything\n\t // // put the outer ring (potentially due to winding)\n\t // _offset.forEach((coord, index) => {\n\t // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t //\n\t // if (index === 0) {\n\t // ctx.moveTo(coord[0], coord[1]);\n\t // } else {\n\t // ctx.lineTo(coord[0], coord[1]);\n\t // }\n\t // });\n\t //\n\t // ctx.closePath();\n\t // });\n\t //\n\t // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n\t // ctx.fill();\n\t // }\n\t\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this2._request = null;\n\t _this2._processTileData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this2._request = null;\n\t });\n\t }\n\t }, {\n\t key: '_processTileData',\n\t value: function _processTileData(data) {\n\t var _this3 = this;\n\t\n\t console.time(this._tile);\n\t\n\t var geojson = _utilGeoJSON2['default'].mergeFeatures(data, this._options.topojson);\n\t\n\t // TODO: Check that GeoJSON is valid / usable\n\t\n\t var features = geojson.features;\n\t\n\t // Run filter, if provided\n\t if (this._options.filter) {\n\t features = geojson.features.filter(this._options.filter);\n\t }\n\t\n\t var style = this._options.style;\n\t\n\t var offset = (0, _geoPoint.point)(0, 0);\n\t offset.x = -1 * this._center[0];\n\t offset.y = -1 * this._center[1];\n\t\n\t // TODO: Wrap into a helper method so this isn't duplicated in the non-tiled\n\t // GeoJSON output layer\n\t //\n\t // Need to be careful as to not make it impossible to fork this off into a\n\t // worker script at a later stage\n\t //\n\t // Also unsure as to whether it's wise to lump so much into a black box\n\t //\n\t // var meshes = GeoJSON.createMeshes(features, offset, style);\n\t\n\t var polygons = {\n\t vertices: [],\n\t faces: [],\n\t colours: [],\n\t facesCount: 0,\n\t allFlat: true\n\t };\n\t\n\t var lines = {\n\t vertices: [],\n\t colours: [],\n\t verticesCount: 0\n\t };\n\t\n\t if (this._options.picking) {\n\t polygons.pickingIds = [];\n\t lines.pickingIds = [];\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t\n\t features.forEach(function (feature) {\n\t // feature.geometry, feature.properties\n\t\n\t // Skip features that aren't supported\n\t //\n\t // TODO: Add support for all GeoJSON geometry types, including Multi...\n\t // geometry types\n\t if (feature.geometry.type !== 'Polygon' && feature.geometry.type !== 'LineString' && feature.geometry.type !== 'MultiLineString') {\n\t return;\n\t }\n\t\n\t // Get style object, if provided\n\t if (typeof _this3._options.style === 'function') {\n\t style = (0, _lodashAssign2['default'])({}, _this3._defaultStyle, _this3._options.style(feature));\n\t }\n\t\n\t var coordinates = feature.geometry.coordinates;\n\t\n\t // if (feature.geometry.type === 'LineString') {\n\t if (feature.geometry.type === 'LineString') {\n\t colour.set(style.lineColor);\n\t\n\t coordinates = coordinates.map(function (coordinate) {\n\t var latlon = (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t var point = _this3._layer._world.latLonToPoint(latlon);\n\t return [point.x, point.y];\n\t });\n\t\n\t var height = 0;\n\t\n\t if (style.lineHeight) {\n\t height = _this3._world.metresToWorld(style.lineHeight, _this3._pointScale);\n\t }\n\t\n\t var linestringAttributes = _utilGeoJSON2['default'].lineStringAttributes(coordinates, colour, height);\n\t\n\t lines.vertices.push(linestringAttributes.vertices);\n\t lines.colours.push(linestringAttributes.colours);\n\t\n\t if (_this3._options.picking) {\n\t var pickingId = _this3._layer.getPickingId();\n\t\n\t // Inject picking ID\n\t //\n\t // TODO: Perhaps handle this within the GeoJSON helper\n\t lines.pickingIds.push(pickingId);\n\t\n\t if (_this3._options.onClick) {\n\t // TODO: Find a way to properly remove this listener on destroy\n\t _this3._world.on('pick-' + pickingId, function (point2d, point3d, intersects) {\n\t _this3._options.onClick(feature, point2d, point3d, intersects);\n\t });\n\t }\n\t }\n\t\n\t lines.verticesCount += linestringAttributes.vertices.length;\n\t }\n\t\n\t if (feature.geometry.type === 'MultiLineString') {\n\t colour.set(style.lineColor);\n\t\n\t coordinates = coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (coordinate) {\n\t var latlon = (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t var point = _this3._layer._world.latLonToPoint(latlon);\n\t return [point.x, point.y];\n\t });\n\t });\n\t\n\t var height = 0;\n\t\n\t if (style.lineHeight) {\n\t height = _this3._world.metresToWorld(style.lineHeight, _this3._pointScale);\n\t }\n\t\n\t var multiLinestringAttributes = _utilGeoJSON2['default'].multiLineStringAttributes(coordinates, colour, height);\n\t\n\t lines.vertices.push(multiLinestringAttributes.vertices);\n\t lines.colours.push(multiLinestringAttributes.colours);\n\t\n\t if (_this3._options.picking) {\n\t var pickingId = _this3._layer.getPickingId();\n\t\n\t // Inject picking ID\n\t //\n\t // TODO: Perhaps handle this within the GeoJSON helper\n\t lines.pickingIds.push(pickingId);\n\t\n\t if (_this3._options.onClick) {\n\t // TODO: Find a way to properly remove this listener on destroy\n\t _this3._world.on('pick-' + pickingId, function (point2d, point3d, intersects) {\n\t _this3._options.onClick(feature, point2d, point3d, intersects);\n\t });\n\t }\n\t }\n\t\n\t lines.verticesCount += multiLinestringAttributes.vertices.length;\n\t }\n\t\n\t if (feature.geometry.type === 'Polygon') {\n\t colour.set(style.color);\n\t\n\t coordinates = coordinates.map(function (ring) {\n\t return ring.map(function (coordinate) {\n\t var latlon = (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t var point = _this3._layer._world.latLonToPoint(latlon);\n\t return [point.x, point.y];\n\t });\n\t });\n\t\n\t var height = 0;\n\t\n\t if (style.height) {\n\t height = _this3._world.metresToWorld(style.height, _this3._pointScale);\n\t }\n\t\n\t // Draw footprint on shadow canvas\n\t //\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t // this._addShadow(coordinates);\n\t\n\t var polygonAttributes = _utilGeoJSON2['default'].polygonAttributes(coordinates, colour, height);\n\t\n\t polygons.vertices.push(polygonAttributes.vertices);\n\t polygons.faces.push(polygonAttributes.faces);\n\t polygons.colours.push(polygonAttributes.colours);\n\t\n\t if (_this3._options.picking) {\n\t var pickingId = _this3._layer.getPickingId();\n\t\n\t // Inject picking ID\n\t //\n\t // TODO: Perhaps handle this within the GeoJSON helper\n\t polygons.pickingIds.push(pickingId);\n\t\n\t if (_this3._options.onClick) {\n\t // TODO: Find a way to properly remove this listener on destroy\n\t _this3._world.on('pick-' + pickingId, function (point2d, point3d, intersects) {\n\t _this3._options.onClick(feature, point2d, point3d, intersects);\n\t });\n\t }\n\t }\n\t\n\t if (polygons.allFlat && !polygonAttributes.flat) {\n\t polygons.allFlat = false;\n\t }\n\t\n\t polygons.facesCount += polygonAttributes.faces.length;\n\t }\n\t });\n\t\n\t // Output shadow canvas\n\t //\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t\n\t // var texture = new THREE.Texture(this._shadowCanvas);\n\t //\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t //\n\t // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t //\n\t // texture.needsUpdate = true;\n\t //\n\t // var material;\n\t // if (!this._world._environment._skybox) {\n\t // material = new THREE.MeshBasicMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // } else {\n\t // material = new THREE.MeshStandardMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // material.roughness = 1;\n\t // material.metalness = 0.1;\n\t // material.envMap = this._world._environment._skybox.getRenderTarget();\n\t // }\n\t //\n\t // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\t // var mesh = new THREE.Mesh(geom, material);\n\t //\n\t // mesh.castShadow = false;\n\t // mesh.receiveShadow = false;\n\t // mesh.renderOrder = 1;\n\t //\n\t // mesh.rotation.x = -90 * Math.PI / 180;\n\t //\n\t // this._mesh.add(mesh);\n\t\n\t var geometry;\n\t var material;\n\t var mesh;\n\t\n\t // Output lines\n\t if (lines.vertices.length > 0) {\n\t geometry = _utilBuffer2['default'].createLineGeometry(lines, offset);\n\t\n\t material = new _three2['default'].LineBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t\n\t mesh = new _three2['default'].LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t // TODO: Can a line cast a shadow?\n\t // mesh.castShadow = true;\n\t\n\t this._mesh.add(mesh);\n\t\n\t if (this._options.picking) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new _three2['default'].LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t }\n\t\n\t // Output polygons\n\t if (polygons.facesCount > 0) {\n\t geometry = _utilBuffer2['default'].createGeometry(polygons, offset);\n\t\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshPhongMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t\n\t if (polygons.allFlat) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t this._mesh.add(mesh);\n\t\n\t if (this._options.picking) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t }\n\t\n\t this._ready = true;\n\t console.timeEnd(this._tile);\n\t console.log(this._tile + ': ' + features.length + ' features');\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t }]);\n\t\n\t return GeoJSONTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = GeoJSONTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer, options) {\n\t return new GeoJSONTile(quadcode, path, layer, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTile = noNew;\n\n/***/ },\n/* 63 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n\t * Reqwest! A general purpose XHR connection manager\n\t * license MIT (c) Dustin Diaz 2015\n\t * https://github.com/ded/reqwest\n\t */\n\t\n\t!function (name, context, definition) {\n\t if (typeof module != 'undefined' && module.exports) module.exports = definition()\n\t else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\t else context[name] = definition()\n\t}('reqwest', this, function () {\n\t\n\t var context = this\n\t\n\t if ('window' in context) {\n\t var doc = document\n\t , byTag = 'getElementsByTagName'\n\t , head = doc[byTag]('head')[0]\n\t } else {\n\t var XHR2\n\t try {\n\t XHR2 = __webpack_require__(64)\n\t } catch (ex) {\n\t throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n\t }\n\t }\n\t\n\t\n\t var httpsRe = /^http/\n\t , protocolRe = /(^\\w+):\\/\\//\n\t , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n\t , readyState = 'readyState'\n\t , contentType = 'Content-Type'\n\t , requestedWith = 'X-Requested-With'\n\t , uniqid = 0\n\t , callbackPrefix = 'reqwest_' + (+new Date())\n\t , lastValue // data stored by the most recent JSONP callback\n\t , xmlHttpRequest = 'XMLHttpRequest'\n\t , xDomainRequest = 'XDomainRequest'\n\t , noop = function () {}\n\t\n\t , isArray = typeof Array.isArray == 'function'\n\t ? Array.isArray\n\t : function (a) {\n\t return a instanceof Array\n\t }\n\t\n\t , defaultHeaders = {\n\t 'contentType': 'application/x-www-form-urlencoded'\n\t , 'requestedWith': xmlHttpRequest\n\t , 'accept': {\n\t '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n\t , 'xml': 'application/xml, text/xml'\n\t , 'html': 'text/html'\n\t , 'text': 'text/plain'\n\t , 'json': 'application/json, text/javascript'\n\t , 'js': 'application/javascript, text/javascript'\n\t }\n\t }\n\t\n\t , xhr = function(o) {\n\t // is it x-domain\n\t if (o['crossOrigin'] === true) {\n\t var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n\t if (xhr && 'withCredentials' in xhr) {\n\t return xhr\n\t } else if (context[xDomainRequest]) {\n\t return new XDomainRequest()\n\t } else {\n\t throw new Error('Browser does not support cross-origin requests')\n\t }\n\t } else if (context[xmlHttpRequest]) {\n\t return new XMLHttpRequest()\n\t } else if (XHR2) {\n\t return new XHR2()\n\t } else {\n\t return new ActiveXObject('Microsoft.XMLHTTP')\n\t }\n\t }\n\t , globalSetupOptions = {\n\t dataFilter: function (data) {\n\t return data\n\t }\n\t }\n\t\n\t function succeed(r) {\n\t var protocol = protocolRe.exec(r.url)\n\t protocol = (protocol && protocol[1]) || context.location.protocol\n\t return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n\t }\n\t\n\t function handleReadyState(r, success, error) {\n\t return function () {\n\t // use _aborted to mitigate against IE err c00c023f\n\t // (can't read props on aborted request objects)\n\t if (r._aborted) return error(r.request)\n\t if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n\t if (r.request && r.request[readyState] == 4) {\n\t r.request.onreadystatechange = noop\n\t if (succeed(r)) success(r.request)\n\t else\n\t error(r.request)\n\t }\n\t }\n\t }\n\t\n\t function setHeaders(http, o) {\n\t var headers = o['headers'] || {}\n\t , h\n\t\n\t headers['Accept'] = headers['Accept']\n\t || defaultHeaders['accept'][o['type']]\n\t || defaultHeaders['accept']['*']\n\t\n\t var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n\t // breaks cross-origin requests with legacy browsers\n\t if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n\t if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n\t for (h in headers)\n\t headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n\t }\n\t\n\t function setCredentials(http, o) {\n\t if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n\t http.withCredentials = !!o['withCredentials']\n\t }\n\t }\n\t\n\t function generalCallback(data) {\n\t lastValue = data\n\t }\n\t\n\t function urlappend (url, s) {\n\t return url + (/\\?/.test(url) ? '&' : '?') + s\n\t }\n\t\n\t function handleJsonp(o, fn, err, url) {\n\t var reqId = uniqid++\n\t , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n\t , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n\t , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n\t , match = url.match(cbreg)\n\t , script = doc.createElement('script')\n\t , loaded = 0\n\t , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\t\n\t if (match) {\n\t if (match[3] === '?') {\n\t url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n\t } else {\n\t cbval = match[3] // provided callback func name\n\t }\n\t } else {\n\t url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n\t }\n\t\n\t context[cbval] = generalCallback\n\t\n\t script.type = 'text/javascript'\n\t script.src = url\n\t script.async = true\n\t if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n\t // need this for IE due to out-of-order onreadystatechange(), binding script\n\t // execution to an event listener gives us control over when the script\n\t // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n\t script.htmlFor = script.id = '_reqwest_' + reqId\n\t }\n\t\n\t script.onload = script.onreadystatechange = function () {\n\t if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n\t return false\n\t }\n\t script.onload = script.onreadystatechange = null\n\t script.onclick && script.onclick()\n\t // Call the user callback with the last value stored and clean up values and scripts.\n\t fn(lastValue)\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t\n\t // Add the script to the DOM head\n\t head.appendChild(script)\n\t\n\t // Enable JSONP timeout\n\t return {\n\t abort: function () {\n\t script.onload = script.onreadystatechange = null\n\t err({}, 'Request is aborted: timeout', {})\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t }\n\t }\n\t\n\t function getRequest(fn, err) {\n\t var o = this.o\n\t , method = (o['method'] || 'GET').toUpperCase()\n\t , url = typeof o === 'string' ? o : o['url']\n\t // convert non-string objects to query-string form unless o['processData'] is false\n\t , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n\t ? reqwest.toQueryString(o['data'])\n\t : (o['data'] || null)\n\t , http\n\t , sendWait = false\n\t\n\t // if we're working on a GET request and we have data then we should append\n\t // query string to end of URL and not post data\n\t if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n\t url = urlappend(url, data)\n\t data = null\n\t }\n\t\n\t if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\t\n\t // get the xhr from the factory if passed\n\t // if the factory returns null, fall-back to ours\n\t http = (o.xhr && o.xhr(o)) || xhr(o)\n\t\n\t http.open(method, url, o['async'] === false ? false : true)\n\t setHeaders(http, o)\n\t setCredentials(http, o)\n\t if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n\t http.onload = fn\n\t http.onerror = err\n\t // NOTE: see\n\t // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n\t http.onprogress = function() {}\n\t sendWait = true\n\t } else {\n\t http.onreadystatechange = handleReadyState(this, fn, err)\n\t }\n\t o['before'] && o['before'](http)\n\t if (sendWait) {\n\t setTimeout(function () {\n\t http.send(data)\n\t }, 200)\n\t } else {\n\t http.send(data)\n\t }\n\t return http\n\t }\n\t\n\t function Reqwest(o, fn) {\n\t this.o = o\n\t this.fn = fn\n\t\n\t init.apply(this, arguments)\n\t }\n\t\n\t function setType(header) {\n\t // json, javascript, text/plain, text/html, xml\n\t if (header === null) return undefined; //In case of no content-type.\n\t if (header.match('json')) return 'json'\n\t if (header.match('javascript')) return 'js'\n\t if (header.match('text')) return 'html'\n\t if (header.match('xml')) return 'xml'\n\t }\n\t\n\t function init(o, fn) {\n\t\n\t this.url = typeof o == 'string' ? o : o['url']\n\t this.timeout = null\n\t\n\t // whether request has been fulfilled for purpose\n\t // of tracking the Promises\n\t this._fulfilled = false\n\t // success handlers\n\t this._successHandler = function(){}\n\t this._fulfillmentHandlers = []\n\t // error handlers\n\t this._errorHandlers = []\n\t // complete (both success and fail) handlers\n\t this._completeHandlers = []\n\t this._erred = false\n\t this._responseArgs = {}\n\t\n\t var self = this\n\t\n\t fn = fn || function () {}\n\t\n\t if (o['timeout']) {\n\t this.timeout = setTimeout(function () {\n\t timedOut()\n\t }, o['timeout'])\n\t }\n\t\n\t if (o['success']) {\n\t this._successHandler = function () {\n\t o['success'].apply(o, arguments)\n\t }\n\t }\n\t\n\t if (o['error']) {\n\t this._errorHandlers.push(function () {\n\t o['error'].apply(o, arguments)\n\t })\n\t }\n\t\n\t if (o['complete']) {\n\t this._completeHandlers.push(function () {\n\t o['complete'].apply(o, arguments)\n\t })\n\t }\n\t\n\t function complete (resp) {\n\t o['timeout'] && clearTimeout(self.timeout)\n\t self.timeout = null\n\t while (self._completeHandlers.length > 0) {\n\t self._completeHandlers.shift()(resp)\n\t }\n\t }\n\t\n\t function success (resp) {\n\t var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n\t resp = (type !== 'jsonp') ? self.request : resp\n\t // use global data filter on response text\n\t var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n\t , r = filteredResponse\n\t try {\n\t resp.responseText = r\n\t } catch (e) {\n\t // can't assign this in IE<=8, just ignore\n\t }\n\t if (r) {\n\t switch (type) {\n\t case 'json':\n\t try {\n\t resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n\t } catch (err) {\n\t return error(resp, 'Could not parse JSON in response', err)\n\t }\n\t break\n\t case 'js':\n\t resp = eval(r)\n\t break\n\t case 'html':\n\t resp = r\n\t break\n\t case 'xml':\n\t resp = resp.responseXML\n\t && resp.responseXML.parseError // IE trololo\n\t && resp.responseXML.parseError.errorCode\n\t && resp.responseXML.parseError.reason\n\t ? null\n\t : resp.responseXML\n\t break\n\t }\n\t }\n\t\n\t self._responseArgs.resp = resp\n\t self._fulfilled = true\n\t fn(resp)\n\t self._successHandler(resp)\n\t while (self._fulfillmentHandlers.length > 0) {\n\t resp = self._fulfillmentHandlers.shift()(resp)\n\t }\n\t\n\t complete(resp)\n\t }\n\t\n\t function timedOut() {\n\t self._timedOut = true\n\t self.request.abort()\n\t }\n\t\n\t function error(resp, msg, t) {\n\t resp = self.request\n\t self._responseArgs.resp = resp\n\t self._responseArgs.msg = msg\n\t self._responseArgs.t = t\n\t self._erred = true\n\t while (self._errorHandlers.length > 0) {\n\t self._errorHandlers.shift()(resp, msg, t)\n\t }\n\t complete(resp)\n\t }\n\t\n\t this.request = getRequest.call(this, success, error)\n\t }\n\t\n\t Reqwest.prototype = {\n\t abort: function () {\n\t this._aborted = true\n\t this.request.abort()\n\t }\n\t\n\t , retry: function () {\n\t init.call(this, this.o, this.fn)\n\t }\n\t\n\t /**\n\t * Small deviation from the Promises A CommonJs specification\n\t * http://wiki.commonjs.org/wiki/Promises/A\n\t */\n\t\n\t /**\n\t * `then` will execute upon successful requests\n\t */\n\t , then: function (success, fail) {\n\t success = success || function () {}\n\t fail = fail || function () {}\n\t if (this._fulfilled) {\n\t this._responseArgs.resp = success(this._responseArgs.resp)\n\t } else if (this._erred) {\n\t fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._fulfillmentHandlers.push(success)\n\t this._errorHandlers.push(fail)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `always` will execute whether the request succeeds or fails\n\t */\n\t , always: function (fn) {\n\t if (this._fulfilled || this._erred) {\n\t fn(this._responseArgs.resp)\n\t } else {\n\t this._completeHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `fail` will execute when the request fails\n\t */\n\t , fail: function (fn) {\n\t if (this._erred) {\n\t fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._errorHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t , 'catch': function (fn) {\n\t return this.fail(fn)\n\t }\n\t }\n\t\n\t function reqwest(o, fn) {\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t // normalize newline variants according to spec -> CRLF\n\t function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }\n\t\n\t function serial(el, cb) {\n\t var n = el.name\n\t , t = el.tagName.toLowerCase()\n\t , optCb = function (o) {\n\t // IE gives value=\"\" even where there is no value attribute\n\t // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n\t if (o && !o['disabled'])\n\t cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n\t }\n\t , ch, ra, val, i\n\t\n\t // don't serialize elements that are disabled or without a name\n\t if (el.disabled || !n) return\n\t\n\t switch (t) {\n\t case 'input':\n\t if (!/reset|button|image|file/i.test(el.type)) {\n\t ch = /checkbox/i.test(el.type)\n\t ra = /radio/i.test(el.type)\n\t val = el.value\n\t // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n\t ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n\t }\n\t break\n\t case 'textarea':\n\t cb(n, normalize(el.value))\n\t break\n\t case 'select':\n\t if (el.type.toLowerCase() === 'select-one') {\n\t optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n\t } else {\n\t for (i = 0; el.length && i < el.length; i++) {\n\t el.options[i].selected && optCb(el.options[i])\n\t }\n\t }\n\t break\n\t }\n\t }\n\t\n\t // collect up all form elements found from the passed argument elements all\n\t // the way down to child elements; pass a '
' or form fields.\n\t // called with 'this'=callback to use for serial() on each element\n\t function eachFormElement() {\n\t var cb = this\n\t , e, i\n\t , serializeSubtags = function (e, tags) {\n\t var i, j, fa\n\t for (i = 0; i < tags.length; i++) {\n\t fa = e[byTag](tags[i])\n\t for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n\t }\n\t }\n\t\n\t for (i = 0; i < arguments.length; i++) {\n\t e = arguments[i]\n\t if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n\t serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n\t }\n\t }\n\t\n\t // standard query string style serialization\n\t function serializeQueryString() {\n\t return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n\t }\n\t\n\t // { 'name': 'value', ... } style serialization\n\t function serializeHash() {\n\t var hash = {}\n\t eachFormElement.apply(function (name, value) {\n\t if (name in hash) {\n\t hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n\t hash[name].push(value)\n\t } else hash[name] = value\n\t }, arguments)\n\t return hash\n\t }\n\t\n\t // [ { name: 'name', value: 'value' }, ... ] style serialization\n\t reqwest.serializeArray = function () {\n\t var arr = []\n\t eachFormElement.apply(function (name, value) {\n\t arr.push({name: name, value: value})\n\t }, arguments)\n\t return arr\n\t }\n\t\n\t reqwest.serialize = function () {\n\t if (arguments.length === 0) return ''\n\t var opt, fn\n\t , args = Array.prototype.slice.call(arguments, 0)\n\t\n\t opt = args.pop()\n\t opt && opt.nodeType && args.push(opt) && (opt = null)\n\t opt && (opt = opt.type)\n\t\n\t if (opt == 'map') fn = serializeHash\n\t else if (opt == 'array') fn = reqwest.serializeArray\n\t else fn = serializeQueryString\n\t\n\t return fn.apply(null, args)\n\t }\n\t\n\t reqwest.toQueryString = function (o, trad) {\n\t var prefix, i\n\t , traditional = trad || false\n\t , s = []\n\t , enc = encodeURIComponent\n\t , add = function (key, value) {\n\t // If value is a function, invoke it and return its value\n\t value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n\t s[s.length] = enc(key) + '=' + enc(value)\n\t }\n\t // If an array was passed in, assume that it is an array of form elements.\n\t if (isArray(o)) {\n\t for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n\t } else {\n\t // If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t // did it), otherwise encode params recursively.\n\t for (prefix in o) {\n\t if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n\t }\n\t }\n\t\n\t // spaces should be + according to spec\n\t return s.join('&').replace(/%20/g, '+')\n\t }\n\t\n\t function buildParams(prefix, obj, traditional, add) {\n\t var name, i, v\n\t , rbracket = /\\[\\]$/\n\t\n\t if (isArray(obj)) {\n\t // Serialize array item.\n\t for (i = 0; obj && i < obj.length; i++) {\n\t v = obj[i]\n\t if (traditional || rbracket.test(prefix)) {\n\t // Treat each array item as a scalar.\n\t add(prefix, v)\n\t } else {\n\t buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n\t }\n\t }\n\t } else if (obj && obj.toString() === '[object Object]') {\n\t // Serialize object item.\n\t for (name in obj) {\n\t buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n\t }\n\t\n\t } else {\n\t // Serialize scalar item.\n\t add(prefix, obj)\n\t }\n\t }\n\t\n\t reqwest.getcallbackPrefix = function () {\n\t return callbackPrefix\n\t }\n\t\n\t // jQuery and Zepto compatibility, differences can be remapped here so you can call\n\t // .ajax.compat(options, callback)\n\t reqwest.compat = function (o, fn) {\n\t if (o) {\n\t o['type'] && (o['method'] = o['type']) && delete o['type']\n\t o['dataType'] && (o['type'] = o['dataType'])\n\t o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n\t o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n\t }\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t reqwest.ajaxSetup = function (options) {\n\t options = options || {}\n\t for (var k in options) {\n\t globalSetupOptions[k] = options[k]\n\t }\n\t }\n\t\n\t return reqwest\n\t});\n\n\n/***/ },\n/* 64 */\n/***/ function(module, exports) {\n\n\t/* (ignored) */\n\n/***/ },\n/* 65 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * GeoJSON helpers for handling data and generating objects\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _topojson2 = __webpack_require__(66);\n\t\n\tvar _topojson3 = _interopRequireDefault(_topojson2);\n\t\n\tvar _geojsonMerge = __webpack_require__(67);\n\t\n\tvar _geojsonMerge2 = _interopRequireDefault(_geojsonMerge);\n\t\n\t// TODO: Make it so height can be per-coordinate / point but connected together\n\t// as a linestring (eg. GPS points with an elevation at each point)\n\t//\n\t// This isn't really valid GeoJSON so perhaps something best left to an external\n\t// component for now, until a better approach can be considered\n\t//\n\t// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\t\n\t// Light and dark colours used for poor-mans AO gradient on object sides\n\tvar light = new _three2['default'].Color(0xffffff);\n\tvar shadow = new _three2['default'].Color(0x666666);\n\t\n\tvar GeoJSON = (function () {\n\t var defaultStyle = {\n\t color: '#ffffff',\n\t height: 0,\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t };\n\t\n\t // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n\t // into a single FeatureCollection\n\t var collectFeatures = function collectFeatures(data, _topojson) {\n\t var collections = [];\n\t\n\t if (_topojson) {\n\t // TODO: Allow TopoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var tk in data.objects) {\n\t collections.push(_topojson3['default'].feature(data, data.objects[tk]));\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else {\n\t // If root doesn't have a type then let's see if there are features in the\n\t // next step down\n\t if (!data.type) {\n\t // TODO: Allow GeoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var gk in data) {\n\t if (!data[gk].type) {\n\t continue;\n\t }\n\t\n\t collections.push(data[gk]);\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else if (Array.isArray(data)) {\n\t return (0, _geojsonMerge2['default'])(data);\n\t } else {\n\t return data;\n\t }\n\t }\n\t };\n\t\n\t return {\n\t defaultStyle: defaultStyle,\n\t collectFeatures: collectFeatures\n\t };\n\t})();\n\t\n\texports['default'] = GeoJSON;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t(function (global, factory) {\n\t true ? factory(exports) :\n\t typeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t (factory((global.topojson = {})));\n\t}(this, function (exports) { 'use strict';\n\t\n\t function noop() {}\n\t\n\t function absolute(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t point[0] = (x0 += point[0]) * kx + dx;\n\t point[1] = (y0 += point[1]) * ky + dy;\n\t };\n\t }\n\t\n\t function relative(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t var x1 = (point[0] - dx) / kx | 0,\n\t y1 = (point[1] - dy) / ky | 0;\n\t point[0] = x1 - x0;\n\t point[1] = y1 - y0;\n\t x0 = x1;\n\t y0 = y1;\n\t };\n\t }\n\t\n\t function reverse(array, n) {\n\t var t, j = array.length, i = j - n;\n\t while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n\t }\n\t\n\t function bisect(a, x) {\n\t var lo = 0, hi = a.length;\n\t while (lo < hi) {\n\t var mid = lo + hi >>> 1;\n\t if (a[mid] < x) lo = mid + 1;\n\t else hi = mid;\n\t }\n\t return lo;\n\t }\n\t\n\t function feature(topology, o) {\n\t return o.type === \"GeometryCollection\" ? {\n\t type: \"FeatureCollection\",\n\t features: o.geometries.map(function(o) { return feature$1(topology, o); })\n\t } : feature$1(topology, o);\n\t }\n\t\n\t function feature$1(topology, o) {\n\t var f = {\n\t type: \"Feature\",\n\t id: o.id,\n\t properties: o.properties || {},\n\t geometry: object(topology, o)\n\t };\n\t if (o.id == null) delete f.id;\n\t return f;\n\t }\n\t\n\t function object(topology, o) {\n\t var absolute$$ = absolute(topology.transform),\n\t arcs = topology.arcs;\n\t\n\t function arc(i, points) {\n\t if (points.length) points.pop();\n\t for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n\t points.push(p = a[k].slice());\n\t absolute$$(p, k);\n\t }\n\t if (i < 0) reverse(points, n);\n\t }\n\t\n\t function point(p) {\n\t p = p.slice();\n\t absolute$$(p, 0);\n\t return p;\n\t }\n\t\n\t function line(arcs) {\n\t var points = [];\n\t for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n\t if (points.length < 2) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function ring(arcs) {\n\t var points = line(arcs);\n\t while (points.length < 4) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function polygon(arcs) {\n\t return arcs.map(ring);\n\t }\n\t\n\t function geometry(o) {\n\t var t = o.type;\n\t return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n\t : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n\t : null;\n\t }\n\t\n\t var geometryType = {\n\t Point: function(o) { return point(o.coordinates); },\n\t MultiPoint: function(o) { return o.coordinates.map(point); },\n\t LineString: function(o) { return line(o.arcs); },\n\t MultiLineString: function(o) { return o.arcs.map(line); },\n\t Polygon: function(o) { return polygon(o.arcs); },\n\t MultiPolygon: function(o) { return o.arcs.map(polygon); }\n\t };\n\t\n\t return geometry(o);\n\t }\n\t\n\t function stitchArcs(topology, arcs) {\n\t var stitchedArcs = {},\n\t fragmentByStart = {},\n\t fragmentByEnd = {},\n\t fragments = [],\n\t emptyIndex = -1;\n\t\n\t // Stitch empty arcs first, since they may be subsumed by other arcs.\n\t arcs.forEach(function(i, j) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], t;\n\t if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n\t t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n\t }\n\t });\n\t\n\t arcs.forEach(function(i) {\n\t var e = ends(i),\n\t start = e[0],\n\t end = e[1],\n\t f, g;\n\t\n\t if (f = fragmentByEnd[start]) {\n\t delete fragmentByEnd[f.end];\n\t f.push(i);\n\t f.end = end;\n\t if (g = fragmentByStart[end]) {\n\t delete fragmentByStart[g.start];\n\t var fg = g === f ? f : f.concat(g);\n\t fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else if (f = fragmentByStart[end]) {\n\t delete fragmentByStart[f.start];\n\t f.unshift(i);\n\t f.start = start;\n\t if (g = fragmentByEnd[start]) {\n\t delete fragmentByEnd[g.end];\n\t var gf = g === f ? f : g.concat(f);\n\t fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else {\n\t f = [i];\n\t fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n\t }\n\t });\n\t\n\t function ends(i) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n\t if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n\t else p1 = arc[arc.length - 1];\n\t return i < 0 ? [p1, p0] : [p0, p1];\n\t }\n\t\n\t function flush(fragmentByEnd, fragmentByStart) {\n\t for (var k in fragmentByEnd) {\n\t var f = fragmentByEnd[k];\n\t delete fragmentByStart[f.start];\n\t delete f.start;\n\t delete f.end;\n\t f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n\t fragments.push(f);\n\t }\n\t }\n\t\n\t flush(fragmentByEnd, fragmentByStart);\n\t flush(fragmentByStart, fragmentByEnd);\n\t arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\t\n\t return fragments;\n\t }\n\t\n\t function mesh(topology) {\n\t return object(topology, meshArcs.apply(this, arguments));\n\t }\n\t\n\t function meshArcs(topology, o, filter) {\n\t var arcs = [];\n\t\n\t function arc(i) {\n\t var j = i < 0 ? ~i : i;\n\t (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n\t }\n\t\n\t function line(arcs) {\n\t arcs.forEach(arc);\n\t }\n\t\n\t function polygon(arcs) {\n\t arcs.forEach(line);\n\t }\n\t\n\t function geometry(o) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n\t else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n\t }\n\t\n\t if (arguments.length > 1) {\n\t var geomsByArc = [],\n\t geom;\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n\t };\n\t\n\t geometry(o);\n\t\n\t geomsByArc.forEach(arguments.length < 3\n\t ? function(geoms) { arcs.push(geoms[0].i); }\n\t : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n\t } else {\n\t for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n\t }\n\t\n\t return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n\t }\n\t\n\t function triangle(triangle) {\n\t var a = triangle[0], b = triangle[1], c = triangle[2];\n\t return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n\t }\n\t\n\t function ring(ring) {\n\t var i = -1,\n\t n = ring.length,\n\t a,\n\t b = ring[n - 1],\n\t area = 0;\n\t\n\t while (++i < n) {\n\t a = b;\n\t b = ring[i];\n\t area += a[0] * b[1] - a[1] * b[0];\n\t }\n\t\n\t return area / 2;\n\t }\n\t\n\t function merge(topology) {\n\t return object(topology, mergeArcs.apply(this, arguments));\n\t }\n\t\n\t function mergeArcs(topology, objects) {\n\t var polygonsByArc = {},\n\t polygons = [],\n\t components = [];\n\t\n\t objects.forEach(function(o) {\n\t if (o.type === \"Polygon\") register(o.arcs);\n\t else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n\t });\n\t\n\t function register(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n\t });\n\t });\n\t polygons.push(polygon);\n\t }\n\t\n\t function exterior(ring$$) {\n\t return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n\t }\n\t\n\t polygons.forEach(function(polygon) {\n\t if (!polygon._) {\n\t var component = [],\n\t neighbors = [polygon];\n\t polygon._ = 1;\n\t components.push(component);\n\t while (polygon = neighbors.pop()) {\n\t component.push(polygon);\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n\t if (!polygon._) {\n\t polygon._ = 1;\n\t neighbors.push(polygon);\n\t }\n\t });\n\t });\n\t });\n\t }\n\t }\n\t });\n\t\n\t polygons.forEach(function(polygon) {\n\t delete polygon._;\n\t });\n\t\n\t return {\n\t type: \"MultiPolygon\",\n\t arcs: components.map(function(polygons) {\n\t var arcs = [], n;\n\t\n\t // Extract the exterior (unique) arcs.\n\t polygons.forEach(function(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n\t arcs.push(arc);\n\t }\n\t });\n\t });\n\t });\n\t\n\t // Stitch the arcs into one or more rings.\n\t arcs = stitchArcs(topology, arcs);\n\t\n\t // If more than one ring is returned,\n\t // at most one of these rings can be the exterior;\n\t // this exterior ring has the same winding order\n\t // as any exterior ring in the original polygons.\n\t if ((n = arcs.length) > 1) {\n\t var sgn = exterior(polygons[0][0]);\n\t for (var i = 0, t; i < n; ++i) {\n\t if (sgn === exterior(arcs[i])) {\n\t t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t return arcs;\n\t })\n\t };\n\t }\n\t\n\t function neighbors(objects) {\n\t var indexesByArc = {}, // arc index -> array of object indexes\n\t neighbors = objects.map(function() { return []; });\n\t\n\t function line(arcs, i) {\n\t arcs.forEach(function(a) {\n\t if (a < 0) a = ~a;\n\t var o = indexesByArc[a];\n\t if (o) o.push(i);\n\t else indexesByArc[a] = [i];\n\t });\n\t }\n\t\n\t function polygon(arcs, i) {\n\t arcs.forEach(function(arc) { line(arc, i); });\n\t }\n\t\n\t function geometry(o, i) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n\t else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n\t }\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n\t };\n\t\n\t objects.forEach(geometry);\n\t\n\t for (var i in indexesByArc) {\n\t for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n\t for (var k = j + 1; k < m; ++k) {\n\t var ij = indexes[j], ik = indexes[k], n;\n\t if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n\t if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n\t }\n\t }\n\t }\n\t\n\t return neighbors;\n\t }\n\t\n\t function compareArea(a, b) {\n\t return a[1][2] - b[1][2];\n\t }\n\t\n\t function minAreaHeap() {\n\t var heap = {},\n\t array = [],\n\t size = 0;\n\t\n\t heap.push = function(object) {\n\t up(array[object._ = size] = object, size++);\n\t return size;\n\t };\n\t\n\t heap.pop = function() {\n\t if (size <= 0) return;\n\t var removed = array[0], object;\n\t if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n\t return removed;\n\t };\n\t\n\t heap.remove = function(removed) {\n\t var i = removed._, object;\n\t if (array[i] !== removed) return; // invalid request\n\t if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n\t return i;\n\t };\n\t\n\t function up(object, i) {\n\t while (i > 0) {\n\t var j = ((i + 1) >> 1) - 1,\n\t parent = array[j];\n\t if (compareArea(object, parent) >= 0) break;\n\t array[parent._ = i] = parent;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t function down(object, i) {\n\t while (true) {\n\t var r = (i + 1) << 1,\n\t l = r - 1,\n\t j = i,\n\t child = array[j];\n\t if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n\t if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n\t if (j === i) break;\n\t array[child._ = i] = child;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t return heap;\n\t }\n\t\n\t function presimplify(topology, triangleArea) {\n\t var absolute$$ = absolute(topology.transform),\n\t relative$$ = relative(topology.transform),\n\t heap = minAreaHeap();\n\t\n\t if (!triangleArea) triangleArea = triangle;\n\t\n\t topology.arcs.forEach(function(arc) {\n\t var triangles = [],\n\t maxArea = 0,\n\t triangle,\n\t i,\n\t n,\n\t p;\n\t\n\t // To store each point’s effective area, we create a new array rather than\n\t // extending the passed-in point to workaround a Chrome/V8 bug (getting\n\t // stuck in smi mode). For midpoints, the initial effective area of\n\t // Infinity will be computed in the next step.\n\t for (i = 0, n = arc.length; i < n; ++i) {\n\t p = arc[i];\n\t absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n\t }\n\t\n\t for (i = 1, n = arc.length - 1; i < n; ++i) {\n\t triangle = arc.slice(i - 1, i + 2);\n\t triangle[1][2] = triangleArea(triangle);\n\t triangles.push(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t for (i = 0, n = triangles.length; i < n; ++i) {\n\t triangle = triangles[i];\n\t triangle.previous = triangles[i - 1];\n\t triangle.next = triangles[i + 1];\n\t }\n\t\n\t while (triangle = heap.pop()) {\n\t var previous = triangle.previous,\n\t next = triangle.next;\n\t\n\t // If the area of the current point is less than that of the previous point\n\t // to be eliminated, use the latter's area instead. This ensures that the\n\t // current point cannot be eliminated without eliminating previously-\n\t // eliminated points.\n\t if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n\t else maxArea = triangle[1][2];\n\t\n\t if (previous) {\n\t previous.next = next;\n\t previous[2] = triangle[2];\n\t update(previous);\n\t }\n\t\n\t if (next) {\n\t next.previous = previous;\n\t next[0] = triangle[0];\n\t update(next);\n\t }\n\t }\n\t\n\t arc.forEach(relative$$);\n\t });\n\t\n\t function update(triangle) {\n\t heap.remove(triangle);\n\t triangle[1][2] = triangleArea(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t return topology;\n\t }\n\t\n\t var version = \"1.6.24\";\n\t\n\t exports.version = version;\n\t exports.mesh = mesh;\n\t exports.meshArcs = meshArcs;\n\t exports.merge = merge;\n\t exports.mergeArcs = mergeArcs;\n\t exports.feature = feature;\n\t exports.neighbors = neighbors;\n\t exports.presimplify = presimplify;\n\t\n\t}));\n\n/***/ },\n/* 67 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar normalize = __webpack_require__(68);\n\t\n\tmodule.exports = function(inputs) {\n\t return {\n\t type: 'FeatureCollection',\n\t features: inputs.reduce(function(memo, input) {\n\t return memo.concat(normalize(input).features);\n\t }, [])\n\t };\n\t};\n\n\n/***/ },\n/* 68 */\n/***/ function(module, exports) {\n\n\tmodule.exports = normalize;\n\t\n\tvar types = {\n\t Point: 'geometry',\n\t MultiPoint: 'geometry',\n\t LineString: 'geometry',\n\t MultiLineString: 'geometry',\n\t Polygon: 'geometry',\n\t MultiPolygon: 'geometry',\n\t GeometryCollection: 'geometry',\n\t Feature: 'feature',\n\t FeatureCollection: 'featurecollection'\n\t};\n\t\n\t/**\n\t * Normalize a GeoJSON feature into a FeatureCollection.\n\t *\n\t * @param {object} gj geojson data\n\t * @returns {object} normalized geojson data\n\t */\n\tfunction normalize(gj) {\n\t if (!gj || !gj.type) return null;\n\t var type = types[gj.type];\n\t if (!type) return null;\n\t\n\t if (type === 'geometry') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [{\n\t type: 'Feature',\n\t properties: {},\n\t geometry: gj\n\t }]\n\t };\n\t } else if (type === 'feature') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [gj]\n\t };\n\t } else if (type === 'featurecollection') {\n\t return gj;\n\t }\n\t}\n\n\n/***/ },\n/* 69 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * BufferGeometry helpers\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar Buffer = (function () {\n\t // Merge multiple attribute objects into a single attribute object\n\t //\n\t // Attribute objects must all use the same attribute keys\n\t var mergeAttributes = function mergeAttributes(attributes) {\n\t var lengths = {};\n\t\n\t // Find array lengths\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lengths[k]) {\n\t lengths[k] = 0;\n\t }\n\t\n\t lengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t var mergedAttributes = {};\n\t\n\t // Set up arrays to merge into\n\t for (var k in lengths) {\n\t mergedAttributes[k] = new Float32Array(lengths[k]);\n\t }\n\t\n\t var lastLengths = {};\n\t\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lastLengths[k]) {\n\t lastLengths[k] = 0;\n\t }\n\t\n\t mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\t\n\t lastLengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t return mergedAttributes;\n\t };\n\t\n\t var createLineGeometry = function createLineGeometry(lines, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t var vertices = new Float32Array(lines.verticesCount * 3);\n\t var colours = new Float32Array(lines.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (lines.pickingIds) {\n\t // One component per vertex (1)\n\t pickingIds = new Float32Array(lines.verticesCount);\n\t }\n\t\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < lines.vertices.length; i++) {\n\t _vertices = lines.vertices[i];\n\t _colour = lines.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = lines.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _vertices.length; j++) {\n\t var ax = _vertices[j][0] + offset.x;\n\t var ay = _vertices[j][1];\n\t var az = _vertices[j][2] + offset.y;\n\t\n\t var c1 = _colour[j];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t // TODO: Make picking IDs optional\n\t var createGeometry = function createGeometry(attributes, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(attributes.facesCount * 9);\n\t var normals = new Float32Array(attributes.facesCount * 9);\n\t var colours = new Float32Array(attributes.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (attributes.pickingIds) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(attributes.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t var _faces;\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t var lastIndex = 0;\n\t for (var i = 0; i < attributes.faces.length; i++) {\n\t _faces = attributes.faces[i];\n\t _vertices = attributes.vertices[i];\n\t _colour = attributes.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = attributes.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _faces.length; j++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[j][0];\n\t\n\t var ax = _vertices[index][0] + offset.x;\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2] + offset.y;\n\t\n\t var c1 = _colour[j][0];\n\t\n\t index = _faces[j][1];\n\t\n\t var bx = _vertices[index][0] + offset.x;\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2] + offset.y;\n\t\n\t var c2 = _colour[j][1];\n\t\n\t index = _faces[j][2];\n\t\n\t var cx = _vertices[index][0] + offset.x;\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2] + offset.y;\n\t\n\t var c3 = _colour[j][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t return {\n\t mergeAttributes: mergeAttributes,\n\t createLineGeometry: createLineGeometry,\n\t createGeometry: createGeometry\n\t };\n\t})();\n\t\n\texports['default'] = Buffer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _PickingShader = __webpack_require__(71);\n\t\n\tvar _PickingShader2 = _interopRequireDefault(_PickingShader);\n\t\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingMaterial = function PickingMaterial() {\n\t _three2['default'].ShaderMaterial.call(this, {\n\t uniforms: {\n\t size: {\n\t type: 'f',\n\t value: 0.01\n\t },\n\t scale: {\n\t type: 'f',\n\t value: 400\n\t }\n\t },\n\t // attributes: ['position', 'id'],\n\t vertexShader: _PickingShader2['default'].vertexShader,\n\t fragmentShader: _PickingShader2['default'].fragmentShader\n\t });\n\t\n\t this.linePadding = 2;\n\t};\n\t\n\tPickingMaterial.prototype = Object.create(_three2['default'].ShaderMaterial.prototype);\n\t\n\tPickingMaterial.prototype.constructor = PickingMaterial;\n\t\n\tPickingMaterial.prototype.setPointSize = function (size) {\n\t this.uniforms.size.value = size;\n\t};\n\t\n\tPickingMaterial.prototype.setPointScale = function (scale) {\n\t this.uniforms.scale.value = scale;\n\t};\n\t\n\texports['default'] = PickingMaterial;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 71 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingShader = {\n\t\tvertexShader: ['attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'', 'varying vec4 worldId;', '', 'void main() {', ' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);', ' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);', ' worldId = vec4(a,1);', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['#ifdef GL_ES\\n', 'precision highp float;\\n', '#endif\\n', '', 'varying vec4 worldId;', '', 'void main() {', ' gl_FragColor = worldId;', '}'].join('\\n')\n\t};\n\t\n\texports['default'] = PickingShader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 72 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONTileLayer2 = __webpack_require__(61);\n\t\n\tvar _GeoJSONTileLayer3 = _interopRequireDefault(_GeoJSONTileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONTileLayer = (function (_GeoJSONTileLayer) {\n\t _inherits(TopoJSONTileLayer, _GeoJSONTileLayer);\n\t\n\t function TopoJSONTileLayer(path, options) {\n\t _classCallCheck(this, TopoJSONTileLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONTileLayer.prototype), 'constructor', this).call(this, path, options);\n\t }\n\t\n\t return TopoJSONTileLayer;\n\t})(_GeoJSONTileLayer3['default']);\n\t\n\texports['default'] = TopoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new TopoJSONTileLayer(path, options);\n\t};\n\t\n\texports.topoJSONTileLayer = noNew;\n\n/***/ },\n/* 73 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Consider adopting GeoJSON CSS\n\t// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\t\n\tvar _LayerGroup2 = __webpack_require__(74);\n\t\n\tvar _LayerGroup3 = _interopRequireDefault(_LayerGroup2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _reqwest = __webpack_require__(63);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _utilGeoJSON = __webpack_require__(65);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _geometryPolygonLayer = __webpack_require__(75);\n\t\n\tvar _geometryPolygonLayer2 = _interopRequireDefault(_geometryPolygonLayer);\n\t\n\tvar _geometryPolylineLayer = __webpack_require__(78);\n\t\n\tvar _geometryPolylineLayer2 = _interopRequireDefault(_geometryPolylineLayer);\n\t\n\tvar _geometryPointLayer = __webpack_require__(79);\n\t\n\tvar _geometryPointLayer2 = _interopRequireDefault(_geometryPointLayer);\n\t\n\tvar GeoJSONLayer = (function (_LayerGroup) {\n\t _inherits(GeoJSONLayer, _LayerGroup);\n\t\n\t function GeoJSONLayer(geojson, options) {\n\t _classCallCheck(this, GeoJSONLayer);\n\t\n\t var defaults = {\n\t output: false,\n\t interactive: false,\n\t topojson: false,\n\t filter: null,\n\t onEachFeature: null,\n\t pointGeometry: null,\n\t style: _utilGeoJSON2['default'].defaultStyle\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t _options.style = options.style;\n\t } else {\n\t _options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._geojson = geojson;\n\t }\n\t\n\t _createClass(GeoJSONLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new THREE.Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t // Request data from URL if needed\n\t if (typeof this._geojson === 'string') {\n\t this._requestData(this._geojson);\n\t } else {\n\t // Process and add GeoJSON to layer\n\t this._processData(this._geojson);\n\t }\n\t }\n\t }, {\n\t key: '_requestData',\n\t value: function _requestData(url) {\n\t var _this = this;\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this._request = null;\n\t _this._processData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this._request = null;\n\t });\n\t }\n\t\n\t // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n\t // GeoJSON output layer\n\t //\n\t // Need to be careful as to not make it impossible to fork this off into a\n\t // worker script at a later stage\n\t }, {\n\t key: '_processData',\n\t value: function _processData(data) {\n\t var _this2 = this;\n\t\n\t // Collects features into a single FeatureCollection\n\t //\n\t // Also converts TopoJSON to GeoJSON if instructed\n\t this._geojson = _utilGeoJSON2['default'].collectFeatures(data, this._options.topojson);\n\t\n\t // TODO: Check that GeoJSON is valid / usable\n\t\n\t var features = this._geojson.features;\n\t\n\t // Run filter, if provided\n\t if (this._options.filter) {\n\t features = this._geojson.features.filter(this._options.filter);\n\t }\n\t\n\t var defaults = {};\n\t\n\t // Assume that a style won't be set per feature\n\t var style = this._options.style;\n\t\n\t var options;\n\t features.forEach(function (feature) {\n\t // Get per-feature style object, if provided\n\t if (typeof _this2._options.style === 'function') {\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, _this2._options.style(feature));\n\t }\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, {\n\t // If merging feature layers, stop them outputting themselves\n\t // If not, let feature layers output themselves to the world\n\t output: !_this2.isOutput(),\n\t interactive: _this2._options.interactive,\n\t style: style\n\t });\n\t\n\t var layer = _this2._featureToLayer(feature, options);\n\t\n\t if (!layer) {\n\t return;\n\t }\n\t\n\t layer.feature = feature;\n\t\n\t // If defined, call a function for each feature\n\t //\n\t // This is commonly used for adding event listeners from the user script\n\t if (_this2._options.onEachFeature) {\n\t _this2._options.onEachFeature(feature, layer);\n\t }\n\t\n\t _this2.addLayer(layer);\n\t });\n\t\n\t // If merging layers do that now, otherwise skip as the geometry layers\n\t // should have already outputted themselves\n\t if (!this.isOutput()) {\n\t return;\n\t }\n\t\n\t // From here on we can assume that we want to merge the layers\n\t\n\t var polygonAttributes = [];\n\t var polygonFlat = true;\n\t\n\t var polylineAttributes = [];\n\t var pointAttributes = [];\n\t\n\t this._layers.forEach(function (layer) {\n\t if (layer instanceof _geometryPolygonLayer2['default']) {\n\t polygonAttributes.push(layer.getBufferAttributes());\n\t\n\t if (polygonFlat && !layer.isFlat()) {\n\t polygonFlat = false;\n\t }\n\t } else if (layer instanceof _geometryPolylineLayer2['default']) {\n\t polylineAttributes.push(layer.getBufferAttributes());\n\t } else if (layer instanceof _geometryPointLayer2['default']) {\n\t pointAttributes.push(layer.getBufferAttributes());\n\t }\n\t });\n\t\n\t if (polygonAttributes.length > 0) {\n\t var mergedPolygonAttributes = _utilBuffer2['default'].mergeAttributes(polygonAttributes);\n\t this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n\t this.add(this._polygonMesh);\n\t }\n\t\n\t if (polylineAttributes.length > 0) {\n\t var mergedPolylineAttributes = _utilBuffer2['default'].mergeAttributes(polylineAttributes);\n\t this._setPolylineMesh(mergedPolylineAttributes);\n\t this.add(this._polylineMesh);\n\t }\n\t\n\t if (pointAttributes.length > 0) {\n\t var mergedPointAttributes = _utilBuffer2['default'].mergeAttributes(pointAttributes);\n\t this._setPointMesh(mergedPointAttributes);\n\t this.add(this._pointMesh);\n\t }\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // TODO: De-dupe this from the individual mesh creation logic within each\n\t // geometry layer (materials, settings, etc)\n\t //\n\t // Could make this an abstract method for each geometry layer\n\t }, {\n\t key: '_setPolygonMesh',\n\t value: function _setPolygonMesh(attributes, flat) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t\n\t if (flat) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._polygonMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPolylineMesh',\n\t value: function _setPolylineMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t // TODO: Make this work when style is a function per feature\n\t var style = typeof this._options.style === 'function' ? this._options.style(this._geojson.features[0]) : this._options.style;\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, style);\n\t\n\t var material = new THREE.LineBasicMaterial({\n\t vertexColors: THREE.VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t\n\t var mesh = new THREE.LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new THREE.LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._polylineMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPointMesh',\n\t value: function _setPointMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._pointMesh = mesh;\n\t }\n\t\n\t // TODO: Support all GeoJSON geometry types\n\t }, {\n\t key: '_featureToLayer',\n\t value: function _featureToLayer(feature, options) {\n\t var geometry = feature.geometry;\n\t var coordinates = geometry.coordinates ? geometry.coordinates : null;\n\t\n\t if (!coordinates || !geometry) {\n\t return;\n\t }\n\t\n\t if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n\t return new _geometryPolygonLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n\t return new _geometryPolylineLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n\t // Get geometry object to use for point, if provided\n\t if (typeof this._options.pointGeometry === 'function') {\n\t options.geometry = this._options.pointGeometry(feature);\n\t }\n\t\n\t return new _geometryPointLayer2['default'](coordinates, options);\n\t }\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONLayer;\n\t})(_LayerGroup3['default']);\n\t\n\texports['default'] = GeoJSONLayer;\n\t\n\tvar noNew = function noNew(geojson, options) {\n\t return new GeoJSONLayer(geojson, options);\n\t};\n\t\n\texports.geoJSONLayer = noNew;\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar LayerGroup = (function (_Layer) {\n\t _inherits(LayerGroup, _Layer);\n\t\n\t function LayerGroup(options) {\n\t _classCallCheck(this, LayerGroup);\n\t\n\t var defaults = {\n\t output: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._layers = [];\n\t }\n\t\n\t _createClass(LayerGroup, [{\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t this._layers.push(layer);\n\t this._world.addLayer(layer);\n\t }\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t this._world.removeLayer(layer);\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t for (var i = 0; i < this._layers.length; i++) {\n\t this._layers[i].destroy();\n\t }\n\t\n\t this._layers = null;\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return LayerGroup;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = LayerGroup;\n\t\n\tvar noNew = function noNew(options) {\n\t return new LayerGroup(options);\n\t};\n\t\n\texports.layerGroup = noNew;\n\n/***/ },\n/* 75 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _earcut2 = __webpack_require__(76);\n\t\n\tvar _earcut3 = _interopRequireDefault(_earcut2);\n\t\n\tvar _utilExtrudePolygon = __webpack_require__(77);\n\t\n\tvar _utilExtrudePolygon2 = _interopRequireDefault(_utilExtrudePolygon);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolygonLayer = (function (_Layer) {\n\t _inherits(PolygonLayer, _Layer);\n\t\n\t function PolygonLayer(coordinates, options) {\n\t _classCallCheck(this, PolygonLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t color: '#ffffff',\n\t height: 0\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of polygons so it's easy to support\n\t // MultiPolygon features (a single polygon would be a MultiPolygon with a\n\t // single polygon in the array)\n\t this._coordinates = PolygonLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t }\n\t\n\t _createClass(PolygonLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polygon as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._coordinates[0][0][0];\n\t }\n\t\n\t // Return polygon bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.height && this._options.style.height !== 0) {\n\t height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.color);\n\t\n\t // Light and dark colours used for poor-mans AO gradient on object sides\n\t var light = new _three2['default'].Color(0xffffff);\n\t var shadow = new _three2['default'].Color(0x666666);\n\t\n\t // For each polygon\n\t var attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t // Convert coordinates to earcut format\n\t var _earcut = _this2._toEarcut(_projectedCoordinates);\n\t\n\t // Triangulate faces using earcut\n\t var faces = _this2._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\t\n\t var groupedVertices = [];\n\t for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n\t groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n\t }\n\t\n\t var extruded = (0, _utilExtrudePolygon2['default'])(groupedVertices, faces, {\n\t bottom: 0,\n\t top: height\n\t });\n\t\n\t var topColor = colour.clone().multiply(light);\n\t var bottomColor = colour.clone().multiply(shadow);\n\t\n\t var _vertices = extruded.positions;\n\t var _faces = [];\n\t var _colours = [];\n\t\n\t var _colour;\n\t extruded.top.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t\n\t _this2._flat = true;\n\t\n\t if (extruded.sides) {\n\t _this2._flat = false;\n\t\n\t // Set up colours for every vertex with poor-mans AO on the sides\n\t extruded.sides.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t // First face is always bottom-bottom-top\n\t if (fi % 2 === 0) {\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t // Reverse winding for the second face\n\t // top-top-bottom\n\t } else {\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t }\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t }\n\t\n\t // Skip bottom as there's no point rendering it\n\t // allFaces.push(extruded.faces);\n\t\n\t var polygon = {\n\t vertices: _vertices,\n\t faces: _faces,\n\t colours: _colours,\n\t facesCount: _faces.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t polygon.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert polygon representation to proper attribute arrays\n\t return _this2._toAttributes(polygon);\n\t });\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshPhongMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t\n\t if (this.isFlat()) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Convert coordinates array to something earcut can understand\n\t }, {\n\t key: '_toEarcut',\n\t value: function _toEarcut(coordinates) {\n\t var dim = 2;\n\t var result = { vertices: [], holes: [], dimensions: dim };\n\t var holeIndex = 0;\n\t\n\t for (var i = 0; i < coordinates.length; i++) {\n\t for (var j = 0; j < coordinates[i].length; j++) {\n\t // for (var d = 0; d < dim; d++) {\n\t result.vertices.push(coordinates[i][j].x);\n\t result.vertices.push(coordinates[i][j].y);\n\t // }\n\t }\n\t if (i > 0) {\n\t holeIndex += coordinates[i - 1].length;\n\t result.holes.push(holeIndex);\n\t }\n\t }\n\t\n\t return result;\n\t }\n\t\n\t // Triangulate earcut-based input using earcut\n\t }, {\n\t key: '_triangulate',\n\t value: function _triangulate(contour, holes, dim) {\n\t // console.time('earcut');\n\t\n\t var faces = (0, _earcut3['default'])(contour, holes, dim);\n\t var result = [];\n\t\n\t for (i = 0, il = faces.length; i < il; i += 3) {\n\t result.push(faces.slice(i, i + 3));\n\t }\n\t\n\t // console.timeEnd('earcut');\n\t\n\t return result;\n\t }\n\t\n\t // Transform polygon representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(polygon) {\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(polygon.facesCount * 9);\n\t var normals = new Float32Array(polygon.facesCount * 9);\n\t var colours = new Float32Array(polygon.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (polygon.pickingId) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(polygon.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t\n\t var _faces = polygon.faces;\n\t var _vertices = polygon.vertices;\n\t var _colour = polygon.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = polygon.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _faces.length; i++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[i][0];\n\t\n\t var ax = _vertices[index][0];\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2];\n\t\n\t var c1 = _colour[i][0];\n\t\n\t index = _faces[i][1];\n\t\n\t var bx = _vertices[index][0];\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2];\n\t\n\t var c2 = _colour[i][1];\n\t\n\t index = _faces[i][2];\n\t\n\t var cx = _vertices[index][0];\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2];\n\t\n\t var c3 = _colour[i][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t normals: normals,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the polygon is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPolygon GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0][0]);\n\t }\n\t }]);\n\t\n\t return PolygonLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolygonLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolygonLayer(coordinates, options);\n\t};\n\t\n\texports.polygonLayer = noNew;\n\n/***/ },\n/* 76 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = earcut;\n\t\n\tfunction earcut(data, holeIndices, dim) {\n\t\n\t dim = dim || 2;\n\t\n\t var hasHoles = holeIndices && holeIndices.length,\n\t outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n\t outerNode = linkedList(data, 0, outerLen, dim, true),\n\t triangles = [];\n\t\n\t if (!outerNode) return triangles;\n\t\n\t var minX, minY, maxX, maxY, x, y, size;\n\t\n\t if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\t\n\t // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t if (data.length > 80 * dim) {\n\t minX = maxX = data[0];\n\t minY = maxY = data[1];\n\t\n\t for (var i = dim; i < outerLen; i += dim) {\n\t x = data[i];\n\t y = data[i + 1];\n\t if (x < minX) minX = x;\n\t if (y < minY) minY = y;\n\t if (x > maxX) maxX = x;\n\t if (y > maxY) maxY = y;\n\t }\n\t\n\t // minX, minY and size are later used to transform coords into integers for z-order calculation\n\t size = Math.max(maxX - minX, maxY - minY);\n\t }\n\t\n\t earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\t\n\t return triangles;\n\t}\n\t\n\t// create a circular doubly linked list from polygon points in the specified winding order\n\tfunction linkedList(data, start, end, dim, clockwise) {\n\t var sum = 0,\n\t i, j, last;\n\t\n\t // calculate original winding order of a polygon ring\n\t for (i = start, j = end - dim; i < end; i += dim) {\n\t sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n\t j = i;\n\t }\n\t\n\t // link points into circular doubly-linked list in the specified winding order\n\t if (clockwise === (sum > 0)) {\n\t for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n\t } else {\n\t for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n\t }\n\t\n\t return last;\n\t}\n\t\n\t// eliminate colinear or duplicate points\n\tfunction filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\t\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\t\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\t\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\t\n\t return end;\n\t}\n\t\n\t// main ear slicing loop which triangulates a polygon (given as a linked list)\n\tfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n\t if (!ear) return;\n\t\n\t // interlink polygon nodes in z-order\n\t if (!pass && size) indexCurve(ear, minX, minY, size);\n\t\n\t var stop = ear,\n\t prev, next;\n\t\n\t // iterate through ears, slicing them one by one\n\t while (ear.prev !== ear.next) {\n\t prev = ear.prev;\n\t next = ear.next;\n\t\n\t if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n\t // cut off the triangle\n\t triangles.push(prev.i / dim);\n\t triangles.push(ear.i / dim);\n\t triangles.push(next.i / dim);\n\t\n\t removeNode(ear);\n\t\n\t // skipping the next vertice leads to less sliver triangles\n\t ear = next.next;\n\t stop = next.next;\n\t\n\t continue;\n\t }\n\t\n\t ear = next;\n\t\n\t // if we looped through the whole remaining polygon and can't find any more ears\n\t if (ear === stop) {\n\t // try filtering points and slicing again\n\t if (!pass) {\n\t earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\t\n\t // if this didn't work, try curing all small self-intersections locally\n\t } else if (pass === 1) {\n\t ear = cureLocalIntersections(ear, triangles, dim);\n\t earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\t\n\t // as a last resort, try splitting the remaining polygon into two\n\t } else if (pass === 2) {\n\t splitEarcut(ear, triangles, dim, minX, minY, size);\n\t }\n\t\n\t break;\n\t }\n\t }\n\t}\n\t\n\t// check whether a polygon node forms a valid ear with adjacent nodes\n\tfunction isEar(ear) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // now make sure we don't have other points inside the potential ear\n\t var p = ear.next.next;\n\t\n\t while (p !== ear.prev) {\n\t if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.next;\n\t }\n\t\n\t return true;\n\t}\n\t\n\tfunction isEarHashed(ear, minX, minY, size) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // triangle bbox; min & max are calculated like this for speed\n\t var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n\t minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n\t maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n\t maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\t\n\t // z-order range for the current triangle bbox;\n\t var minZ = zOrder(minTX, minTY, minX, minY, size),\n\t maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\t\n\t // first look for points inside the triangle in increasing z-order\n\t var p = ear.nextZ;\n\t\n\t while (p && p.z <= maxZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.nextZ;\n\t }\n\t\n\t // then look for points in decreasing z-order\n\t p = ear.prevZ;\n\t\n\t while (p && p.z >= minZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.prevZ;\n\t }\n\t\n\t return true;\n\t}\n\t\n\t// go through all polygon nodes and cure small local self-intersections\n\tfunction cureLocalIntersections(start, triangles, dim) {\n\t var p = start;\n\t do {\n\t var a = p.prev,\n\t b = p.next.next;\n\t\n\t // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n\t if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\t\n\t triangles.push(a.i / dim);\n\t triangles.push(p.i / dim);\n\t triangles.push(b.i / dim);\n\t\n\t // remove two nodes involved\n\t removeNode(p);\n\t removeNode(p.next);\n\t\n\t p = start = b;\n\t }\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return p;\n\t}\n\t\n\t// try splitting polygon into two and triangulate them independently\n\tfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n\t // look for a valid diagonal that divides the polygon into two\n\t var a = start;\n\t do {\n\t var b = a.next.next;\n\t while (b !== a.prev) {\n\t if (a.i !== b.i && isValidDiagonal(a, b)) {\n\t // split the polygon in two by the diagonal\n\t var c = splitPolygon(a, b);\n\t\n\t // filter colinear points around the cuts\n\t a = filterPoints(a, a.next);\n\t c = filterPoints(c, c.next);\n\t\n\t // run earcut on each half\n\t earcutLinked(a, triangles, dim, minX, minY, size);\n\t earcutLinked(c, triangles, dim, minX, minY, size);\n\t return;\n\t }\n\t b = b.next;\n\t }\n\t a = a.next;\n\t } while (a !== start);\n\t}\n\t\n\t// link every hole into the outer loop, producing a single-ring polygon without holes\n\tfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n\t var queue = [],\n\t i, len, start, end, list;\n\t\n\t for (i = 0, len = holeIndices.length; i < len; i++) {\n\t start = holeIndices[i] * dim;\n\t end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n\t list = linkedList(data, start, end, dim, false);\n\t if (list === list.next) list.steiner = true;\n\t queue.push(getLeftmost(list));\n\t }\n\t\n\t queue.sort(compareX);\n\t\n\t // process holes from left to right\n\t for (i = 0; i < queue.length; i++) {\n\t eliminateHole(queue[i], outerNode);\n\t outerNode = filterPoints(outerNode, outerNode.next);\n\t }\n\t\n\t return outerNode;\n\t}\n\t\n\tfunction compareX(a, b) {\n\t return a.x - b.x;\n\t}\n\t\n\t// find a bridge between vertices that connects hole with an outer ring and and link it\n\tfunction eliminateHole(hole, outerNode) {\n\t outerNode = findHoleBridge(hole, outerNode);\n\t if (outerNode) {\n\t var b = splitPolygon(outerNode, hole);\n\t filterPoints(b, b.next);\n\t }\n\t}\n\t\n\t// David Eberly's algorithm for finding a bridge between hole and outer polygon\n\tfunction findHoleBridge(hole, outerNode) {\n\t var p = outerNode,\n\t hx = hole.x,\n\t hy = hole.y,\n\t qx = -Infinity,\n\t m;\n\t\n\t // find a segment intersected by a ray from the hole's leftmost point to the left;\n\t // segment's endpoint with lesser x will be potential connection point\n\t do {\n\t if (hy <= p.y && hy >= p.next.y) {\n\t var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n\t if (x <= hx && x > qx) {\n\t qx = x;\n\t m = p.x < p.next.x ? p : p.next;\n\t }\n\t }\n\t p = p.next;\n\t } while (p !== outerNode);\n\t\n\t if (!m) return null;\n\t\n\t if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\t\n\t // look for points inside the triangle of hole point, segment intersection and endpoint;\n\t // if there are no points found, we have a valid connection;\n\t // otherwise choose the point of the minimum angle with the ray as connection point\n\t\n\t var stop = m,\n\t tanMin = Infinity,\n\t tan;\n\t\n\t p = m.next;\n\t\n\t while (p !== stop) {\n\t if (hx >= p.x && p.x >= m.x &&\n\t pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\t\n\t tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\t\n\t if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n\t m = p;\n\t tanMin = tan;\n\t }\n\t }\n\t\n\t p = p.next;\n\t }\n\t\n\t return m;\n\t}\n\t\n\t// interlink polygon nodes in z-order\n\tfunction indexCurve(start, minX, minY, size) {\n\t var p = start;\n\t do {\n\t if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n\t p.prevZ = p.prev;\n\t p.nextZ = p.next;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t p.prevZ.nextZ = null;\n\t p.prevZ = null;\n\t\n\t sortLinked(p);\n\t}\n\t\n\t// Simon Tatham's linked list merge sort algorithm\n\t// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\n\tfunction sortLinked(list) {\n\t var i, p, q, e, tail, numMerges, pSize, qSize,\n\t inSize = 1;\n\t\n\t do {\n\t p = list;\n\t list = null;\n\t tail = null;\n\t numMerges = 0;\n\t\n\t while (p) {\n\t numMerges++;\n\t q = p;\n\t pSize = 0;\n\t for (i = 0; i < inSize; i++) {\n\t pSize++;\n\t q = q.nextZ;\n\t if (!q) break;\n\t }\n\t\n\t qSize = inSize;\n\t\n\t while (pSize > 0 || (qSize > 0 && q)) {\n\t\n\t if (pSize === 0) {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t } else if (qSize === 0 || !q) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else if (p.z <= q.z) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t }\n\t\n\t if (tail) tail.nextZ = e;\n\t else list = e;\n\t\n\t e.prevZ = tail;\n\t tail = e;\n\t }\n\t\n\t p = q;\n\t }\n\t\n\t tail.nextZ = null;\n\t inSize *= 2;\n\t\n\t } while (numMerges > 1);\n\t\n\t return list;\n\t}\n\t\n\t// z-order of a point given coords and size of the data bounding box\n\tfunction zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\t\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\t\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\t\n\t return x | (y << 1);\n\t}\n\t\n\t// find the leftmost node of a polygon ring\n\tfunction getLeftmost(start) {\n\t var p = start,\n\t leftmost = start;\n\t do {\n\t if (p.x < leftmost.x) leftmost = p;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return leftmost;\n\t}\n\t\n\t// check if a point lies within a convex triangle\n\tfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}\n\t\n\t// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\n\tfunction isValidDiagonal(a, b) {\n\t return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n\t locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n\t}\n\t\n\t// signed area of a triangle\n\tfunction area(p, q, r) {\n\t return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n\t}\n\t\n\t// check if two points are equal\n\tfunction equals(p1, p2) {\n\t return p1.x === p2.x && p1.y === p2.y;\n\t}\n\t\n\t// check if two segments intersect\n\tfunction intersects(p1, q1, p2, q2) {\n\t return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n\t area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n\t}\n\t\n\t// check if a polygon diagonal intersects any polygon segments\n\tfunction intersectsPolygon(a, b) {\n\t var p = a;\n\t do {\n\t if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t intersects(p, p.next, a, b)) return true;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return false;\n\t}\n\t\n\t// check if a polygon diagonal is locally inside the polygon\n\tfunction locallyInside(a, b) {\n\t return area(a.prev, a, a.next) < 0 ?\n\t area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n\t area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n\t}\n\t\n\t// check if the middle point of a polygon diagonal is inside the polygon\n\tfunction middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return inside;\n\t}\n\t\n\t// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n\t// if one belongs to the outer ring and another to a hole, it merges it into a single ring\n\tfunction splitPolygon(a, b) {\n\t var a2 = new Node(a.i, a.x, a.y),\n\t b2 = new Node(b.i, b.x, b.y),\n\t an = a.next,\n\t bp = b.prev;\n\t\n\t a.next = b;\n\t b.prev = a;\n\t\n\t a2.next = an;\n\t an.prev = a2;\n\t\n\t b2.next = a2;\n\t a2.prev = b2;\n\t\n\t bp.next = b2;\n\t b2.prev = bp;\n\t\n\t return b2;\n\t}\n\t\n\t// create a node and optionally link it with previous one (in a circular doubly linked list)\n\tfunction insertNode(i, x, y, last) {\n\t var p = new Node(i, x, y);\n\t\n\t if (!last) {\n\t p.prev = p;\n\t p.next = p;\n\t\n\t } else {\n\t p.next = last.next;\n\t p.prev = last;\n\t last.next.prev = p;\n\t last.next = p;\n\t }\n\t return p;\n\t}\n\t\n\tfunction removeNode(p) {\n\t p.next.prev = p.prev;\n\t p.prev.next = p.next;\n\t\n\t if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n\t if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n\t}\n\t\n\tfunction Node(i, x, y) {\n\t // vertice index in coordinates array\n\t this.i = i;\n\t\n\t // vertex coordinates\n\t this.x = x;\n\t this.y = y;\n\t\n\t // previous and next vertice nodes in a polygon ring\n\t this.prev = null;\n\t this.next = null;\n\t\n\t // z-order curve value\n\t this.z = null;\n\t\n\t // previous and next nodes in z-order\n\t this.prevZ = null;\n\t this.nextZ = null;\n\t\n\t // indicates whether this is a steiner point\n\t this.steiner = false;\n\t}\n\n\n/***/ },\n/* 77 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Extrude a polygon given its vertices and triangulated faces\n\t *\n\t * Based on:\n\t * https://github.com/freeman-lab/extrude\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar extrudePolygon = function extrudePolygon(points, faces, _options) {\n\t var defaults = {\n\t top: 1,\n\t bottom: 0,\n\t closed: true\n\t };\n\t\n\t var options = (0, _lodashAssign2['default'])({}, defaults, _options);\n\t\n\t var n = points.length;\n\t var positions;\n\t var cells;\n\t var topCells;\n\t var bottomCells;\n\t var sideCells;\n\t\n\t // If bottom and top values are identical then return the flat shape\n\t options.top === options.bottom ? flat() : full();\n\t\n\t function flat() {\n\t positions = points.map(function (p) {\n\t return [p[0], options.top, p[1]];\n\t });\n\t cells = faces;\n\t topCells = faces;\n\t }\n\t\n\t function full() {\n\t positions = [];\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.top, p[1]]);\n\t });\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.bottom, p[1]]);\n\t });\n\t\n\t cells = [];\n\t for (var i = 0; i < n; i++) {\n\t if (i === n - 1) {\n\t cells.push([i + n, n, i]);\n\t cells.push([0, i, n]);\n\t } else {\n\t cells.push([i + n, i + n + 1, i]);\n\t cells.push([i + 1, i, i + n + 1]);\n\t }\n\t }\n\t\n\t sideCells = [].concat(cells);\n\t\n\t if (options.closed) {\n\t var top = faces;\n\t var bottom = top.map(function (p) {\n\t return p.map(function (v) {\n\t return v + n;\n\t });\n\t });\n\t bottom = bottom.map(function (p) {\n\t return [p[0], p[2], p[1]];\n\t });\n\t cells = cells.concat(top).concat(bottom);\n\t\n\t topCells = top;\n\t bottomCells = bottom;\n\t }\n\t }\n\t\n\t return {\n\t positions: positions,\n\t faces: cells,\n\t top: topCells,\n\t bottom: bottomCells,\n\t sides: sideCells\n\t };\n\t};\n\t\n\texports['default'] = extrudePolygon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 78 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Provide alternative output using tubes and splines / curves\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolylineLayer = (function (_Layer) {\n\t _inherits(PolylineLayer, _Layer);\n\t\n\t function PolylineLayer(coordinates, options) {\n\t _classCallCheck(this, PolylineLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of lines so it's easy to support\n\t // MultiLineString features (a single line would be a MultiLineString with a\n\t // single line in the array)\n\t this._coordinates = PolylineLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Polyline features are always flat (for now at least)\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PolylineLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polyline as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._coordinates[0][0];\n\t }\n\t\n\t // Return line bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.lineHeight) {\n\t height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.lineColor);\n\t\n\t // For each line\n\t var attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t var _vertices = [];\n\t var _colours = [];\n\t\n\t // Connect coordinate with the next to make a pair\n\t //\n\t // LineSegments requires pairs of vertices so repeat the last point if\n\t // there's an odd number of vertices\n\t var nextCoord;\n\t _projectedCoordinates.forEach(function (coordinate, index) {\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([coordinate.x, height, coordinate.y]);\n\t\n\t nextCoord = _projectedCoordinates[index + 1] ? _projectedCoordinates[index + 1] : coordinate;\n\t\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([nextCoord.x, height, nextCoord.y]);\n\t });\n\t\n\t var line = {\n\t vertices: _vertices,\n\t colours: _colours,\n\t verticesCount: _vertices.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t line.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert line representation to proper attribute arrays\n\t return _this2._toAttributes(line);\n\t });\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var style = this._options.style;\n\t var material = new _three2['default'].LineBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t\n\t var mesh = new _three2['default'].LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new _three2['default'].LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiLineString GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0]);\n\t }\n\t }]);\n\t\n\t return PolylineLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolylineLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolylineLayer(coordinates, options);\n\t};\n\t\n\texports.polylineLayer = noNew;\n\n/***/ },\n/* 79 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Point features may be using custom models / meshes and so an approach\n\t// needs to be found to allow these to be brokwn down into buffer attributes for\n\t// merging\n\t//\n\t// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n\t// and pull out the attributes\n\t\n\t// TODO: Support sprite objects using textures\n\t\n\t// TODO: Provide option to billboard geometry so it always faces the camera\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PointLayer = (function (_Layer) {\n\t _inherits(PointLayer, _Layer);\n\t\n\t function PointLayer(coordinates, options) {\n\t _classCallCheck(this, PointLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // THREE.Geometry or THREE.BufferGeometry to use for point output\n\t //\n\t // TODO: Make this customisable per point via a callback (like style)\n\t geometry: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t pointColor: '#ff0000'\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of points so it's easy to support\n\t // MultiPoint features (a single point would be a MultiPoint with a\n\t // single point in the array)\n\t this._coordinates = PointLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Point features are always flat (for now at least)\n\t //\n\t // This won't always be the case once custom point objects / meshes are\n\t // added\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PointLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of point as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._coordinates;\n\t }\n\t\n\t // Return point bounds in geographic coordinates\n\t //\n\t // While not useful for single points, it could be useful for MultiPoint\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.pointHeight) {\n\t height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.pointColor);\n\t\n\t var geometry;\n\t\n\t // Use default geometry if none has been provided or the provided geometry\n\t // isn't valid\n\t if (!this._options.geometry || !this._options.geometry instanceof _three2['default'].Geometry || !this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t // Debug geometry for points is a thin bar\n\t //\n\t // TODO: Allow point geometry to be customised / overridden\n\t var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n\t var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n\t var _geometry = new _three2['default'].BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\t\n\t // Shift geometry up so it sits on the ground\n\t _geometry.translate(0, geometryHeight * 0.5, 0);\n\t\n\t // Pull attributes out of debug geometry\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(_geometry);\n\t } else {\n\t if (this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t geometry = this._options.geometry;\n\t } else {\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(this._options.geometry);\n\t }\n\t }\n\t\n\t // For each point\n\t var attributes = this._projectedCoordinates.map(function (coordinate) {\n\t var _vertices = [];\n\t var _normals = [];\n\t var _colours = [];\n\t\n\t var _geometry = geometry.clone();\n\t\n\t _geometry.translate(coordinate.x, height, coordinate.y);\n\t\n\t var _vertices = _geometry.attributes.position.clone().array;\n\t var _normals = _geometry.attributes.normal.clone().array;\n\t var _colours = _geometry.attributes.color.clone().array;\n\t\n\t for (var i = 0; i < _colours.length; i += 3) {\n\t _colours[i] = colour.r;\n\t _colours[i + 1] = colour.g;\n\t _colours[i + 2] = colour.b;\n\t }\n\t\n\t var _point = {\n\t vertices: _vertices,\n\t normals: _normals,\n\t colours: _colours\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t // point.pickingId = this._pickingId;\n\t _point.pickingIds = new Float32Array(_vertices.length / 3);\n\t for (var i = 0; i < _point.pickingIds.length; i++) {\n\t _point.pickingIds[i] = _this2._pickingId;\n\t }\n\t }\n\t\n\t // Convert point representation to proper attribute arrays\n\t // return this._toAttributes(_point);\n\t return _point;\n\t });\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var _point;\n\t return this._coordinates.map(function (latlon) {\n\t _point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * _point.x;\n\t _this3._offset.y = -1 * _point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return _point;\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPoint GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0]);\n\t }\n\t }]);\n\t\n\t return PointLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PointLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PointLayer(coordinates, options);\n\t};\n\t\n\texports.pointLayer = noNew;\n\n/***/ },\n/* 80 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONLayer2 = __webpack_require__(73);\n\t\n\tvar _GeoJSONLayer3 = _interopRequireDefault(_GeoJSONLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONLayer = (function (_GeoJSONLayer) {\n\t _inherits(TopoJSONLayer, _GeoJSONLayer);\n\t\n\t function TopoJSONLayer(topojson, options) {\n\t _classCallCheck(this, TopoJSONLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONLayer.prototype), 'constructor', this).call(this, topojson, options);\n\t }\n\t\n\t return TopoJSONLayer;\n\t})(_GeoJSONLayer3['default']);\n\t\n\texports['default'] = TopoJSONLayer;\n\t\n\tvar noNew = function noNew(topojson, options) {\n\t return new TopoJSONLayer(topojson, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.topoJSONLayer = noNew;\n\n/***/ }\n/******/ ])\n});\n;"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 17cc43e152b0cd914e8d\n **/","import World, {world} from './World';\nimport Controls from './controls/index';\n\nimport Layer, {layer} from './layer/Layer';\nimport EnvironmentLayer, {environmentLayer} from './layer/environment/EnvironmentLayer';\nimport ImageTileLayer, {imageTileLayer} from './layer/tile/ImageTileLayer';\nimport GeoJSONTileLayer, {geoJSONTileLayer} from './layer/tile/GeoJSONTileLayer';\nimport TopoJSONTileLayer, {topoJSONTileLayer} from './layer/tile/TopoJSONTileLayer';\nimport GeoJSONLayer, {geoJSONLayer} from './layer/GeoJSONLayer';\nimport TopoJSONLayer, {topoJSONLayer} from './layer/TopoJSONLayer';\nimport PolygonLayer, {polygonLayer} from './layer/geometry/PolygonLayer';\nimport PolylineLayer, {polylineLayer} from './layer/geometry/PolylineLayer';\nimport PointLayer, {pointLayer} from './layer/geometry/PointLayer';\n\nimport Point, {point} from './geo/Point';\nimport LatLon, {latLon} from './geo/LatLon';\n\nconst VIZI = {\n version: '0.3',\n\n // Public API\n World: World,\n world: world,\n Controls: Controls,\n Layer: Layer,\n layer: layer,\n EnvironmentLayer: EnvironmentLayer,\n environmentLayer: environmentLayer,\n ImageTileLayer: ImageTileLayer,\n imageTileLayer: imageTileLayer,\n GeoJSONTileLayer: GeoJSONTileLayer,\n geoJSONTileLayer: geoJSONTileLayer,\n TopoJSONTileLayer: TopoJSONTileLayer,\n topoJSONTileLayer: topoJSONTileLayer,\n GeoJSONLayer: GeoJSONLayer,\n geoJSONLayer: geoJSONLayer,\n TopoJSONLayer: TopoJSONLayer,\n topoJSONLayer: topoJSONLayer,\n PolygonLayer: PolygonLayer,\n polygonLayer: polygonLayer,\n PolylineLayer: PolylineLayer,\n polylineLayer: polylineLayer,\n PointLayer: PointLayer,\n pointLayer: pointLayer,\n Point: Point,\n point: point,\n LatLon: LatLon,\n latLon: latLon\n};\n\nexport default VIZI;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vizicities.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport CRS from './geo/crs/index';\nimport {point as Point} from './geo/Point';\nimport {latLon as LatLon} from './geo/LatLon';\nimport Engine from './engine/Engine';\nimport EnvironmentLayer from './layer/environment/EnvironmentLayer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Pretty much any event someone using ViziCities would need will be emitted or\n// proxied by World (eg. render events, etc)\n\nclass World extends EventEmitter {\n constructor(domId, options) {\n super();\n\n var defaults = {\n crs: CRS.EPSG3857,\n skybox: false\n };\n\n this.options = extend({}, defaults, options);\n\n this._layers = [];\n this._controls = [];\n\n this._initContainer(domId);\n this._initEngine();\n this._initEnvironment();\n this._initEvents();\n\n this._pause = false;\n\n // Kick off the update and render loop\n this._update();\n }\n\n _initContainer(domId) {\n this._container = document.getElementById(domId);\n }\n\n _initEngine() {\n this._engine = new Engine(this._container, this);\n\n // Engine events\n //\n // Consider proxying these through events on World for public access\n // this._engine.on('preRender', () => {});\n // this._engine.on('postRender', () => {});\n }\n\n _initEnvironment() {\n // Not sure if I want to keep this as a private API\n //\n // Makes sense to allow others to customise their environment so perhaps\n // add some method of disable / overriding the environment settings\n this._environment = new EnvironmentLayer({\n skybox: this.options.skybox\n }).addTo(this);\n }\n\n _initEvents() {\n this.on('controlsMoveEnd', this._onControlsMoveEnd);\n }\n\n _onControlsMoveEnd(point) {\n var _point = Point(point.x, point.z);\n this._resetView(this.pointToLatLon(_point), _point);\n }\n\n // Reset world view\n _resetView(latlon, point) {\n this.emit('preResetView');\n\n this._moveStart();\n this._move(latlon, point);\n this._moveEnd();\n\n this.emit('postResetView');\n }\n\n _moveStart() {\n this.emit('moveStart');\n }\n\n _move(latlon, point) {\n this._lastPosition = latlon;\n this.emit('move', latlon, point);\n }\n _moveEnd() {\n this.emit('moveEnd');\n }\n\n _update() {\n if (this._pause) {\n return;\n }\n\n var delta = this._engine.clock.getDelta();\n\n // Once _update is called it will run forever, for now\n window.requestAnimationFrame(this._update.bind(this));\n\n // Update controls\n this._controls.forEach(controls => {\n controls.update();\n });\n\n this.emit('preUpdate', delta);\n this._engine.update(delta);\n this.emit('postUpdate', delta);\n }\n\n // Set world view\n setView(latlon) {\n // Store initial geographic coordinate for the [0,0,0] world position\n //\n // The origin point doesn't move in three.js / 3D space so only set it once\n // here instead of every time _resetView is called\n //\n // If it was updated every time then coorindates would shift over time and\n // would be out of place / context with previously-placed points (0,0 would\n // refer to a different point each time)\n this._originLatlon = latlon;\n this._originPoint = this.project(latlon);\n\n this._resetView(latlon);\n return this;\n }\n\n // Return world geographic position\n getPosition() {\n return this._lastPosition;\n }\n\n // Transform geographic coordinate to world point\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the origin point of the projection (not the world)\n project(latlon) {\n return this.options.crs.latLonToPoint(LatLon(latlon));\n }\n\n // Transform world point to geographic coordinate\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a point relative to the origin point of the\n // projection (not the world) and returns a geographic coordinate\n unproject(point) {\n return this.options.crs.pointToLatLon(Point(point));\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the three.js / 3D origin (0,0)\n latLonToPoint(latlon) {\n var projectedPoint = this.project(LatLon(latlon));\n return projectedPoint._subtract(this._originPoint);\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a point relative to the three.js / 3D origin (0,0)\n // and returns the exact geographic coordinate at that point\n pointToLatLon(point) {\n var projectedPoint = Point(point).add(this._originPoint);\n return this.unproject(projectedPoint);\n }\n\n // Return pointscale for a given geographic coordinate\n pointScale(latlon, accurate) {\n return this.options.crs.pointScale(latlon, accurate);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n metresToWorld(metres, pointScale, zoom) {\n return this.options.crs.metresToWorld(metres, pointScale, zoom);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n worldToMetres(worldUnits, pointScale, zoom) {\n return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n }\n\n // Unsure if it's a good idea to expose this here for components like\n // GridLayer to use (eg. to keep track of a frustum)\n getCamera() {\n return this._engine._camera;\n }\n\n addLayer(layer) {\n layer._addToWorld(this);\n\n this._layers.push(layer);\n\n if (layer.isOutput()) {\n // Could move this into Layer but it'll do here for now\n this._engine._scene.add(layer._object3D);\n this._engine._domScene3D.add(layer._domObject3D);\n this._engine._domScene2D.add(layer._domObject2D);\n }\n\n this.emit('layerAdded', layer);\n return this;\n }\n\n // Remove layer from world and scene but don't destroy it entirely\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n if (layer.isOutput()) {\n this._engine._scene.remove(layer._object3D);\n this._engine._domScene3D.remove(layer._domObject3D);\n this._engine._domScene2D.remove(layer._domObject2D);\n }\n\n this.emit('layerRemoved');\n return this;\n }\n\n addControls(controls) {\n controls._addToWorld(this);\n\n this._controls.push(controls);\n\n this.emit('controlsAdded', controls);\n return this;\n }\n\n // Remove controls from world but don't destroy them entirely\n removeControls(controls) {\n var controlsIndex = this._controls.indexOf(controlsIndex);\n\n if (controlsIndex > -1) {\n this._controls.splice(controlsIndex, 1);\n };\n\n this.emit('controlsRemoved', controls);\n return this;\n }\n\n stop() {\n this._pause = true;\n }\n\n start() {\n this._pause = false;\n this._update();\n }\n\n // Destroys the world(!) and removes it from the scene and memory\n //\n // TODO: World out why so much three.js stuff is left in the heap after this\n destroy() {\n this.stop();\n\n // Remove listeners\n this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\n var i;\n\n // Remove all controls\n var controls;\n for (i = this._controls.length - 1; i >= 0; i--) {\n controls = this._controls[0];\n this.removeControls(controls);\n controls.destroy();\n };\n\n // Remove all layers\n var layer;\n for (i = this._layers.length - 1; i >= 0; i--) {\n layer = this._layers[0];\n this.removeLayer(layer);\n layer.destroy();\n };\n\n // Environment layer is removed with the other layers\n this._environment = null;\n\n this._engine.destroy();\n this._engine = null;\n\n // TODO: Probably should clean the container too / remove the canvas\n this._container = null;\n }\n}\n\nexport default World;\n\nvar noNew = function(domId, options) {\n return new World(domId, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as world};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/World.js\n **/","'use strict';\n\n//\n// We store our EE objects in a plain object whose properties are event names.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// `~` to make sure that the built-in object properties are not overridden or\n// used as an attack vector.\n// We also assume that `Object.create(null)` is available when the event name\n// is an ES6 Symbol.\n//\nvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\n/**\n * Representation of a single EventEmitter function.\n *\n * @param {Function} fn Event handler to be called.\n * @param {Mixed} context Context for function execution.\n * @param {Boolean} once Only emit once\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal EventEmitter interface that is molded against the Node.js\n * EventEmitter interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() { /* Nothing to set */ }\n\n/**\n * Holds the assigned EventEmitters by name.\n *\n * @type {Object}\n * @private\n */\nEventEmitter.prototype._events = undefined;\n\n/**\n * Return a list of assigned event listeners.\n *\n * @param {String} event The events that should be listed.\n * @param {Boolean} exists We only need to know if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events && this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Emit an event to all registered event listeners.\n *\n * @param {String} event The name of the event.\n * @returns {Boolean} Indication if we've emitted an event.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if ('function' === typeof listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Register a new EventListener for the given event.\n *\n * @param {String} event Name of the event.\n * @param {Functon} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Add an EventListener that's only called once.\n *\n * @param {String} event Name of the event.\n * @param {Function} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Remove event listeners.\n *\n * @param {String} event The event we want to remove.\n * @param {Function} fn The listener that we need to find.\n * @param {Mixed} context Only remove listeners matching this context.\n * @param {Boolean} once Only remove once listeners.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return this;\n\n var listeners = this._events[evt]\n , events = [];\n\n if (fn) {\n if (listeners.fn) {\n if (\n listeners.fn !== fn\n || (once && !listeners.once)\n || (context && listeners.context !== context)\n ) {\n events.push(listeners);\n }\n } else {\n for (var i = 0, length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) {\n this._events[evt] = events.length === 1 ? events[0] : events;\n } else {\n delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners or only the listeners for the specified event.\n *\n * @param {String} event The event want to remove all listeners for.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n if (!this._events) return this;\n\n if (event) delete this._events[prefix ? prefix + event : event];\n else this._events = prefix ? {} : Object.create(null);\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/eventemitter3/index.js\n ** module id = 2\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar keys = require('lodash.keys'),\n rest = require('lodash.rest');\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if ((!eq(objValue, value) ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object) {\n return copyObjectWith(source, props, object);\n}\n\n/**\n * This function is like `copyObject` except that it accepts a function to\n * customize copied values.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObjectWith(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\n assignValue(object, key, newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return rest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Assigns own enumerable properties of source objects to the destination\n * object. Source objects are applied from left to right. Subsequent sources\n * overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.c = 3;\n * }\n *\n * function Bar() {\n * this.e = 5;\n * }\n *\n * Foo.prototype.d = 4;\n * Bar.prototype.f = 6;\n *\n * _.assign({ 'a': 1 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3, 'e': 5 }\n */\nvar assign = createAssigner(function(object, source) {\n copyObject(source, keys(source), object);\n});\n\nmodule.exports = assign;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.assign/index.js\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n stringTag = '[object String]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar getPrototypeOf = Object.getPrototypeOf,\n propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = Object.keys;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n // that are composed entirely of index properties, return `false` for\n // `hasOwnProperty` checks of them.\n return hasOwnProperty.call(object, key) ||\n (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n}\n\n/**\n * The base implementation of `_.keys` which doesn't skip the constructor\n * property of prototypes or treat sparse arrays as dense.\n *\n * @private\n * @type Function\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n return nativeKeys(Object(object));\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Creates an array of index keys for `object` values of arrays,\n * `arguments` objects, and strings, otherwise `null` is returned.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array|null} Returns index keys, else `null`.\n */\nfunction indexKeys(object) {\n var length = object ? object.length : undefined;\n if (isLength(length) &&\n (isArray(object) || isString(object) || isArguments(object))) {\n return baseTimes(length, String);\n }\n return null;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n var isProto = isPrototype(object);\n if (!(isProto || isArrayLike(object))) {\n return baseKeys(object);\n }\n var indexes = indexKeys(object),\n skipIndexes = !!indexes,\n result = indexes || [],\n length = result.length;\n\n for (var key in object) {\n if (baseHas(object, key) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n !(isProto && key == 'constructor')) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.keys/index.js\n ** module id = 4\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n var length = args.length;\n switch (length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, array);\n case 1: return func.call(this, args[0], array);\n case 2: return func.call(this, args[0], args[1], array);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3');\n * // => 3\n */\nfunction toInteger(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n var remainder = value % 1;\n return value === value ? (remainder ? value - remainder : value) : 0;\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = rest;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.rest/index.js\n ** module id = 5\n ** module chunks = 0\n **/","import EPSG3857 from './CRS.EPSG3857';\nimport {EPSG900913} from './CRS.EPSG3857';\nimport EPSG3395 from './CRS.EPSG3395';\nimport EPSG4326 from './CRS.EPSG4326';\nimport Simple from './CRS.Simple';\nimport Proj4 from './CRS.Proj4';\n\nconst CRS = {};\n\nCRS.EPSG3857 = EPSG3857;\nCRS.EPSG900913 = EPSG900913;\nCRS.EPSG3395 = EPSG3395;\nCRS.EPSG4326 = EPSG4326;\nCRS.Simple = Simple;\nCRS.Proj4 = Proj4;\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/index.js\n **/","/*\n * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport SphericalMercator from '../projection/Projection.SphericalMercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3857 = {\n code: 'EPSG:3857',\n projection: SphericalMercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * SphericalMercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * SphericalMercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3857 = extend({}, Earth, _EPSG3857);\n\nconst EPSG900913 = extend({}, EPSG3857, {\n code: 'EPSG:900913'\n});\n\nexport {EPSG900913};\n\nexport default EPSG3857;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3857.js\n **/","/*\n * CRS.Earth is the base class for all CRS representing Earth.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport {latLon as LatLon} from '../LatLon';\n\nconst Earth = {\n wrapLon: [-180, 180],\n\n R: 6378137,\n\n // Distance between two geographical points using spherical law of cosines\n // approximation or Haversine\n //\n // See: http://www.movable-type.co.uk/scripts/latlong.html\n distance: function(latlon1, latlon2, accurate) {\n var rad = Math.PI / 180;\n\n var lat1;\n var lat2;\n\n var a;\n\n if (!accurate) {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\n return this.R * Math.acos(Math.min(a, 1));\n } else {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n var lon1 = latlon1.lon * rad;\n var lon2 = latlon2.lon * rad;\n\n var deltaLat = lat2 - lat1;\n var deltaLon = lon2 - lon1;\n\n var halfDeltaLat = deltaLat / 2;\n var halfDeltaLon = deltaLon / 2;\n\n a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return this.R * c;\n }\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Defaults to a scale factor of 1 if no calculation method exists\n //\n // Probably need to run this through the CRS transformation or similar so the\n // resulting scale is relative to the dimensions of the world space\n // Eg. 1 metre in projected space is likly scaled up or down to some other\n // number\n pointScale: function(latlon, accurate) {\n return (this.projection.pointScale) ? this.projection.pointScale(latlon, accurate) : [1, 1];\n },\n\n // Convert real metres to projected units\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n metresToProjected: function(metres, pointScale) {\n return metres * pointScale[1];\n },\n\n // Convert projected units to real metres\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n projectedToMetres: function(projectedUnits, pointScale) {\n return projectedUnits / pointScale[1];\n },\n\n // Convert real metres to a value in world (WebGL) units\n metresToWorld: function(metres, pointScale, zoom) {\n // Transform metres to projected metres using the latitude point scale\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n var projectedMetres = this.metresToProjected(metres, pointScale);\n\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n // Scale projected metres\n var scaledMetres = (scale * (this.transformScale * projectedMetres));\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n scaledMetres /= pointScale[1];\n }\n\n return scaledMetres;\n },\n\n // Convert world (WebGL) units to a value in real metres\n worldToMetres: function(worldUnits, pointScale, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var projectedUnits = ((worldUnits / scale) / this.transformScale);\n var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n realMetres *= pointScale[1];\n }\n\n return realMetres;\n }\n};\n\nexport default extend({}, CRS, Earth);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Earth.js\n **/","/*\n * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\nimport wrapNum from '../../util/wrapNum';\n\nconst CRS = {\n // Scale factor determines final dimensions of world space\n //\n // Projection transformation in range -1 to 1 is multiplied by scale factor to\n // find final world coordinates\n //\n // Scale factor can be considered as half the amount of the desired dimension\n // for the largest side when transformation is equal to 1 or -1, or as the\n // distance between 0 and 1 on the largest side\n //\n // For example, if you want the world dimensions to be between -1000 and 1000\n // then the scale factor will be 1000\n scaleFactor: 1000000,\n\n // Converts geo coords to pixel / WebGL ones\n latLonToPoint: function(latlon, zoom) {\n var projectedPoint = this.projection.project(latlon);\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n return this.transformation._transform(projectedPoint, scale);\n },\n\n // Converts pixel / WebGL coords to geo coords\n pointToLatLon: function(point, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var untransformedPoint = this.transformation.untransform(point, scale);\n\n return this.projection.unproject(untransformedPoint);\n },\n\n // Converts geo coords to projection-specific coords (e.g. in meters)\n project: function(latlon) {\n return this.projection.project(latlon);\n },\n\n // Converts projected coords to geo coords\n unproject: function(point) {\n return this.projection.unproject(point);\n },\n\n // If zoom is provided, returns the map width in pixels for a given zoom\n // Else, provides fixed scale value\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom >= 0) {\n return 256 * Math.pow(2, zoom);\n // Else, return fixed scale value to expand projected coordinates from\n // their 0 to 1 range into something more practical\n } else {\n return this.scaleFactor;\n }\n },\n\n // Returns zoom level for a given scale value\n // This only works with a scale value that is based on map pixel width\n zoom: function(scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n\n // Returns the bounds of the world in projected coords if applicable\n getProjectedBounds: function(zoom) {\n if (this.infinite) { return null; }\n\n var b = this.projection.bounds;\n var s = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n s /= 2;\n }\n\n // Bottom left\n var min = this.transformation.transform(Point(b[0]), s);\n\n // Top right\n var max = this.transformation.transform(Point(b[1]), s);\n\n return [min, max];\n },\n\n // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n // wrapLon: [min, max],\n // wrapLat: [min, max],\n\n // If true, the coordinate space will be unbounded (infinite in all directions)\n // infinite: false,\n\n // Wraps geo coords in certain ranges if applicable\n wrapLatLon: function(latlon) {\n var lat = this.wrapLat ? wrapNum(latlon.lat, this.wrapLat, true) : latlon.lat;\n var lon = this.wrapLon ? wrapNum(latlon.lon, this.wrapLon, true) : latlon.lon;\n var alt = latlon.alt;\n\n return LatLon(lat, lon, alt);\n }\n};\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.js\n **/","/*\n * LatLon is a helper class for ensuring consistent geographic coordinates.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n */\n\nclass LatLon {\n constructor(lat, lon, alt) {\n if (isNaN(lat) || isNaN(lon)) {\n throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n }\n\n this.lat = +lat;\n this.lon = +lon;\n\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n\n clone() {\n return new LatLon(this.lat, this.lon, this.alt);\n }\n}\n\nexport default LatLon;\n\n// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n// Also converts between lng and lon\nvar noNew = function(a, b, c) {\n if (a instanceof LatLon) {\n return a;\n }\n if (Array.isArray(a) && typeof a[0] !== 'object') {\n if (a.length === 3) {\n return new LatLon(a[0], a[1], a[2]);\n }\n if (a.length === 2) {\n return new LatLon(a[0], a[1]);\n }\n return null;\n }\n if (a === undefined || a === null) {\n return a;\n }\n if (typeof a === 'object' && 'lat' in a) {\n return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n }\n if (b === undefined) {\n return null;\n }\n return new LatLon(a, b, c);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as latLon};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/LatLon.js\n **/","/*\n * Point is a helper class for ensuring consistent world positions.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n */\n\nclass Point {\n constructor(x, y, round) {\n this.x = (round ? Math.round(x) : x);\n this.y = (round ? Math.round(y) : y);\n }\n\n clone() {\n return new Point(this.x, this.y);\n }\n\n // Non-destructive\n add(point) {\n return this.clone()._add(_point(point));\n }\n\n // Destructive\n _add(point) {\n this.x += point.x;\n this.y += point.y;\n return this;\n }\n\n // Non-destructive\n subtract(point) {\n return this.clone()._subtract(_point(point));\n }\n\n // Destructive\n _subtract(point) {\n this.x -= point.x;\n this.y -= point.y;\n return this;\n }\n}\n\nexport default Point;\n\n// Accepts (point), ([x, y]) and (x, y, round)\nvar _point = function(x, y, round) {\n if (x instanceof Point) {\n return x;\n }\n if (Array.isArray(x)) {\n return new Point(x[0], x[1]);\n }\n if (x === undefined || x === null) {\n return x;\n }\n return new Point(x, y, round);\n};\n\n// Initialise without requiring new keyword\nexport {_point as point};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/Point.js\n **/","/*\n * Wrap the given number to lie within a certain range (eg. longitude)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n */\n\nvar wrapNum = function(x, range, includeMax) {\n var max = range[1];\n var min = range[0];\n var d = max - min;\n return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n};\n\nexport default wrapNum;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/wrapNum.js\n **/","/*\n * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n * used by default.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst SphericalMercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var max = this.MAX_LATITUDE;\n var lat = Math.max(Math.min(max, latlon.lat), -max);\n var sin = Math.sin(lat * d);\n\n return Point(\n this.R * latlon.lon * d,\n this.R * Math.log((1 + sin) / (1 - sin)) / 2\n );\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n\n return LatLon(\n (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\n point.x * d / this.R\n );\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Accurate scale factor uses proper Web Mercator scaling\n // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n // See: http://jsfiddle.net/robhawkes/yws924cf/\n pointScale: function(latlon, accurate) {\n var rad = Math.PI / 180;\n\n var k;\n\n if (!accurate) {\n k = 1 / Math.cos(latlon.lat * rad);\n\n // [scaleX, scaleY]\n return [k, k];\n } else {\n var lat = latlon.lat * rad;\n var lon = latlon.lon * rad;\n\n var a = this.R;\n\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n\n var cosLat = Math.cos(lat);\n\n // Radius meridian\n var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\n // Radius prime meridian\n var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\n // Scale N/S\n var h = (a / p) / cosLat;\n\n // Scale E/W\n k = (a / v) / cosLat;\n\n // [scaleX, scaleY]\n return [k, h];\n }\n },\n\n // Not using this.R due to scoping\n bounds: (function() {\n var d = 6378137 * Math.PI;\n return [[-d, -d], [d, d]];\n })()\n};\n\nexport default SphericalMercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.SphericalMercator.js\n **/","/*\n * Transformation is an utility class to perform simple point transformations\n * through a 2d-matrix.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n */\n\nimport {point as Point} from '../geo/Point';\n\nclass Transformation {\n constructor(a, b, c, d) {\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n\n transform(point, scale) {\n // Copy input point as to not destroy the original data\n return this._transform(point.clone(), scale);\n }\n\n // Destructive transform (faster)\n _transform(point, scale) {\n scale = scale || 1;\n\n point.x = scale * (this._a * point.x + this._b);\n point.y = scale * (this._c * point.y + this._d);\n return point;\n }\n\n untransform(point, scale) {\n scale = scale || 1;\n return Point(\n (point.x / scale - this._b) / this._a,\n (point.y / scale - this._d) / this._c\n );\n }\n}\n\nexport default Transformation;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Transformation.js\n **/","/*\n * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Mercator from '../projection/Projection.Mercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3395 = {\n code: 'EPSG:3395',\n projection: Mercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * Mercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * Mercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3395 = extend({}, Earth, _EPSG3395);\n\nexport default EPSG3395;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3395.js\n **/","/*\n * Mercator projection that takes into account that the Earth is not a perfect\n * sphere. Less popular than spherical mercator; used by projections like\n * EPSG:3395.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Mercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n R_MINOR: 6356752.314245179,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var r = this.R;\n var y = latlon.lat * d;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var con = e * Math.sin(y);\n\n var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n y = -r * Math.log(Math.max(ts, 1E-10));\n\n return Point(latlon.lon * d * r, y);\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n var r = this.R;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var ts = Math.exp(-point.y / r);\n var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\n for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n con = e * Math.sin(phi);\n con = Math.pow((1 - con) / (1 + con), e / 2);\n dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n phi += dphi;\n }\n\n return LatLon(phi * d, point.x * d / r);\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n pointScale: function(latlon) {\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n var cosLat = Math.cos(lat);\n\n var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\n // [scaleX, scaleY]\n return [k, k];\n },\n\n bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n};\n\nexport default Mercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Mercator.js\n **/","/*\n * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG4326 = {\n code: 'EPSG:4326',\n projection: LatLonProjection,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / 180,\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n //\n // TODO: Cannot use this.transformScale due to scope\n transformation: new Transformation(1 / 180, 0, -1 / 180, 0)\n};\n\nconst EPSG4326 = extend({}, Earth, _EPSG4326);\n\nexport default EPSG4326;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG4326.js\n **/","/*\n * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n * and Simple.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst ProjectionLatLon = {\n project: function(latlon) {\n return Point(latlon.lon, latlon.lat);\n },\n\n unproject: function(point) {\n return LatLon(point.y, point.x);\n },\n\n // Scale factor for converting between real metres and degrees\n //\n // degrees = realMetres * pointScale\n // realMetres = degrees / pointScale\n //\n // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n pointScale: function(latlon) {\n var m1 = 111132.92;\n var m2 = -559.82;\n var m3 = 1.175;\n var m4 = -0.0023;\n var p1 = 111412.84;\n var p2 = -93.5;\n var p3 = 0.118;\n\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n\n var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\n return [1 / latlen, 1 / lonlen];\n },\n\n bounds: [[-180, -90], [180, 90]]\n};\n\nexport default ProjectionLatLon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.LatLon.js\n **/","/*\n * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n * maps.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _Simple = {\n projection: LatLonProjection,\n\n // Straight 1:1 mapping (-1, -1 would be top-left)\n transformation: new Transformation(1, 0, 1, 0),\n\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom) {\n return Math.pow(2, zoom);\n // Else, make no change to scale – may need to increase this or make it a\n // user-definable variable\n } else {\n return 1;\n }\n },\n\n zoom: function(scale) {\n return Math.log(scale) / Math.LN2;\n },\n\n distance: function(latlon1, latlon2) {\n var dx = latlon2.lon - latlon1.lon;\n var dy = latlon2.lat - latlon1.lat;\n\n return Math.sqrt(dx * dx + dy * dy);\n },\n\n infinite: true\n};\n\nconst Simple = extend({}, CRS, _Simple);\n\nexport default Simple;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Simple.js\n **/","/*\n * CRS.Proj4 for any Proj4-supported CRS.\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Proj4Projection from '../projection/Projection.Proj4';\nimport Transformation from '../../util/Transformation';\n\nvar _Proj4 = function(code, def, bounds) {\n var projection = Proj4Projection(def, bounds);\n\n // Transformation calcuations\n var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\n var halfX = diffX / 2;\n var halfY = diffY / 2;\n\n // This is the raw scale factor\n var scaleX = 1 / halfX;\n var scaleY = 1 / halfY;\n\n // Find the minimum scale factor\n //\n // The minimum scale factor comes from the largest side and is the one\n // you want to use for both axis so they stay relative in dimension\n var scale = Math.min(scaleX, scaleY);\n\n // Find amount to offset each axis by to make the central point lie on\n // the [0,0] origin\n var offsetX = scale * (projection.bounds[0][0] + halfX);\n var offsetY = scale * (projection.bounds[0][1] + halfY);\n\n return {\n code: code,\n projection: projection,\n\n transformScale: scale,\n\n // Map the input to a [-1,1] range with [0,0] in the centre\n transformation: new Transformation(scale, -offsetX, -scale, offsetY)\n };\n};\n\nconst Proj4 = function(code, def, bounds) {\n return extend({}, Earth, _Proj4(code, def, bounds));\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Proj4.js\n **/","/*\n * Proj4 support for any projection.\n */\n\nimport proj4 from 'proj4';\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Proj4 = function(def, bounds) {\n var proj = proj4(def);\n\n var project = function(latlon) {\n return Point(proj.forward([latlon.lon, latlon.lat]));\n };\n\n var unproject = function(point) {\n var inverse = proj.inverse([point.x, point.y]);\n return LatLon(inverse[1], inverse[0]);\n };\n\n return {\n project: project,\n unproject: unproject,\n\n // Scale factor for converting between real metres and projected metres\\\n //\n // Need to work out the best way to provide the pointScale calculations\n // for custom, unknown projections (if wanting to override default)\n //\n // For now, user can manually override crs.pointScale or\n // crs.projection.pointScale\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n pointScale: function(latlon, accurate) {\n return [1, 1];\n },\n\n // Try and calculate bounds if none are provided\n //\n // This will provide incorrect bounds for some projections, so perhaps make\n // bounds a required input instead\n bounds: (function() {\n if (bounds) {\n return bounds;\n } else {\n var bottomLeft = project([-90, -180]);\n var topRight = project([90, 180]);\n\n return [bottomLeft, topRight];\n }\n })()\n };\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Proj4.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"proj4\"\n ** module id = 22\n ** module chunks = 0\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport Scene from './Scene';\nimport DOMScene3D from './DOMScene3D';\nimport DOMScene2D from './DOMScene2D';\nimport Renderer from './Renderer';\nimport DOMRenderer3D from './DOMRenderer3D';\nimport DOMRenderer2D from './DOMRenderer2D';\nimport Camera from './Camera';\nimport Picking from './Picking';\n\nclass Engine extends EventEmitter {\n constructor(container, world) {\n console.log('Init Engine');\n\n super();\n\n this._world = world;\n\n this._scene = Scene;\n this._domScene3D = DOMScene3D;\n this._domScene2D = DOMScene2D;\n\n this._renderer = Renderer(container);\n this._domRenderer3D = DOMRenderer3D(container);\n this._domRenderer2D = DOMRenderer2D(container);\n\n this._camera = Camera(container);\n\n // TODO: Make this optional\n this._picking = Picking(this._world, this._renderer, this._camera);\n\n this.clock = new THREE.Clock();\n\n this._frustum = new THREE.Frustum();\n }\n\n update(delta) {\n this.emit('preRender');\n\n this._renderer.render(this._scene, this._camera);\n\n // Render picking scene\n // this._renderer.render(this._picking._pickingScene, this._camera);\n\n // Render DOM scenes\n this._domRenderer3D.render(this._domScene3D, this._camera);\n this._domRenderer2D.render(this._domScene2D, this._camera);\n\n this.emit('postRender');\n }\n\n destroy() {\n // Remove any remaining objects from scene\n var child;\n for (var i = this._scene.children.length - 1; i >= 0; i--) {\n child = this._scene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._scene.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n };\n\n for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n child = this._domScene3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene3D.remove(child);\n };\n\n for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n child = this._domScene2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene2D.remove(child);\n };\n\n this._picking.destroy();\n this._picking = null;\n\n this._world = null;\n this._scene = null;\n this._domScene3D = null;\n this._domScene2D = null;\n this._renderer = null;\n this._domRenderer3D = null;\n this._domRenderer2D = null;\n this._camera = null;\n this._clock = null;\n this._frustum = null;\n }\n}\n\nexport default Engine;\n\n// // Initialise without requiring new keyword\n// export default function(container, world) {\n// return new Engine(container, world);\n// };\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Engine.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"THREE\"\n ** module id = 24\n ** module chunks = 0\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n\n // TODO: Re-enable when this works with the skybox\n // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Scene.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene3D.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene2D.js\n **/","import THREE from 'three';\nimport Scene from './Scene';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new THREE.WebGLRenderer({\n antialias: true\n });\n\n // TODO: Re-enable when this works with the skybox\n // renderer.setClearColor(Scene.fog.color, 1);\n\n renderer.setClearColor(0xffffff, 1);\n renderer.setPixelRatio(window.devicePixelRatio);\n\n // Gamma settings make things look nicer\n renderer.gammaInput = true;\n renderer.gammaOutput = true;\n\n renderer.shadowMap.enabled = true;\n renderer.shadowMap.cullFace = THREE.CullFaceBack;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Renderer.js\n **/","import THREE from 'three';\nimport {CSS3DRenderer} from '../vendor/CSS3DRenderer';\nimport DOMScene3D from './DOMScene3D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS3DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer3D.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS3DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS3DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS3DObject.prototype.constructor = CSS3DObject;\n\nvar CSS3DSprite = function ( element ) {\n\n\tCSS3DObject.call( this, element );\n\n};\n\nCSS3DSprite.prototype = Object.create( CSS3DObject.prototype );\nCSS3DSprite.prototype.constructor = CSS3DSprite;\n\n//\n\nvar CSS3DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS3DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar matrix = new THREE.Matrix4();\n\n\tvar cache = {\n\t\tcamera: { fov: 0, style: '' },\n\t\tobjects: {}\n\t};\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\tdomElement.style.oTransformStyle = 'preserve-3d';\n\tdomElement.style.transformStyle = 'preserve-3d';\n\n\tthis.domElement = domElement;\n\n\tvar cameraElement = document.createElement( 'div' );\n\n\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\tcameraElement.style.transformStyle = 'preserve-3d';\n\n\tdomElement.appendChild( cameraElement );\n\n\tthis.setClearColor = function () {};\n\n\tthis.getSize = function() {\n\n\t\treturn {\n\t\t\twidth: _width,\n\t\t\theight: _height\n\t\t};\n\n\t};\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t\tcameraElement.style.width = width + 'px';\n\t\tcameraElement.style.height = height + 'px';\n\n\t};\n\n\tvar epsilon = function ( value ) {\n\n\t\treturn Math.abs( value ) < Number.EPSILON ? 0 : value;\n\n\t};\n\n\tvar getCameraCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( - elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( elements[ 6 ] ) + ',' +\n\t\t\tepsilon( elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( - elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( - elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar getObjectCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( - elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( - elements[ 6 ] ) + ',' +\n\t\t\tepsilon( - elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS3DObject ) {\n\n\t\t\tvar style;\n\n\t\t\tif ( object instanceof CSS3DSprite ) {\n\n\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\n\t\t\t\tmatrix.copy( camera.matrixWorldInverse );\n\t\t\t\tmatrix.transpose();\n\t\t\t\tmatrix.copyPosition( object.matrixWorld );\n\t\t\t\tmatrix.scale( object.scale );\n\n\t\t\t\tmatrix.elements[ 3 ] = 0;\n\t\t\t\tmatrix.elements[ 7 ] = 0;\n\t\t\t\tmatrix.elements[ 11 ] = 0;\n\t\t\t\tmatrix.elements[ 15 ] = 1;\n\n\t\t\t\tstyle = getObjectCSSMatrix( matrix );\n\n\t\t\t} else {\n\n\t\t\t\tstyle = getObjectCSSMatrix( object.matrixWorld );\n\n\t\t\t}\n\n\t\t\tvar element = object.element;\n\t\t\tvar cachedStyle = cache.objects[ object.id ];\n\n\t\t\tif ( cachedStyle === undefined || cachedStyle !== style ) {\n\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\n\t\t\t\tcache.objects[ object.id ] = style;\n\n\t\t\t}\n\n\t\t\tif ( element.parentNode !== cameraElement ) {\n\n\t\t\t\tcameraElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tvar fov = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * _height;\n\n\t\tif ( cache.camera.fov !== fov ) {\n\n\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\tdomElement.style.perspective = fov + 'px';\n\n\t\t\tcache.camera.fov = fov;\n\n\t\t}\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse ) +\n\t\t\t' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\n\t\tif ( cache.camera.style !== style ) {\n\n\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\tcameraElement.style.MozTransform = style;\n\t\t\tcameraElement.style.oTransform = style;\n\t\t\tcameraElement.style.transform = style;\n\n\t\t\tcache.camera.style = style;\n\n\t\t}\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS3DObject as CSS3DObject};\nexport {CSS3DSprite as CSS3DSprite};\nexport {CSS3DRenderer as CSS3DRenderer};\n\nTHREE.CSS3DObject = CSS3DObject;\nTHREE.CSS3DSprite = CSS3DSprite;\nTHREE.CSS3DRenderer = CSS3DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS3DRenderer.js\n **/","import THREE from 'three';\nimport {CSS2DRenderer} from '../vendor/CSS2DRenderer';\nimport DOMScene2D from './DOMScene2D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS2DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer2D.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS2DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS2DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS2DObject.prototype.constructor = CSS2DObject;\n\n//\n\nvar CSS2DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS2DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar vector = new THREE.Vector3();\n\tvar viewMatrix = new THREE.Matrix4();\n\tvar viewProjectionMatrix = new THREE.Matrix4();\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tthis.domElement = domElement;\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS2DObject ) {\n\n\t\t\tvector.setFromMatrixPosition( object.matrixWorld );\n\t\t\tvector.applyProjection( viewProjectionMatrix );\n\n\t\t\tvar element = object.element;\n\t\t\tvar style = 'translate(-50%,-50%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)';\n\n\t\t\telement.style.WebkitTransform = style;\n\t\t\telement.style.MozTransform = style;\n\t\t\telement.style.oTransform = style;\n\t\t\telement.style.transform = style;\n\n\t\t\tif ( element.parentNode !== domElement ) {\n\n\t\t\t\tdomElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tviewMatrix.copy( camera.matrixWorldInverse.getInverse( camera.matrixWorld ) );\n\t\tviewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS2DObject as CSS2DObject};\nexport {CSS2DRenderer as CSS2DRenderer};\n\nTHREE.CSS2DObject = CSS2DObject;\nTHREE.CSS2DRenderer = CSS2DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS2DRenderer.js\n **/","import THREE from 'three';\n\n// This can only be accessed from Engine.camera if you want to reference the\n// same scene in multiple places\n\n// TODO: Ensure that FOV looks natural on all aspect ratios\n// http://stackoverflow.com/q/26655930/997339\n\nexport default function(container) {\n var camera = new THREE.PerspectiveCamera(45, 1, 1, 200000);\n camera.position.y = 400;\n camera.position.z = 400;\n\n var updateSize = function() {\n camera.aspect = container.clientWidth / container.clientHeight;\n camera.updateProjectionMatrix();\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return camera;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Camera.js\n **/","import THREE from 'three';\nimport {point as Point} from '../geo/Point';\nimport PickingScene from './PickingScene';\n\n// TODO: Look into a way of setting this up without passing in a renderer and\n// camera from the engine\n\n// TODO: Add a basic indicator on or around the mouse pointer when it is over\n// something pickable / clickable\n//\n// A simple transparent disc or ring at the mouse point should work to start, or\n// even just changing the cursor to the CSS 'pointer' style\n//\n// Probably want this on mousemove with a throttled update as not to spam the\n// picking method\n//\n// Relies upon the picking method not redrawing the scene every call due to\n// the way TileLayer invalidates the picking scene\n\nvar nextId = 1;\n\nclass Picking {\n constructor(world, renderer, camera) {\n this._world = world;\n this._renderer = renderer;\n this._camera = camera;\n\n this._raycaster = new THREE.Raycaster();\n\n // TODO: Match this with the line width used in the picking layers\n this._raycaster.linePrecision = 3;\n\n this._pickingScene = PickingScene;\n this._pickingTexture = new THREE.WebGLRenderTarget();\n this._pickingTexture.texture.minFilter = THREE.LinearFilter;\n this._pickingTexture.texture.generateMipmaps = false;\n\n this._nextId = 1;\n\n this._resizeTexture();\n this._initEvents();\n }\n\n _initEvents() {\n window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\n // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onMouseUp(event) {\n // Only react to main button click\n if (event.button !== 0) {\n return;\n }\n\n var point = Point(event.clientX, event.clientY);\n\n var normalisedPoint = Point(0, 0);\n normalisedPoint.x = (point.x / this._width) * 2 - 1;\n normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\n this._pick(point, normalisedPoint);\n }\n\n _onWorldMove() {\n this._needUpdate = true;\n }\n\n // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n _resizeTexture() {\n var size = this._renderer.getSize();\n\n this._width = size.width;\n this._height = size.height;\n\n this._pickingTexture.setSize(this._width, this._height);\n this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\n this._needUpdate = true;\n }\n\n // TODO: Make this only re-draw the scene if both an update is needed and the\n // camera has moved since the last update\n //\n // Otherwise it re-draws the scene on every click due to the way LOD updates\n // work in TileLayer – spamming this.add() and this.remove()\n //\n // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n // be a point in time where the user cares for picking functionality\n _update() {\n if (this._needUpdate) {\n var texture = this._pickingTexture;\n\n this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\n // Read the rendering texture\n this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\n this._needUpdate = false;\n }\n }\n\n _pick(point, normalisedPoint) {\n this._update();\n\n var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\n // Interpret the pixel as an ID\n var id = (this._pixelBuffer[index * 4 + 2] * 255 * 255) + (this._pixelBuffer[index * 4 + 1] * 255) + (this._pixelBuffer[index * 4 + 0]);\n\n // Skip if ID is 16646655 (white) as the background returns this\n if (id === 16646655) {\n return;\n }\n\n this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\n // Perform ray intersection on picking scene\n //\n // TODO: Only perform intersection test on the relevant picking mesh\n var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\n var _point2d = point.clone();\n\n var _point3d;\n if (intersects.length > 0) {\n _point3d = intersects[0].point.clone();\n }\n\n // Pass along as much data as possible for now until we know more about how\n // people use the picking API and what the returned data should be\n //\n // TODO: Look into the leak potential for passing so much by reference here\n this._world.emit('pick', id, _point2d, _point3d, intersects);\n this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n }\n\n // Add mesh to picking scene\n //\n // Picking ID should already be added as an attribute\n add(mesh) {\n this._pickingScene.add(mesh);\n this._needUpdate = true;\n }\n\n // Remove mesh from picking scene\n remove(mesh) {\n this._pickingScene.remove(mesh);\n this._needUpdate = true;\n }\n\n // Returns next ID to use for picking\n getNextId() {\n return nextId++;\n }\n\n destroy() {\n // TODO: Find a way to properly remove these listeners as they stay\n // active at the moment\n window.removeEventListener('resize', this._resizeTexture, false);\n this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n this._world.off('move', this._onWorldMove);\n\n if (this._pickingScene.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n child = this._pickingScene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._pickingScene.remove(child);\n\n // Probably not a good idea to dispose of geometry due to it being\n // shared with the non-picking scene\n // if (child.geometry) {\n // // Dispose of mesh and materials\n // child.geometry.dispose();\n // child.geometry = null;\n // }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n this._pickingScene = null;\n this._pickingTexture = null;\n this._pixelBuffer = null;\n\n this._world = null;\n this._renderer = null;\n this._camera = null;\n }\n}\n\n// Initialise without requiring new keyword\nexport default function(world, renderer, camera) {\n return new Picking(world, renderer, camera);\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Picking.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.pickingScene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingScene.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Skybox from './Skybox';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass EnvironmentLayer extends Layer {\n constructor(options) {\n var defaults = {\n skybox: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n }\n\n _onAdd() {\n this._initLights();\n\n if (this._options.skybox) {\n this._initSkybox();\n }\n\n // this._initGrid();\n }\n\n // Not fleshed out or thought through yet\n //\n // Lights could potentially be put it their own 'layer' to keep this class\n // much simpler and less messy\n _initLights() {\n // Position doesn't really matter (the angle is important), however it's\n // used here so the helpers look more natural.\n\n if (!this._options.skybox) {\n var directionalLight = new THREE.DirectionalLight(0xffffff, 1);\n directionalLight.position.x = 1000;\n directionalLight.position.y = 1000;\n directionalLight.position.z = 1000;\n\n // TODO: Get shadows working in non-PBR scenes\n\n // directionalLight.castShadow = true;\n //\n // var d = 100;\n // directionalLight.shadow.camera.left = -d;\n // directionalLight.shadow.camera.right = d;\n // directionalLight.shadow.camera.top = d;\n // directionalLight.shadow.camera.bottom = -d;\n //\n // directionalLight.shadow.camera.near = 10;\n // directionalLight.shadow.camera.far = 100;\n //\n // // TODO: Need to dial in on a good shadowmap size\n // directionalLight.shadow.mapSize.width = 2048;\n // directionalLight.shadow.mapSize.height = 2048;\n //\n // // directionalLight.shadowBias = -0.0010;\n // // directionalLight.shadow.darkness = 0.15;\n\n var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5);\n directionalLight2.position.x = -1000;\n directionalLight2.position.y = 1000;\n directionalLight2.position.z = -1000;\n\n // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\n this.add(directionalLight);\n this.add(directionalLight2);\n\n // this.add(helper);\n // this.add(helper2);\n } else {\n // Directional light that will be projected from the sun\n this._skyboxLight = new THREE.DirectionalLight(0xffffff, 1);\n\n this._skyboxLight.castShadow = true;\n\n var d = 1000;\n this._skyboxLight.shadow.camera.left = -d;\n this._skyboxLight.shadow.camera.right = d;\n this._skyboxLight.shadow.camera.top = d;\n this._skyboxLight.shadow.camera.bottom = -d;\n\n this._skyboxLight.shadow.camera.near = 10000;\n this._skyboxLight.shadow.camera.far = 70000;\n\n // TODO: Need to dial in on a good shadowmap size\n this._skyboxLight.shadow.mapSize.width = 2048;\n this._skyboxLight.shadow.mapSize.height = 2048;\n\n // this._skyboxLight.shadowBias = -0.0010;\n // this._skyboxLight.shadow.darkness = 0.15;\n\n // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\n this.add(this._skyboxLight);\n }\n }\n\n _initSkybox() {\n this._skybox = new Skybox(this._world, this._skyboxLight);\n this.add(this._skybox._mesh);\n }\n\n // Add grid helper for context during initial development\n _initGrid() {\n var size = 4000;\n var step = 100;\n\n var gridHelper = new THREE.GridHelper(size, step);\n this.add(gridHelper);\n }\n\n // Clean up environment\n destroy() {\n this._skyboxLight = null;\n\n this.remove(this._skybox._mesh);\n this._skybox.destroy();\n this._skybox = null;\n\n super.destroy();\n }\n}\n\nexport default EnvironmentLayer;\n\nvar noNew = function(options) {\n return new EnvironmentLayer(options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as environmentLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/EnvironmentLayer.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Scene from '../engine/Scene';\nimport {CSS3DObject} from '../vendor/CSS3DRenderer';\nimport {CSS2DObject} from '../vendor/CSS2DRenderer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Need a single move method that handles moving all the various object\n// layers so that the DOM layers stay in sync with the 3D layer\n\n// TODO: Double check that objects within the _object3D Object3D parent are frustum\n// culled even if the layer position stays at the default (0,0,0) and the child\n// objects are positioned much further away\n//\n// Or does the layer being at (0,0,0) prevent the child objects from being\n// culled because the layer parent is effectively always in view even if the\n// child is actually out of camera\n\nclass Layer extends EventEmitter {\n constructor(options) {\n super();\n\n var defaults = {\n output: true\n };\n\n this._options = extend({}, defaults, options);\n\n if (this.isOutput()) {\n this._object3D = new THREE.Object3D();\n\n this._dom3D = document.createElement('div');\n this._domObject3D = new CSS3DObject(this._dom3D);\n\n this._dom2D = document.createElement('div');\n this._domObject2D = new CSS2DObject(this._dom2D);\n }\n }\n\n // Add THREE object directly to layer\n add(object) {\n this._object3D.add(object);\n }\n\n // Remove THREE object from to layer\n remove(object) {\n this._object3D.remove(object);\n }\n\n addDOM3D(object) {\n this._domObject3D.add(object);\n }\n\n removeDOM3D(object) {\n this._domObject3D.remove(object);\n }\n\n addDOM2D(object) {\n this._domObject2D.add(object);\n }\n\n removeDOM2D(object) {\n this._domObject2D.remove(object);\n }\n\n // Add layer to world instance and store world reference\n addTo(world) {\n world.addLayer(this);\n return this;\n }\n\n // Internal method called by World.addLayer to actually add the layer\n _addToWorld(world) {\n this._world = world;\n this._onAdd(world);\n this.emit('added');\n }\n\n _onAdd(world) {}\n\n getPickingId() {\n if (this._world._engine._picking) {\n return this._world._engine._picking.getNextId();\n }\n\n return false;\n }\n\n // TODO: Tidy this up and don't access so many private properties to work\n addToPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.add(object);\n }\n\n removeFromPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.remove(object);\n }\n\n isOutput() {\n return this._options.output;\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._object3D && this._object3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n child = this._object3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n if (this._domObject3D && this._domObject3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n child = this._domObject3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM3D(child);\n }\n }\n\n if (this._domObject2D && this._domObject2D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n child = this._domObject2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM2D(child);\n }\n }\n\n this._domObject3D = null;\n this._domObject2D = null;\n\n this._world = null;\n this._object3D = null;\n }\n}\n\nexport default Layer;\n\nvar noNew = function(options) {\n return new Layer(options);\n};\n\nexport {noNew as layer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/Layer.js\n **/","import THREE from 'three';\nimport Sky from './Sky';\nimport throttle from 'lodash.throttle';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nvar cubemap = {\n vertexShader: [\n\t\t'varying vec3 vPosition;',\n\t\t'void main() {',\n\t\t\t'vPosition = position;',\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n 'uniform samplerCube cubemap;',\n 'varying vec3 vPosition;',\n\n 'void main() {',\n 'gl_FragColor = textureCube(cubemap, normalize(vPosition));',\n '}'\n ].join('\\n')\n};\n\nclass Skybox {\n constructor(world, light) {\n this._world = world;\n this._light = light;\n\n this._settings = {\n distance: 38000,\n turbidity: 10,\n reileigh: 2,\n mieCoefficient: 0.005,\n mieDirectionalG: 0.8,\n luminance: 1,\n // 0.48 is a cracking dusk / sunset\n // 0.4 is a beautiful early-morning / late-afternoon\n // 0.2 is a nice day time\n inclination: 0.48, // Elevation / inclination\n azimuth: 0.25, // Facing front\n };\n\n this._initSkybox();\n this._updateUniforms();\n this._initEvents();\n }\n\n _initEvents() {\n // Throttled to 1 per 100ms\n this._throttledWorldUpdate = throttle(this._update, 100);\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n }\n\n _initSkybox() {\n // Cube camera for skybox\n this._cubeCamera = new THREE.CubeCamera(1, 2000000, 128);\n\n // Cube material\n var cubeTarget = this._cubeCamera.renderTarget;\n\n // Add Sky Mesh\n this._sky = new Sky();\n this._skyScene = new THREE.Scene();\n this._skyScene.add(this._sky.mesh);\n\n // Add Sun Helper\n this._sunSphere = new THREE.Mesh(\n new THREE.SphereBufferGeometry(2000, 16, 8),\n new THREE.MeshBasicMaterial({\n color: 0xffffff\n })\n );\n\n // TODO: This isn't actually visible because it's not added to the layer\n // this._sunSphere.visible = true;\n\n var skyboxUniforms = {\n cubemap: { type: 't', value: cubeTarget }\n };\n\n var skyboxMat = new THREE.ShaderMaterial({\n uniforms: skyboxUniforms,\n vertexShader: cubemap.vertexShader,\n fragmentShader: cubemap.fragmentShader,\n side: THREE.BackSide\n });\n\n this._mesh = new THREE.Mesh(new THREE.BoxGeometry(190000, 190000, 190000), skyboxMat);\n\n this._updateSkybox = true;\n }\n\n _updateUniforms() {\n var settings = this._settings;\n var uniforms = this._sky.uniforms;\n uniforms.turbidity.value = settings.turbidity;\n uniforms.reileigh.value = settings.reileigh;\n uniforms.luminance.value = settings.luminance;\n uniforms.mieCoefficient.value = settings.mieCoefficient;\n uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\n var theta = Math.PI * (settings.inclination - 0.5);\n var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\n this._sunSphere.position.x = settings.distance * Math.cos(phi);\n this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\n // Move directional light to sun position\n this._light.position.copy(this._sunSphere.position);\n\n this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n }\n\n _update(delta) {\n if (this._updateSkybox) {\n this._updateSkybox = false;\n } else {\n return;\n }\n\n // if (!this._angle) {\n // this._angle = 0;\n // }\n //\n // // Animate inclination\n // this._angle += Math.PI * delta;\n // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\n // Update light intensity depending on elevation of sun (day to night)\n this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\n // // console.log(delta, this._angle, this._settings.inclination);\n //\n // TODO: Only do this when the uniforms have been changed\n this._updateUniforms();\n\n // TODO: Only do this when the cubemap has actually changed\n this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n }\n\n getRenderTarget() {\n return this._cubeCamera.renderTarget;\n }\n\n setInclination(inclination) {\n this._settings.inclination = inclination;\n this._updateSkybox = true;\n }\n\n // Destroy the skybox and remove it from memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._throttledWorldUpdate = null;\n\n this._world = null;\n this._light = null;\n\n this._cubeCamera = null;\n\n this._sky.mesh.geometry.dispose();\n this._sky.mesh.geometry = null;\n\n if (this._sky.mesh.material.map) {\n this._sky.mesh.material.map.dispose();\n this._sky.mesh.material.map = null;\n }\n\n this._sky.mesh.material.dispose();\n this._sky.mesh.material = null;\n\n this._sky.mesh = null;\n this._sky = null;\n\n this._skyScene = null;\n\n this._sunSphere.geometry.dispose();\n this._sunSphere.geometry = null;\n\n if (this._sunSphere.material.map) {\n this._sunSphere.material.map.dispose();\n this._sunSphere.material.map = null;\n }\n\n this._sunSphere.material.dispose();\n this._sunSphere.material = null;\n\n this._sunSphere = null;\n\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n}\n\nexport default Skybox;\n\nvar noNew = function(world, light) {\n return new Skybox(world, light);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as skybox};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Skybox.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * @author zz85 / https://github.com/zz85\n *\n * Based on 'A Practical Analytic Model for Daylight'\n * aka The Preetham Model, the de facto standard analytic skydome model\n * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n *\n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nimport THREE from 'three';\n\nTHREE.ShaderLib[ 'sky' ] = {\n\n\tuniforms: {\n\n\t\tluminance:\t { type: 'f', value: 1 },\n\t\tturbidity:\t { type: 'f', value: 2 },\n\t\treileigh:\t { type: 'f', value: 1 },\n\t\tmieCoefficient:\t { type: 'f', value: 0.005 },\n\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\tsunPosition: \t { type: 'v3', value: new THREE.Vector3() }\n\n\t},\n\n\tvertexShader: [\n\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'void main() {',\n\n\t\t\t'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n\t\t\t'vWorldPosition = worldPosition.xyz;',\n\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n\t\t'}',\n\n\t].join( '\\n' ),\n\n\tfragmentShader: [\n\n\t\t'uniform sampler2D skySampler;',\n\t\t'uniform vec3 sunPosition;',\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'vec3 cameraPos = vec3(0., 0., 0.);',\n\t\t'// uniform sampler2D sDiffuse;',\n\t\t'// const float turbidity = 10.0; //',\n\t\t'// const float reileigh = 2.; //',\n\t\t'// const float luminance = 1.0; //',\n\t\t'// const float mieCoefficient = 0.005;',\n\t\t'// const float mieDirectionalG = 0.8;',\n\n\t\t'uniform float luminance;',\n\t\t'uniform float turbidity;',\n\t\t'uniform float reileigh;',\n\t\t'uniform float mieCoefficient;',\n\t\t'uniform float mieDirectionalG;',\n\n\t\t'// constants for atmospheric scattering',\n\t\t'const float e = 2.71828182845904523536028747135266249775724709369995957;',\n\t\t'const float pi = 3.141592653589793238462643383279502884197169;',\n\n\t\t'const float n = 1.0003; // refractive index of air',\n\t\t'const float N = 2.545E25; // number of molecules per unit volume for air at',\n\t\t\t\t\t\t\t\t'// 288.15K and 1013mb (sea level -45 celsius)',\n\t\t'const float pn = 0.035;\t// depolatization factor for standard air',\n\n\t\t'// wavelength of used primaries, according to preetham',\n\t\t'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);',\n\n\t\t'// mie stuff',\n\t\t'// K coefficient for the primaries',\n\t\t'const vec3 K = vec3(0.686, 0.678, 0.666);',\n\t\t'const float v = 4.0;',\n\n\t\t'// optical length at zenith for molecules',\n\t\t'const float rayleighZenithLength = 8.4E3;',\n\t\t'const float mieZenithLength = 1.25E3;',\n\t\t'const vec3 up = vec3(0.0, 1.0, 0.0);',\n\n\t\t'const float EE = 1000.0;',\n\t\t'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;',\n\t\t'// 66 arc seconds -> degrees, and the cosine of that',\n\n\t\t'// earth shadow hack',\n\t\t'const float cutoffAngle = pi/1.95;',\n\t\t'const float steepness = 1.5;',\n\n\n\t\t'vec3 totalRayleigh(vec3 lambda)',\n\t\t'{',\n\t\t\t'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));',\n\t\t'}',\n\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE',\n\t\t'vec3 simplifiedRayleigh()',\n\t\t'{',\n\t\t\t'return 0.0005 / vec3(94, 40, 18);',\n\t\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}',\n\n\t\t'float rayleighPhase(float cosTheta)',\n\t\t'{\t ',\n\t\t\t'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'}',\n\n\t\t'vec3 totalMie(vec3 lambda, vec3 K, float T)',\n\t\t'{',\n\t\t\t'float c = (0.2 * T ) * 10E-18;',\n\t\t\t'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;',\n\t\t'}',\n\n\t\t'float hgPhase(float cosTheta, float g)',\n\t\t'{',\n\t\t\t'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));',\n\t\t'}',\n\n\t\t'float sunIntensity(float zenithAngleCos)',\n\t\t'{',\n\t\t\t'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));',\n\t\t'}',\n\n\t\t'// float logLuminance(vec3 c)',\n\t\t'// {',\n\t\t'// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);',\n\t\t'// }',\n\n\t\t'// Filmic ToneMapping http://filmicgames.com/archives/75',\n\t\t'float A = 0.15;',\n\t\t'float B = 0.50;',\n\t\t'float C = 0.10;',\n\t\t'float D = 0.20;',\n\t\t'float E = 0.02;',\n\t\t'float F = 0.30;',\n\t\t'float W = 1000.0;',\n\n\t\t'vec3 Uncharted2Tonemap(vec3 x)',\n\t\t'{',\n\t\t 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;',\n\t\t'}',\n\n\n\t\t'void main() ',\n\t\t'{',\n\t\t\t'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);',\n\n\t\t\t'// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;',\n\n\t\t\t '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);',\n\n\t\t\t'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));',\n\n\t\t\t'vec3 sunDirection = normalize(sunPosition);',\n\n\t\t\t'float sunE = sunIntensity(dot(sunDirection, up));',\n\n\t\t\t'// extinction (absorbtion + out scattering) ',\n\t\t\t'// rayleigh coefficients',\n\n\t\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;',\n\n\t\t\t'// mie coefficients',\n\t\t\t'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;',\n\n\t\t\t'// optical length',\n\t\t\t'// cutoff angle at 90 to avoid singularity in next formula.',\n\t\t\t'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));',\n\t\t\t'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\t\t\t'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\n\n\n\t\t\t'// combined extinction factor\t',\n\t\t\t'vec3 Fex = exp(-(betaR * sR + betaM * sM));',\n\n\t\t\t'// in scattering',\n\t\t\t'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);',\n\n\t\t\t'float rPhase = rayleighPhase(cosTheta*0.5+0.5);',\n\t\t\t'vec3 betaRTheta = betaR * rPhase;',\n\n\t\t\t'float mPhase = hgPhase(cosTheta, mieDirectionalG);',\n\t\t\t'vec3 betaMTheta = betaM * mPhase;',\n\n\n\t\t\t'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));',\n\t\t\t'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));',\n\n\t\t\t'//nightsky',\n\t\t\t'vec3 direction = normalize(vWorldPosition - cameraPos);',\n\t\t\t'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]',\n\t\t\t'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]',\n\t\t\t'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);',\n\t\t\t'// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;',\n\t\t\t'vec3 L0 = vec3(0.1) * Fex;',\n\n\t\t\t'// composition + solar disc',\n\t\t\t'//if (cosTheta > sunAngularDiameterCos)',\n\t\t\t'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);',\n\t\t\t'// if (normalize(vWorldPosition - cameraPos).y>0.0)',\n\t\t\t'L0 += (sunE * 19000.0 * Fex)*sundisk;',\n\n\n\t\t\t'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));',\n\n\t\t\t'vec3 texColor = (Lin+L0); ',\n\t\t\t'texColor *= 0.04 ;',\n\t\t\t'texColor += vec3(0.0,0.001,0.0025)*0.3;',\n\n\t\t\t'float g_fMaxLuminance = 1.0;',\n\t\t\t'float fLumScaled = 0.1 / luminance; ',\n\t\t\t'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ',\n\n\t\t\t'float ExposureBias = fLumCompressed;',\n\n\t\t\t'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);',\n\t\t\t'vec3 color = curr*whiteScale;',\n\n\t\t\t'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));',\n\n\n\t\t\t'gl_FragColor.rgb = retColor;',\n\n\t\t\t'gl_FragColor.a = 1.0;',\n\t\t'}',\n\n\t].join( '\\n' )\n\n};\n\nvar Sky = function () {\n\n\tvar skyShader = THREE.ShaderLib[ 'sky' ];\n\tvar skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );\n\n\tvar skyMat = new THREE.ShaderMaterial( {\n\t\tfragmentShader: skyShader.fragmentShader,\n\t\tvertexShader: skyShader.vertexShader,\n\t\tuniforms: skyUniforms,\n\t\tside: THREE.BackSide\n\t} );\n\n\tvar skyGeo = new THREE.SphereBufferGeometry( 450000, 32, 15 );\n\tvar skyMesh = new THREE.Mesh( skyGeo, skyMat );\n\n\n\t// Expose variables\n\tthis.mesh = skyMesh;\n\tthis.uniforms = skyUniforms;\n\n};\n\nexport default Sky;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Sky.js\n **/","/**\n * lodash 4.0.0 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar debounce = require('lodash.debounce');\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide an options object to indicate whether\n * `func` should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the throttled function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=true] Specify invoking on the leading\n * edge of the timeout.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // avoid excessively updating the position while scrolling\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // cancel a trailing throttled invocation\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = throttle;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/index.js\n ** module id = 40\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\nvar now = Date.now;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide an options object to indicate whether `func` should be invoked on\n * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent calls\n * to the debounced function return the result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it's invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n leading = false,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function flush() {\n if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n result = func.apply(thisArg, args);\n }\n cancel();\n return result;\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/~/lodash.debounce/index.js\n ** module id = 41\n ** module chunks = 0\n **/","import Orbit, {orbit} from './Controls.Orbit';\n\nconst Controls = {\n Orbit: Orbit,\n orbit, orbit\n};\n\nexport default Controls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/index.js\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport OrbitControls from '../vendor/OrbitControls';\n\nclass Orbit extends EventEmitter {\n constructor() {\n super();\n }\n\n // Proxy control events\n //\n // There's currently no distinction between pan, orbit and zoom events\n _initEvents() {\n this._controls.addEventListener('start', (event) => {\n this._world.emit('controlsMoveStart', event.target.target);\n });\n\n this._controls.addEventListener('change', (event) => {\n this._world.emit('controlsMove', event.target.target);\n });\n\n this._controls.addEventListener('end', (event) => {\n this._world.emit('controlsMoveEnd', event.target.target);\n });\n }\n\n // Moving the camera along the [x,y,z] axis based on a target position\n _panTo(point, animate) {}\n _panBy(pointDelta, animate) {}\n\n // Zooming the camera in and out\n _zoomTo(metres, animate) {}\n _zoomBy(metresDelta, animate) {}\n\n // Force camera to look at something other than the target\n _lookAt(point, animate) {}\n\n // Make camera look at the target\n _lookAtTarget() {}\n\n // Tilt (up and down)\n _tiltTo(angle, animate) {}\n _tiltBy(angleDelta, animate) {}\n\n // Rotate (left and right)\n _rotateTo(angle, animate) {}\n _rotateBy(angleDelta, animate) {}\n\n // Fly to the given point, animating pan and tilt/rotation to final position\n // with nice zoom out and in\n //\n // Calling flyTo a second time before the previous animation has completed\n // will immediately start the new animation from wherever the previous one\n // has got to\n _flyTo(point, noZoom) {}\n\n // Proxy to OrbitControls.update()\n update() {\n this._controls.update();\n }\n\n // Add controls to world instance and store world reference\n addTo(world) {\n world.addControls(this);\n return this;\n }\n\n // Internal method called by World.addControls to actually add the controls\n _addToWorld(world) {\n this._world = world;\n\n // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n // See: http://stackoverflow.com/a/26188674/997339\n this._controls = new OrbitControls(world._engine._camera, world._container);\n\n // Disable keys for now as no events are fired for them anyway\n this._controls.keys = false;\n\n // 89 degrees\n this._controls.maxPolarAngle = 1.5533;\n\n // this._controls.enableDamping = true;\n // this._controls.dampingFactor = 0.25;\n\n this._initEvents();\n\n this.emit('added');\n }\n\n // Destroys the controls and removes them from memory\n destroy() {\n // TODO: Remove event listeners\n\n this._controls.dispose();\n\n this._world = null;\n this._controls = null;\n }\n}\n\nexport default Orbit;\n\nvar noNew = function() {\n return new Orbit();\n};\n\n// Initialise without requiring new keyword\nexport {noNew as orbit};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/Controls.Orbit.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\nimport THREE from 'three';\nimport Hammer from 'hammerjs';\n\n/**\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author erich666 / http://erichaines.com\n */\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one finger move\n// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n// Pan - right mouse, or arrow keys / touch: three finter swipe\n\nvar OrbitControls = function ( object, domElement ) {\n\n\tthis.object = object;\n\n\tthis.domElement = ( domElement !== undefined ) ? domElement : document;\n\n\t// Set to false to disable this control\n\tthis.enabled = true;\n\n\t// \"target\" sets the location of focus, where the object orbits around\n\tthis.target = new THREE.Vector3();\n\n\t// How far you can dolly in and out ( PerspectiveCamera only )\n\tthis.minDistance = 0;\n\tthis.maxDistance = Infinity;\n\n\t// How far you can zoom in and out ( OrthographicCamera only )\n\tthis.minZoom = 0;\n\tthis.maxZoom = Infinity;\n\n\t// How far you can orbit vertically, upper and lower limits.\n\t// Range is 0 to Math.PI radians.\n\tthis.minPolarAngle = 0; // radians\n\tthis.maxPolarAngle = Math.PI; // radians\n\n\t// How far you can orbit horizontally, upper and lower limits.\n\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\tthis.minAzimuthAngle = - Infinity; // radians\n\tthis.maxAzimuthAngle = Infinity; // radians\n\n\t// Set to true to enable damping (inertia)\n\t// If damping is enabled, you must call controls.update() in your animation loop\n\tthis.enableDamping = false;\n\tthis.dampingFactor = 0.25;\n\n\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t// Set to false to disable zooming\n\tthis.enableZoom = true;\n\tthis.zoomSpeed = 1.0;\n\n\t// Set to false to disable rotating\n\tthis.enableRotate = true;\n\tthis.rotateSpeed = 1.0;\n\n\t// Set to false to disable panning\n\tthis.enablePan = true;\n\tthis.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\n\t// Set to true to automatically rotate around the target\n\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\tthis.autoRotate = false;\n\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n\t// Set to false to disable use of the keys\n\tthis.enableKeys = true;\n\n\t// The four arrow keys\n\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\n\t// Mouse buttons\n\tthis.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };\n\n\t// for reset\n\tthis.target0 = this.target.clone();\n\tthis.position0 = this.object.position.clone();\n\tthis.zoom0 = this.object.zoom;\n\n\t//\n\t// public methods\n\t//\n\n\tthis.getPolarAngle = function () {\n\n\t\treturn phi;\n\n\t};\n\n\tthis.getAzimuthalAngle = function () {\n\n\t\treturn theta;\n\n\t};\n\n\tthis.reset = function () {\n\n\t\tscope.target.copy( scope.target0 );\n\t\tscope.object.position.copy( scope.position0 );\n\t\tscope.object.zoom = scope.zoom0;\n\n\t\tscope.object.updateProjectionMatrix();\n\t\tscope.dispatchEvent( changeEvent );\n\n\t\tscope.update();\n\n\t\tstate = STATE.NONE;\n\n\t};\n\n\t// this method is exposed, but perhaps it would be better if we can make it private...\n\tthis.update = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\t// so camera.up is the orbit axis\n\t\tvar quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );\n\t\tvar quatInverse = quat.clone().inverse();\n\n\t\tvar lastPosition = new THREE.Vector3();\n\t\tvar lastQuaternion = new THREE.Quaternion();\n\n\t\treturn function () {\n\n\t\t\tvar position = scope.object.position;\n\n\t\t\toffset.copy( position ).sub( scope.target );\n\n\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\toffset.applyQuaternion( quat );\n\n\t\t\t// angle from z-axis around y-axis\n\n\t\t\ttheta = Math.atan2( offset.x, offset.z );\n\n\t\t\t// angle from y-axis\n\n\t\t\tphi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );\n\n\t\t\tif ( scope.autoRotate && state === STATE.NONE ) {\n\n\t\t\t\trotateLeft( getAutoRotationAngle() );\n\n\t\t\t}\n\n\t\t\ttheta += thetaDelta;\n\t\t\tphi += phiDelta;\n\n\t\t\t// restrict theta to be between desired limits\n\t\t\ttheta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, theta ) );\n\n\t\t\t// restrict phi to be between desired limits\n\t\t\tphi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, phi ) );\n\n\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\tphi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );\n\n\t\t\tvar radius = offset.length() * scale;\n\n\t\t\t// restrict radius to be between desired limits\n\t\t\tradius = Math.max( scope.minDistance, Math.min( scope.maxDistance, radius ) );\n\n\t\t\t// move target to panned location\n\t\t\tscope.target.add( panOffset );\n\n\t\t\toffset.x = radius * Math.sin( phi ) * Math.sin( theta );\n\t\t\toffset.y = radius * Math.cos( phi );\n\t\t\toffset.z = radius * Math.sin( phi ) * Math.cos( theta );\n\n\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\toffset.applyQuaternion( quatInverse );\n\n\t\t\tposition.copy( scope.target ).add( offset );\n\n\t\t\tscope.object.lookAt( scope.target );\n\n\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\tthetaDelta *= ( 1 - scope.dampingFactor );\n\t\t\t\tphiDelta *= ( 1 - scope.dampingFactor );\n\n\t\t\t} else {\n\n\t\t\t\tthetaDelta = 0;\n\t\t\t\tphiDelta = 0;\n\n\t\t\t}\n\n\t\t\tscale = 1;\n\t\t\tpanOffset.set( 0, 0, 0 );\n\n\t\t\t// update condition is:\n\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n\t\t\tif ( zoomChanged ||\n\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n\t\t\t\tscope.dispatchEvent( changeEvent );\n\n\t\t\t\tlastPosition.copy( scope.object.position );\n\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\tzoomChanged = false;\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t}();\n\n\tthis.dispose = function() {\n\n\t\tscope.domElement.removeEventListener( 'contextmenu', onContextMenu, false );\n\t\tscope.domElement.removeEventListener( 'mousedown', onMouseDown, false );\n\t\tscope.domElement.removeEventListener( 'mousewheel', onMouseWheel, false );\n\t\tscope.domElement.removeEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t\tscope.domElement.removeEventListener( 'touchstart', onTouchStart, false );\n\t\tscope.domElement.removeEventListener( 'touchend', onTouchEnd, false );\n\t\tscope.domElement.removeEventListener( 'touchmove', onTouchMove, false );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\twindow.removeEventListener( 'keydown', onKeyDown, false );\n\n\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\n\t};\n\n\t//\n\t// internals\n\t//\n\n\tvar scope = this;\n\n\tvar changeEvent = { type: 'change' };\n\tvar startEvent = { type: 'start' };\n\tvar endEvent = { type: 'end' };\n\n\tvar STATE = { NONE : - 1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };\n\n\tvar state = STATE.NONE;\n\n\tvar EPS = 0.000001;\n\n\t// current position in spherical coordinates\n\tvar theta;\n\tvar phi;\n\n\tvar phiDelta = 0;\n\tvar thetaDelta = 0;\n\tvar scale = 1;\n\tvar panOffset = new THREE.Vector3();\n\tvar zoomChanged = false;\n\n\tvar rotateStart = new THREE.Vector2();\n\tvar rotateEnd = new THREE.Vector2();\n\tvar rotateDelta = new THREE.Vector2();\n\n\tvar panStart = new THREE.Vector2();\n\tvar panEnd = new THREE.Vector2();\n\tvar panDelta = new THREE.Vector2();\n\n\tvar dollyStart = new THREE.Vector2();\n\tvar dollyEnd = new THREE.Vector2();\n\tvar dollyDelta = new THREE.Vector2();\n\n\tfunction getAutoRotationAngle() {\n\n\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\n\t}\n\n\tfunction getZoomScale() {\n\n\t\treturn Math.pow( 0.95, scope.zoomSpeed );\n\n\t}\n\n\tfunction rotateLeft( angle ) {\n\n\t\tthetaDelta -= angle;\n\n\t}\n\n\tfunction rotateUp( angle ) {\n\n\t\tphiDelta -= angle;\n\n\t}\n\n\tvar panLeft = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panLeft( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get X column of objectMatrix\n\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n //\n\t\t// \tv.multiplyScalar( - distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n // Fixed panning to x/y plane\n return function panLeft(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t // var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 0 ], 0, te[ 2 ]);\n\t v.multiplyScalar(-distance);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n // Fixed panning to x/y plane\n\tvar panUp = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panUp( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get Y column of objectMatrix\n\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n //\n\t\t// \tv.multiplyScalar( distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n return function panUp(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 4 ], 0, te[ 6 ]);\n\t v.multiplyScalar(adjDist);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n\t// deltaX and deltaY are in pixels; right and down are positive\n\tvar pan = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\treturn function( deltaX, deltaY ) {\n\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\t\t// perspective\n\t\t\t\tvar position = scope.object.position;\n\t\t\t\toffset.copy( position ).sub( scope.target );\n\t\t\t\tvar targetDistance = offset.length();\n\n\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\ttargetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\tpanLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n\t\t\t\tpanUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\t\t// orthographic\n\t\t\t\tpanLeft( deltaX * ( scope.object.right - scope.object.left ) / element.clientWidth, scope.object.matrix );\n\t\t\t\tpanUp( deltaY * ( scope.object.top - scope.object.bottom ) / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else {\n\n\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n\t\t\t\tscope.enablePan = false;\n\n\t\t\t}\n\n\t\t};\n\n\t}();\n\n\tfunction dollyIn( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale /= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\tfunction dollyOut( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale *= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\t//\n\t// event callbacks - update the object state\n\t//\n\n\tfunction handleMouseDownRotate( event ) {\n\n\t\t//console.log( 'handleMouseDownRotate' );\n\n\t\trotateStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownDolly( event ) {\n\n\t\t//console.log( 'handleMouseDownDolly' );\n\n\t\tdollyStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownPan( event ) {\n\n\t\t//console.log( 'handleMouseDownPan' );\n\n\t\tpanStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseMoveRotate( event ) {\n\n\t\t//console.log( 'handleMouseMoveRotate' );\n\n\t\trotateEnd.set( event.clientX, event.clientY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMoveDolly( event ) {\n\n\t\t//console.log( 'handleMouseMoveDolly' );\n\n\t\tdollyEnd.set( event.clientX, event.clientY );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMovePan( event ) {\n\n\t\t//console.log( 'handleMouseMovePan' );\n\n\t\tpanEnd.set( event.clientX, event.clientY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseUp( event ) {\n\n\t\t//console.log( 'handleMouseUp' );\n\n\t}\n\n\tfunction handleMouseWheel( event ) {\n\n\t\t//console.log( 'handleMouseWheel' );\n\n\t\tvar delta = 0;\n\n\t\tif ( event.wheelDelta !== undefined ) {\n\n\t\t\t// WebKit / Opera / Explorer 9\n\n\t\t\tdelta = event.wheelDelta;\n\n\t\t} else if ( event.detail !== undefined ) {\n\n\t\t\t// Firefox\n\n\t\t\tdelta = - event.detail;\n\n\t\t}\n\n\t\tif ( delta > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( delta < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleKeyDown( event ) {\n\n\t\t//console.log( 'handleKeyDown' );\n\n\t\tswitch ( event.keyCode ) {\n\n\t\t\tcase scope.keys.UP:\n\t\t\t\tpan( 0, scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\tpan( 0, - scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.LEFT:\n\t\t\t\tpan( scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.RIGHT:\n\t\t\t\tpan( - scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction handleTouchStartRotate( event ) {\n\n\t\t//console.log( 'handleTouchStartRotate' );\n\n\t\trotateStart.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\n\t}\n\n\tfunction handleTouchStartDolly( event ) {\n\n\t\t//console.log( 'handleTouchStartDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyStart.set( 0, distance );\n\n\t}\n\n\tfunction handleTouchStartPan( event ) {\n\n\t\t//console.log( 'handleTouchStartPan' );\n\n\t\tpanStart.set( event.deltaX, event.deltaY );\n\n\t}\n\n\tfunction handleTouchMoveRotate( event ) {\n\n\t\t//console.log( 'handleTouchMoveRotate' );\n\n\t\trotateEnd.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMoveDolly( event ) {\n\n\t\t//console.log( 'handleTouchMoveDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyEnd.set( 0, distance );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMovePan( event ) {\n\n\t\t//console.log( 'handleTouchMovePan' );\n\n\t\tpanEnd.set( event.deltaX, event.deltaY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchEnd( event ) {\n\n\t\t//console.log( 'handleTouchEnd' );\n\n\t}\n\n\t//\n\t// event handlers - FSM: listen for events and reset state\n\t//\n\n\tfunction onMouseDown( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.button === scope.mouseButtons.ORBIT ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseDownRotate( event );\n\n\t\t\tstate = STATE.ROTATE;\n\n\t\t} else if ( event.button === scope.mouseButtons.ZOOM ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseDownDolly( event );\n\n\t\t\tstate = STATE.DOLLY;\n\n\t\t} else if ( event.button === scope.mouseButtons.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseDownPan( event );\n\n\t\t\tstate = STATE.PAN;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tdocument.addEventListener( 'mousemove', onMouseMove, false );\n\t\t\tdocument.addEventListener( 'mouseup', onMouseUp, false );\n\t\t\tdocument.addEventListener( 'mouseout', onMouseUp, false );\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( state === STATE.ROTATE ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseMoveRotate( event );\n\n\t\t} else if ( state === STATE.DOLLY ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseMoveDolly( event );\n\n\t\t} else if ( state === STATE.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseMovePan( event );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseUp( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleMouseUp( event );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onMouseWheel( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\thandleMouseWheel( event );\n\n\t\tscope.dispatchEvent( startEvent ); // not sure why these are here...\n\t\tscope.dispatchEvent( endEvent );\n\n\t}\n\n\tfunction onKeyDown( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;\n\n\t\thandleKeyDown( event );\n\n\t}\n\n\tfunction onTouchStart( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1:\t// one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\thandleTouchStartRotate( event );\n\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\t// two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\thandleTouchStartDolly( event );\n\n\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\thandleTouchStartPan( event );\n\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onTouchMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1: // one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveRotate( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2: // two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveDolly( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\t\thandleTouchMovePan( event );\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t}\n\n\tfunction onTouchEnd( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleTouchEnd( event );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onContextMenu( event ) {\n\n\t\tevent.preventDefault();\n\n\t}\n\n\t//\n\n\tscope.domElement.addEventListener( 'contextmenu', onContextMenu, false );\n\n\tscope.domElement.addEventListener( 'mousedown', onMouseDown, false );\n\tscope.domElement.addEventListener( 'mousewheel', onMouseWheel, false );\n\tscope.domElement.addEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\n\tscope.hammer = new Hammer(scope.domElement);\n\n\tscope.hammer.get('pan').set({\n\t\tpointers: 0,\n\t\tdirection: Hammer.DIRECTION_ALL\n\t});\n\n\tscope.hammer.get('pinch').set({\n\t\tenable: true,\n\t\tthreshold: 0.1\n\t});\n\n\tscope.hammer.on('panstart', function(event) {\n\t\tif (scope.enabled === false) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif (scope.enablePan === false) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\thandleTouchStartPan(event);\n\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\n\t\t\tstate = STATE.TOUCH_PAN;\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleTouchStartRotate( event );\n\n\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t}\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('panend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('panmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif ( scope.enablePan === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\thandleTouchMovePan( event );\n\n\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t//\n\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t//\n\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t//\n\t\t\t// panStart.copy( panEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\thandleTouchMoveRotate( event );\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchstart', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( scope.enableZoom === false ) return;\n\n\t\thandleTouchStartDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyStart.set( 0, distance );\n\t\t//\n\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('pinchmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif ( scope.enableZoom === false ) return;\n\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\thandleTouchMoveDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyEnd.set( 0, distance );\n\t\t//\n\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t//\n\t\t// if ( dollyDelta.y > 0 ) {\n\t\t//\n\t\t// \tdollyOut( getZoomScale() );\n\t\t//\n\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t//\n\t\t// \tdollyIn( getZoomScale() );\n\t\t//\n\t\t// }\n\t\t//\n\t\t// dollyStart.copy( dollyEnd );\n\t\t//\n\t\t// scope.update();\n\t});\n\n\twindow.addEventListener( 'keydown', onKeyDown, false );\n\n\t// force an update at start\n\n\tthis.update();\n\n};\n\nOrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );\nOrbitControls.prototype.constructor = THREE.OrbitControls;\n\nObject.defineProperties( OrbitControls.prototype, {\n\n\tcenter: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .center has been renamed to .target' );\n\t\t\treturn this.target;\n\n\t\t}\n\n\t},\n\n\t// backward compatibility\n\n\tnoZoom: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\treturn ! this.enableZoom;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\tthis.enableZoom = ! value;\n\n\t\t}\n\n\t},\n\n\tnoRotate: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\treturn ! this.enableRotate;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\tthis.enableRotate = ! value;\n\n\t\t}\n\n\t},\n\n\tnoPan: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\treturn ! this.enablePan;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\tthis.enablePan = ! value;\n\n\t\t}\n\n\t},\n\n\tnoKeys: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\treturn ! this.enableKeys;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\tthis.enableKeys = ! value;\n\n\t\t}\n\n\t},\n\n\tstaticMoving : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\treturn ! this.constraint.enableDamping;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\tthis.constraint.enableDamping = ! value;\n\n\t\t}\n\n\t},\n\n\tdynamicDampingFactor : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\treturn this.constraint.dampingFactor;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\tthis.constraint.dampingFactor = value;\n\n\t\t}\n\n\t}\n\n} );\n\nexport default OrbitControls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/OrbitControls.js\n **/","/*! Hammer.JS - v2.0.6 - 2015-12-23\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2015 Jorik Tangelder;\n * Licensed under the license */\n(function(window, document, exportName, undefined) {\n 'use strict';\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = document.createElement('div');\n\nvar TYPE_FUNCTION = 'function';\n\nvar round = Math.round;\nvar abs = Math.abs;\nvar now = Date.now;\n\n/**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\nfunction setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n}\n\n/**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n}\n\n/**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function() {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n .replace(/^\\s+at\\s+/gm, '')\n .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean=false} [merge]\n * @returns {Object} dest\n */\nvar extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\nvar merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\nfunction inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign(childP, properties);\n }\n}\n\n/**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\nfunction boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n}\n\n/**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\nfunction ifUndefined(val1, val2) {\n return (val1 === undefined) ? val2 : val1;\n}\n\n/**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n}\n\n/**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n return i;\n }\n i++;\n }\n return -1;\n }\n}\n\n/**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\n/**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\nfunction prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = (prefix) ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n}\n\n/**\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return (doc.defaultView || doc.parentWindow || window);\n}\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\nvar SUPPORT_TOUCH = ('ontouchstart' in window);\nvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\n\nvar COMPUTE_INTERVAL = 25;\n\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\n\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\n\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\nfunction Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function(ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n\n}\n\nInput.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function() { },\n\n /**\n * bind the events\n */\n init: function() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n\n /**\n * unbind the events\n */\n destroy: function() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n};\n\n/**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\nfunction createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new (Type)(manager, inputHandler);\n}\n\n/**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\n input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity, velocityX, velocityY, direction;\n\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\nfunction getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0, y = 0, i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\n/**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n\n return Math.sqrt((x * x) + (y * y));\n}\n\n/**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\n\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n/**\n * Mouse events input\n * @constructor\n * @extends Input\n */\nfunction MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n\n this.allow = true; // used by Input.TouchMouse to disable mouse events\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n}\n\ninherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n if (!this.pressed || !this.allow) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n});\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n};\n\n// in IE10 the pointer types is defined as an enum\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n};\n\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n// IE10 has prefixed support, and case-sensitive\nif (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n\n/**\n * Pointer events input\n * @constructor\n * @extends Input\n */\nfunction PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n\n Input.apply(this, arguments);\n\n this.store = (this.manager.session.pointerEvents = []);\n}\n\ninherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\n var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n});\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Touch events input\n * @constructor\n * @extends Input\n */\nfunction SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n\n Input.apply(this, arguments);\n}\n\ninherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\nfunction TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n\n Input.apply(this, arguments);\n}\n\ninherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function(touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n changedTargetTouches\n ];\n}\n\n/**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\nfunction TouchMouseInput() {\n Input.apply(this, arguments);\n\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n}\n\ninherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\n // when we're in a touch event, so block all upcoming mouse events\n // most mobile browser also emit mouseevents, right after touchstart\n if (isTouch) {\n this.mouse.allow = false;\n } else if (isMouse && !this.mouse.allow) {\n return;\n }\n\n // reset the allowMouse when we're done\n if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n this.mouse.allow = true;\n }\n\n this.callback(manager, inputEvent, inputData);\n },\n\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n});\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n// magical touchAction value\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\n/**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\nfunction TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n}\n\nTouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function(value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n\n /**\n * just re-set the touchAction value\n */\n update: function() {\n this.set(this.manager.options.touchAction);\n },\n\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function() {\n var actions = [];\n each(this.manager.recognizers, function(recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function(input) {\n // not needed with native support for the touchAction property\n if (NATIVE_TOUCH_ACTION) {\n return;\n }\n\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)) {\n return this.preventSrc(srcEvent);\n }\n },\n\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n};\n\n/**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\nfunction Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n\n this.id = uniqueId();\n\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n\n this.state = STATE_POSSIBLE;\n\n this.simultaneous = {};\n this.requireFail = [];\n}\n\nRecognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function(options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function() {\n return this.requireFail.length > 0;\n },\n\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function(input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function() {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function(inputData) { }, // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function() { },\n\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function() { }\n};\n\n/**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n}\n\n/**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\nfunction directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n}\n\n/**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n}\n\n/**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\nfunction AttrRecognizer() {\n Recognizer.apply(this, arguments);\n}\n\ninherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function(input) {\n var state = this.state;\n var eventType = input.eventType;\n\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n});\n\n/**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n\n this.pX = null;\n this.pY = null;\n}\n\ninherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n\n getTouchAction: function() {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n\n directionTest: function(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n\n attrTest: function(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n },\n\n emit: function(input) {\n\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n\n emit: function(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\nfunction PressRecognizer() {\n Recognizer.apply(this, arguments);\n\n this._timer = null;\n this._input = null;\n}\n\ninherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251, // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_AUTO];\n },\n\n process: function(input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && (input.eventType & INPUT_END)) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n});\n\n/**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n\n getTouchAction: function() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n\n attrTest: function(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n\n emit: function(input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n }\n});\n\n/**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\nfunction TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n\n this._timer = null;\n this._input = null;\n this.count = 0;\n}\n\ninherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300, // max time between the multi-tap taps\n time: 250, // max time of the pointer to be down (like finger on the screen)\n threshold: 9, // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_MANIPULATION];\n },\n\n process: function(input) {\n var options = this.options;\n\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n\n this.reset();\n\n if ((input.eventType & INPUT_START) && (this.count === 0)) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n\n failTimeout: function() {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function() {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n}\n\n/**\n * @const {string}\n */\nHammer.VERSION = '2.0.6';\n\n/**\n * default settings\n * @namespace\n */\nHammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {enable: false}],\n [PinchRecognizer, {enable: false}, ['rotate']],\n [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n [PressRecognizer]\n ],\n\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n};\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n\n/**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n\n this.options.inputTarget = this.options.inputTarget || element;\n\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n\n toggleCssProps(this, true);\n\n each(this.options.recognizers, function(item) {\n var recognizer = this.add(new (item[0])(item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n}\n\nManager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function(options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n curRecognizer = session.curRecognizer = null;\n }\n\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) { // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function(recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n\n this.touchAction.update();\n return recognizer;\n },\n\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function(recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n },\n\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n data.preventDefault = function() {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function() {\n this.element && toggleCssProps(this, false);\n\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n};\n\n/**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n each(manager.options.cssProps, function(value, name) {\n element.style[prefixed(element.style, name)] = add ? value : '';\n });\n}\n\n/**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n\nassign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n});\n\n// this prevents errors when Hammer is loaded in the presence of an AMD\n// style loader but by script tag, not by the loader.\nvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\nfreeGlobal.Hammer = Hammer;\n\nif (typeof define === 'function' && define.amd) {\n define(function() {\n return Hammer;\n });\n} else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n} else {\n window[exportName] = Hammer;\n}\n\n})(window, document, 'Hammer');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/hammerjs/hammer.js\n ** module id = 45\n ** module chunks = 0\n **/","import TileLayer from './TileLayer';\nimport ImageTile from './ImageTile';\nimport ImageTileLayerBaseMaterial from './ImageTileLayerBaseMaterial';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\nimport extend from 'lodash.assign';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n// being removed and the new tiles being ready for display\n//\n// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n// of the basemap ground so it blends in a little more, or have a huge ground\n// plane underneath all the tiles that shows through between tile updates.\n//\n// Could keep the old tiles around until the new ones are ready, though they'd\n// probably need to be layered in a way so the old tiles don't overlap new ones,\n// which is similar to how Leaflet approaches this (it has 2 layers)\n//\n// Could keep the tile from the previous quadtree level visible until all 4\n// tiles at the new / current level have finished loading and are displayed.\n// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n// child quadcodes showing whether they are loaded and in view. If all true then\n// remove the parent tile, otherwise keep it on a lower layer.\n\n// TODO: Load and display a base layer separate to the LOD grid that is at a low\n// resolution – used as a backup / background to fill in empty areas / distance\n\n// DONE: Fix the issue where some tiles just don't load, or at least the texture\n// never shows up – tends to happen if you quickly zoom in / out past it while\n// it's still loading, leaving a blank space\n\n// TODO: Optimise the request of many image tiles – look at how Leaflet and\n// OpenWebGlobe approach this (eg. batching, queues, etc)\n\n// TODO: Cancel pending tile requests if they get removed from view before they\n// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n// images are re-requested when the tile is next in scene (even if from cache)\n\n// TODO: Consider not performing an LOD calculation on every frame, instead only\n// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n// possible for performance to tank if you pan, orbit or zoom rapidly while all\n// the LOD calculations are being made and new tiles requested.\n//\n// Pending tiles should continue to be requested and output to the scene on each\n// frame, but no new LOD calculations should be made.\n\n// This tile layer both updates the quadtree and outputs tiles on every frame\n// (throttled to some amount)\n//\n// This is because the computational complexity of image tiles is generally low\n// and so there isn't much jank when running these calculations and outputs in\n// realtime\n//\n// The benefit to doing this is that the underlying map layer continues to\n// refresh and update during movement, which is an arguably better experience\n\nclass ImageTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n distance: 40000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Add base layer\n var geom = new THREE.PlaneBufferGeometry(200000, 200000, 1);\n\n var baseMaterial;\n if (this._world._environment._skybox) {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n } else {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3');\n }\n\n var mesh = new THREE.Mesh(geom, baseMaterial);\n mesh.renderOrder = 0;\n mesh.rotation.x = -90 * Math.PI / 180;\n\n // TODO: It might be overkill to receive a shadow on the base layer as it's\n // rarely seen (good to have if performance difference is negligible)\n mesh.receiveShadow = true;\n\n this._baseLayer = mesh;\n this.add(mesh);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onWorldUpdate() {\n this._calculateLOD();\n this._outputTiles();\n }\n\n _onWorldMove(latlon, point) {\n this._moveBaseLayer(point);\n }\n\n _moveBaseLayer(point) {\n this._baseLayer.position.x = point.x;\n this._baseLayer.position.z = point.y;\n }\n\n _createTile(quadcode, layer) {\n return new ImageTile(quadcode, this._path, layer);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Dispose of mesh and materials\n this._baseLayer.geometry.dispose();\n this._baseLayer.geometry = null;\n\n if (this._baseLayer.material.map) {\n this._baseLayer.material.map.dispose();\n this._baseLayer.material.map = null;\n }\n\n this._baseLayer.material.dispose();\n this._baseLayer.material = null;\n\n this._baseLayer = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default ImageTileLayer;\n\nvar noNew = function(path, options) {\n return new ImageTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayer.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport TileCache from './TileCache';\nimport THREE from 'three';\n\n// TODO: Consider removing picking from TileLayer instances as there aren't\n// (m)any situations where it would be practical\n//\n// For example, how would you even know what picking IDs to listen to and what\n// to do with them?\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider keeping a single TileLayer / LOD instance running by default\n// that keeps a standard LOD grid for other layers to utilise, rather than\n// having to create their own, unique LOD grid and duplicate calculations when\n// they're going to use the same grid setup anyway\n//\n// It still makes sense to be able to have a custom LOD grid for some layers as\n// they may want to customise things, maybe not even using a quadtree at all!\n//\n// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n// pass in the necessary parameters each time for the calculation step.\n//\n// Either way, it seems silly to force layers to have to create a new LOD grid\n// each time and create extra, duplicated processing every frame.\n\n// TODO: Allow passing in of options to define min/max LOD and a distance to use\n// for culling tiles beyond that distance.\n\n// DONE: Prevent tiles from being loaded if they are further than a certain\n// distance from the camera and are unlikely to be seen anyway\n\n// TODO: Avoid performing LOD calculation when it isn't required. For example,\n// when nothing has changed since the last frame and there are no tiles to be\n// loaded or in need of rendering\n\n// TODO: Only remove tiles from the layer that aren't to be rendered in the\n// current frame – it seems excessive to remove all tiles and re-add them on\n// every single frame, even if it's just array manipulation\n\n// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n// problems (eg. making min above 5 causes all sorts of issues)\n\n// TODO: Reuse THREE objects where possible instead of creating new instances\n// on every LOD calculation\n\n// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n// to avoid creating unnecessary memory for garbage collection\n\n// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n// closest to the camera) so visual inconsistancies during loading are minimised\n\nclass TileLayer extends Layer {\n constructor(options) {\n var defaults = {\n picking: false,\n maxCache: 1000,\n maxLOD: 18\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._tileCache = new TileCache(this._options.maxCache, tile => {\n this._destroyTile(tile);\n });\n\n // List of tiles from the previous LOD calculation\n this._tileList = [];\n\n // TODO: Work out why changing the minLOD causes loads of issues\n this._minLOD = 3;\n this._maxLOD = this._options.maxLOD;\n\n this._frustum = new THREE.Frustum();\n this._tiles = new THREE.Object3D();\n this._tilesPicking = new THREE.Object3D();\n }\n\n _onAdd(world) {\n this.addToPicking(this._tilesPicking);\n this.add(this._tiles);\n }\n\n _updateFrustum() {\n var camera = this._world.getCamera();\n var projScreenMatrix = new THREE.Matrix4();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\n this._frustum.setFromMatrix(camera.projectionMatrix);\n this._frustum.setFromMatrix(new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n }\n\n _tileInFrustum(tile) {\n var bounds = tile.getBounds();\n return this._frustum.intersectsBox(new THREE.Box3(new THREE.Vector3(bounds[0], 0, bounds[3]), new THREE.Vector3(bounds[2], 0, bounds[1])));\n }\n\n // Update and output tiles from the previous LOD checklist\n _outputTiles() {\n if (!this._tiles) {\n return;\n }\n\n // Remove all tiles from layer\n this._removeTiles();\n\n // Add / re-add tiles\n this._tileList.forEach(tile => {\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n if (!tile.isReady()) {\n return;\n }\n\n // Add tile to layer (and to scene) if not already there\n this._tiles.add(tile.getMesh());\n\n if (tile.getPickingMesh()) {\n this._tilesPicking.add(tile.getPickingMesh());\n }\n });\n }\n\n // Works out tiles in the view frustum and stores them in an array\n //\n // Does not output the tiles, deferring this to _outputTiles()\n _calculateLOD() {\n if (this._stop || !this._world) {\n return;\n }\n\n // var start = performance.now();\n\n var camera = this._world.getCamera();\n\n // 1. Update and retrieve camera frustum\n this._updateFrustum(this._frustum, camera);\n\n // 2. Add the four root items of the quadtree to a check list\n var checkList = this._checklist;\n checkList = [];\n checkList.push(this._requestTile('0', this));\n checkList.push(this._requestTile('1', this));\n checkList.push(this._requestTile('2', this));\n checkList.push(this._requestTile('3', this));\n\n // 3. Call Divide, passing in the check list\n this._divide(checkList);\n\n // // 4. Remove all tiles from layer\n //\n // Moved to _outputTiles() for now\n // this._removeTiles();\n\n // 5. Filter the tiles remaining in the check list\n this._tileList = checkList.filter((tile, index) => {\n // Skip tile if it's not in the current view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n if (this._options.distance && this._options.distance > 0) {\n // TODO: Can probably speed this up\n var center = tile.getCenter();\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n // Manual distance limit to cut down on tiles so far away\n if (dist > this._options.distance) {\n return false;\n }\n }\n\n // Does the tile have a mesh?\n //\n // If yes, continue\n // If no, generate tile mesh, request texture and skip\n if (!tile.getMesh()) {\n tile.requestTileAsync();\n }\n\n return true;\n\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n // if (!tile.isReady()) {\n // return;\n // }\n //\n // // Add tile to layer (and to scene)\n // this._tiles.add(tile.getMesh());\n });\n\n // console.log(performance.now() - start);\n }\n\n _divide(checkList) {\n var count = 0;\n var currentItem;\n var quadcode;\n\n // 1. Loop until count equals check list length\n while (count != checkList.length) {\n currentItem = checkList[count];\n quadcode = currentItem.getQuadcode();\n\n // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n if (currentItem.length === this._maxLOD) {\n count++;\n continue;\n }\n\n // 3. Else, calculate screen-space error metric for quadcode\n if (this._screenSpaceError(currentItem)) {\n // 4. If error is sufficient...\n\n // 4a. Remove parent item from the check list\n checkList.splice(count, 1);\n\n // 4b. Add 4 child items to the check list\n checkList.push(this._requestTile(quadcode + '0', this));\n checkList.push(this._requestTile(quadcode + '1', this));\n checkList.push(this._requestTile(quadcode + '2', this));\n checkList.push(this._requestTile(quadcode + '3', this));\n\n // 4d. Continue the loop without increasing count\n continue;\n } else {\n // 5. Else, increase count and continue loop\n count++;\n }\n }\n }\n\n _screenSpaceError(tile) {\n var minDepth = this._minLOD;\n var maxDepth = this._maxLOD;\n\n var quadcode = tile.getQuadcode();\n\n var camera = this._world.getCamera();\n\n // Tweak this value to refine specific point that each quad is subdivided\n //\n // It's used to multiple the dimensions of the tile sides before\n // comparing against the tile distance from camera\n var quality = 3.0;\n\n // 1. Return false if quadcode length equals maxDepth (stop dividing)\n if (quadcode.length === maxDepth) {\n return false;\n }\n\n // 2. Return true if quadcode length is less than minDepth\n if (quadcode.length < minDepth) {\n return true;\n }\n\n // 3. Return false if quadcode bounds are not in view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n var center = tile.getCenter();\n\n // 4. Calculate screen-space error metric\n // TODO: Use closest distance to one of the 4 tile corners\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n var error = quality * tile.getSide() / dist;\n\n // 5. Return true if error is greater than 1.0, else return false\n return (error > 1.0);\n }\n\n _removeTiles() {\n if (!this._tiles || !this._tiles.children) {\n return;\n }\n\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n\n if (!this._tilesPicking || !this._tilesPicking.children) {\n return;\n }\n\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n // Return a new tile instance\n _createTile(quadcode, layer) {}\n\n // Get a cached tile or request a new one if not in cache\n _requestTile(quadcode, layer) {\n var tile = this._tileCache.getTile(quadcode);\n\n if (!tile) {\n // Set up a brand new tile\n tile = this._createTile(quadcode, layer);\n\n // Add tile to cache, though it won't be ready yet as the data is being\n // requested from various places asynchronously\n this._tileCache.setTile(quadcode, tile);\n }\n\n return tile;\n }\n\n _destroyTile(tile) {\n // Remove tile from scene\n this._tiles.remove(tile.getMesh());\n\n // Delete any references to the tile within this component\n\n // Call destory on tile instance\n tile.destroy();\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._tiles.children) {\n // Remove all tiles\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n }\n\n // Remove tile from picking scene\n this.removeFromPicking(this._tilesPicking);\n\n if (this._tilesPicking.children) {\n // Remove all tiles\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n this._tileCache.destroy();\n this._tileCache = null;\n\n this._tiles = null;\n this._tilesPicking = null;\n this._frustum = null;\n\n super.destroy();\n }\n}\n\nexport default TileLayer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileLayer.js\n **/","import LRUCache from 'lru-cache';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// This process is based on a similar approach taken by OpenWebGlobe\n// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\nclass TileCache {\n constructor(cacheLimit, onDestroyTile) {\n this._cache = LRUCache({\n max: cacheLimit,\n dispose: (key, tile) => {\n onDestroyTile(tile);\n }\n });\n }\n\n // Returns true if all specified tile providers are ready to be used\n // Otherwise, returns false\n isReady() {\n return false;\n }\n\n // Get a cached tile without requesting a new one\n getTile(quadcode) {\n return this._cache.get(quadcode);\n }\n\n // Add tile to cache\n setTile(quadcode, tile) {\n this._cache.set(quadcode, tile);\n }\n\n // Destroy the cache and remove it from memory\n //\n // TODO: Call destroy method on items in cache\n destroy() {\n this._cache.reset();\n this._cache = null;\n }\n}\n\nexport default TileCache;\n\nvar noNew = function(cacheLimit, onDestroyTile) {\n return new TileCache(cacheLimit, onDestroyTile);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as tileCache};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileCache.js\n **/","module.exports = LRUCache\n\n// This will be a proper iterable 'Map' in engines that support it,\n// or a fakey-fake PseudoMap in older versions.\nvar Map = require('pseudomap')\nvar util = require('util')\n\n// A linked list to keep track of recently-used-ness\nvar Yallist = require('yallist')\n\n// use symbols if possible, otherwise just _props\nvar symbols = {}\nvar hasSymbol = typeof Symbol === 'function'\nvar makeSymbol\nif (hasSymbol) {\n makeSymbol = function (key) {\n return Symbol.for(key)\n }\n} else {\n makeSymbol = function (key) {\n return '_' + key\n }\n}\n\nfunction priv (obj, key, val) {\n var sym\n if (symbols[key]) {\n sym = symbols[key]\n } else {\n sym = makeSymbol(key)\n symbols[key] = sym\n }\n if (arguments.length === 2) {\n return obj[sym]\n } else {\n obj[sym] = val\n return val\n }\n}\n\nfunction naiveLength () { return 1 }\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nfunction LRUCache (options) {\n if (!(this instanceof LRUCache)) {\n return new LRUCache(options)\n }\n\n if (typeof options === 'number') {\n options = { max: options }\n }\n\n if (!options) {\n options = {}\n }\n\n var max = priv(this, 'max', options.max)\n // Kind of weird to have a default max of Infinity, but oh well.\n if (!max ||\n !(typeof max === 'number') ||\n max <= 0) {\n priv(this, 'max', Infinity)\n }\n\n var lc = options.length || naiveLength\n if (typeof lc !== 'function') {\n lc = naiveLength\n }\n priv(this, 'lengthCalculator', lc)\n\n priv(this, 'allowStale', options.stale || false)\n priv(this, 'maxAge', options.maxAge || 0)\n priv(this, 'dispose', options.dispose)\n this.reset()\n}\n\n// resize the cache when the max changes.\nObject.defineProperty(LRUCache.prototype, 'max', {\n set: function (mL) {\n if (!mL || !(typeof mL === 'number') || mL <= 0) {\n mL = Infinity\n }\n priv(this, 'max', mL)\n trim(this)\n },\n get: function () {\n return priv(this, 'max')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'allowStale', {\n set: function (allowStale) {\n priv(this, 'allowStale', !!allowStale)\n },\n get: function () {\n return priv(this, 'allowStale')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'maxAge', {\n set: function (mA) {\n if (!mA || !(typeof mA === 'number') || mA < 0) {\n mA = 0\n }\n priv(this, 'maxAge', mA)\n trim(this)\n },\n get: function () {\n return priv(this, 'maxAge')\n },\n enumerable: true\n})\n\n// resize the cache when the lengthCalculator changes.\nObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n set: function (lC) {\n if (typeof lC !== 'function') {\n lC = naiveLength\n }\n if (lC !== priv(this, 'lengthCalculator')) {\n priv(this, 'lengthCalculator', lC)\n priv(this, 'length', 0)\n priv(this, 'lruList').forEach(function (hit) {\n hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n priv(this, 'length', priv(this, 'length') + hit.length)\n }, this)\n }\n trim(this)\n },\n get: function () { return priv(this, 'lengthCalculator') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'length', {\n get: function () { return priv(this, 'length') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'itemCount', {\n get: function () { return priv(this, 'lruList').length },\n enumerable: true\n})\n\nLRUCache.prototype.rforEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n var prev = walker.prev\n forEachStep(this, fn, walker, thisp)\n walker = prev\n }\n}\n\nfunction forEachStep (self, fn, node, thisp) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) {\n hit = undefined\n }\n }\n if (hit) {\n fn.call(thisp, hit.value, hit.key, self)\n }\n}\n\nLRUCache.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').head; walker !== null;) {\n var next = walker.next\n forEachStep(this, fn, walker, thisp)\n walker = next\n }\n}\n\nLRUCache.prototype.keys = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.key\n }, this)\n}\n\nLRUCache.prototype.values = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.value\n }, this)\n}\n\nLRUCache.prototype.reset = function () {\n if (priv(this, 'dispose') &&\n priv(this, 'lruList') &&\n priv(this, 'lruList').length) {\n priv(this, 'lruList').forEach(function (hit) {\n priv(this, 'dispose').call(this, hit.key, hit.value)\n }, this)\n }\n\n priv(this, 'cache', new Map()) // hash of items by key\n priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n priv(this, 'length', 0) // length of items in the list\n}\n\nLRUCache.prototype.dump = function () {\n return priv(this, 'lruList').map(function (hit) {\n if (!isStale(this, hit)) {\n return {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }\n }\n }, this).toArray().filter(function (h) {\n return h\n })\n}\n\nLRUCache.prototype.dumpLru = function () {\n return priv(this, 'lruList')\n}\n\nLRUCache.prototype.inspect = function (n, opts) {\n var str = 'LRUCache {'\n var extras = false\n\n var as = priv(this, 'allowStale')\n if (as) {\n str += '\\n allowStale: true'\n extras = true\n }\n\n var max = priv(this, 'max')\n if (max && max !== Infinity) {\n if (extras) {\n str += ','\n }\n str += '\\n max: ' + util.inspect(max, opts)\n extras = true\n }\n\n var maxAge = priv(this, 'maxAge')\n if (maxAge) {\n if (extras) {\n str += ','\n }\n str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n extras = true\n }\n\n var lc = priv(this, 'lengthCalculator')\n if (lc && lc !== naiveLength) {\n if (extras) {\n str += ','\n }\n str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n extras = true\n }\n\n var didFirst = false\n priv(this, 'lruList').forEach(function (item) {\n if (didFirst) {\n str += ',\\n '\n } else {\n if (extras) {\n str += ',\\n'\n }\n didFirst = true\n str += '\\n '\n }\n var key = util.inspect(item.key).split('\\n').join('\\n ')\n var val = { value: item.value }\n if (item.maxAge !== maxAge) {\n val.maxAge = item.maxAge\n }\n if (lc !== naiveLength) {\n val.length = item.length\n }\n if (isStale(this, item)) {\n val.stale = true\n }\n\n val = util.inspect(val, opts).split('\\n').join('\\n ')\n str += key + ' => ' + val\n })\n\n if (didFirst || extras) {\n str += '\\n'\n }\n str += '}'\n\n return str\n}\n\nLRUCache.prototype.set = function (key, value, maxAge) {\n maxAge = maxAge || priv(this, 'maxAge')\n\n var now = maxAge ? Date.now() : 0\n var len = priv(this, 'lengthCalculator').call(this, value, key)\n\n if (priv(this, 'cache').has(key)) {\n if (len > priv(this, 'max')) {\n del(this, priv(this, 'cache').get(key))\n return false\n }\n\n var node = priv(this, 'cache').get(key)\n var item = node.value\n\n // dispose of the old one before overwriting\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, item.value)\n }\n\n item.now = now\n item.maxAge = maxAge\n item.value = value\n priv(this, 'length', priv(this, 'length') + (len - item.length))\n item.length = len\n this.get(key)\n trim(this)\n return true\n }\n\n var hit = new Entry(key, value, len, now, maxAge)\n\n // oversized objects fall out of cache automatically.\n if (hit.length > priv(this, 'max')) {\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, value)\n }\n return false\n }\n\n priv(this, 'length', priv(this, 'length') + hit.length)\n priv(this, 'lruList').unshift(hit)\n priv(this, 'cache').set(key, priv(this, 'lruList').head)\n trim(this)\n return true\n}\n\nLRUCache.prototype.has = function (key) {\n if (!priv(this, 'cache').has(key)) return false\n var hit = priv(this, 'cache').get(key).value\n if (isStale(this, hit)) {\n return false\n }\n return true\n}\n\nLRUCache.prototype.get = function (key) {\n return get(this, key, true)\n}\n\nLRUCache.prototype.peek = function (key) {\n return get(this, key, false)\n}\n\nLRUCache.prototype.pop = function () {\n var node = priv(this, 'lruList').tail\n if (!node) return null\n del(this, node)\n return node.value\n}\n\nLRUCache.prototype.del = function (key) {\n del(this, priv(this, 'cache').get(key))\n}\n\nLRUCache.prototype.load = function (arr) {\n // reset the cache\n this.reset()\n\n var now = Date.now()\n // A previous serialized cache has the most recent items first\n for (var l = arr.length - 1; l >= 0; l--) {\n var hit = arr[l]\n var expiresAt = hit.e || 0\n if (expiresAt === 0) {\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v)\n } else {\n var maxAge = expiresAt - now\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge)\n }\n }\n }\n}\n\nLRUCache.prototype.prune = function () {\n var self = this\n priv(this, 'cache').forEach(function (value, key) {\n get(self, key, false)\n })\n}\n\nfunction get (self, key, doUse) {\n var node = priv(self, 'cache').get(key)\n if (node) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) hit = undefined\n } else {\n if (doUse) {\n priv(self, 'lruList').unshiftNode(node)\n }\n }\n if (hit) hit = hit.value\n }\n return hit\n}\n\nfunction isStale (self, hit) {\n if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n return false\n }\n var stale = false\n var diff = Date.now() - hit.now\n if (hit.maxAge) {\n stale = diff > hit.maxAge\n } else {\n stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n }\n return stale\n}\n\nfunction trim (self) {\n if (priv(self, 'length') > priv(self, 'max')) {\n for (var walker = priv(self, 'lruList').tail;\n priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n var prev = walker.prev\n del(self, walker)\n walker = prev\n }\n }\n}\n\nfunction del (self, node) {\n if (node) {\n var hit = node.value\n if (priv(self, 'dispose')) {\n priv(self, 'dispose').call(this, hit.key, hit.value)\n }\n priv(self, 'length', priv(self, 'length') - hit.length)\n priv(self, 'cache').delete(hit.key)\n priv(self, 'lruList').removeNode(node)\n }\n}\n\n// classy, since V8 prefers predictable objects.\nfunction Entry (key, value, length, now, maxAge) {\n this.key = key\n this.value = value\n this.length = length\n this.now = now\n this.maxAge = maxAge || 0\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lru-cache/lib/lru-cache.js\n ** module id = 49\n ** module chunks = 0\n **/","if (process.env.npm_package_name === 'pseudomap' &&\n process.env.npm_lifecycle_script === 'test')\n process.env.TEST_PSEUDOMAP = 'true'\n\nif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n module.exports = Map\n} else {\n module.exports = require('./pseudomap')\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/map.js\n ** module id = 50\n ** module chunks = 0\n **/","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 51\n ** module chunks = 0\n **/","var hasOwnProperty = Object.prototype.hasOwnProperty\n\nmodule.exports = PseudoMap\n\nfunction PseudoMap (set) {\n if (!(this instanceof PseudoMap)) // whyyyyyyy\n throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\n this.clear()\n\n if (set) {\n if ((set instanceof PseudoMap) ||\n (typeof Map === 'function' && set instanceof Map))\n set.forEach(function (value, key) {\n this.set(key, value)\n }, this)\n else if (Array.isArray(set))\n set.forEach(function (kv) {\n this.set(kv[0], kv[1])\n }, this)\n else\n throw new TypeError('invalid argument')\n }\n}\n\nPseudoMap.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n Object.keys(this._data).forEach(function (k) {\n if (k !== 'size')\n fn.call(thisp, this._data[k].value, this._data[k].key)\n }, this)\n}\n\nPseudoMap.prototype.has = function (k) {\n return !!find(this._data, k)\n}\n\nPseudoMap.prototype.get = function (k) {\n var res = find(this._data, k)\n return res && res.value\n}\n\nPseudoMap.prototype.set = function (k, v) {\n set(this._data, k, v)\n}\n\nPseudoMap.prototype.delete = function (k) {\n var res = find(this._data, k)\n if (res) {\n delete this._data[res._index]\n this._data.size--\n }\n}\n\nPseudoMap.prototype.clear = function () {\n var data = Object.create(null)\n data.size = 0\n\n Object.defineProperty(this, '_data', {\n value: data,\n enumerable: false,\n configurable: true,\n writable: false\n })\n}\n\nObject.defineProperty(PseudoMap.prototype, 'size', {\n get: function () {\n return this._data.size\n },\n set: function (n) {},\n enumerable: true,\n configurable: true\n})\n\nPseudoMap.prototype.values =\nPseudoMap.prototype.keys =\nPseudoMap.prototype.entries = function () {\n throw new Error('iterators are not implemented in this version')\n}\n\n// Either identical, or both NaN\nfunction same (a, b) {\n return a === b || a !== a && b !== b\n}\n\nfunction Entry (k, v, i) {\n this.key = k\n this.value = v\n this._index = i\n}\n\nfunction find (data, k) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k))\n return data[key]\n }\n}\n\nfunction set (data, k, v) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k)) {\n data[key].value = v\n return\n }\n }\n data.size++\n data[key] = new Entry(k, v, key)\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/pseudomap.js\n ** module id = 52\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/util.js\n ** module id = 53\n ** module chunks = 0\n **/","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/support/isBufferBrowser.js\n ** module id = 54\n ** module chunks = 0\n **/","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/inherits/inherits_browser.js\n ** module id = 55\n ** module chunks = 0\n **/","module.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length --\n node.next = null\n node.prev = null\n node.list = null\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length ++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length ++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail)\n return undefined\n\n var res = this.tail.value\n this.tail = this.tail.prev\n this.tail.next = null\n this.length --\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head)\n return undefined\n\n var res = this.head.value\n this.head = this.head.next\n this.head.prev = null\n this.length --\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length ++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length ++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/yallist/yallist.js\n ** module id = 56\n ** module chunks = 0\n **/","import Tile from './Tile';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass ImageTile extends Tile {\n constructor(quadcode, path, layer) {\n super(quadcode, path, layer);\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n this._requestTile();\n }\n }, 0);\n }\n\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear image reference\n this._image = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n depthWrite: false\n });\n\n // var material = new THREE.MeshPhongMaterial({\n // depthWrite: false\n // });\n } else {\n // Other MeshStandardMaterial settings\n //\n // material.envMapIntensity will change the amount of colour reflected(?)\n // from the environment map – can be greater than 1 for more intensity\n\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var localMesh = new THREE.Mesh(geom, material);\n localMesh.rotation.x = -90 * Math.PI / 180;\n\n localMesh.receiveShadow = true;\n\n mesh.add(localMesh);\n mesh.renderOrder = 0.1;\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n // var box = new BoxHelper(localMesh);\n // mesh.add(box);\n //\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n var image = document.createElement('img');\n\n image.addEventListener('load', event => {\n var texture = new THREE.Texture();\n\n texture.image = image;\n texture.needsUpdate = true;\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n // Something went wrong and the tile or its material is missing\n //\n // Possibly removed by the cache before the image loaded\n if (!this._mesh || !this._mesh.children[0] || !this._mesh.children[0].material) {\n return;\n }\n\n this._mesh.children[0].material.map = texture;\n this._mesh.children[0].material.needsUpdate = true;\n\n this._texture = texture;\n this._ready = true;\n }, false);\n\n // image.addEventListener('progress', event => {}, false);\n // image.addEventListener('error', event => {}, false);\n\n image.crossOrigin = '';\n\n // Load image\n image.src = url;\n\n this._image = image;\n }\n\n _abortRequest() {\n if (!this._image) {\n return;\n }\n\n this._image.src = '';\n }\n}\n\nexport default ImageTile;\n\nvar noNew = function(quadcode, path, layer) {\n return new ImageTile(quadcode, path, layer);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTile.js\n **/","import {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Manages a single tile and its layers\n\nvar r2d = 180 / Math.PI;\n\nvar tileURLRegex = /\\{([szxy])\\}/g;\n\nclass Tile {\n constructor(quadcode, path, layer) {\n this._layer = layer;\n this._world = layer._world;\n this._quadcode = quadcode;\n this._path = path;\n\n this._ready = false;\n\n this._tile = this._quadcodeToTile(quadcode);\n\n // Bottom-left and top-right bounds in WGS84 coordinates\n this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\n // Bottom-left and top-right bounds in world coordinates\n this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\n // Tile center in world coordinates\n this._center = this._boundsToCenter(this._boundsWorld);\n\n // Tile center in projected coordinates\n this._centerLatlon = this._world.pointToLatLon(Point(this._center[0], this._center[1]));\n\n // Length of a tile side in world coorindates\n this._side = this._getSide(this._boundsWorld);\n\n // Point scale for tile (for unit conversion)\n this._pointScale = this._world.pointScale(this._centerLatlon);\n }\n\n // Returns true if the tile mesh and texture are ready to be used\n // Otherwise, returns false\n isReady() {\n return this._ready;\n }\n\n // Request data for the tile\n requestTileAsync() {}\n\n getQuadcode() {\n return this._quadcode;\n }\n\n getBounds() {\n return this._boundsWorld;\n }\n\n getCenter() {\n return this._center;\n }\n\n getSide() {\n return this._side;\n }\n\n getMesh() {\n return this._mesh;\n }\n\n getPickingMesh() {\n return this._pickingMesh;\n }\n\n // Destroys the tile and removes it from the layer and memory\n //\n // Ensure that this leaves no trace of the tile – no textures, no meshes,\n // nothing in memory or the GPU\n destroy() {\n // Delete reference to layer and world\n this._layer = null;\n this._world = null;\n\n // Delete location references\n this._boundsLatLon = null;\n this._boundsWorld = null;\n this._center = null;\n\n // Done if no mesh\n if (!this._mesh) {\n return;\n }\n\n if (this._mesh.children) {\n // Dispose of mesh and materials\n this._mesh.children.forEach(child => {\n child.geometry.dispose();\n child.geometry = null;\n\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n });\n } else {\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n }\n\n _createMesh() {}\n _createDebugMesh() {}\n\n _getTileURL(urlParams) {\n if (!urlParams.s) {\n // Default to a random choice of a, b or c\n urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n }\n\n tileURLRegex.lastIndex = 0;\n return this._path.replace(tileURLRegex, function(value, key) {\n // Replace with paramter, otherwise keep existing value\n return urlParams[key];\n });\n }\n\n // Convert from quadcode to TMS tile coordinates\n _quadcodeToTile(quadcode) {\n var x = 0;\n var y = 0;\n var z = quadcode.length;\n\n for (var i = z; i > 0; i--) {\n var mask = 1 << (i - 1);\n var q = +quadcode[z - i];\n if (q === 1) {\n x |= mask;\n }\n if (q === 2) {\n y |= mask;\n }\n if (q === 3) {\n x |= mask;\n y |= mask;\n }\n }\n\n return [x, y, z];\n }\n\n // Convert WGS84 tile bounds to world coordinates\n _tileBoundsFromWGS84(boundsWGS84) {\n var sw = this._layer._world.latLonToPoint(LatLon(boundsWGS84[1], boundsWGS84[0]));\n var ne = this._layer._world.latLonToPoint(LatLon(boundsWGS84[3], boundsWGS84[2]));\n\n return [sw.x, sw.y, ne.x, ne.y];\n }\n\n // Get tile bounds in WGS84 coordinates\n _tileBoundsWGS84(tile) {\n var e = this._tile2lon(tile[0] + 1, tile[2]);\n var w = this._tile2lon(tile[0], tile[2]);\n var s = this._tile2lat(tile[1] + 1, tile[2]);\n var n = this._tile2lat(tile[1], tile[2]);\n return [w, s, e, n];\n }\n\n _tile2lon(x, z) {\n return x / Math.pow(2, z) * 360 - 180;\n }\n\n _tile2lat(y, z) {\n var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n }\n\n _boundsToCenter(bounds) {\n var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\n return [x, y];\n }\n\n _getSide(bounds) {\n return (new THREE.Vector3(bounds[0], 0, bounds[3])).sub(new THREE.Vector3(bounds[0], 0, bounds[1])).length();\n }\n}\n\nexport default Tile;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/Tile.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\nimport THREE from 'three';\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nBoxHelper = function ( object ) {\n\n\tvar indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\tvar positions = new Float32Array( 8 * 3 );\n\n\tvar geometry = new THREE.BufferGeometry();\n\tgeometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );\n\n\tTHREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { linewidth: 2, color: 0xff0000 } ) );\n\n\tif ( object !== undefined ) {\n\n\t\tthis.update( object );\n\n\t}\n\n};\n\nBoxHelper.prototype = Object.create( THREE.LineSegments.prototype );\nBoxHelper.prototype.constructor = BoxHelper;\n\nBoxHelper.prototype.update = ( function () {\n\n\tvar box = new THREE.Box3();\n\n\treturn function ( object ) {\n\n\t\tbox.setFromObject( object );\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tvar min = box.min;\n\t\tvar max = box.max;\n\n\t\t/*\n\t\t 5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tvar position = this.geometry.attributes.position;\n\t\tvar array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t};\n\n} )();\n\nexport default BoxHelper;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/BoxHelper.js\n **/","import THREE from 'three';\n\nexport default function(colour, skyboxTarget) {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n\n var context = canvas.getContext('2d');\n context.fillStyle = colour;\n context.fillRect(0, 0, canvas.width, canvas.height);\n // context.strokeStyle = '#D0D0CF';\n // context.strokeRect(0, 0, canvas.width, canvas.height);\n\n var texture = new THREE.Texture(canvas);\n\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n // //\n // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n\n // texture.wrapS = THREE.RepeatWrapping;\n // texture.wrapT = THREE.RepeatWrapping;\n // texture.repeat.set(segments, segments);\n\n texture.needsUpdate = true;\n\n var material;\n\n if (!skyboxTarget) {\n material = new THREE.MeshBasicMaterial({\n map: texture,\n depthWrite: false\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = skyboxTarget;\n }\n\n return material;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayerBaseMaterial.js\n **/","import TileLayer from './TileLayer';\nimport extend from 'lodash.assign';\nimport GeoJSONTile from './GeoJSONTile';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\n\n// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n// tile grid using geojson-vt\n//\n// See: https://github.com/mapbox/geojson-vt\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider pausing per-frame output during movement so there's little to\n// no jank caused by previous tiles still processing\n\n// This tile layer only updates the quadtree after world movement has occurred\n//\n// Tiles from previous quadtree updates are updated and outputted every frame\n// (or at least every frame, throttled to some amount)\n//\n// This is because the complexity of TopoJSON tiles requires a lot of processing\n// and so makes movement janky if updates occur every frame – only updating\n// after movement means frame drops are less obvious due to heavy processing\n// occurring while the view is generally stationary\n//\n// The downside is that until new tiles are requested and outputted you will\n// see blank spaces as you orbit and move around\n//\n// An added benefit is that it dramatically reduces the number of tiles being\n// requested over a period of time and the time it takes to go from request to\n// screen output\n//\n// It may be possible to perform these updates per-frame once Web Worker\n// processing is added\n\nclass GeoJSONTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n maxLOD: 14,\n distance: 2000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n this._world.on('controlsMove', this._onControlsMove, this);\n }\n\n // Update and output tiles each frame (throttled)\n _onWorldUpdate() {\n if (this._pauseOutput) {\n return;\n }\n\n this._outputTiles();\n }\n\n // Update tiles grid after world move, but don't output them\n _onWorldMove(latlon, point) {\n this._pauseOutput = false;\n this._calculateLOD();\n }\n\n // Pause updates during control movement for less visual jank\n _onControlsMove() {\n this._pauseOutput = true;\n }\n\n _createTile(quadcode, layer) {\n var options = {};\n\n if (this._options.filter) {\n options.filter = this._options.filter;\n }\n\n if (this._options.style) {\n options.style = this._options.style;\n }\n\n if (this._options.topojson) {\n options.topojson = true;\n }\n\n if (this._options.picking) {\n options.picking = true;\n }\n\n if (this._options.onClick) {\n options.onClick = this._options.onClick;\n }\n\n return new GeoJSONTile(quadcode, this._path, layer, options);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new GeoJSONTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTileLayer.js\n **/","import Tile from './Tile';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\nimport reqwest from 'reqwest';\nimport {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport extend from 'lodash.assign';\n// import Offset from 'polygon-offset';\nimport GeoJSON from '../../util/GeoJSON';\nimport Buffer from '../../util/Buffer';\nimport PickingMaterial from '../../engine/PickingMaterial';\n\n// TODO: Look into using a GeoJSONLayer to represent and output the tile data\n// instead of duplicating a lot of effort within this class\n\n// TODO: Map picking IDs to some reference within the tile data / geometry so\n// that something useful can be done when an object is picked / clicked on\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Perform tile request and processing in a Web Worker\n//\n// Use Operative (https://github.com/padolsey/operative)\n//\n// Would it make sense to have the worker functionality defined in a static\n// method so it only gets initialised once and not on every tile instance?\n//\n// Otherwise, worker processing logic would have to go in the tile layer so not\n// to waste loads of time setting up a brand new worker with three.js for each\n// tile every single time.\n//\n// Unsure of the best way to get three.js and VIZI into the worker\n//\n// Would need to set up a CRS / projection identical to the world instance\n//\n// Is it possible to bypass requirements on external script by having multiple\n// simple worker methods that each take enough inputs to perform a single task\n// without requiring VIZI or three.js? So long as the heaviest logic is done in\n// the worker and transferrable objects are used then it should be better than\n// nothing. Would probably still need things like earcut...\n//\n// After all, the three.js logic and object creation will still need to be\n// done on the main thread regardless so the worker should try to do as much as\n// possible with as few dependencies as possible.\n//\n// Have a look at how this is done in Tangram before implementing anything as\n// the approach there is pretty similar and robust.\n\nclass GeoJSONTile extends Tile {\n constructor(quadcode, path, layer, options) {\n super(quadcode, path, layer);\n\n this._defaultStyle = GeoJSON.defaultStyle;\n\n var defaults = {\n picking: false,\n topojson: false,\n filter: null,\n onClick: null,\n style: this._defaultStyle\n };\n\n this._options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n this._options.style = options.style;\n } else {\n this._options.style = extend({}, defaults.style, options.style);\n }\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n\n if (this._options.picking) {\n this._pickingMesh = this._createPickingMesh();\n }\n\n // this._shadowCanvas = this._createShadowCanvas();\n\n this._requestTile();\n }\n }, 0);\n }\n\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n //\n // var material = new THREE.MeshBasicMaterial({\n // depthWrite: false\n // });\n //\n // var localMesh = new THREE.Mesh(geom, material);\n // localMesh.rotation.x = -90 * Math.PI / 180;\n //\n // mesh.add(localMesh);\n //\n // var box = new BoxHelper(localMesh);\n // mesh.add(box);\n //\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createPickingMesh() {\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n _createShadowCanvas() {\n var canvas = document.createElement('canvas');\n\n // Rendered at a low resolution and later scaled up for a low-quality blur\n canvas.width = 512;\n canvas.height = 512;\n\n return canvas;\n }\n\n // _addShadow(coordinates) {\n // var ctx = this._shadowCanvas.getContext('2d');\n // var width = this._shadowCanvas.width;\n // var height = this._shadowCanvas.height;\n //\n // var _coords;\n // var _offset;\n // var offset = new Offset();\n //\n // // Transform coordinates to shadowCanvas space and draw on canvas\n // coordinates.forEach((ring, index) => {\n // ctx.beginPath();\n //\n // _coords = ring.map(coord => {\n // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n // return [xFrac * width, yFrac * height];\n // });\n //\n // if (index > 0) {\n // _offset = _coords;\n // } else {\n // _offset = offset.data(_coords).padding(1.3);\n // }\n //\n // // TODO: This is super flaky and crashes the browser if run on anything\n // // put the outer ring (potentially due to winding)\n // _offset.forEach((coord, index) => {\n // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n //\n // if (index === 0) {\n // ctx.moveTo(coord[0], coord[1]);\n // } else {\n // ctx.lineTo(coord[0], coord[1]);\n // }\n // });\n //\n // ctx.closePath();\n // });\n //\n // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n // ctx.fill();\n // }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processTileData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n _processTileData(data) {\n console.time(this._tile);\n\n var geojson = GeoJSON.mergeFeatures(data, this._options.topojson);\n\n // TODO: Check that GeoJSON is valid / usable\n\n var features = geojson.features;\n\n // Run filter, if provided\n if (this._options.filter) {\n features = geojson.features.filter(this._options.filter);\n }\n\n var style = this._options.style;\n\n var offset = Point(0, 0);\n offset.x = -1 * this._center[0];\n offset.y = -1 * this._center[1];\n\n // TODO: Wrap into a helper method so this isn't duplicated in the non-tiled\n // GeoJSON output layer\n //\n // Need to be careful as to not make it impossible to fork this off into a\n // worker script at a later stage\n //\n // Also unsure as to whether it's wise to lump so much into a black box\n //\n // var meshes = GeoJSON.createMeshes(features, offset, style);\n\n var polygons = {\n vertices: [],\n faces: [],\n colours: [],\n facesCount: 0,\n allFlat: true\n };\n\n var lines = {\n vertices: [],\n colours: [],\n verticesCount: 0\n };\n\n if (this._options.picking) {\n polygons.pickingIds = [];\n lines.pickingIds = [];\n }\n\n var colour = new THREE.Color();\n\n features.forEach(feature => {\n // feature.geometry, feature.properties\n\n // Skip features that aren't supported\n //\n // TODO: Add support for all GeoJSON geometry types, including Multi...\n // geometry types\n if (\n feature.geometry.type !== 'Polygon' &&\n feature.geometry.type !== 'LineString' &&\n feature.geometry.type !== 'MultiLineString'\n ) {\n return;\n }\n\n // Get style object, if provided\n if (typeof this._options.style === 'function') {\n style = extend({}, this._defaultStyle, this._options.style(feature));\n }\n\n var coordinates = feature.geometry.coordinates;\n\n // if (feature.geometry.type === 'LineString') {\n if (feature.geometry.type === 'LineString') {\n colour.set(style.lineColor);\n\n coordinates = coordinates.map(coordinate => {\n var latlon = LatLon(coordinate[1], coordinate[0]);\n var point = this._layer._world.latLonToPoint(latlon);\n return [point.x, point.y];\n });\n\n var height = 0;\n\n if (style.lineHeight) {\n height = this._world.metresToWorld(style.lineHeight, this._pointScale);\n }\n\n var linestringAttributes = GeoJSON.lineStringAttributes(coordinates, colour, height);\n\n lines.vertices.push(linestringAttributes.vertices);\n lines.colours.push(linestringAttributes.colours);\n\n if (this._options.picking) {\n var pickingId = this._layer.getPickingId();\n\n // Inject picking ID\n //\n // TODO: Perhaps handle this within the GeoJSON helper\n lines.pickingIds.push(pickingId);\n\n if (this._options.onClick) {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + pickingId, (point2d, point3d, intersects) => {\n this._options.onClick(feature, point2d, point3d, intersects);\n });\n }\n }\n\n lines.verticesCount += linestringAttributes.vertices.length;\n }\n\n if (feature.geometry.type === 'MultiLineString') {\n colour.set(style.lineColor);\n\n coordinates = coordinates.map(_coordinates => {\n return _coordinates.map(coordinate => {\n var latlon = LatLon(coordinate[1], coordinate[0]);\n var point = this._layer._world.latLonToPoint(latlon);\n return [point.x, point.y];\n });\n });\n\n var height = 0;\n\n if (style.lineHeight) {\n height = this._world.metresToWorld(style.lineHeight, this._pointScale);\n }\n\n var multiLinestringAttributes = GeoJSON.multiLineStringAttributes(coordinates, colour, height);\n\n lines.vertices.push(multiLinestringAttributes.vertices);\n lines.colours.push(multiLinestringAttributes.colours);\n\n if (this._options.picking) {\n var pickingId = this._layer.getPickingId();\n\n // Inject picking ID\n //\n // TODO: Perhaps handle this within the GeoJSON helper\n lines.pickingIds.push(pickingId);\n\n if (this._options.onClick) {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + pickingId, (point2d, point3d, intersects) => {\n this._options.onClick(feature, point2d, point3d, intersects);\n });\n }\n }\n\n lines.verticesCount += multiLinestringAttributes.vertices.length;\n }\n\n if (feature.geometry.type === 'Polygon') {\n colour.set(style.color);\n\n coordinates = coordinates.map(ring => {\n return ring.map(coordinate => {\n var latlon = LatLon(coordinate[1], coordinate[0]);\n var point = this._layer._world.latLonToPoint(latlon);\n return [point.x, point.y];\n });\n });\n\n var height = 0;\n\n if (style.height) {\n height = this._world.metresToWorld(style.height, this._pointScale);\n }\n\n // Draw footprint on shadow canvas\n //\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n // this._addShadow(coordinates);\n\n var polygonAttributes = GeoJSON.polygonAttributes(coordinates, colour, height);\n\n polygons.vertices.push(polygonAttributes.vertices);\n polygons.faces.push(polygonAttributes.faces);\n polygons.colours.push(polygonAttributes.colours);\n\n if (this._options.picking) {\n var pickingId = this._layer.getPickingId();\n\n // Inject picking ID\n //\n // TODO: Perhaps handle this within the GeoJSON helper\n polygons.pickingIds.push(pickingId);\n\n if (this._options.onClick) {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + pickingId, (point2d, point3d, intersects) => {\n this._options.onClick(feature, point2d, point3d, intersects);\n });\n }\n }\n\n if (polygons.allFlat && !polygonAttributes.flat) {\n polygons.allFlat = false;\n }\n\n polygons.facesCount += polygonAttributes.faces.length;\n }\n });\n\n // Output shadow canvas\n //\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n\n // var texture = new THREE.Texture(this._shadowCanvas);\n //\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n //\n // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n //\n // texture.needsUpdate = true;\n //\n // var material;\n // if (!this._world._environment._skybox) {\n // material = new THREE.MeshBasicMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // } else {\n // material = new THREE.MeshStandardMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // material.roughness = 1;\n // material.metalness = 0.1;\n // material.envMap = this._world._environment._skybox.getRenderTarget();\n // }\n //\n // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n // var mesh = new THREE.Mesh(geom, material);\n //\n // mesh.castShadow = false;\n // mesh.receiveShadow = false;\n // mesh.renderOrder = 1;\n //\n // mesh.rotation.x = -90 * Math.PI / 180;\n //\n // this._mesh.add(mesh);\n\n var geometry;\n var material;\n var mesh;\n\n // Output lines\n if (lines.vertices.length > 0) {\n geometry = Buffer.createLineGeometry(lines, offset);\n\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n\n mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n // TODO: Can a line cast a shadow?\n // mesh.castShadow = true;\n\n this._mesh.add(mesh);\n\n if (this._options.picking) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n }\n\n // Output polygons\n if (polygons.facesCount > 0) {\n geometry = Buffer.createGeometry(polygons, offset);\n\n if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n\n if (polygons.allFlat) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n this._mesh.add(mesh);\n\n if (this._options.picking) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n }\n\n this._ready = true;\n console.timeEnd(this._tile);\n console.log(`${this._tile}: ${features.length} features`);\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n}\n\nexport default GeoJSONTile;\n\nvar noNew = function(quadcode, path, layer, options) {\n return new GeoJSONTile(quadcode, path, layer, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTile.js\n **/","/*!\n * Reqwest! A general purpose XHR connection manager\n * license MIT (c) Dustin Diaz 2015\n * https://github.com/ded/reqwest\n */\n\n!function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else context[name] = definition()\n}('reqwest', this, function () {\n\n var context = this\n\n if ('window' in context) {\n var doc = document\n , byTag = 'getElementsByTagName'\n , head = doc[byTag]('head')[0]\n } else {\n var XHR2\n try {\n XHR2 = require('xhr2')\n } catch (ex) {\n throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n }\n }\n\n\n var httpsRe = /^http/\n , protocolRe = /(^\\w+):\\/\\//\n , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n , readyState = 'readyState'\n , contentType = 'Content-Type'\n , requestedWith = 'X-Requested-With'\n , uniqid = 0\n , callbackPrefix = 'reqwest_' + (+new Date())\n , lastValue // data stored by the most recent JSONP callback\n , xmlHttpRequest = 'XMLHttpRequest'\n , xDomainRequest = 'XDomainRequest'\n , noop = function () {}\n\n , isArray = typeof Array.isArray == 'function'\n ? Array.isArray\n : function (a) {\n return a instanceof Array\n }\n\n , defaultHeaders = {\n 'contentType': 'application/x-www-form-urlencoded'\n , 'requestedWith': xmlHttpRequest\n , 'accept': {\n '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n , 'xml': 'application/xml, text/xml'\n , 'html': 'text/html'\n , 'text': 'text/plain'\n , 'json': 'application/json, text/javascript'\n , 'js': 'application/javascript, text/javascript'\n }\n }\n\n , xhr = function(o) {\n // is it x-domain\n if (o['crossOrigin'] === true) {\n var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n if (xhr && 'withCredentials' in xhr) {\n return xhr\n } else if (context[xDomainRequest]) {\n return new XDomainRequest()\n } else {\n throw new Error('Browser does not support cross-origin requests')\n }\n } else if (context[xmlHttpRequest]) {\n return new XMLHttpRequest()\n } else if (XHR2) {\n return new XHR2()\n } else {\n return new ActiveXObject('Microsoft.XMLHTTP')\n }\n }\n , globalSetupOptions = {\n dataFilter: function (data) {\n return data\n }\n }\n\n function succeed(r) {\n var protocol = protocolRe.exec(r.url)\n protocol = (protocol && protocol[1]) || context.location.protocol\n return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n }\n\n function handleReadyState(r, success, error) {\n return function () {\n // use _aborted to mitigate against IE err c00c023f\n // (can't read props on aborted request objects)\n if (r._aborted) return error(r.request)\n if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n if (r.request && r.request[readyState] == 4) {\n r.request.onreadystatechange = noop\n if (succeed(r)) success(r.request)\n else\n error(r.request)\n }\n }\n }\n\n function setHeaders(http, o) {\n var headers = o['headers'] || {}\n , h\n\n headers['Accept'] = headers['Accept']\n || defaultHeaders['accept'][o['type']]\n || defaultHeaders['accept']['*']\n\n var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n // breaks cross-origin requests with legacy browsers\n if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n for (h in headers)\n headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n }\n\n function setCredentials(http, o) {\n if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n http.withCredentials = !!o['withCredentials']\n }\n }\n\n function generalCallback(data) {\n lastValue = data\n }\n\n function urlappend (url, s) {\n return url + (/\\?/.test(url) ? '&' : '?') + s\n }\n\n function handleJsonp(o, fn, err, url) {\n var reqId = uniqid++\n , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n , match = url.match(cbreg)\n , script = doc.createElement('script')\n , loaded = 0\n , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\n if (match) {\n if (match[3] === '?') {\n url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n } else {\n cbval = match[3] // provided callback func name\n }\n } else {\n url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n }\n\n context[cbval] = generalCallback\n\n script.type = 'text/javascript'\n script.src = url\n script.async = true\n if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n // need this for IE due to out-of-order onreadystatechange(), binding script\n // execution to an event listener gives us control over when the script\n // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n script.htmlFor = script.id = '_reqwest_' + reqId\n }\n\n script.onload = script.onreadystatechange = function () {\n if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n return false\n }\n script.onload = script.onreadystatechange = null\n script.onclick && script.onclick()\n // Call the user callback with the last value stored and clean up values and scripts.\n fn(lastValue)\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n\n // Add the script to the DOM head\n head.appendChild(script)\n\n // Enable JSONP timeout\n return {\n abort: function () {\n script.onload = script.onreadystatechange = null\n err({}, 'Request is aborted: timeout', {})\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n }\n }\n\n function getRequest(fn, err) {\n var o = this.o\n , method = (o['method'] || 'GET').toUpperCase()\n , url = typeof o === 'string' ? o : o['url']\n // convert non-string objects to query-string form unless o['processData'] is false\n , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n ? reqwest.toQueryString(o['data'])\n : (o['data'] || null)\n , http\n , sendWait = false\n\n // if we're working on a GET request and we have data then we should append\n // query string to end of URL and not post data\n if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n url = urlappend(url, data)\n data = null\n }\n\n if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\n // get the xhr from the factory if passed\n // if the factory returns null, fall-back to ours\n http = (o.xhr && o.xhr(o)) || xhr(o)\n\n http.open(method, url, o['async'] === false ? false : true)\n setHeaders(http, o)\n setCredentials(http, o)\n if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n http.onload = fn\n http.onerror = err\n // NOTE: see\n // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n http.onprogress = function() {}\n sendWait = true\n } else {\n http.onreadystatechange = handleReadyState(this, fn, err)\n }\n o['before'] && o['before'](http)\n if (sendWait) {\n setTimeout(function () {\n http.send(data)\n }, 200)\n } else {\n http.send(data)\n }\n return http\n }\n\n function Reqwest(o, fn) {\n this.o = o\n this.fn = fn\n\n init.apply(this, arguments)\n }\n\n function setType(header) {\n // json, javascript, text/plain, text/html, xml\n if (header === null) return undefined; //In case of no content-type.\n if (header.match('json')) return 'json'\n if (header.match('javascript')) return 'js'\n if (header.match('text')) return 'html'\n if (header.match('xml')) return 'xml'\n }\n\n function init(o, fn) {\n\n this.url = typeof o == 'string' ? o : o['url']\n this.timeout = null\n\n // whether request has been fulfilled for purpose\n // of tracking the Promises\n this._fulfilled = false\n // success handlers\n this._successHandler = function(){}\n this._fulfillmentHandlers = []\n // error handlers\n this._errorHandlers = []\n // complete (both success and fail) handlers\n this._completeHandlers = []\n this._erred = false\n this._responseArgs = {}\n\n var self = this\n\n fn = fn || function () {}\n\n if (o['timeout']) {\n this.timeout = setTimeout(function () {\n timedOut()\n }, o['timeout'])\n }\n\n if (o['success']) {\n this._successHandler = function () {\n o['success'].apply(o, arguments)\n }\n }\n\n if (o['error']) {\n this._errorHandlers.push(function () {\n o['error'].apply(o, arguments)\n })\n }\n\n if (o['complete']) {\n this._completeHandlers.push(function () {\n o['complete'].apply(o, arguments)\n })\n }\n\n function complete (resp) {\n o['timeout'] && clearTimeout(self.timeout)\n self.timeout = null\n while (self._completeHandlers.length > 0) {\n self._completeHandlers.shift()(resp)\n }\n }\n\n function success (resp) {\n var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n resp = (type !== 'jsonp') ? self.request : resp\n // use global data filter on response text\n var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n , r = filteredResponse\n try {\n resp.responseText = r\n } catch (e) {\n // can't assign this in IE<=8, just ignore\n }\n if (r) {\n switch (type) {\n case 'json':\n try {\n resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n } catch (err) {\n return error(resp, 'Could not parse JSON in response', err)\n }\n break\n case 'js':\n resp = eval(r)\n break\n case 'html':\n resp = r\n break\n case 'xml':\n resp = resp.responseXML\n && resp.responseXML.parseError // IE trololo\n && resp.responseXML.parseError.errorCode\n && resp.responseXML.parseError.reason\n ? null\n : resp.responseXML\n break\n }\n }\n\n self._responseArgs.resp = resp\n self._fulfilled = true\n fn(resp)\n self._successHandler(resp)\n while (self._fulfillmentHandlers.length > 0) {\n resp = self._fulfillmentHandlers.shift()(resp)\n }\n\n complete(resp)\n }\n\n function timedOut() {\n self._timedOut = true\n self.request.abort()\n }\n\n function error(resp, msg, t) {\n resp = self.request\n self._responseArgs.resp = resp\n self._responseArgs.msg = msg\n self._responseArgs.t = t\n self._erred = true\n while (self._errorHandlers.length > 0) {\n self._errorHandlers.shift()(resp, msg, t)\n }\n complete(resp)\n }\n\n this.request = getRequest.call(this, success, error)\n }\n\n Reqwest.prototype = {\n abort: function () {\n this._aborted = true\n this.request.abort()\n }\n\n , retry: function () {\n init.call(this, this.o, this.fn)\n }\n\n /**\n * Small deviation from the Promises A CommonJs specification\n * http://wiki.commonjs.org/wiki/Promises/A\n */\n\n /**\n * `then` will execute upon successful requests\n */\n , then: function (success, fail) {\n success = success || function () {}\n fail = fail || function () {}\n if (this._fulfilled) {\n this._responseArgs.resp = success(this._responseArgs.resp)\n } else if (this._erred) {\n fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._fulfillmentHandlers.push(success)\n this._errorHandlers.push(fail)\n }\n return this\n }\n\n /**\n * `always` will execute whether the request succeeds or fails\n */\n , always: function (fn) {\n if (this._fulfilled || this._erred) {\n fn(this._responseArgs.resp)\n } else {\n this._completeHandlers.push(fn)\n }\n return this\n }\n\n /**\n * `fail` will execute when the request fails\n */\n , fail: function (fn) {\n if (this._erred) {\n fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._errorHandlers.push(fn)\n }\n return this\n }\n , 'catch': function (fn) {\n return this.fail(fn)\n }\n }\n\n function reqwest(o, fn) {\n return new Reqwest(o, fn)\n }\n\n // normalize newline variants according to spec -> CRLF\n function normalize(s) {\n return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n }\n\n function serial(el, cb) {\n var n = el.name\n , t = el.tagName.toLowerCase()\n , optCb = function (o) {\n // IE gives value=\"\" even where there is no value attribute\n // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n if (o && !o['disabled'])\n cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n }\n , ch, ra, val, i\n\n // don't serialize elements that are disabled or without a name\n if (el.disabled || !n) return\n\n switch (t) {\n case 'input':\n if (!/reset|button|image|file/i.test(el.type)) {\n ch = /checkbox/i.test(el.type)\n ra = /radio/i.test(el.type)\n val = el.value\n // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n }\n break\n case 'textarea':\n cb(n, normalize(el.value))\n break\n case 'select':\n if (el.type.toLowerCase() === 'select-one') {\n optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n } else {\n for (i = 0; el.length && i < el.length; i++) {\n el.options[i].selected && optCb(el.options[i])\n }\n }\n break\n }\n }\n\n // collect up all form elements found from the passed argument elements all\n // the way down to child elements; pass a '' or form fields.\n // called with 'this'=callback to use for serial() on each element\n function eachFormElement() {\n var cb = this\n , e, i\n , serializeSubtags = function (e, tags) {\n var i, j, fa\n for (i = 0; i < tags.length; i++) {\n fa = e[byTag](tags[i])\n for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n }\n }\n\n for (i = 0; i < arguments.length; i++) {\n e = arguments[i]\n if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n }\n }\n\n // standard query string style serialization\n function serializeQueryString() {\n return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n }\n\n // { 'name': 'value', ... } style serialization\n function serializeHash() {\n var hash = {}\n eachFormElement.apply(function (name, value) {\n if (name in hash) {\n hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n hash[name].push(value)\n } else hash[name] = value\n }, arguments)\n return hash\n }\n\n // [ { name: 'name', value: 'value' }, ... ] style serialization\n reqwest.serializeArray = function () {\n var arr = []\n eachFormElement.apply(function (name, value) {\n arr.push({name: name, value: value})\n }, arguments)\n return arr\n }\n\n reqwest.serialize = function () {\n if (arguments.length === 0) return ''\n var opt, fn\n , args = Array.prototype.slice.call(arguments, 0)\n\n opt = args.pop()\n opt && opt.nodeType && args.push(opt) && (opt = null)\n opt && (opt = opt.type)\n\n if (opt == 'map') fn = serializeHash\n else if (opt == 'array') fn = reqwest.serializeArray\n else fn = serializeQueryString\n\n return fn.apply(null, args)\n }\n\n reqwest.toQueryString = function (o, trad) {\n var prefix, i\n , traditional = trad || false\n , s = []\n , enc = encodeURIComponent\n , add = function (key, value) {\n // If value is a function, invoke it and return its value\n value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n s[s.length] = enc(key) + '=' + enc(value)\n }\n // If an array was passed in, assume that it is an array of form elements.\n if (isArray(o)) {\n for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n } else {\n // If traditional, encode the \"old\" way (the way 1.3.2 or older\n // did it), otherwise encode params recursively.\n for (prefix in o) {\n if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n }\n }\n\n // spaces should be + according to spec\n return s.join('&').replace(/%20/g, '+')\n }\n\n function buildParams(prefix, obj, traditional, add) {\n var name, i, v\n , rbracket = /\\[\\]$/\n\n if (isArray(obj)) {\n // Serialize array item.\n for (i = 0; obj && i < obj.length; i++) {\n v = obj[i]\n if (traditional || rbracket.test(prefix)) {\n // Treat each array item as a scalar.\n add(prefix, v)\n } else {\n buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n }\n }\n } else if (obj && obj.toString() === '[object Object]') {\n // Serialize object item.\n for (name in obj) {\n buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n }\n\n } else {\n // Serialize scalar item.\n add(prefix, obj)\n }\n }\n\n reqwest.getcallbackPrefix = function () {\n return callbackPrefix\n }\n\n // jQuery and Zepto compatibility, differences can be remapped here so you can call\n // .ajax.compat(options, callback)\n reqwest.compat = function (o, fn) {\n if (o) {\n o['type'] && (o['method'] = o['type']) && delete o['type']\n o['dataType'] && (o['type'] = o['dataType'])\n o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n }\n return new Reqwest(o, fn)\n }\n\n reqwest.ajaxSetup = function (options) {\n options = options || {}\n for (var k in options) {\n globalSetupOptions[k] = options[k]\n }\n }\n\n return reqwest\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/reqwest/reqwest.js\n ** module id = 63\n ** module chunks = 0\n **/","/*\n * GeoJSON helpers for handling data and generating objects\n */\n\nimport THREE from 'three';\nimport topojson from 'topojson';\nimport geojsonMerge from 'geojson-merge';\n\n// TODO: Make it so height can be per-coordinate / point but connected together\n// as a linestring (eg. GPS points with an elevation at each point)\n//\n// This isn't really valid GeoJSON so perhaps something best left to an external\n// component for now, until a better approach can be considered\n//\n// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\n// Light and dark colours used for poor-mans AO gradient on object sides\nvar light = new THREE.Color(0xffffff);\nvar shadow = new THREE.Color(0x666666);\n\nvar GeoJSON = (function() {\n var defaultStyle = {\n color: '#ffffff',\n height: 0,\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n };\n\n // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n // into a single FeatureCollection\n var collectFeatures = function(data, _topojson) {\n var collections = [];\n\n if (_topojson) {\n // TODO: Allow TopoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var tk in data.objects) {\n collections.push(topojson.feature(data, data.objects[tk]));\n }\n\n return geojsonMerge(collections);\n } else {\n // If root doesn't have a type then let's see if there are features in the\n // next step down\n if (!data.type) {\n // TODO: Allow GeoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var gk in data) {\n if (!data[gk].type) {\n continue;\n }\n\n collections.push(data[gk]);\n }\n\n return geojsonMerge(collections);\n } else if (Array.isArray(data)) {\n return geojsonMerge(data);\n } else {\n return data;\n }\n }\n };\n\n return {\n defaultStyle: defaultStyle,\n collectFeatures: collectFeatures\n };\n})();\n\nexport default GeoJSON;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/GeoJSON.js\n **/","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.topojson = {})));\n}(this, function (exports) { 'use strict';\n\n function noop() {}\n\n function absolute(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n point[0] = (x0 += point[0]) * kx + dx;\n point[1] = (y0 += point[1]) * ky + dy;\n };\n }\n\n function relative(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n var x1 = (point[0] - dx) / kx | 0,\n y1 = (point[1] - dy) / ky | 0;\n point[0] = x1 - x0;\n point[1] = y1 - y0;\n x0 = x1;\n y0 = y1;\n };\n }\n\n function reverse(array, n) {\n var t, j = array.length, i = j - n;\n while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n }\n\n function bisect(a, x) {\n var lo = 0, hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (a[mid] < x) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function feature(topology, o) {\n return o.type === \"GeometryCollection\" ? {\n type: \"FeatureCollection\",\n features: o.geometries.map(function(o) { return feature$1(topology, o); })\n } : feature$1(topology, o);\n }\n\n function feature$1(topology, o) {\n var f = {\n type: \"Feature\",\n id: o.id,\n properties: o.properties || {},\n geometry: object(topology, o)\n };\n if (o.id == null) delete f.id;\n return f;\n }\n\n function object(topology, o) {\n var absolute$$ = absolute(topology.transform),\n arcs = topology.arcs;\n\n function arc(i, points) {\n if (points.length) points.pop();\n for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n points.push(p = a[k].slice());\n absolute$$(p, k);\n }\n if (i < 0) reverse(points, n);\n }\n\n function point(p) {\n p = p.slice();\n absolute$$(p, 0);\n return p;\n }\n\n function line(arcs) {\n var points = [];\n for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n if (points.length < 2) points.push(points[0].slice());\n return points;\n }\n\n function ring(arcs) {\n var points = line(arcs);\n while (points.length < 4) points.push(points[0].slice());\n return points;\n }\n\n function polygon(arcs) {\n return arcs.map(ring);\n }\n\n function geometry(o) {\n var t = o.type;\n return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n : null;\n }\n\n var geometryType = {\n Point: function(o) { return point(o.coordinates); },\n MultiPoint: function(o) { return o.coordinates.map(point); },\n LineString: function(o) { return line(o.arcs); },\n MultiLineString: function(o) { return o.arcs.map(line); },\n Polygon: function(o) { return polygon(o.arcs); },\n MultiPolygon: function(o) { return o.arcs.map(polygon); }\n };\n\n return geometry(o);\n }\n\n function stitchArcs(topology, arcs) {\n var stitchedArcs = {},\n fragmentByStart = {},\n fragmentByEnd = {},\n fragments = [],\n emptyIndex = -1;\n\n // Stitch empty arcs first, since they may be subsumed by other arcs.\n arcs.forEach(function(i, j) {\n var arc = topology.arcs[i < 0 ? ~i : i], t;\n if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n }\n });\n\n arcs.forEach(function(i) {\n var e = ends(i),\n start = e[0],\n end = e[1],\n f, g;\n\n if (f = fragmentByEnd[start]) {\n delete fragmentByEnd[f.end];\n f.push(i);\n f.end = end;\n if (g = fragmentByStart[end]) {\n delete fragmentByStart[g.start];\n var fg = g === f ? f : f.concat(g);\n fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else if (f = fragmentByStart[end]) {\n delete fragmentByStart[f.start];\n f.unshift(i);\n f.start = start;\n if (g = fragmentByEnd[start]) {\n delete fragmentByEnd[g.end];\n var gf = g === f ? f : g.concat(f);\n fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else {\n f = [i];\n fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n }\n });\n\n function ends(i) {\n var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n else p1 = arc[arc.length - 1];\n return i < 0 ? [p1, p0] : [p0, p1];\n }\n\n function flush(fragmentByEnd, fragmentByStart) {\n for (var k in fragmentByEnd) {\n var f = fragmentByEnd[k];\n delete fragmentByStart[f.start];\n delete f.start;\n delete f.end;\n f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n fragments.push(f);\n }\n }\n\n flush(fragmentByEnd, fragmentByStart);\n flush(fragmentByStart, fragmentByEnd);\n arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\n return fragments;\n }\n\n function mesh(topology) {\n return object(topology, meshArcs.apply(this, arguments));\n }\n\n function meshArcs(topology, o, filter) {\n var arcs = [];\n\n function arc(i) {\n var j = i < 0 ? ~i : i;\n (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n }\n\n function line(arcs) {\n arcs.forEach(arc);\n }\n\n function polygon(arcs) {\n arcs.forEach(line);\n }\n\n function geometry(o) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n }\n\n if (arguments.length > 1) {\n var geomsByArc = [],\n geom;\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n };\n\n geometry(o);\n\n geomsByArc.forEach(arguments.length < 3\n ? function(geoms) { arcs.push(geoms[0].i); }\n : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n } else {\n for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n }\n\n return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n }\n\n function triangle(triangle) {\n var a = triangle[0], b = triangle[1], c = triangle[2];\n return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n }\n\n function ring(ring) {\n var i = -1,\n n = ring.length,\n a,\n b = ring[n - 1],\n area = 0;\n\n while (++i < n) {\n a = b;\n b = ring[i];\n area += a[0] * b[1] - a[1] * b[0];\n }\n\n return area / 2;\n }\n\n function merge(topology) {\n return object(topology, mergeArcs.apply(this, arguments));\n }\n\n function mergeArcs(topology, objects) {\n var polygonsByArc = {},\n polygons = [],\n components = [];\n\n objects.forEach(function(o) {\n if (o.type === \"Polygon\") register(o.arcs);\n else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n });\n\n function register(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n });\n });\n polygons.push(polygon);\n }\n\n function exterior(ring$$) {\n return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n }\n\n polygons.forEach(function(polygon) {\n if (!polygon._) {\n var component = [],\n neighbors = [polygon];\n polygon._ = 1;\n components.push(component);\n while (polygon = neighbors.pop()) {\n component.push(polygon);\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n if (!polygon._) {\n polygon._ = 1;\n neighbors.push(polygon);\n }\n });\n });\n });\n }\n }\n });\n\n polygons.forEach(function(polygon) {\n delete polygon._;\n });\n\n return {\n type: \"MultiPolygon\",\n arcs: components.map(function(polygons) {\n var arcs = [], n;\n\n // Extract the exterior (unique) arcs.\n polygons.forEach(function(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n arcs.push(arc);\n }\n });\n });\n });\n\n // Stitch the arcs into one or more rings.\n arcs = stitchArcs(topology, arcs);\n\n // If more than one ring is returned,\n // at most one of these rings can be the exterior;\n // this exterior ring has the same winding order\n // as any exterior ring in the original polygons.\n if ((n = arcs.length) > 1) {\n var sgn = exterior(polygons[0][0]);\n for (var i = 0, t; i < n; ++i) {\n if (sgn === exterior(arcs[i])) {\n t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n break;\n }\n }\n }\n\n return arcs;\n })\n };\n }\n\n function neighbors(objects) {\n var indexesByArc = {}, // arc index -> array of object indexes\n neighbors = objects.map(function() { return []; });\n\n function line(arcs, i) {\n arcs.forEach(function(a) {\n if (a < 0) a = ~a;\n var o = indexesByArc[a];\n if (o) o.push(i);\n else indexesByArc[a] = [i];\n });\n }\n\n function polygon(arcs, i) {\n arcs.forEach(function(arc) { line(arc, i); });\n }\n\n function geometry(o, i) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n }\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n };\n\n objects.forEach(geometry);\n\n for (var i in indexesByArc) {\n for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n for (var k = j + 1; k < m; ++k) {\n var ij = indexes[j], ik = indexes[k], n;\n if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n }\n }\n }\n\n return neighbors;\n }\n\n function compareArea(a, b) {\n return a[1][2] - b[1][2];\n }\n\n function minAreaHeap() {\n var heap = {},\n array = [],\n size = 0;\n\n heap.push = function(object) {\n up(array[object._ = size] = object, size++);\n return size;\n };\n\n heap.pop = function() {\n if (size <= 0) return;\n var removed = array[0], object;\n if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n return removed;\n };\n\n heap.remove = function(removed) {\n var i = removed._, object;\n if (array[i] !== removed) return; // invalid request\n if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n return i;\n };\n\n function up(object, i) {\n while (i > 0) {\n var j = ((i + 1) >> 1) - 1,\n parent = array[j];\n if (compareArea(object, parent) >= 0) break;\n array[parent._ = i] = parent;\n array[object._ = i = j] = object;\n }\n }\n\n function down(object, i) {\n while (true) {\n var r = (i + 1) << 1,\n l = r - 1,\n j = i,\n child = array[j];\n if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n if (j === i) break;\n array[child._ = i] = child;\n array[object._ = i = j] = object;\n }\n }\n\n return heap;\n }\n\n function presimplify(topology, triangleArea) {\n var absolute$$ = absolute(topology.transform),\n relative$$ = relative(topology.transform),\n heap = minAreaHeap();\n\n if (!triangleArea) triangleArea = triangle;\n\n topology.arcs.forEach(function(arc) {\n var triangles = [],\n maxArea = 0,\n triangle,\n i,\n n,\n p;\n\n // To store each point’s effective area, we create a new array rather than\n // extending the passed-in point to workaround a Chrome/V8 bug (getting\n // stuck in smi mode). For midpoints, the initial effective area of\n // Infinity will be computed in the next step.\n for (i = 0, n = arc.length; i < n; ++i) {\n p = arc[i];\n absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n }\n\n for (i = 1, n = arc.length - 1; i < n; ++i) {\n triangle = arc.slice(i - 1, i + 2);\n triangle[1][2] = triangleArea(triangle);\n triangles.push(triangle);\n heap.push(triangle);\n }\n\n for (i = 0, n = triangles.length; i < n; ++i) {\n triangle = triangles[i];\n triangle.previous = triangles[i - 1];\n triangle.next = triangles[i + 1];\n }\n\n while (triangle = heap.pop()) {\n var previous = triangle.previous,\n next = triangle.next;\n\n // If the area of the current point is less than that of the previous point\n // to be eliminated, use the latter's area instead. This ensures that the\n // current point cannot be eliminated without eliminating previously-\n // eliminated points.\n if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n else maxArea = triangle[1][2];\n\n if (previous) {\n previous.next = next;\n previous[2] = triangle[2];\n update(previous);\n }\n\n if (next) {\n next.previous = previous;\n next[0] = triangle[0];\n update(next);\n }\n }\n\n arc.forEach(relative$$);\n });\n\n function update(triangle) {\n heap.remove(triangle);\n triangle[1][2] = triangleArea(triangle);\n heap.push(triangle);\n }\n\n return topology;\n }\n\n var version = \"1.6.24\";\n\n exports.version = version;\n exports.mesh = mesh;\n exports.meshArcs = meshArcs;\n exports.merge = merge;\n exports.mergeArcs = mergeArcs;\n exports.feature = feature;\n exports.neighbors = neighbors;\n exports.presimplify = presimplify;\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/topojson/build/topojson.js\n ** module id = 66\n ** module chunks = 0\n **/","var normalize = require('geojson-normalize');\n\nmodule.exports = function(inputs) {\n return {\n type: 'FeatureCollection',\n features: inputs.reduce(function(memo, input) {\n return memo.concat(normalize(input).features);\n }, [])\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/index.js\n ** module id = 67\n ** module chunks = 0\n **/","module.exports = normalize;\n\nvar types = {\n Point: 'geometry',\n MultiPoint: 'geometry',\n LineString: 'geometry',\n MultiLineString: 'geometry',\n Polygon: 'geometry',\n MultiPolygon: 'geometry',\n GeometryCollection: 'geometry',\n Feature: 'feature',\n FeatureCollection: 'featurecollection'\n};\n\n/**\n * Normalize a GeoJSON feature into a FeatureCollection.\n *\n * @param {object} gj geojson data\n * @returns {object} normalized geojson data\n */\nfunction normalize(gj) {\n if (!gj || !gj.type) return null;\n var type = types[gj.type];\n if (!type) return null;\n\n if (type === 'geometry') {\n return {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: gj\n }]\n };\n } else if (type === 'feature') {\n return {\n type: 'FeatureCollection',\n features: [gj]\n };\n } else if (type === 'featurecollection') {\n return gj;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/~/geojson-normalize/index.js\n ** module id = 68\n ** module chunks = 0\n **/","/*\n * BufferGeometry helpers\n */\n\nimport THREE from 'three';\n\nvar Buffer = (function() {\n // Merge multiple attribute objects into a single attribute object\n //\n // Attribute objects must all use the same attribute keys\n var mergeAttributes = function(attributes) {\n var lengths = {};\n\n // Find array lengths\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lengths[k]) {\n lengths[k] = 0;\n }\n\n lengths[k] += _attributes[k].length;\n }\n });\n\n var mergedAttributes = {};\n\n // Set up arrays to merge into\n for (var k in lengths) {\n mergedAttributes[k] = new Float32Array(lengths[k]);\n }\n\n var lastLengths = {};\n\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lastLengths[k]) {\n lastLengths[k] = 0;\n }\n\n mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\n lastLengths[k] += _attributes[k].length;\n }\n });\n\n return mergedAttributes;\n };\n\n var createLineGeometry = function(lines, offset) {\n var geometry = new THREE.BufferGeometry();\n\n var vertices = new Float32Array(lines.verticesCount * 3);\n var colours = new Float32Array(lines.verticesCount * 3);\n\n var pickingIds;\n if (lines.pickingIds) {\n // One component per vertex (1)\n pickingIds = new Float32Array(lines.verticesCount);\n }\n\n var _vertices;\n var _colour;\n var _pickingId;\n\n var lastIndex = 0;\n\n for (var i = 0; i < lines.vertices.length; i++) {\n _vertices = lines.vertices[i];\n _colour = lines.colours[i];\n\n if (pickingIds) {\n _pickingId = lines.pickingIds[i];\n }\n\n for (var j = 0; j < _vertices.length; j++) {\n var ax = _vertices[j][0] + offset.x;\n var ay = _vertices[j][1];\n var az = _vertices[j][2] + offset.y;\n\n var c1 = _colour[j];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n // TODO: Make picking IDs optional\n var createGeometry = function(attributes, offset) {\n var geometry = new THREE.BufferGeometry();\n\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(attributes.facesCount * 9);\n var normals = new Float32Array(attributes.facesCount * 9);\n var colours = new Float32Array(attributes.facesCount * 9);\n\n var pickingIds;\n if (attributes.pickingIds) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(attributes.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n var _faces;\n var _vertices;\n var _colour;\n var _pickingId;\n var lastIndex = 0;\n for (var i = 0; i < attributes.faces.length; i++) {\n _faces = attributes.faces[i];\n _vertices = attributes.vertices[i];\n _colour = attributes.colours[i];\n\n if (pickingIds) {\n _pickingId = attributes.pickingIds[i];\n }\n\n for (var j = 0; j < _faces.length; j++) {\n // Array of vertex indexes for the face\n index = _faces[j][0];\n\n var ax = _vertices[index][0] + offset.x;\n var ay = _vertices[index][1];\n var az = _vertices[index][2] + offset.y;\n\n var c1 = _colour[j][0];\n\n index = _faces[j][1];\n\n var bx = _vertices[index][0] + offset.x;\n var by = _vertices[index][1];\n var bz = _vertices[index][2] + offset.y;\n\n var c2 = _colour[j][1];\n\n index = _faces[j][2];\n\n var cx = _vertices[index][0] + offset.x;\n var cy = _vertices[index][1];\n var cz = _vertices[index][2] + offset.y;\n\n var c3 = _colour[j][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n return {\n mergeAttributes: mergeAttributes,\n createLineGeometry: createLineGeometry,\n createGeometry: createGeometry\n };\n})();\n\nexport default Buffer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Buffer.js\n **/","import THREE from 'three';\nimport PickingShader from './PickingShader';\n\n// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingMaterial = function() {\n THREE.ShaderMaterial.call(this, {\n uniforms: {\n size: {\n type: 'f',\n value: 0.01,\n },\n scale: {\n type: 'f',\n value: 400,\n }\n },\n // attributes: ['position', 'id'],\n vertexShader: PickingShader.vertexShader,\n fragmentShader: PickingShader.fragmentShader\n });\n\n this.linePadding = 2;\n};\n\nPickingMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype);\n\nPickingMaterial.prototype.constructor = PickingMaterial;\n\nPickingMaterial.prototype.setPointSize = function(size) {\n this.uniforms.size.value = size;\n};\n\nPickingMaterial.prototype.setPointScale = function(scale) {\n this.uniforms.scale.value = scale;\n};\n\nexport default PickingMaterial;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingMaterial.js\n **/","// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingShader = {\n vertexShader: [\n\t\t'attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);',\n\t\t' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);',\n\t\t' worldId = vec4(a,1);',\n\t\t' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n\t\t'#ifdef GL_ES\\n',\n\t\t'precision highp float;\\n',\n\t\t'#endif\\n',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' gl_FragColor = worldId;',\n\t\t'}'\n\t].join('\\n')\n};\n\nexport default PickingShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingShader.js\n **/","import GeoJSONTileLayer from './GeoJSONTileLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONTileLayer extends GeoJSONTileLayer {\n constructor(path, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(path, options);\n }\n}\n\nexport default TopoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new TopoJSONTileLayer(path, options);\n};\n\nexport {noNew as topoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TopoJSONTileLayer.js\n **/","// TODO: Consider adopting GeoJSON CSS\n// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\nimport LayerGroup from './LayerGroup';\nimport extend from 'lodash.assign';\nimport reqwest from 'reqwest';\nimport GeoJSON from '../util/GeoJSON';\nimport Buffer from '../util/Buffer';\nimport PickingMaterial from '../engine/PickingMaterial';\nimport PolygonLayer from './geometry/PolygonLayer';\nimport PolylineLayer from './geometry/PolylineLayer';\nimport PointLayer from './geometry/PointLayer';\n\nclass GeoJSONLayer extends LayerGroup {\n constructor(geojson, options) {\n var defaults = {\n output: false,\n interactive: false,\n topojson: false,\n filter: null,\n onEachFeature: null,\n pointGeometry: null,\n style: GeoJSON.defaultStyle\n };\n\n var _options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n _options.style = options.style;\n } else {\n _options.style = extend({}, defaults.style, options.style);\n }\n\n super(_options);\n\n this._geojson = geojson;\n }\n\n _onAdd(world) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n // Request data from URL if needed\n if (typeof this._geojson === 'string') {\n this._requestData(this._geojson);\n } else {\n // Process and add GeoJSON to layer\n this._processData(this._geojson);\n }\n }\n\n _requestData(url) {\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n // GeoJSON output layer\n //\n // Need to be careful as to not make it impossible to fork this off into a\n // worker script at a later stage\n _processData(data) {\n // Collects features into a single FeatureCollection\n //\n // Also converts TopoJSON to GeoJSON if instructed\n this._geojson = GeoJSON.collectFeatures(data, this._options.topojson);\n\n // TODO: Check that GeoJSON is valid / usable\n\n var features = this._geojson.features;\n\n // Run filter, if provided\n if (this._options.filter) {\n features = this._geojson.features.filter(this._options.filter);\n }\n\n var defaults = {};\n\n // Assume that a style won't be set per feature\n var style = this._options.style;\n\n var options;\n features.forEach(feature => {\n // Get per-feature style object, if provided\n if (typeof this._options.style === 'function') {\n style = extend({}, GeoJSON.defaultStyle, this._options.style(feature));\n }\n\n options = extend({}, defaults, {\n // If merging feature layers, stop them outputting themselves\n // If not, let feature layers output themselves to the world\n output: !this.isOutput(),\n interactive: this._options.interactive,\n style: style\n });\n\n var layer = this._featureToLayer(feature, options);\n\n if (!layer) {\n return;\n }\n\n layer.feature = feature;\n\n // If defined, call a function for each feature\n //\n // This is commonly used for adding event listeners from the user script\n if (this._options.onEachFeature) {\n this._options.onEachFeature(feature, layer);\n }\n\n this.addLayer(layer);\n });\n\n // If merging layers do that now, otherwise skip as the geometry layers\n // should have already outputted themselves\n if (!this.isOutput()) {\n return;\n }\n\n // From here on we can assume that we want to merge the layers\n\n var polygonAttributes = [];\n var polygonFlat = true;\n\n var polylineAttributes = [];\n var pointAttributes = [];\n\n this._layers.forEach(layer => {\n if (layer instanceof PolygonLayer) {\n polygonAttributes.push(layer.getBufferAttributes());\n\n if (polygonFlat && !layer.isFlat()) {\n polygonFlat = false;\n }\n } else if (layer instanceof PolylineLayer) {\n polylineAttributes.push(layer.getBufferAttributes());\n } else if (layer instanceof PointLayer) {\n pointAttributes.push(layer.getBufferAttributes());\n }\n });\n\n if (polygonAttributes.length > 0) {\n var mergedPolygonAttributes = Buffer.mergeAttributes(polygonAttributes);\n this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n this.add(this._polygonMesh);\n }\n\n if (polylineAttributes.length > 0) {\n var mergedPolylineAttributes = Buffer.mergeAttributes(polylineAttributes);\n this._setPolylineMesh(mergedPolylineAttributes);\n this.add(this._polylineMesh);\n }\n\n if (pointAttributes.length > 0) {\n var mergedPointAttributes = Buffer.mergeAttributes(pointAttributes);\n this._setPointMesh(mergedPointAttributes);\n this.add(this._pointMesh);\n }\n }\n\n // Create and store mesh from buffer attributes\n //\n // TODO: De-dupe this from the individual mesh creation logic within each\n // geometry layer (materials, settings, etc)\n //\n // Could make this an abstract method for each geometry layer\n _setPolygonMesh(attributes, flat) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n\n if (flat) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._polygonMesh = mesh;\n }\n\n _setPolylineMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n // TODO: Make this work when style is a function per feature\n var style = (typeof this._options.style === 'function') ? this._options.style(this._geojson.features[0]) : this._options.style;\n style = extend({}, GeoJSON.defaultStyle, style);\n\n var material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n\n var mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._polylineMesh = mesh;\n }\n\n _setPointMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._pointMesh = mesh;\n }\n\n // TODO: Support all GeoJSON geometry types\n _featureToLayer(feature, options) {\n var geometry = feature.geometry;\n var coordinates = (geometry.coordinates) ? geometry.coordinates : null;\n\n if (!coordinates || !geometry) {\n return;\n }\n\n if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n return new PolygonLayer(coordinates, options);\n }\n\n if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n return new PolylineLayer(coordinates, options);\n }\n\n if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n // Get geometry object to use for point, if provided\n if (typeof this._options.pointGeometry === 'function') {\n options.geometry = this._options.pointGeometry(feature);\n }\n\n return new PointLayer(coordinates, options);\n }\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONLayer;\n\nvar noNew = function(geojson, options) {\n return new GeoJSONLayer(geojson, options);\n};\n\nexport {noNew as geoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/GeoJSONLayer.js\n **/","import Layer from './Layer';\nimport extend from 'lodash.assign';\n\nclass LayerGroup extends Layer {\n constructor(options) {\n var defaults = {\n output: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._layers = [];\n }\n\n addLayer(layer) {\n this._layers.push(layer);\n this._world.addLayer(layer);\n }\n\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n this._world.removeLayer(layer);\n }\n\n _onAdd(world) {}\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].destroy();\n }\n\n this._layers = null;\n\n super.destroy();\n }\n}\n\nexport default LayerGroup;\n\nvar noNew = function(options) {\n return new LayerGroup(options);\n};\n\nexport {noNew as layerGroup};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/LayerGroup.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport earcut from 'earcut';\nimport extrudePolygon from '../../util/extrudePolygon';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolygonLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n color: '#ffffff',\n height: 0\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of polygons so it's easy to support\n // MultiPolygon features (a single polygon would be a MultiPolygon with a\n // single polygon in the array)\n this._coordinates = (PolygonLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polygon as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n getCenter() {\n return this._coordinates[0][0][0];\n }\n\n // Return polygon bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.height && this._options.style.height !== 0) {\n height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.color);\n\n // Light and dark colours used for poor-mans AO gradient on object sides\n var light = new THREE.Color(0xffffff);\n var shadow = new THREE.Color(0x666666);\n\n // For each polygon\n var attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n // Convert coordinates to earcut format\n var _earcut = this._toEarcut(_projectedCoordinates);\n\n // Triangulate faces using earcut\n var faces = this._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\n var groupedVertices = [];\n for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n }\n\n var extruded = extrudePolygon(groupedVertices, faces, {\n bottom: 0,\n top: height\n });\n\n var topColor = colour.clone().multiply(light);\n var bottomColor = colour.clone().multiply(shadow);\n\n var _vertices = extruded.positions;\n var _faces = [];\n var _colours = [];\n\n var _colour;\n extruded.top.forEach((face, fi) => {\n _colour = [];\n\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n\n _faces.push(face);\n _colours.push(_colour);\n });\n\n this._flat = true;\n\n if (extruded.sides) {\n this._flat = false;\n\n // Set up colours for every vertex with poor-mans AO on the sides\n extruded.sides.forEach((face, fi) => {\n _colour = [];\n\n // First face is always bottom-bottom-top\n if (fi % 2 === 0) {\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n // Reverse winding for the second face\n // top-top-bottom\n } else {\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n }\n\n _faces.push(face);\n _colours.push(_colour);\n });\n }\n\n // Skip bottom as there's no point rendering it\n // allFaces.push(extruded.faces);\n\n var polygon = {\n vertices: _vertices,\n faces: _faces,\n colours: _colours,\n facesCount: _faces.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n polygon.pickingId = this._pickingId;\n }\n\n // Convert polygon representation to proper attribute arrays\n return this._toAttributes(polygon);\n });\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n\n if (this.isFlat()) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n });\n }\n\n // Convert coordinates array to something earcut can understand\n _toEarcut(coordinates) {\n var dim = 2;\n var result = {vertices: [], holes: [], dimensions: dim};\n var holeIndex = 0;\n\n for (var i = 0; i < coordinates.length; i++) {\n for (var j = 0; j < coordinates[i].length; j++) {\n // for (var d = 0; d < dim; d++) {\n result.vertices.push(coordinates[i][j].x);\n result.vertices.push(coordinates[i][j].y);\n // }\n }\n if (i > 0) {\n holeIndex += coordinates[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n\n return result;\n }\n\n // Triangulate earcut-based input using earcut\n _triangulate(contour, holes, dim) {\n // console.time('earcut');\n\n var faces = earcut(contour, holes, dim);\n var result = [];\n\n for (i = 0, il = faces.length; i < il; i += 3) {\n result.push(faces.slice(i, i + 3));\n }\n\n // console.timeEnd('earcut');\n\n return result;\n }\n\n // Transform polygon representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(polygon) {\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(polygon.facesCount * 9);\n var normals = new Float32Array(polygon.facesCount * 9);\n var colours = new Float32Array(polygon.facesCount * 9);\n\n var pickingIds;\n if (polygon.pickingId) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(polygon.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n\n var _faces = polygon.faces;\n var _vertices = polygon.vertices;\n var _colour = polygon.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = polygon.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _faces.length; i++) {\n // Array of vertex indexes for the face\n index = _faces[i][0];\n\n var ax = _vertices[index][0];\n var ay = _vertices[index][1];\n var az = _vertices[index][2];\n\n var c1 = _colour[i][0];\n\n index = _faces[i][1];\n\n var bx = _vertices[index][0];\n var by = _vertices[index][1];\n var bz = _vertices[index][2];\n\n var c2 = _colour[i][1];\n\n index = _faces[i][2];\n\n var cx = _vertices[index][0];\n var cy = _vertices[index][1];\n var cz = _vertices[index][2];\n\n var c3 = _colour[i][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n normals: normals,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the polygon is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPolygon GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0][0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolygonLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolygonLayer(coordinates, options);\n};\n\nexport {noNew as polygonLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolygonLayer.js\n **/","'use strict';\n\nmodule.exports = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, size;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY);\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var sum = 0,\n i, j, last;\n\n // calculate original winding order of a polygon ring\n for (i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n\n // link points into circular doubly-linked list in the specified winding order\n if (clockwise === (sum > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && size) indexCurve(ear, minX, minY, size);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, size);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, size) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n var p = ear.nextZ;\n\n while (p && p.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.nextZ;\n }\n\n // then look for points in decreasing z-order\n p = ear.prevZ;\n\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, size);\n earcutLinked(c, triangles, dim, minX, minY, size);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= m.x &&\n pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, size) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize === 0) {\n e = q;\n q = q.nextZ;\n qSize--;\n } else if (qSize === 0 || !q) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else if (p.z <= q.z) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and size of the data bounding box\nfunction zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/earcut/src/earcut.js\n ** module id = 76\n ** module chunks = 0\n **/","/*\n * Extrude a polygon given its vertices and triangulated faces\n *\n * Based on:\n * https://github.com/freeman-lab/extrude\n */\n\nimport extend from 'lodash.assign';\n\nvar extrudePolygon = function(points, faces, _options) {\n var defaults = {\n top: 1,\n bottom: 0,\n closed: true\n };\n\n var options = extend({}, defaults, _options);\n\n var n = points.length;\n var positions;\n var cells;\n var topCells;\n var bottomCells;\n var sideCells;\n\n // If bottom and top values are identical then return the flat shape\n (options.top === options.bottom) ? flat() : full();\n\n function flat() {\n positions = points.map(function(p) { return [p[0], options.top, p[1]]; });\n cells = faces;\n topCells = faces;\n }\n\n function full() {\n positions = [];\n points.forEach(function(p) { positions.push([p[0], options.top, p[1]]); });\n points.forEach(function(p) { positions.push([p[0], options.bottom, p[1]]); });\n\n cells = [];\n for (var i = 0; i < n; i++) {\n if (i === (n - 1)) {\n cells.push([i + n, n, i]);\n cells.push([0, i, n]);\n } else {\n cells.push([i + n, i + n + 1, i]);\n cells.push([i + 1, i, i + n + 1]);\n }\n }\n\n sideCells = [].concat(cells);\n\n if (options.closed) {\n var top = faces;\n var bottom = top.map(function(p) { return p.map(function(v) { return v + n; }); });\n bottom = bottom.map(function(p) { return [p[0], p[2], p[1]]; });\n cells = cells.concat(top).concat(bottom);\n\n topCells = top;\n bottomCells = bottom;\n }\n }\n\n return {\n positions: positions,\n faces: cells,\n top: topCells,\n bottom: bottomCells,\n sides: sideCells\n };\n};\n\nexport default extrudePolygon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/extrudePolygon.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Provide alternative output using tubes and splines / curves\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolylineLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of lines so it's easy to support\n // MultiLineString features (a single line would be a MultiLineString with a\n // single line in the array)\n this._coordinates = (PolylineLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Polyline features are always flat (for now at least)\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polyline as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n getCenter() {\n return this._coordinates[0][0];\n }\n\n // Return line bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.lineHeight) {\n height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.lineColor);\n\n // For each line\n var attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n var _vertices = [];\n var _colours = [];\n\n // Connect coordinate with the next to make a pair\n //\n // LineSegments requires pairs of vertices so repeat the last point if\n // there's an odd number of vertices\n var nextCoord;\n _projectedCoordinates.forEach((coordinate, index) => {\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([coordinate.x, height, coordinate.y]);\n\n nextCoord = (_projectedCoordinates[index + 1]) ? _projectedCoordinates[index + 1] : coordinate;\n\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([nextCoord.x, height, nextCoord.y]);\n });\n\n var line = {\n vertices: _vertices,\n colours: _colours,\n verticesCount: _vertices.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n line.pickingId = this._pickingId;\n }\n\n // Convert line representation to proper attribute arrays\n return this._toAttributes(line);\n });\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var style = this._options.style;\n var material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n\n var mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiLineString GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolylineLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolylineLayer(coordinates, options);\n};\n\nexport {noNew as polylineLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolylineLayer.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Point features may be using custom models / meshes and so an approach\n// needs to be found to allow these to be brokwn down into buffer attributes for\n// merging\n//\n// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n// and pull out the attributes\n\n// TODO: Support sprite objects using textures\n\n// TODO: Provide option to billboard geometry so it always faces the camera\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PointLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // THREE.Geometry or THREE.BufferGeometry to use for point output\n //\n // TODO: Make this customisable per point via a callback (like style)\n geometry: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n pointColor: '#ff0000'\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of points so it's easy to support\n // MultiPoint features (a single point would be a MultiPoint with a\n // single point in the array)\n this._coordinates = (PointLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Point features are always flat (for now at least)\n //\n // This won't always be the case once custom point objects / meshes are\n // added\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of point as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n getCenter() {\n return this._coordinates;\n }\n\n // Return point bounds in geographic coordinates\n //\n // While not useful for single points, it could be useful for MultiPoint\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.pointHeight) {\n height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.pointColor);\n\n var geometry;\n\n // Use default geometry if none has been provided or the provided geometry\n // isn't valid\n if (!this._options.geometry || (!this._options.geometry instanceof THREE.Geometry || !this._options.geometry instanceof THREE.BufferGeometry)) {\n // Debug geometry for points is a thin bar\n //\n // TODO: Allow point geometry to be customised / overridden\n var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n var _geometry = new THREE.BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\n // Shift geometry up so it sits on the ground\n _geometry.translate(0, geometryHeight * 0.5, 0);\n\n // Pull attributes out of debug geometry\n geometry = new THREE.BufferGeometry().fromGeometry(_geometry);\n } else {\n if (this._options.geometry instanceof THREE.BufferGeometry) {\n geometry = this._options.geometry;\n } else {\n geometry = new THREE.BufferGeometry().fromGeometry(this._options.geometry);\n }\n }\n\n // For each point\n var attributes = this._projectedCoordinates.map(coordinate => {\n var _vertices = [];\n var _normals = [];\n var _colours = [];\n\n var _geometry = geometry.clone();\n\n _geometry.translate(coordinate.x, height, coordinate.y);\n\n var _vertices = _geometry.attributes.position.clone().array;\n var _normals = _geometry.attributes.normal.clone().array;\n var _colours = _geometry.attributes.color.clone().array;\n\n for (var i = 0; i < _colours.length; i += 3) {\n _colours[i] = colour.r;\n _colours[i + 1] = colour.g;\n _colours[i + 2] = colour.b;\n }\n\n var _point = {\n vertices: _vertices,\n normals: _normals,\n colours: _colours\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n // point.pickingId = this._pickingId;\n _point.pickingIds = new Float32Array(_vertices.length / 3);\n for (var i = 0; i < _point.pickingIds.length; i++) {\n _point.pickingIds[i] = this._pickingId;\n }\n }\n\n // Convert point representation to proper attribute arrays\n // return this._toAttributes(_point);\n return _point;\n });\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var _point;\n return this._coordinates.map(latlon => {\n _point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * _point.x;\n this._offset.y = -1 * _point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return _point;\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPoint GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PointLayer;\n\nvar noNew = function(coordinates, options) {\n return new PointLayer(coordinates, options);\n};\n\nexport {noNew as pointLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PointLayer.js\n **/","import GeoJSONLayer from './GeoJSONLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONLayer extends GeoJSONLayer {\n constructor(topojson, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(topojson, options);\n }\n}\n\nexport default TopoJSONLayer;\n\nvar noNew = function(topojson, options) {\n return new TopoJSONLayer(topojson, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as topoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/TopoJSONLayer.js\n **/"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","vizicities.min.js","webpack:/webpack/bootstrap 47c645ebef69113e558a","webpack:///src/vizicities.js","webpack:///src/World.js","webpack:///~/eventemitter3/index.js","webpack:///~/lodash.assign/index.js","webpack:///~/lodash.keys/index.js","webpack:///~/lodash.rest/index.js","webpack:///src/geo/crs/index.js","webpack:///src/geo/crs/CRS.EPSG3857.js","webpack:///src/geo/crs/CRS.Earth.js","webpack:///src/geo/crs/CRS.js","webpack:///src/geo/LatLon.js","webpack:///src/geo/Point.js","webpack:///src/util/wrapNum.js","webpack:///src/geo/projection/Projection.SphericalMercator.js","webpack:///src/util/Transformation.js","webpack:///src/geo/crs/CRS.EPSG3395.js","webpack:///src/geo/projection/Projection.Mercator.js","webpack:///src/geo/crs/CRS.EPSG4326.js","webpack:///src/geo/projection/Projection.LatLon.js","webpack:///src/geo/crs/CRS.Simple.js","webpack:///src/geo/crs/CRS.Proj4.js","webpack:///src/geo/projection/Projection.Proj4.js","webpack:/external \"proj4\"","webpack:///src/engine/Engine.js","webpack:/external \"THREE\"","webpack:///src/engine/Scene.js","webpack:///src/engine/DOMScene3D.js","webpack:///src/engine/DOMScene2D.js","webpack:///src/engine/Renderer.js","webpack:///src/engine/DOMRenderer3D.js","webpack:///src/vendor/CSS3DRenderer.js","webpack:///src/engine/DOMRenderer2D.js","webpack:///src/vendor/CSS2DRenderer.js","webpack:///src/engine/Camera.js","webpack:///src/engine/Picking.js","webpack:///src/engine/PickingScene.js","webpack:///src/layer/environment/EnvironmentLayer.js","webpack:///src/layer/Layer.js","webpack:///src/layer/environment/Skybox.js","webpack:///src/layer/environment/Sky.js","webpack:///~/lodash.throttle/index.js","webpack:///~/lodash.throttle/~/lodash.debounce/index.js","webpack:///src/controls/index.js","webpack:///src/controls/Controls.Orbit.js","webpack:///src/vendor/OrbitControls.js","webpack:///~/hammerjs/hammer.js","webpack:///src/layer/tile/ImageTileLayer.js","webpack:///src/layer/tile/TileLayer.js","webpack:///src/layer/tile/TileCache.js","webpack:///~/lru-cache/lib/lru-cache.js","webpack:///~/pseudomap/map.js","webpack:///~/process/browser.js","webpack:///~/pseudomap/pseudomap.js","webpack:///~/util/util.js","webpack:///~/util/support/isBufferBrowser.js","webpack:///~/inherits/inherits_browser.js","webpack:///~/yallist/yallist.js","webpack:///src/layer/tile/ImageTile.js","webpack:///src/layer/tile/Tile.js","webpack:///src/vendor/BoxHelper.js","webpack:///src/layer/tile/ImageTileLayerBaseMaterial.js","webpack:///src/layer/tile/GeoJSONTileLayer.js","webpack:///src/layer/tile/GeoJSONTile.js","webpack:///~/reqwest/reqwest.js","webpack:///src/util/GeoJSON.js","webpack:///~/topojson/build/topojson.js","webpack:///~/geojson-merge/index.js","webpack:///~/geojson-merge/~/geojson-normalize/index.js","webpack:///src/util/Buffer.js","webpack:///src/engine/PickingMaterial.js","webpack:///src/engine/PickingShader.js","webpack:///src/layer/tile/TopoJSONTileLayer.js","webpack:///src/layer/GeoJSONLayer.js","webpack:///src/layer/LayerGroup.js","webpack:///src/layer/geometry/PolygonLayer.js","webpack:///~/earcut/src/earcut.js","webpack:///src/util/extrudePolygon.js","webpack:///src/layer/geometry/PolylineLayer.js","webpack:///src/layer/geometry/PointLayer.js","webpack:///src/layer/TopoJSONLayer.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_22__","__WEBPACK_EXTERNAL_MODULE_24__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","_World","_World2","_controlsIndex","_controlsIndex2","_layerLayer","_layerLayer2","_layerEnvironmentEnvironmentLayer","_layerEnvironmentEnvironmentLayer2","_layerTileImageTileLayer","_layerTileImageTileLayer2","_layerTileGeoJSONTileLayer","_layerTileGeoJSONTileLayer2","_layerTileTopoJSONTileLayer","_layerTileTopoJSONTileLayer2","_layerGeoJSONLayer","_layerGeoJSONLayer2","_layerTopoJSONLayer","_layerTopoJSONLayer2","_layerGeometryPolygonLayer","_layerGeometryPolygonLayer2","_layerGeometryPolylineLayer","_layerGeometryPolylineLayer2","_layerGeometryPointLayer","_layerGeometryPointLayer2","_geoPoint","_geoPoint2","_geoLatLon","_geoLatLon2","VIZI","version","World","world","Controls","Layer","layer","EnvironmentLayer","environmentLayer","ImageTileLayer","imageTileLayer","GeoJSONTileLayer","geoJSONTileLayer","TopoJSONTileLayer","topoJSONTileLayer","GeoJSONLayer","geoJSONLayer","TopoJSONLayer","topoJSONLayer","PolygonLayer","polygonLayer","PolylineLayer","polylineLayer","PointLayer","pointLayer","Point","point","LatLon","latLon","_classCallCheck","instance","Constructor","TypeError","_inherits","subClass","superClass","prototype","create","constructor","enumerable","writable","configurable","setPrototypeOf","__proto__","_createClass","defineProperties","target","props","i","length","descriptor","key","protoProps","staticProps","_get","_x","_x2","_x3","_again","object","property","receiver","Function","desc","getOwnPropertyDescriptor","undefined","getter","get","parent","getPrototypeOf","_eventemitter3","_eventemitter32","_lodashAssign","_lodashAssign2","_geoCrsIndex","_geoCrsIndex2","_engineEngine","_engineEngine2","_EventEmitter","domId","options","defaults","crs","EPSG3857","skybox","_layers","_controls","_initContainer","_initEngine","_initEnvironment","_initEvents","_pause","_update","_container","document","getElementById","_engine","_environment","addTo","on","_onControlsMoveEnd","_point","x","z","_resetView","pointToLatLon","latlon","emit","_moveStart","_move","_moveEnd","_lastPosition","delta","clock","getDelta","window","requestAnimationFrame","bind","forEach","controls","update","_originLatlon","_originPoint","project","latLonToPoint","projectedPoint","_subtract","add","unproject","accurate","pointScale","metres","zoom","metresToWorld","worldUnits","worldToMetres","_camera","_addToWorld","push","isOutput","_scene","_object3D","_domScene3D","_domObject3D","_domScene2D","_domObject2D","layerIndex","indexOf","splice","remove","controlsIndex","stop","off","removeControls","destroy","removeLayer","noNew","EE","fn","context","once","EventEmitter","prefix","_events","listeners","event","exists","evt","available","l","ee","Array","a1","a2","a3","a4","a5","args","len","arguments","removeListener","apply","j","listener","events","removeAllListeners","addListener","setMaxListeners","prefixed","isIndex","reIsUint","test","MAX_SAFE_INTEGER","assignValue","objValue","eq","objectProto","hasOwnProperty","baseProperty","copyObject","source","copyObjectWith","customizer","index","newValue","createAssigner","assigner","rest","sources","guard","isIterateeCall","isObject","type","isArrayLike","other","isFunction","isLength","getLength","tag","objectToString","funcTag","genTag","keys","toString","assign","baseTimes","n","iteratee","result","baseHas","baseKeys","nativeKeys","indexKeys","isArray","isString","isArguments","String","isPrototype","Ctor","proto","isArrayLikeObject","propertyIsEnumerable","argsTag","isObjectLike","stringTag","isProto","indexes","skipIndexes","func","thisArg","start","FUNC_ERROR_TEXT","nativeMax","toInteger","array","otherArgs","toNumber","INFINITY","sign","MAX_INTEGER","remainder","valueOf","replace","reTrim","isBinary","reIsBinary","reIsOctal","freeParseInt","slice","reIsBadHex","NAN","parseInt","Math","max","_CRSEPSG3857","_CRSEPSG38572","_CRSEPSG3395","_CRSEPSG33952","_CRSEPSG4326","_CRSEPSG43262","_CRSSimple","_CRSSimple2","_CRSProj4","_CRSProj42","CRS","EPSG900913","EPSG3395","EPSG4326","Simple","Proj4","_CRSEarth","_CRSEarth2","_projectionProjectionSphericalMercator","_projectionProjectionSphericalMercator2","_utilTransformation","_utilTransformation2","_EPSG3857","code","projection","transformScale","PI","R","transformation","scale","_CRS","_CRS2","Earth","wrapLon","distance","latlon1","latlon2","lat1","lat2","a","rad","lat","lon1","lon","lon2","deltaLat","deltaLon","halfDeltaLat","halfDeltaLon","sin","cos","atan2","sqrt","acos","min","metresToProjected","projectedToMetres","projectedUnits","projectedMetres","scaledMetres","realMetres","_LatLon","_Point","_utilWrapNum","_utilWrapNum2","scaleFactor","_transform","untransformedPoint","untransform","pow","log","LN2","getProjectedBounds","infinite","b","bounds","s","transform","wrapLatLon","wrapLat","alt","isNaN","Error","lng","y","round","clone","_add","wrapNum","range","includeMax","d","SphericalMercator","MAX_LATITUDE","ECC","ECC2","atan","exp","k","sinLat","sinLat2","cosLat","v","h","Transformation","_a","_b","_c","_d","_projectionProjectionMercator","_projectionProjectionMercator2","_EPSG3395","Mercator","R_MINOR","r","tmp","e","con","ts","tan","phi","dphi","abs","_projectionProjectionLatLon","_projectionProjectionLatLon2","_EPSG4326","ProjectionLatLon","m1","m2","m3","m4","p1","p2","p3","latlen","lonlen","_Simple","dx","dy","_projectionProjectionProj4","_projectionProjectionProj42","_Proj4","def","diffX","diffY","halfX","halfY","scaleX","scaleY","offsetX","offsetY","_proj4","_proj42","proj","forward","inverse","bottomLeft","topRight","_three","_three2","_Scene","_Scene2","_DOMScene3D","_DOMScene3D2","_DOMScene2D","_DOMScene2D2","_Renderer","_Renderer2","_DOMRenderer3D","_DOMRenderer3D2","_DOMRenderer2D","_DOMRenderer2D2","_Camera","_Camera2","_Picking","_Picking2","Engine","container","console","_world","_renderer","_domRenderer3D","_domRenderer2D","_picking","Clock","_frustum","Frustum","render","child","children","geometry","dispose","material","map","_clock","scene","Scene","renderer","WebGLRenderer","antialias","setClearColor","setPixelRatio","devicePixelRatio","gammaInput","gammaOutput","shadowMap","enabled","cullFace","CullFaceBack","appendChild","domElement","updateSize","setSize","clientWidth","clientHeight","addEventListener","_vendorCSS3DRenderer","CSS3DRenderer","style","position","top","CSS3DObject","element","Object3D","parentNode","removeChild","CSS3DSprite","REVISION","_width","_height","_widthHalf","_heightHalf","matrix","Matrix4","cache","camera","fov","objects","createElement","overflow","WebkitTransformStyle","MozTransformStyle","oTransformStyle","transformStyle","cameraElement","getSize","width","height","epsilon","Number","EPSILON","getCameraCSSMatrix","elements","getObjectCSSMatrix","renderObject","copy","matrixWorldInverse","transpose","copyPosition","matrixWorld","cachedStyle","WebkitTransform","MozTransform","oTransform","degToRad","WebkitPerspective","MozPerspective","oPerspective","perspective","updateMatrixWorld","getInverse","_vendorCSS2DRenderer","CSS2DRenderer","CSS2DObject","vector","Vector3","viewMatrix","viewProjectionMatrix","setFromMatrixPosition","applyProjection","multiplyMatrices","projectionMatrix","PerspectiveCamera","aspect","updateProjectionMatrix","_PickingScene","_PickingScene2","nextId","Picking","_raycaster","Raycaster","linePrecision","_pickingScene","_pickingTexture","WebGLRenderTarget","texture","minFilter","LinearFilter","generateMipmaps","_nextId","_resizeTexture","_onMouseUp","_onWorldMove","button","clientX","clientY","normalisedPoint","_pick","_needUpdate","size","_pixelBuffer","Uint8Array","readRenderTargetPixels","setFromCamera","_point3d","intersects","intersectObjects","_point2d","mesh","removeEventListener","_Layer2","_Layer3","_Skybox","_Skybox2","_Layer","_options","_initLights","_initSkybox","_skyboxLight","DirectionalLight","castShadow","shadow","left","right","bottom","near","far","mapSize","directionalLight","directionalLight2","_skybox","_mesh","step","gridHelper","GridHelper","_engineScene","output","_dom3D","_dom2D","addLayer","_onAdd","getNextId","removeDOM3D","removeDOM2D","_Sky","_Sky2","_lodashThrottle","_lodashThrottle2","cubemap","vertexShader","join","fragmentShader","Skybox","light","_light","_settings","turbidity","reileigh","mieCoefficient","mieDirectionalG","luminance","inclination","azimuth","_updateUniforms","_throttledWorldUpdate","_cubeCamera","CubeCamera","cubeTarget","renderTarget","_sky","_skyScene","_sunSphere","Mesh","SphereBufferGeometry","MeshBasicMaterial","color","skyboxUniforms","skyboxMat","ShaderMaterial","uniforms","side","BackSide","BoxGeometry","_updateSkybox","settings","theta","sunPosition","intensity","updateCubeMap","ShaderLib","Sky","skyShader","skyUniforms","UniformsUtils","skyMat","skyGeo","skyMesh","throttle","wait","leading","trailing","debounce","maxWait","cancel","timeoutId","clearTimeout","maxTimeoutId","lastCalled","trailingCall","complete","isCalled","now","delayed","remaining","stamp","setTimeout","flush","maxDelayed","debounced","leadingCall","Date","_ControlsOrbit","_ControlsOrbit2","Orbit","orbit","_vendorOrbitControls","_vendorOrbitControls2","_this","animate","pointDelta","metresDelta","angle","angleDelta","noZoom","addControls","maxPolarAngle","_hammerjs","_hammerjs2","OrbitControls","getAutoRotationAngle","scope","autoRotateSpeed","getZoomScale","zoomSpeed","rotateLeft","thetaDelta","rotateUp","phiDelta","dollyIn","dollyScale","OrthographicCamera","minZoom","maxZoom","zoomChanged","warn","enableZoom","dollyOut","handleMouseDownRotate","rotateStart","set","handleMouseDownDolly","dollyStart","handleMouseDownPan","panStart","handleMouseMoveRotate","rotateEnd","rotateDelta","subVectors","body","rotateSpeed","handleMouseMoveDolly","dollyEnd","dollyDelta","handleMouseMovePan","panEnd","panDelta","pan","handleMouseUp","handleMouseWheel","wheelDelta","detail","handleKeyDown","keyCode","UP","keyPanSpeed","BOTTOM","LEFT","RIGHT","handleTouchStartRotate","pointers","pageX","pageY","handleTouchStartDolly","handleTouchStartPan","deltaX","deltaY","handleTouchMoveRotate","handleTouchMoveDolly","handleTouchMovePan","handleTouchEnd","onMouseDown","preventDefault","mouseButtons","ORBIT","enableRotate","state","STATE","ROTATE","ZOOM","DOLLY","PAN","enablePan","NONE","onMouseMove","onMouseUp","dispatchEvent","startEvent","endEvent","onMouseWheel","stopPropagation","onKeyDown","enableKeys","onTouchStart","touches","TOUCH_ROTATE","TOUCH_DOLLY","TOUCH_PAN","onTouchMove","onTouchEnd","onContextMenu","minDistance","maxDistance","Infinity","minPolarAngle","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","autoRotate","MOUSE","MIDDLE","target0","position0","zoom0","getPolarAngle","getAzimuthalAngle","reset","changeEvent","offset","quat","Quaternion","setFromUnitVectors","up","quatInverse","lastPosition","lastQuaternion","sub","applyQuaternion","EPS","radius","panOffset","lookAt","distanceToSquared","dot","quaternion","Vector2","panLeft","objectMatrix","te","multiplyScalar","panUp","adjDist","targetDistance","hammer","direction","DIRECTION_ALL","enable","threshold","pointerType","EventDispatcher","center","noRotate","noPan","noKeys","staticMoving","constraint","dynamicDampingFactor","__WEBPACK_AMD_DEFINE_RESULT__","exportName","setTimeoutContext","timeout","bindFn","invokeArrayArg","arg","each","iterator","deprecate","method","name","message","deprecationMessage","stack","inherit","base","properties","childP","baseP","_super","boolOrFn","val","TYPE_FUNCTION","ifUndefined","val1","val2","addEventListeners","types","handler","splitStr","removeEventListeners","hasParent","node","inStr","str","find","trim","split","inArray","src","findByKey","toArray","uniqueArray","sort","results","values","prop","camelProp","toUpperCase","VENDOR_PREFIXES","uniqueId","_uniqueId","getWindowForElement","doc","ownerDocument","defaultView","parentWindow","Input","manager","callback","self","inputTarget","domHandler","ev","init","createInputInstance","Type","inputClass","SUPPORT_POINTER_EVENTS","PointerEventInput","SUPPORT_ONLY_TOUCH","TouchInput","SUPPORT_TOUCH","TouchMouseInput","MouseInput","inputHandler","eventType","input","pointersLen","changedPointersLen","changedPointers","isFirst","INPUT_START","isFinal","INPUT_END","INPUT_CANCEL","session","computeInputData","recognize","prevInput","pointersLength","firstInput","simpleCloneInputData","firstMultiple","offsetCenter","getCenter","timeStamp","deltaTime","getAngle","getDistance","computeDeltaXY","offsetDirection","getDirection","overallVelocity","getVelocity","overallVelocityX","overallVelocityY","getScale","rotation","getRotation","maxPointers","computeIntervalInputData","srcEvent","offsetDelta","prevDelta","velocity","velocityX","velocityY","last","lastInterval","COMPUTE_INTERVAL","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","PROPS_XY","end","PROPS_CLIENT_XY","evEl","MOUSE_ELEMENT_EVENTS","evWin","MOUSE_WINDOW_EVENTS","allow","pressed","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","store","pointerEvents","SingleTouchInput","evTarget","SINGLE_TOUCH_TARGET_EVENTS","SINGLE_TOUCH_WINDOW_EVENTS","started","normalizeSingleTouches","all","changed","changedTouches","concat","TOUCH_TARGET_EVENTS","targetIds","getTouches","allTouches","INPUT_MOVE","identifier","targetTouches","changedTargetTouches","filter","touch","mouse","TouchAction","cleanTouchActions","actions","TOUCH_ACTION_NONE","hasPanX","TOUCH_ACTION_PAN_X","hasPanY","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_AUTO","Recognizer","STATE_POSSIBLE","simultaneous","requireFail","stateStr","STATE_CANCELLED","STATE_ENDED","STATE_CHANGED","STATE_BEGAN","directionStr","getRecognizerByNameIfManager","otherRecognizer","recognizer","AttrRecognizer","PanRecognizer","pX","pY","PinchRecognizer","PressRecognizer","_timer","_input","RotateRecognizer","SwipeRecognizer","TapRecognizer","pTime","pCenter","count","Hammer","recognizers","preset","Manager","handlers","touchAction","toggleCssProps","item","recognizeWith","requireFailure","cssProps","triggerDomEvent","data","gestureEvent","createEvent","initEvent","gesture","TEST_ELEMENT","nextKey","extend","dest","merge","MOBILE_REGEX","navigator","userAgent","INPUT_TYPE_TOUCH","INPUT_TYPE_PEN","INPUT_TYPE_MOUSE","INPUT_TYPE_KINECT","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","which","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM",2,3,4,5,"MSPointerEvent","PointerEvent","removePointer","eventTypeNormalized","toLowerCase","isTouch","storeIndex","pointerId","SINGLE_TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","TOUCH_INPUT_MAP","inputEvent","inputData","isMouse","PREFIXED_TOUCH_ACTION","NATIVE_TOUCH_ACTION","TOUCH_ACTION_COMPUTE","compute","getTouchAction","preventDefaults","prevented","hasNone","isTapPointer","isTapMovement","isTapTouchTime","preventSrc","STATE_RECOGNIZED","STATE_FAILED","dropRecognizeWith","dropRequireFailure","hasRequireFailures","canRecognizeWith","additionalEvent","tryEmit","canEmit","inputDataClone","process","attrTest","optionPointers","isRecognized","isValid","directionTest","hasMoved","inOut","time","validPointers","validMovement","validTime","taps","interval","posThreshold","validTouchTime","failTimeout","validInterval","validMultiTap","tapCount","VERSION","domEvents","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","STOP","FORCED_STOP","force","stopped","curRecognizer","existing","Tap","Pan","Swipe","Pinch","Rotate","Press","freeGlobal","_TileLayer2","_TileLayer3","_ImageTile","_ImageTile2","_ImageTileLayerBaseMaterial","_ImageTileLayerBaseMaterial2","_TileLayer","path","_path","baseMaterial","geom","PlaneBufferGeometry","getRenderTarget","renderOrder","receiveShadow","_baseLayer","_calculateLOD","_onWorldUpdate","_outputTiles","_moveBaseLayer","quadcode","_TileCache","_TileCache2","TileLayer","picking","maxCache","maxLOD","_tileCache","tile","_destroyTile","_tileList","_minLOD","_maxLOD","_tiles","_tilesPicking","addToPicking","getCamera","projScreenMatrix","setFromMatrix","getBounds","intersectsBox","Box3","_this2","_removeTiles","isReady","getMesh","getPickingMesh","_this3","_stop","_updateFrustum","checkList","_checklist","_requestTile","_divide","_tileInFrustum","dist","requestTileAsync","currentItem","getQuadcode","_screenSpaceError","minDepth","maxDepth","quality","error","getSide","getTile","_createTile","setTile","removeFromPicking","_lruCache","_lruCache2","TileCache","cacheLimit","onDestroyTile","_cache","tileCache","priv","sym","symbols","makeSymbol","naiveLength","LRUCache","lc","stale","maxAge","forEachStep","thisp","hit","isStale","del","doUse","unshiftNode","diff","walker","tail","prev","removeNode","Entry","Map","util","Yallist","hasSymbol","Symbol","mL","allowStale","mA","lC","rforEach","head","next","dump","dumpLru","inspect","opts","extras","as","didFirst","has","unshift","peek","pop","load","arr","expiresAt","prune","env","npm_package_name","npm_lifecycle_script","TEST_PSEUDOMAP","cleanUpNextTick","draining","currentQueue","queue","queueIndex","drainQueue","run","Item","fun","noop","nextTick","title","browser","argv","versions","binding","cwd","chdir","dir","umask","PseudoMap","clear","kv","same","_index","_data","res","entries","global","ctx","seen","stylize","stylizeNoColor","depth","colors","isBoolean","showHidden","_extend","isUndefined","customInspect","stylizeWithColor","formatValue","styleType","styles","arrayToHash","hash","idx","recurseTimes","ret","primitive","formatPrimitive","visibleKeys","getOwnPropertyNames","isError","formatError","isRegExp","RegExp","isDate","braces","toUTCString","formatArray","formatProperty","reduceToSingleString","simple","JSON","stringify","isNumber","isNull","match","line","substr","numLinesEst","reduce","cur","ar","isNullOrUndefined","isSymbol","re","isPrimitive","o","pad","timestamp","getHours","getMinutes","getSeconds","getDate","months","getMonth","formatRegExp","format","f","_","msg","deprecated","warned","throwDeprecation","traceDeprecation","trace","noDeprecation","debugEnviron","debugs","debuglog","NODE_DEBUG","pid","bold","italic","underline","white","grey","black","blue","cyan","green","magenta","red","yellow","special","number","boolean","null","string","date","regexp","isBuffer","inherits","origin","fill","readUInt8","ctor","superCtor","super_","TempCtor","list","Node","pushNode","shift","forEachReverse","getReverse","mapReverse","initial","acc","reduceReverse","toArrayReverse","from","to","sliceReverse","reverse","_Tile2","_Tile3","_vendorBoxHelper","ImageTile","_Tile","_createMesh","_abortRequest","_image","_center","_side","MeshStandardMaterial","depthWrite","roughness","metalness","envMap","localMesh","canvas","getContext","font","fillStyle","fillText","_quadcode","_tile","Texture","magFilter","LinearMipMapLinearFilter","anisotropy","needsUpdate","transparent","urlParams","url","_getTileURL","image","_texture","_ready","crossOrigin","imageTile","r2d","tileURLRegex","Tile","_layer","_quadcodeToTile","_boundsLatLon","_tileBoundsWGS84","_boundsWorld","_tileBoundsFromWGS84","_boundsToCenter","_centerLatlon","_getSide","_pointScale","_pickingMesh","fromCharCode","floor","random","lastIndex","mask","q","boundsWGS84","sw","ne","_tile2lon","w","_tile2lat","BoxHelper","indices","Uint16Array","positions","Float32Array","BufferGeometry","setIndex","BufferAttribute","addAttribute","LineSegments","LineBasicMaterial","linewidth","box","setFromObject","isEmpty","attributes","computeBoundingSphere","colour","skyboxTarget","fillRect","_GeoJSONTile","_GeoJSONTile2","_onControlsMove","_pauseOutput","topojson","onClick","_reqwest","_reqwest2","_utilGeoJSON","_utilGeoJSON2","_utilBuffer","_utilBuffer2","_enginePickingMaterial","_enginePickingMaterial2","GeoJSONTile","_defaultStyle","defaultStyle","_createPickingMesh","_request","then","_processTileData","err","geojson","mergeFeatures","features","polygons","vertices","faces","colours","facesCount","allFlat","lines","verticesCount","pickingIds","Color","feature","coordinates","lineColor","coordinate","lineHeight","linestringAttributes","lineStringAttributes","pickingId","getPickingId","point2d","point3d","_coordinates","multiLinestringAttributes","multiLineStringAttributes","ring","polygonAttributes","flat","createLineGeometry","vertexColors","VertexColors","lineWidth","lineTransparent","opacity","lineOpacity","blending","lineBlending","lineRenderOrder","linePadding","pickingMesh","createGeometry","envMapIntensity","MeshPhongMaterial","timeEnd","abort","geoJSONTile","__WEBPACK_AMD_DEFINE_FACTORY__","definition","succeed","protocol","protocolRe","exec","location","httpsRe","twoHundo","request","status","response","handleReadyState","success","_aborted","_timedOut","readyState","onreadystatechange","setHeaders","http","headers","defaultHeaders","isAFormData","FormData","requestedWith","contentType","setRequestHeader","setCredentials","withCredentials","generalCallback","lastValue","urlappend","handleJsonp","reqId","uniqid","cbkey","cbval","reqwest","getcallbackPrefix","cbreg","script","isIE10","async","htmlFor","onload","onclick","getRequest","toQueryString","sendWait","xhr","open","xDomainRequest","onerror","onprogress","send","Reqwest","setType","header","resp","_completeHandlers","getResponseHeader","filteredResponse","globalSetupOptions","dataFilter","responseText","parse","eval","responseXML","parseError","errorCode","reason","_responseArgs","_fulfilled","_successHandler","_fulfillmentHandlers","timedOut","t","_erred","_errorHandlers","normalize","serial","el","cb","ch","ra","tagName","optCb","disabled","checked","selectedIndex","selected","eachFormElement","serializeSubtags","tags","fa","byTag","serializeQueryString","serializeArray","serializeHash","buildParams","traditional","rbracket","XHR2","ex","callbackPrefix","xmlHttpRequest","accept","*","xml","html","text","json","js","XMLHttpRequest","XDomainRequest","ActiveXObject","retry","fail","always","catch","serialize","opt","nodeType","trad","enc","encodeURIComponent","compat","ajaxSetup","_topojson2","_topojson3","_geojsonMerge","_geojsonMerge2","GeoJSON","NormalBlending","collectFeatures","_topojson","collections","tk","gk","absolute","x0","y0","kx","ky","translate","relative","x1","y1","bisect","lo","hi","mid","topology","geometries","feature$1","arc","points","arcs","absolute$$","polygon","geometryType","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","stitchArcs","ends","p0","dp","fragmentByEnd","fragmentByStart","stitchedArcs","fragments","emptyIndex","g","fg","gf","meshArcs","geomsByArc","geoms","triangle","area","mergeArcs","register","ring$$","polygonsByArc","exterior","components","component","neighbors","sgn","indexesByArc","ij","ik","compareArea","minAreaHeap","down","heap","removed","presimplify","triangleArea","relative$$","triangles","maxArea","previous","inputs","memo","gj","GeometryCollection","Feature","FeatureCollection","Buffer","mergeAttributes","lengths","_attributes","mergedAttributes","lastLengths","_vertices","_colour","_pickingId","ax","ay","az","c1","computeBoundingBox","normals","_faces","pA","pB","pC","ab","bx","by","bz","c2","cx","cy","cz","c3","cross","nx","ny","nz","_PickingShader","_PickingShader2","PickingMaterial","setPointSize","setPointScale","PickingShader","_GeoJSONTileLayer2","_GeoJSONTileLayer3","_GeoJSONTileLayer","_LayerGroup2","_LayerGroup3","_geometryPolygonLayer","_geometryPolygonLayer2","_geometryPolylineLayer","_geometryPolylineLayer2","_geometryPointLayer","_geometryPointLayer2","_LayerGroup","interactive","onEachFeature","polygonMaterial","onPolygonMesh","onPolygonBufferAttributes","polylineMaterial","onPolylineMesh","onPolylineBufferAttributes","pointGeometry","pointMaterial","onPointMesh","_geojson","THREE","_requestData","_processData","_featureToLayer","polygonFlat","polylineAttributes","pointAttributes","getBufferAttributes","isFlat","mergedPolygonAttributes","_setPolygonMesh","_polygonMesh","mergedPolylineAttributes","_setPolylineMesh","_polylineMesh","mergedPointAttributes","_setPointMesh","_pointMesh","Material","onMesh","onBufferAttributes","lineMaterial","LayerGroup","layerGroup","_earcut2","_earcut3","_utilExtrudePolygon","_utilExtrudePolygon2","isSingle","_setCoordinates","_setPickingId","_addPickingEvents","_setBufferAttributes","_setMesh","_bufferAttributes","_projectedCoordinates","_earcut","_toEarcut","_triangulate","holes","dimensions","groupedVertices","il","extruded","topColor","multiply","bottomColor","_colours","face","fi","_flat","sides","_toAttributes","_bounds","_convertCoordinates","_projectedBounds","_projectCoordinates","_offset","dim","holeIndex","contour","earcut","holeIndices","hasHoles","outerLen","outerNode","linkedList","minX","minY","maxX","maxY","eliminateHoles","earcutLinked","clockwise","sum","insertNode","filterPoints","again","steiner","equals","ear","pass","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","pointInTriangle","minTX","minTY","maxTX","maxTY","minZ","zOrder","maxZ","nextZ","prevZ","locallyInside","isValidDiagonal","splitPolygon","getLeftmost","compareX","eliminateHole","hole","findHoleBridge","hx","hy","qx","tanMin","sortLinked","numMerges","pSize","qSize","inSize","leftmost","px","py","intersectsPolygon","middleInside","q1","q2","inside","b2","an","bp","extrudePolygon","cells","topCells","full","sideCells","closed","bottomCells","nextCoord","pointColor","pointHeight","Geometry","geometryWidth","geometryHeight","_geometry","fromGeometry","_normals","normal","_GeoJSONLayer2","_GeoJSONLayer3","_GeoJSONLayer"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,SAAAA,QAAA,UACA,kBAAAC,SAAAA,OAAAC,IACAD,QAAA,QAAA,SAAAJ,GACA,gBAAAC,SACAA,QAAA,KAAAD,EAAAG,QAAA,SAAAA,QAAA,UAEAJ,EAAA,KAAAC,EAAAD,EAAA,MAAAA,EAAA,QACCO,KAAA,SAAAC,+BAAAC,gCACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAV,OAGA,IAAAC,GAAAU,EAAAD,IACAV,WACAY,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAb,EAAAD,QAAAC,EAAAA,EAAAD,QAAAS,GAGAR,EAAAY,QAAA,EAGAZ,EAAAD,QAvBA,GAAAW,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASR,EAAQD,EAASS,GAM/B,QAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAAWF,GAJzFG,OAAOC,eAAevB,EAAS,cAC7BwB,OAAO,GAKT,IAAIC,GAAShB,EE9Da,GFgEtBiB,EAAUR,EAAuBO,GAEjCE,EAAiBlB,EEjED,IFmEhBmB,EAAkBV,EAAuBS,GAEzCE,EAAcpB,EEnEQ,IFqEtBqB,EAAeZ,EAAuBW,GAEtCE,EAAoCtB,EEtEQ,IFwE5CuB,EAAqCd,EAAuBa,GAE5DE,EAA2BxB,EEzEa,IF2ExCyB,EAA4BhB,EAAuBe,GAEnDE,EAA6B1B,EE5Ee,IF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AT,KAQTukD,EAAUv8C,GjFm+iBjB,MAdA/C,GiF79iBGhB,EAAa0+D,GAAb1+D,GjF4+iBFy+D,EAAe,WAElB/iE,GAAQ,WiFl+iBMsE,CAEf,IAAI2I,GAAQ,SAAS23C,EAAUv8C,GAC7B,MAAO,IAAI/D,GAAcsgD,EAAUv8C,GjFs+iBpCrI,GiFl+iBgBuE,cAAT0I","file":"vizicities.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"proj4\"), require(\"THREE\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"proj4\", \"THREE\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VIZI\"] = factory(require(\"proj4\"), require(\"THREE\"));\n\telse\n\t\troot[\"VIZI\"] = factory(root[\"proj4\"], root[\"THREE\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_24__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"proj4\"), require(\"THREE\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"proj4\", \"THREE\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VIZI\"] = factory(require(\"proj4\"), require(\"THREE\"));\n\telse\n\t\troot[\"VIZI\"] = factory(root[\"proj4\"], root[\"THREE\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_24__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _World = __webpack_require__(1);\n\t\n\tvar _World2 = _interopRequireDefault(_World);\n\t\n\tvar _controlsIndex = __webpack_require__(42);\n\t\n\tvar _controlsIndex2 = _interopRequireDefault(_controlsIndex);\n\t\n\tvar _layerLayer = __webpack_require__(37);\n\t\n\tvar _layerLayer2 = _interopRequireDefault(_layerLayer);\n\t\n\tvar _layerEnvironmentEnvironmentLayer = __webpack_require__(36);\n\t\n\tvar _layerEnvironmentEnvironmentLayer2 = _interopRequireDefault(_layerEnvironmentEnvironmentLayer);\n\t\n\tvar _layerTileImageTileLayer = __webpack_require__(46);\n\t\n\tvar _layerTileImageTileLayer2 = _interopRequireDefault(_layerTileImageTileLayer);\n\t\n\tvar _layerTileGeoJSONTileLayer = __webpack_require__(61);\n\t\n\tvar _layerTileGeoJSONTileLayer2 = _interopRequireDefault(_layerTileGeoJSONTileLayer);\n\t\n\tvar _layerTileTopoJSONTileLayer = __webpack_require__(72);\n\t\n\tvar _layerTileTopoJSONTileLayer2 = _interopRequireDefault(_layerTileTopoJSONTileLayer);\n\t\n\tvar _layerGeoJSONLayer = __webpack_require__(73);\n\t\n\tvar _layerGeoJSONLayer2 = _interopRequireDefault(_layerGeoJSONLayer);\n\t\n\tvar _layerTopoJSONLayer = __webpack_require__(80);\n\t\n\tvar _layerTopoJSONLayer2 = _interopRequireDefault(_layerTopoJSONLayer);\n\t\n\tvar _layerGeometryPolygonLayer = __webpack_require__(75);\n\t\n\tvar _layerGeometryPolygonLayer2 = _interopRequireDefault(_layerGeometryPolygonLayer);\n\t\n\tvar _layerGeometryPolylineLayer = __webpack_require__(78);\n\t\n\tvar _layerGeometryPolylineLayer2 = _interopRequireDefault(_layerGeometryPolylineLayer);\n\t\n\tvar _layerGeometryPointLayer = __webpack_require__(79);\n\t\n\tvar _layerGeometryPointLayer2 = _interopRequireDefault(_layerGeometryPointLayer);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoPoint2 = _interopRequireDefault(_geoPoint);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoLatLon2 = _interopRequireDefault(_geoLatLon);\n\t\n\tvar VIZI = {\n\t version: '0.3',\n\t\n\t // Public API\n\t World: _World2['default'],\n\t world: _World.world,\n\t Controls: _controlsIndex2['default'],\n\t Layer: _layerLayer2['default'],\n\t layer: _layerLayer.layer,\n\t EnvironmentLayer: _layerEnvironmentEnvironmentLayer2['default'],\n\t environmentLayer: _layerEnvironmentEnvironmentLayer.environmentLayer,\n\t ImageTileLayer: _layerTileImageTileLayer2['default'],\n\t imageTileLayer: _layerTileImageTileLayer.imageTileLayer,\n\t GeoJSONTileLayer: _layerTileGeoJSONTileLayer2['default'],\n\t geoJSONTileLayer: _layerTileGeoJSONTileLayer.geoJSONTileLayer,\n\t TopoJSONTileLayer: _layerTileTopoJSONTileLayer2['default'],\n\t topoJSONTileLayer: _layerTileTopoJSONTileLayer.topoJSONTileLayer,\n\t GeoJSONLayer: _layerGeoJSONLayer2['default'],\n\t geoJSONLayer: _layerGeoJSONLayer.geoJSONLayer,\n\t TopoJSONLayer: _layerTopoJSONLayer2['default'],\n\t topoJSONLayer: _layerTopoJSONLayer.topoJSONLayer,\n\t PolygonLayer: _layerGeometryPolygonLayer2['default'],\n\t polygonLayer: _layerGeometryPolygonLayer.polygonLayer,\n\t PolylineLayer: _layerGeometryPolylineLayer2['default'],\n\t polylineLayer: _layerGeometryPolylineLayer.polylineLayer,\n\t PointLayer: _layerGeometryPointLayer2['default'],\n\t pointLayer: _layerGeometryPointLayer.pointLayer,\n\t Point: _geoPoint2['default'],\n\t point: _geoPoint.point,\n\t LatLon: _geoLatLon2['default'],\n\t latLon: _geoLatLon.latLon\n\t};\n\t\n\texports['default'] = VIZI;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _geoCrsIndex = __webpack_require__(6);\n\t\n\tvar _geoCrsIndex2 = _interopRequireDefault(_geoCrsIndex);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _engineEngine = __webpack_require__(23);\n\t\n\tvar _engineEngine2 = _interopRequireDefault(_engineEngine);\n\t\n\tvar _layerEnvironmentEnvironmentLayer = __webpack_require__(36);\n\t\n\tvar _layerEnvironmentEnvironmentLayer2 = _interopRequireDefault(_layerEnvironmentEnvironmentLayer);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// Pretty much any event someone using ViziCities would need will be emitted or\n\t// proxied by World (eg. render events, etc)\n\t\n\tvar World = (function (_EventEmitter) {\n\t _inherits(World, _EventEmitter);\n\t\n\t function World(domId, options) {\n\t _classCallCheck(this, World);\n\t\n\t _get(Object.getPrototypeOf(World.prototype), 'constructor', this).call(this);\n\t\n\t var defaults = {\n\t crs: _geoCrsIndex2['default'].EPSG3857,\n\t skybox: false\n\t };\n\t\n\t this.options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t this._layers = [];\n\t this._controls = [];\n\t\n\t this._initContainer(domId);\n\t this._initEngine();\n\t this._initEnvironment();\n\t this._initEvents();\n\t\n\t this._pause = false;\n\t\n\t // Kick off the update and render loop\n\t this._update();\n\t }\n\t\n\t _createClass(World, [{\n\t key: '_initContainer',\n\t value: function _initContainer(domId) {\n\t this._container = document.getElementById(domId);\n\t }\n\t }, {\n\t key: '_initEngine',\n\t value: function _initEngine() {\n\t this._engine = new _engineEngine2['default'](this._container, this);\n\t\n\t // Engine events\n\t //\n\t // Consider proxying these through events on World for public access\n\t // this._engine.on('preRender', () => {});\n\t // this._engine.on('postRender', () => {});\n\t }\n\t }, {\n\t key: '_initEnvironment',\n\t value: function _initEnvironment() {\n\t // Not sure if I want to keep this as a private API\n\t //\n\t // Makes sense to allow others to customise their environment so perhaps\n\t // add some method of disable / overriding the environment settings\n\t this._environment = new _layerEnvironmentEnvironmentLayer2['default']({\n\t skybox: this.options.skybox\n\t }).addTo(this);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t this.on('controlsMoveEnd', this._onControlsMoveEnd);\n\t }\n\t }, {\n\t key: '_onControlsMoveEnd',\n\t value: function _onControlsMoveEnd(point) {\n\t var _point = (0, _geoPoint.point)(point.x, point.z);\n\t this._resetView(this.pointToLatLon(_point), _point);\n\t }\n\t\n\t // Reset world view\n\t }, {\n\t key: '_resetView',\n\t value: function _resetView(latlon, point) {\n\t this.emit('preResetView');\n\t\n\t this._moveStart();\n\t this._move(latlon, point);\n\t this._moveEnd();\n\t\n\t this.emit('postResetView');\n\t }\n\t }, {\n\t key: '_moveStart',\n\t value: function _moveStart() {\n\t this.emit('moveStart');\n\t }\n\t }, {\n\t key: '_move',\n\t value: function _move(latlon, point) {\n\t this._lastPosition = latlon;\n\t this.emit('move', latlon, point);\n\t }\n\t }, {\n\t key: '_moveEnd',\n\t value: function _moveEnd() {\n\t this.emit('moveEnd');\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._pause) {\n\t return;\n\t }\n\t\n\t var delta = this._engine.clock.getDelta();\n\t\n\t // Once _update is called it will run forever, for now\n\t window.requestAnimationFrame(this._update.bind(this));\n\t\n\t // Update controls\n\t this._controls.forEach(function (controls) {\n\t controls.update();\n\t });\n\t\n\t this.emit('preUpdate', delta);\n\t this._engine.update(delta);\n\t this.emit('postUpdate', delta);\n\t }\n\t\n\t // Set world view\n\t }, {\n\t key: 'setView',\n\t value: function setView(latlon) {\n\t // Store initial geographic coordinate for the [0,0,0] world position\n\t //\n\t // The origin point doesn't move in three.js / 3D space so only set it once\n\t // here instead of every time _resetView is called\n\t //\n\t // If it was updated every time then coorindates would shift over time and\n\t // would be out of place / context with previously-placed points (0,0 would\n\t // refer to a different point each time)\n\t this._originLatlon = latlon;\n\t this._originPoint = this.project(latlon);\n\t\n\t this._resetView(latlon);\n\t return this;\n\t }\n\t\n\t // Return world geographic position\n\t }, {\n\t key: 'getPosition',\n\t value: function getPosition() {\n\t return this._lastPosition;\n\t }\n\t\n\t // Transform geographic coordinate to world point\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the origin point of the projection (not the world)\n\t }, {\n\t key: 'project',\n\t value: function project(latlon) {\n\t return this.options.crs.latLonToPoint((0, _geoLatLon.latLon)(latlon));\n\t }\n\t\n\t // Transform world point to geographic coordinate\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a point relative to the origin point of the\n\t // projection (not the world) and returns a geographic coordinate\n\t }, {\n\t key: 'unproject',\n\t value: function unproject(point) {\n\t return this.options.crs.pointToLatLon((0, _geoPoint.point)(point));\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the three.js / 3D origin (0,0)\n\t }, {\n\t key: 'latLonToPoint',\n\t value: function latLonToPoint(latlon) {\n\t var projectedPoint = this.project((0, _geoLatLon.latLon)(latlon));\n\t return projectedPoint._subtract(this._originPoint);\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a point relative to the three.js / 3D origin (0,0)\n\t // and returns the exact geographic coordinate at that point\n\t }, {\n\t key: 'pointToLatLon',\n\t value: function pointToLatLon(point) {\n\t var projectedPoint = (0, _geoPoint.point)(point).add(this._originPoint);\n\t return this.unproject(projectedPoint);\n\t }\n\t\n\t // Return pointscale for a given geographic coordinate\n\t }, {\n\t key: 'pointScale',\n\t value: function pointScale(latlon, accurate) {\n\t return this.options.crs.pointScale(latlon, accurate);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'metresToWorld',\n\t value: function metresToWorld(metres, pointScale, zoom) {\n\t return this.options.crs.metresToWorld(metres, pointScale, zoom);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'worldToMetres',\n\t value: function worldToMetres(worldUnits, pointScale, zoom) {\n\t return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n\t }\n\t\n\t // Unsure if it's a good idea to expose this here for components like\n\t // GridLayer to use (eg. to keep track of a frustum)\n\t }, {\n\t key: 'getCamera',\n\t value: function getCamera() {\n\t return this._engine._camera;\n\t }\n\t }, {\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t layer._addToWorld(this);\n\t\n\t this._layers.push(layer);\n\t\n\t if (layer.isOutput()) {\n\t // Could move this into Layer but it'll do here for now\n\t this._engine._scene.add(layer._object3D);\n\t this._engine._domScene3D.add(layer._domObject3D);\n\t this._engine._domScene2D.add(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerAdded', layer);\n\t return this;\n\t }\n\t\n\t // Remove layer from world and scene but don't destroy it entirely\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t if (layer.isOutput()) {\n\t this._engine._scene.remove(layer._object3D);\n\t this._engine._domScene3D.remove(layer._domObject3D);\n\t this._engine._domScene2D.remove(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerRemoved');\n\t return this;\n\t }\n\t }, {\n\t key: 'addControls',\n\t value: function addControls(controls) {\n\t controls._addToWorld(this);\n\t\n\t this._controls.push(controls);\n\t\n\t this.emit('controlsAdded', controls);\n\t return this;\n\t }\n\t\n\t // Remove controls from world but don't destroy them entirely\n\t }, {\n\t key: 'removeControls',\n\t value: function removeControls(controls) {\n\t var controlsIndex = this._controls.indexOf(controlsIndex);\n\t\n\t if (controlsIndex > -1) {\n\t this._controls.splice(controlsIndex, 1);\n\t };\n\t\n\t this.emit('controlsRemoved', controls);\n\t return this;\n\t }\n\t }, {\n\t key: 'stop',\n\t value: function stop() {\n\t this._pause = true;\n\t }\n\t }, {\n\t key: 'start',\n\t value: function start() {\n\t this._pause = false;\n\t this._update();\n\t }\n\t\n\t // Destroys the world(!) and removes it from the scene and memory\n\t //\n\t // TODO: World out why so much three.js stuff is left in the heap after this\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this.stop();\n\t\n\t // Remove listeners\n\t this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\t\n\t var i;\n\t\n\t // Remove all controls\n\t var controls;\n\t for (i = this._controls.length - 1; i >= 0; i--) {\n\t controls = this._controls[0];\n\t this.removeControls(controls);\n\t controls.destroy();\n\t };\n\t\n\t // Remove all layers\n\t var layer;\n\t for (i = this._layers.length - 1; i >= 0; i--) {\n\t layer = this._layers[0];\n\t this.removeLayer(layer);\n\t layer.destroy();\n\t };\n\t\n\t // Environment layer is removed with the other layers\n\t this._environment = null;\n\t\n\t this._engine.destroy();\n\t this._engine = null;\n\t\n\t // TODO: Probably should clean the container too / remove the canvas\n\t this._container = null;\n\t }\n\t }]);\n\t\n\t return World;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = World;\n\t\n\tvar noNew = function noNew(domId, options) {\n\t return new World(domId, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.world = noNew;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\t//\n\t// We store our EE objects in a plain object whose properties are event names.\n\t// If `Object.create(null)` is not supported we prefix the event names with a\n\t// `~` to make sure that the built-in object properties are not overridden or\n\t// used as an attack vector.\n\t// We also assume that `Object.create(null)` is available when the event name\n\t// is an ES6 Symbol.\n\t//\n\tvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\t\n\t/**\n\t * Representation of a single EventEmitter function.\n\t *\n\t * @param {Function} fn Event handler to be called.\n\t * @param {Mixed} context Context for function execution.\n\t * @param {Boolean} once Only emit once\n\t * @api private\n\t */\n\tfunction EE(fn, context, once) {\n\t this.fn = fn;\n\t this.context = context;\n\t this.once = once || false;\n\t}\n\t\n\t/**\n\t * Minimal EventEmitter interface that is molded against the Node.js\n\t * EventEmitter interface.\n\t *\n\t * @constructor\n\t * @api public\n\t */\n\tfunction EventEmitter() { /* Nothing to set */ }\n\t\n\t/**\n\t * Holds the assigned EventEmitters by name.\n\t *\n\t * @type {Object}\n\t * @private\n\t */\n\tEventEmitter.prototype._events = undefined;\n\t\n\t/**\n\t * Return a list of assigned event listeners.\n\t *\n\t * @param {String} event The events that should be listed.\n\t * @param {Boolean} exists We only need to know if there are listeners.\n\t * @returns {Array|Boolean}\n\t * @api public\n\t */\n\tEventEmitter.prototype.listeners = function listeners(event, exists) {\n\t var evt = prefix ? prefix + event : event\n\t , available = this._events && this._events[evt];\n\t\n\t if (exists) return !!available;\n\t if (!available) return [];\n\t if (available.fn) return [available.fn];\n\t\n\t for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n\t ee[i] = available[i].fn;\n\t }\n\t\n\t return ee;\n\t};\n\t\n\t/**\n\t * Emit an event to all registered event listeners.\n\t *\n\t * @param {String} event The name of the event.\n\t * @returns {Boolean} Indication if we've emitted an event.\n\t * @api public\n\t */\n\tEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return false;\n\t\n\t var listeners = this._events[evt]\n\t , len = arguments.length\n\t , args\n\t , i;\n\t\n\t if ('function' === typeof listeners.fn) {\n\t if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: return listeners.fn.call(listeners.context), true;\n\t case 2: return listeners.fn.call(listeners.context, a1), true;\n\t case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n\t case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n\t case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n\t case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n\t }\n\t\n\t for (i = 1, args = new Array(len -1); i < len; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t\n\t listeners.fn.apply(listeners.context, args);\n\t } else {\n\t var length = listeners.length\n\t , j;\n\t\n\t for (i = 0; i < length; i++) {\n\t if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: listeners[i].fn.call(listeners[i].context); break;\n\t case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n\t case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n\t default:\n\t if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n\t args[j - 1] = arguments[j];\n\t }\n\t\n\t listeners[i].fn.apply(listeners[i].context, args);\n\t }\n\t }\n\t }\n\t\n\t return true;\n\t};\n\t\n\t/**\n\t * Register a new EventListener for the given event.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Functon} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.on = function on(event, fn, context) {\n\t var listener = new EE(fn, context || this)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Add an EventListener that's only called once.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Function} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.once = function once(event, fn, context) {\n\t var listener = new EE(fn, context || this, true)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove event listeners.\n\t *\n\t * @param {String} event The event we want to remove.\n\t * @param {Function} fn The listener that we need to find.\n\t * @param {Mixed} context Only remove listeners matching this context.\n\t * @param {Boolean} once Only remove once listeners.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return this;\n\t\n\t var listeners = this._events[evt]\n\t , events = [];\n\t\n\t if (fn) {\n\t if (listeners.fn) {\n\t if (\n\t listeners.fn !== fn\n\t || (once && !listeners.once)\n\t || (context && listeners.context !== context)\n\t ) {\n\t events.push(listeners);\n\t }\n\t } else {\n\t for (var i = 0, length = listeners.length; i < length; i++) {\n\t if (\n\t listeners[i].fn !== fn\n\t || (once && !listeners[i].once)\n\t || (context && listeners[i].context !== context)\n\t ) {\n\t events.push(listeners[i]);\n\t }\n\t }\n\t }\n\t }\n\t\n\t //\n\t // Reset the array, or remove it completely if we have no more listeners.\n\t //\n\t if (events.length) {\n\t this._events[evt] = events.length === 1 ? events[0] : events;\n\t } else {\n\t delete this._events[evt];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove all listeners or only the listeners for the specified event.\n\t *\n\t * @param {String} event The event want to remove all listeners for.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n\t if (!this._events) return this;\n\t\n\t if (event) delete this._events[prefix ? prefix + event : event];\n\t else this._events = prefix ? {} : Object.create(null);\n\t\n\t return this;\n\t};\n\t\n\t//\n\t// Alias methods names because people roll like that.\n\t//\n\tEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\tEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\t\n\t//\n\t// This function doesn't apply anymore.\n\t//\n\tEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n\t return this;\n\t};\n\t\n\t//\n\t// Expose the prefix.\n\t//\n\tEventEmitter.prefixed = prefix;\n\t\n\t//\n\t// Expose the module.\n\t//\n\tif (true) {\n\t module.exports = EventEmitter;\n\t}\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar keys = __webpack_require__(4),\n\t rest = __webpack_require__(5);\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/**\n\t * Assigns `value` to `key` of `object` if the existing value is not equivalent\n\t * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * for equality comparisons.\n\t *\n\t * @private\n\t * @param {Object} object The object to modify.\n\t * @param {string} key The key of the property to assign.\n\t * @param {*} value The value to assign.\n\t */\n\tfunction assignValue(object, key, value) {\n\t var objValue = object[key];\n\t if ((!eq(objValue, value) ||\n\t (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n\t (value === undefined && !(key in object))) {\n\t object[key] = value;\n\t }\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Copies properties of `source` to `object`.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObject(source, props, object) {\n\t return copyObjectWith(source, props, object);\n\t}\n\t\n\t/**\n\t * This function is like `copyObject` except that it accepts a function to\n\t * customize copied values.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @param {Function} [customizer] The function to customize copied values.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObjectWith(source, props, object, customizer) {\n\t object || (object = {});\n\t\n\t var index = -1,\n\t length = props.length;\n\t\n\t while (++index < length) {\n\t var key = props[index],\n\t newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\t\n\t assignValue(object, key, newValue);\n\t }\n\t return object;\n\t}\n\t\n\t/**\n\t * Creates a function like `_.assign`.\n\t *\n\t * @private\n\t * @param {Function} assigner The function to assign values.\n\t * @returns {Function} Returns the new assigner function.\n\t */\n\tfunction createAssigner(assigner) {\n\t return rest(function(object, sources) {\n\t var index = -1,\n\t length = sources.length,\n\t customizer = length > 1 ? sources[length - 1] : undefined,\n\t guard = length > 2 ? sources[2] : undefined;\n\t\n\t customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n\t if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n\t customizer = length < 3 ? undefined : customizer;\n\t length = 1;\n\t }\n\t object = Object(object);\n\t while (++index < length) {\n\t var source = sources[index];\n\t if (source) {\n\t assigner(object, source, index, customizer);\n\t }\n\t }\n\t return object;\n\t });\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Checks if the provided arguments are from an iteratee call.\n\t *\n\t * @private\n\t * @param {*} value The potential iteratee value argument.\n\t * @param {*} index The potential iteratee index or key argument.\n\t * @param {*} object The potential iteratee object argument.\n\t * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n\t */\n\tfunction isIterateeCall(value, index, object) {\n\t if (!isObject(object)) {\n\t return false;\n\t }\n\t var type = typeof index;\n\t if (type == 'number'\n\t ? (isArrayLike(object) && isIndex(index, object.length))\n\t : (type == 'string' && index in object)) {\n\t return eq(object[index], value);\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * comparison between two values to determine if they are equivalent.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to compare.\n\t * @param {*} other The other value to compare.\n\t * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n\t * @example\n\t *\n\t * var object = { 'user': 'fred' };\n\t * var other = { 'user': 'fred' };\n\t *\n\t * _.eq(object, object);\n\t * // => true\n\t *\n\t * _.eq(object, other);\n\t * // => false\n\t *\n\t * _.eq('a', 'a');\n\t * // => true\n\t *\n\t * _.eq('a', Object('a'));\n\t * // => false\n\t *\n\t * _.eq(NaN, NaN);\n\t * // => true\n\t */\n\tfunction eq(value, other) {\n\t return value === other || (value !== value && other !== other);\n\t}\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Assigns own enumerable properties of source objects to the destination\n\t * object. Source objects are applied from left to right. Subsequent sources\n\t * overwrite property assignments of previous sources.\n\t *\n\t * **Note:** This method mutates `object` and is loosely based on\n\t * [`Object.assign`](https://mdn.io/Object/assign).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The destination object.\n\t * @param {...Object} [sources] The source objects.\n\t * @returns {Object} Returns `object`.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.c = 3;\n\t * }\n\t *\n\t * function Bar() {\n\t * this.e = 5;\n\t * }\n\t *\n\t * Foo.prototype.d = 4;\n\t * Bar.prototype.f = 6;\n\t *\n\t * _.assign({ 'a': 1 }, new Foo, new Bar);\n\t * // => { 'a': 1, 'c': 3, 'e': 5 }\n\t */\n\tvar assign = createAssigner(function(object, source) {\n\t copyObject(source, keys(source), object);\n\t});\n\t\n\tmodule.exports = assign;\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar argsTag = '[object Arguments]',\n\t funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]',\n\t stringTag = '[object String]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * The base implementation of `_.times` without support for iteratee shorthands\n\t * or max array length checks.\n\t *\n\t * @private\n\t * @param {number} n The number of times to invoke `iteratee`.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Array} Returns the array of results.\n\t */\n\tfunction baseTimes(n, iteratee) {\n\t var index = -1,\n\t result = Array(n);\n\t\n\t while (++index < n) {\n\t result[index] = iteratee(index);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/** Built-in value references. */\n\tvar getPrototypeOf = Object.getPrototypeOf,\n\t propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeKeys = Object.keys;\n\t\n\t/**\n\t * The base implementation of `_.has` without support for deep paths.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {Array|string} key The key to check.\n\t * @returns {boolean} Returns `true` if `key` exists, else `false`.\n\t */\n\tfunction baseHas(object, key) {\n\t // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n\t // that are composed entirely of index properties, return `false` for\n\t // `hasOwnProperty` checks of them.\n\t return hasOwnProperty.call(object, key) ||\n\t (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n\t}\n\t\n\t/**\n\t * The base implementation of `_.keys` which doesn't skip the constructor\n\t * property of prototypes or treat sparse arrays as dense.\n\t *\n\t * @private\n\t * @type Function\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t */\n\tfunction baseKeys(object) {\n\t return nativeKeys(Object(object));\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Creates an array of index keys for `object` values of arrays,\n\t * `arguments` objects, and strings, otherwise `null` is returned.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {Array|null} Returns index keys, else `null`.\n\t */\n\tfunction indexKeys(object) {\n\t var length = object ? object.length : undefined;\n\t if (isLength(length) &&\n\t (isArray(object) || isString(object) || isArguments(object))) {\n\t return baseTimes(length, String);\n\t }\n\t return null;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely a prototype object.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n\t */\n\tfunction isPrototype(value) {\n\t var Ctor = value && value.constructor,\n\t proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\t\n\t return value === proto;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely an `arguments` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArguments(function() { return arguments; }());\n\t * // => true\n\t *\n\t * _.isArguments([1, 2, 3]);\n\t * // => false\n\t */\n\tfunction isArguments(value) {\n\t // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n\t return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n\t (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as an `Array` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArray([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArray(document.body.children);\n\t * // => false\n\t *\n\t * _.isArray('abc');\n\t * // => false\n\t *\n\t * _.isArray(_.noop);\n\t * // => false\n\t */\n\tvar isArray = Array.isArray;\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * This method is like `_.isArrayLike` except that it also checks if `value`\n\t * is an object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLikeObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject('abc');\n\t * // => false\n\t *\n\t * _.isArrayLikeObject(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLikeObject(value) {\n\t return isObjectLike(value) && isArrayLike(value);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Checks if `value` is object-like. A value is object-like if it's not `null`\n\t * and has a `typeof` result of \"object\".\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n\t * @example\n\t *\n\t * _.isObjectLike({});\n\t * // => true\n\t *\n\t * _.isObjectLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObjectLike(_.noop);\n\t * // => false\n\t *\n\t * _.isObjectLike(null);\n\t * // => false\n\t */\n\tfunction isObjectLike(value) {\n\t return !!value && typeof value == 'object';\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `String` primitive or object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isString('abc');\n\t * // => true\n\t *\n\t * _.isString(1);\n\t * // => false\n\t */\n\tfunction isString(value) {\n\t return typeof value == 'string' ||\n\t (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n\t}\n\t\n\t/**\n\t * Creates an array of the own enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects. See the\n\t * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n\t * for more details.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keys(new Foo);\n\t * // => ['a', 'b'] (iteration order is not guaranteed)\n\t *\n\t * _.keys('hi');\n\t * // => ['0', '1']\n\t */\n\tfunction keys(object) {\n\t var isProto = isPrototype(object);\n\t if (!(isProto || isArrayLike(object))) {\n\t return baseKeys(object);\n\t }\n\t var indexes = indexKeys(object),\n\t skipIndexes = !!indexes,\n\t result = indexes || [],\n\t length = result.length;\n\t\n\t for (var key in object) {\n\t if (baseHas(object, key) &&\n\t !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n\t !(isProto && key == 'constructor')) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = keys;\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar INFINITY = 1 / 0,\n\t MAX_INTEGER = 1.7976931348623157e+308,\n\t NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/**\n\t * A faster alternative to `Function#apply`, this function invokes `func`\n\t * with the `this` binding of `thisArg` and the arguments of `args`.\n\t *\n\t * @private\n\t * @param {Function} func The function to invoke.\n\t * @param {*} thisArg The `this` binding of `func`.\n\t * @param {...*} args The arguments to invoke `func` with.\n\t * @returns {*} Returns the result of `func`.\n\t */\n\tfunction apply(func, thisArg, args) {\n\t var length = args.length;\n\t switch (length) {\n\t case 0: return func.call(thisArg);\n\t case 1: return func.call(thisArg, args[0]);\n\t case 2: return func.call(thisArg, args[0], args[1]);\n\t case 3: return func.call(thisArg, args[0], args[1], args[2]);\n\t }\n\t return func.apply(thisArg, args);\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Creates a function that invokes `func` with the `this` binding of the\n\t * created function and arguments from `start` and beyond provided as an array.\n\t *\n\t * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to apply a rest parameter to.\n\t * @param {number} [start=func.length-1] The start position of the rest parameter.\n\t * @returns {Function} Returns the new function.\n\t * @example\n\t *\n\t * var say = _.rest(function(what, names) {\n\t * return what + ' ' + _.initial(names).join(', ') +\n\t * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n\t * });\n\t *\n\t * say('hello', 'fred', 'barney', 'pebbles');\n\t * // => 'hello fred, barney, & pebbles'\n\t */\n\tfunction rest(func, start) {\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n\t return function() {\n\t var args = arguments,\n\t index = -1,\n\t length = nativeMax(args.length - start, 0),\n\t array = Array(length);\n\t\n\t while (++index < length) {\n\t array[index] = args[start + index];\n\t }\n\t switch (start) {\n\t case 0: return func.call(this, array);\n\t case 1: return func.call(this, args[0], array);\n\t case 2: return func.call(this, args[0], args[1], array);\n\t }\n\t var otherArgs = Array(start + 1);\n\t index = -1;\n\t while (++index < start) {\n\t otherArgs[index] = args[index];\n\t }\n\t otherArgs[start] = array;\n\t return apply(func, this, otherArgs);\n\t };\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to an integer.\n\t *\n\t * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to convert.\n\t * @returns {number} Returns the converted integer.\n\t * @example\n\t *\n\t * _.toInteger(3);\n\t * // => 3\n\t *\n\t * _.toInteger(Number.MIN_VALUE);\n\t * // => 0\n\t *\n\t * _.toInteger(Infinity);\n\t * // => 1.7976931348623157e+308\n\t *\n\t * _.toInteger('3');\n\t * // => 3\n\t */\n\tfunction toInteger(value) {\n\t if (!value) {\n\t return value === 0 ? value : 0;\n\t }\n\t value = toNumber(value);\n\t if (value === INFINITY || value === -INFINITY) {\n\t var sign = (value < 0 ? -1 : 1);\n\t return sign * MAX_INTEGER;\n\t }\n\t var remainder = value % 1;\n\t return value === value ? (remainder ? value - remainder : value) : 0;\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = rest;\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _CRSEPSG3857 = __webpack_require__(7);\n\t\n\tvar _CRSEPSG38572 = _interopRequireDefault(_CRSEPSG3857);\n\t\n\tvar _CRSEPSG3395 = __webpack_require__(15);\n\t\n\tvar _CRSEPSG33952 = _interopRequireDefault(_CRSEPSG3395);\n\t\n\tvar _CRSEPSG4326 = __webpack_require__(17);\n\t\n\tvar _CRSEPSG43262 = _interopRequireDefault(_CRSEPSG4326);\n\t\n\tvar _CRSSimple = __webpack_require__(19);\n\t\n\tvar _CRSSimple2 = _interopRequireDefault(_CRSSimple);\n\t\n\tvar _CRSProj4 = __webpack_require__(20);\n\t\n\tvar _CRSProj42 = _interopRequireDefault(_CRSProj4);\n\t\n\tvar CRS = {};\n\t\n\tCRS.EPSG3857 = _CRSEPSG38572['default'];\n\tCRS.EPSG900913 = _CRSEPSG3857.EPSG900913;\n\tCRS.EPSG3395 = _CRSEPSG33952['default'];\n\tCRS.EPSG4326 = _CRSEPSG43262['default'];\n\tCRS.Simple = _CRSSimple2['default'];\n\tCRS.Proj4 = _CRSProj42['default'];\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionSphericalMercator = __webpack_require__(13);\n\t\n\tvar _projectionProjectionSphericalMercator2 = _interopRequireDefault(_projectionProjectionSphericalMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3857 = {\n\t code: 'EPSG:3857',\n\t projection: _projectionProjectionSphericalMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3857 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3857);\n\t\n\tvar EPSG900913 = (0, _lodashAssign2['default'])({}, EPSG3857, {\n\t code: 'EPSG:900913'\n\t});\n\t\n\texports.EPSG900913 = EPSG900913;\n\texports['default'] = EPSG3857;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Earth is the base class for all CRS representing Earth.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar Earth = {\n\t wrapLon: [-180, 180],\n\t\n\t R: 6378137,\n\t\n\t // Distance between two geographical points using spherical law of cosines\n\t // approximation or Haversine\n\t //\n\t // See: http://www.movable-type.co.uk/scripts/latlong.html\n\t distance: function distance(latlon1, latlon2, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var lat1;\n\t var lat2;\n\t\n\t var a;\n\t\n\t if (!accurate) {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\t\n\t return this.R * Math.acos(Math.min(a, 1));\n\t } else {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t var lon1 = latlon1.lon * rad;\n\t var lon2 = latlon2.lon * rad;\n\t\n\t var deltaLat = lat2 - lat1;\n\t var deltaLon = lon2 - lon1;\n\t\n\t var halfDeltaLat = deltaLat / 2;\n\t var halfDeltaLon = deltaLon / 2;\n\t\n\t a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\t\n\t var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\t\n\t return this.R * c;\n\t }\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Defaults to a scale factor of 1 if no calculation method exists\n\t //\n\t // Probably need to run this through the CRS transformation or similar so the\n\t // resulting scale is relative to the dimensions of the world space\n\t // Eg. 1 metre in projected space is likly scaled up or down to some other\n\t // number\n\t pointScale: function pointScale(latlon, accurate) {\n\t return this.projection.pointScale ? this.projection.pointScale(latlon, accurate) : [1, 1];\n\t },\n\t\n\t // Convert real metres to projected units\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t metresToProjected: function metresToProjected(metres, pointScale) {\n\t return metres * pointScale[1];\n\t },\n\t\n\t // Convert projected units to real metres\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t projectedToMetres: function projectedToMetres(projectedUnits, pointScale) {\n\t return projectedUnits / pointScale[1];\n\t },\n\t\n\t // Convert real metres to a value in world (WebGL) units\n\t metresToWorld: function metresToWorld(metres, pointScale, zoom) {\n\t // Transform metres to projected metres using the latitude point scale\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t var projectedMetres = this.metresToProjected(metres, pointScale);\n\t\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t // Scale projected metres\n\t var scaledMetres = scale * (this.transformScale * projectedMetres);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t scaledMetres /= pointScale[1];\n\t }\n\t\n\t return scaledMetres;\n\t },\n\t\n\t // Convert world (WebGL) units to a value in real metres\n\t worldToMetres: function worldToMetres(worldUnits, pointScale, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var projectedUnits = worldUnits / scale / this.transformScale;\n\t var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t realMetres *= pointScale[1];\n\t }\n\t\n\t return realMetres;\n\t }\n\t};\n\t\n\texports['default'] = (0, _lodashAssign2['default'])({}, _CRS2['default'], Earth);\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar _utilWrapNum = __webpack_require__(12);\n\t\n\tvar _utilWrapNum2 = _interopRequireDefault(_utilWrapNum);\n\t\n\tvar CRS = {\n\t // Scale factor determines final dimensions of world space\n\t //\n\t // Projection transformation in range -1 to 1 is multiplied by scale factor to\n\t // find final world coordinates\n\t //\n\t // Scale factor can be considered as half the amount of the desired dimension\n\t // for the largest side when transformation is equal to 1 or -1, or as the\n\t // distance between 0 and 1 on the largest side\n\t //\n\t // For example, if you want the world dimensions to be between -1000 and 1000\n\t // then the scale factor will be 1000\n\t scaleFactor: 1000000,\n\t\n\t // Converts geo coords to pixel / WebGL ones\n\t latLonToPoint: function latLonToPoint(latlon, zoom) {\n\t var projectedPoint = this.projection.project(latlon);\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t return this.transformation._transform(projectedPoint, scale);\n\t },\n\t\n\t // Converts pixel / WebGL coords to geo coords\n\t pointToLatLon: function pointToLatLon(point, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var untransformedPoint = this.transformation.untransform(point, scale);\n\t\n\t return this.projection.unproject(untransformedPoint);\n\t },\n\t\n\t // Converts geo coords to projection-specific coords (e.g. in meters)\n\t project: function project(latlon) {\n\t return this.projection.project(latlon);\n\t },\n\t\n\t // Converts projected coords to geo coords\n\t unproject: function unproject(point) {\n\t return this.projection.unproject(point);\n\t },\n\t\n\t // If zoom is provided, returns the map width in pixels for a given zoom\n\t // Else, provides fixed scale value\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom >= 0) {\n\t return 256 * Math.pow(2, zoom);\n\t // Else, return fixed scale value to expand projected coordinates from\n\t // their 0 to 1 range into something more practical\n\t } else {\n\t return this.scaleFactor;\n\t }\n\t },\n\t\n\t // Returns zoom level for a given scale value\n\t // This only works with a scale value that is based on map pixel width\n\t zoom: function zoom(scale) {\n\t return Math.log(scale / 256) / Math.LN2;\n\t },\n\t\n\t // Returns the bounds of the world in projected coords if applicable\n\t getProjectedBounds: function getProjectedBounds(zoom) {\n\t if (this.infinite) {\n\t return null;\n\t }\n\t\n\t var b = this.projection.bounds;\n\t var s = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t s /= 2;\n\t }\n\t\n\t // Bottom left\n\t var min = this.transformation.transform((0, _Point.point)(b[0]), s);\n\t\n\t // Top right\n\t var max = this.transformation.transform((0, _Point.point)(b[1]), s);\n\t\n\t return [min, max];\n\t },\n\t\n\t // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n\t // wrapLon: [min, max],\n\t // wrapLat: [min, max],\n\t\n\t // If true, the coordinate space will be unbounded (infinite in all directions)\n\t // infinite: false,\n\t\n\t // Wraps geo coords in certain ranges if applicable\n\t wrapLatLon: function wrapLatLon(latlon) {\n\t var lat = this.wrapLat ? (0, _utilWrapNum2['default'])(latlon.lat, this.wrapLat, true) : latlon.lat;\n\t var lon = this.wrapLon ? (0, _utilWrapNum2['default'])(latlon.lon, this.wrapLon, true) : latlon.lon;\n\t var alt = latlon.alt;\n\t\n\t return (0, _LatLon.latLon)(lat, lon, alt);\n\t }\n\t};\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * LatLon is a helper class for ensuring consistent geographic coordinates.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n\t */\n\t\n\tvar LatLon = (function () {\n\t function LatLon(lat, lon, alt) {\n\t _classCallCheck(this, LatLon);\n\t\n\t if (isNaN(lat) || isNaN(lon)) {\n\t throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n\t }\n\t\n\t this.lat = +lat;\n\t this.lon = +lon;\n\t\n\t if (alt !== undefined) {\n\t this.alt = +alt;\n\t }\n\t }\n\t\n\t _createClass(LatLon, [{\n\t key: 'clone',\n\t value: function clone() {\n\t return new LatLon(this.lat, this.lon, this.alt);\n\t }\n\t }]);\n\t\n\t return LatLon;\n\t})();\n\t\n\texports['default'] = LatLon;\n\t\n\t// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n\t// Also converts between lng and lon\n\tvar noNew = function noNew(a, b, c) {\n\t if (a instanceof LatLon) {\n\t return a;\n\t }\n\t if (Array.isArray(a) && typeof a[0] !== 'object') {\n\t if (a.length === 3) {\n\t return new LatLon(a[0], a[1], a[2]);\n\t }\n\t if (a.length === 2) {\n\t return new LatLon(a[0], a[1]);\n\t }\n\t return null;\n\t }\n\t if (a === undefined || a === null) {\n\t return a;\n\t }\n\t if (typeof a === 'object' && 'lat' in a) {\n\t return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n\t }\n\t if (b === undefined) {\n\t return null;\n\t }\n\t return new LatLon(a, b, c);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.latLon = noNew;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*\n\t * Point is a helper class for ensuring consistent world positions.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n\t */\n\t\n\tvar Point = (function () {\n\t function Point(x, y, round) {\n\t _classCallCheck(this, Point);\n\t\n\t this.x = round ? Math.round(x) : x;\n\t this.y = round ? Math.round(y) : y;\n\t }\n\t\n\t _createClass(Point, [{\n\t key: \"clone\",\n\t value: function clone() {\n\t return new Point(this.x, this.y);\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"add\",\n\t value: function add(point) {\n\t return this.clone()._add(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_add\",\n\t value: function _add(point) {\n\t this.x += point.x;\n\t this.y += point.y;\n\t return this;\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"subtract\",\n\t value: function subtract(point) {\n\t return this.clone()._subtract(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_subtract\",\n\t value: function _subtract(point) {\n\t this.x -= point.x;\n\t this.y -= point.y;\n\t return this;\n\t }\n\t }]);\n\t\n\t return Point;\n\t})();\n\t\n\texports[\"default\"] = Point;\n\t\n\t// Accepts (point), ([x, y]) and (x, y, round)\n\tvar _point = function _point(x, y, round) {\n\t if (x instanceof Point) {\n\t return x;\n\t }\n\t if (Array.isArray(x)) {\n\t return new Point(x[0], x[1]);\n\t }\n\t if (x === undefined || x === null) {\n\t return x;\n\t }\n\t return new Point(x, y, round);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.point = _point;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t/*\n\t * Wrap the given number to lie within a certain range (eg. longitude)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n\t */\n\t\n\tvar wrapNum = function wrapNum(x, range, includeMax) {\n\t var max = range[1];\n\t var min = range[0];\n\t var d = max - min;\n\t return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n\t};\n\t\n\texports[\"default\"] = wrapNum;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n\t * used by default.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar SphericalMercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t MAX_LATITUDE: 85.0511287798,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var max = this.MAX_LATITUDE;\n\t var lat = Math.max(Math.min(max, latlon.lat), -max);\n\t var sin = Math.sin(lat * d);\n\t\n\t return (0, _Point.point)(this.R * latlon.lon * d, this.R * Math.log((1 + sin) / (1 - sin)) / 2);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t\n\t return (0, _LatLon.latLon)((2 * Math.atan(Math.exp(point.y / this.R)) - Math.PI / 2) * d, point.x * d / this.R);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Accurate scale factor uses proper Web Mercator scaling\n\t // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t // See: http://jsfiddle.net/robhawkes/yws924cf/\n\t pointScale: function pointScale(latlon, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var k;\n\t\n\t if (!accurate) {\n\t k = 1 / Math.cos(latlon.lat * rad);\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t } else {\n\t var lat = latlon.lat * rad;\n\t var lon = latlon.lon * rad;\n\t\n\t var a = this.R;\n\t\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t\n\t var cosLat = Math.cos(lat);\n\t\n\t // Radius meridian\n\t var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\t\n\t // Radius prime meridian\n\t var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\t\n\t // Scale N/S\n\t var h = a / p / cosLat;\n\t\n\t // Scale E/W\n\t k = a / v / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, h];\n\t }\n\t },\n\t\n\t // Not using this.R due to scoping\n\t bounds: (function () {\n\t var d = 6378137 * Math.PI;\n\t return [[-d, -d], [d, d]];\n\t })()\n\t};\n\t\n\texports['default'] = SphericalMercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * Transformation is an utility class to perform simple point transformations\n\t * through a 2d-matrix.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n\t */\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar Transformation = (function () {\n\t function Transformation(a, b, c, d) {\n\t _classCallCheck(this, Transformation);\n\t\n\t this._a = a;\n\t this._b = b;\n\t this._c = c;\n\t this._d = d;\n\t }\n\t\n\t _createClass(Transformation, [{\n\t key: 'transform',\n\t value: function transform(point, scale) {\n\t // Copy input point as to not destroy the original data\n\t return this._transform(point.clone(), scale);\n\t }\n\t\n\t // Destructive transform (faster)\n\t }, {\n\t key: '_transform',\n\t value: function _transform(point, scale) {\n\t scale = scale || 1;\n\t\n\t point.x = scale * (this._a * point.x + this._b);\n\t point.y = scale * (this._c * point.y + this._d);\n\t return point;\n\t }\n\t }, {\n\t key: 'untransform',\n\t value: function untransform(point, scale) {\n\t scale = scale || 1;\n\t return (0, _geoPoint.point)((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);\n\t }\n\t }]);\n\t\n\t return Transformation;\n\t})();\n\t\n\texports['default'] = Transformation;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionMercator = __webpack_require__(16);\n\t\n\tvar _projectionProjectionMercator2 = _interopRequireDefault(_projectionProjectionMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3395 = {\n\t code: 'EPSG:3395',\n\t projection: _projectionProjectionMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3395 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3395);\n\t\n\texports['default'] = EPSG3395;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Mercator projection that takes into account that the Earth is not a perfect\n\t * sphere. Less popular than spherical mercator; used by projections like\n\t * EPSG:3395.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Mercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t R_MINOR: 6356752.314245179,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var r = this.R;\n\t var y = latlon.lat * d;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var con = e * Math.sin(y);\n\t\n\t var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n\t y = -r * Math.log(Math.max(ts, 1E-10));\n\t\n\t return (0, _Point.point)(latlon.lon * d * r, y);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t var r = this.R;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var ts = Math.exp(-point.y / r);\n\t var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\t\n\t for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n\t con = e * Math.sin(phi);\n\t con = Math.pow((1 - con) / (1 + con), e / 2);\n\t dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n\t phi += dphi;\n\t }\n\t\n\t return (0, _LatLon.latLon)(phi * d, point.x * d / r);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t pointScale: function pointScale(latlon) {\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t var cosLat = Math.cos(lat);\n\t\n\t var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t },\n\t\n\t bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n\t};\n\t\n\texports['default'] = Mercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG4326 = {\n\t code: 'EPSG:4326',\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / 180,\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t //\n\t // TODO: Cannot use this.transformScale due to scope\n\t transformation: new _utilTransformation2['default'](1 / 180, 0, -1 / 180, 0)\n\t};\n\t\n\tvar EPSG4326 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG4326);\n\t\n\texports['default'] = EPSG4326;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n\t * and Simple.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar ProjectionLatLon = {\n\t project: function project(latlon) {\n\t return (0, _Point.point)(latlon.lon, latlon.lat);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t return (0, _LatLon.latLon)(point.y, point.x);\n\t },\n\t\n\t // Scale factor for converting between real metres and degrees\n\t //\n\t // degrees = realMetres * pointScale\n\t // realMetres = degrees / pointScale\n\t //\n\t // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n\t // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n\t pointScale: function pointScale(latlon) {\n\t var m1 = 111132.92;\n\t var m2 = -559.82;\n\t var m3 = 1.175;\n\t var m4 = -0.0023;\n\t var p1 = 111412.84;\n\t var p2 = -93.5;\n\t var p3 = 0.118;\n\t\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t\n\t var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n\t var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\t\n\t return [1 / latlen, 1 / lonlen];\n\t },\n\t\n\t bounds: [[-180, -90], [180, 90]]\n\t};\n\t\n\texports['default'] = ProjectionLatLon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n\t * maps.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Simple = {\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Straight 1:1 mapping (-1, -1 would be top-left)\n\t transformation: new _utilTransformation2['default'](1, 0, 1, 0),\n\t\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom) {\n\t return Math.pow(2, zoom);\n\t // Else, make no change to scale – may need to increase this or make it a\n\t // user-definable variable\n\t } else {\n\t return 1;\n\t }\n\t },\n\t\n\t zoom: function zoom(scale) {\n\t return Math.log(scale) / Math.LN2;\n\t },\n\t\n\t distance: function distance(latlon1, latlon2) {\n\t var dx = latlon2.lon - latlon1.lon;\n\t var dy = latlon2.lat - latlon1.lat;\n\t\n\t return Math.sqrt(dx * dx + dy * dy);\n\t },\n\t\n\t infinite: true\n\t};\n\t\n\tvar Simple = (0, _lodashAssign2['default'])({}, _CRS2['default'], _Simple);\n\t\n\texports['default'] = Simple;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Proj4 for any Proj4-supported CRS.\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionProj4 = __webpack_require__(21);\n\t\n\tvar _projectionProjectionProj42 = _interopRequireDefault(_projectionProjectionProj4);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Proj4 = function _Proj4(code, def, bounds) {\n\t var projection = (0, _projectionProjectionProj42['default'])(def, bounds);\n\t\n\t // Transformation calcuations\n\t var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n\t var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\t\n\t var halfX = diffX / 2;\n\t var halfY = diffY / 2;\n\t\n\t // This is the raw scale factor\n\t var scaleX = 1 / halfX;\n\t var scaleY = 1 / halfY;\n\t\n\t // Find the minimum scale factor\n\t //\n\t // The minimum scale factor comes from the largest side and is the one\n\t // you want to use for both axis so they stay relative in dimension\n\t var scale = Math.min(scaleX, scaleY);\n\t\n\t // Find amount to offset each axis by to make the central point lie on\n\t // the [0,0] origin\n\t var offsetX = scale * (projection.bounds[0][0] + halfX);\n\t var offsetY = scale * (projection.bounds[0][1] + halfY);\n\t\n\t return {\n\t code: code,\n\t projection: projection,\n\t\n\t transformScale: scale,\n\t\n\t // Map the input to a [-1,1] range with [0,0] in the centre\n\t transformation: new _utilTransformation2['default'](scale, -offsetX, -scale, offsetY)\n\t };\n\t};\n\t\n\tvar Proj4 = function Proj4(code, def, bounds) {\n\t return (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _Proj4(code, def, bounds));\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 21 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Proj4 support for any projection.\n\t */\n\t\n\tvar _proj4 = __webpack_require__(22);\n\t\n\tvar _proj42 = _interopRequireDefault(_proj4);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Proj4 = function Proj4(def, bounds) {\n\t var proj = (0, _proj42['default'])(def);\n\t\n\t var project = function project(latlon) {\n\t return (0, _Point.point)(proj.forward([latlon.lon, latlon.lat]));\n\t };\n\t\n\t var unproject = function unproject(point) {\n\t var inverse = proj.inverse([point.x, point.y]);\n\t return (0, _LatLon.latLon)(inverse[1], inverse[0]);\n\t };\n\t\n\t return {\n\t project: project,\n\t unproject: unproject,\n\t\n\t // Scale factor for converting between real metres and projected metres\\\n\t //\n\t // Need to work out the best way to provide the pointScale calculations\n\t // for custom, unknown projections (if wanting to override default)\n\t //\n\t // For now, user can manually override crs.pointScale or\n\t // crs.projection.pointScale\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t pointScale: function pointScale(latlon, accurate) {\n\t return [1, 1];\n\t },\n\t\n\t // Try and calculate bounds if none are provided\n\t //\n\t // This will provide incorrect bounds for some projections, so perhaps make\n\t // bounds a required input instead\n\t bounds: (function () {\n\t if (bounds) {\n\t return bounds;\n\t } else {\n\t var bottomLeft = project([-90, -180]);\n\t var topRight = project([90, 180]);\n\t\n\t return [bottomLeft, topRight];\n\t }\n\t })()\n\t };\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n/***/ },\n/* 23 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\tvar _Renderer = __webpack_require__(28);\n\t\n\tvar _Renderer2 = _interopRequireDefault(_Renderer);\n\t\n\tvar _DOMRenderer3D = __webpack_require__(29);\n\t\n\tvar _DOMRenderer3D2 = _interopRequireDefault(_DOMRenderer3D);\n\t\n\tvar _DOMRenderer2D = __webpack_require__(31);\n\t\n\tvar _DOMRenderer2D2 = _interopRequireDefault(_DOMRenderer2D);\n\t\n\tvar _Camera = __webpack_require__(33);\n\t\n\tvar _Camera2 = _interopRequireDefault(_Camera);\n\t\n\tvar _Picking = __webpack_require__(34);\n\t\n\tvar _Picking2 = _interopRequireDefault(_Picking);\n\t\n\tvar Engine = (function (_EventEmitter) {\n\t _inherits(Engine, _EventEmitter);\n\t\n\t function Engine(container, world) {\n\t _classCallCheck(this, Engine);\n\t\n\t console.log('Init Engine');\n\t\n\t _get(Object.getPrototypeOf(Engine.prototype), 'constructor', this).call(this);\n\t\n\t this._world = world;\n\t\n\t this._scene = _Scene2['default'];\n\t this._domScene3D = _DOMScene3D2['default'];\n\t this._domScene2D = _DOMScene2D2['default'];\n\t\n\t this._renderer = (0, _Renderer2['default'])(container);\n\t this._domRenderer3D = (0, _DOMRenderer3D2['default'])(container);\n\t this._domRenderer2D = (0, _DOMRenderer2D2['default'])(container);\n\t\n\t this._camera = (0, _Camera2['default'])(container);\n\t\n\t // TODO: Make this optional\n\t this._picking = (0, _Picking2['default'])(this._world, this._renderer, this._camera);\n\t\n\t this.clock = new _three2['default'].Clock();\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t }\n\t\n\t _createClass(Engine, [{\n\t key: 'update',\n\t value: function update(delta) {\n\t this.emit('preRender');\n\t\n\t this._renderer.render(this._scene, this._camera);\n\t\n\t // Render picking scene\n\t // this._renderer.render(this._picking._pickingScene, this._camera);\n\t\n\t // Render DOM scenes\n\t this._domRenderer3D.render(this._domScene3D, this._camera);\n\t this._domRenderer2D.render(this._domScene2D, this._camera);\n\t\n\t this.emit('postRender');\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Remove any remaining objects from scene\n\t var child;\n\t for (var i = this._scene.children.length - 1; i >= 0; i--) {\n\t child = this._scene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._scene.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t };\n\t\n\t for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene3D.remove(child);\n\t };\n\t\n\t for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene2D.remove(child);\n\t };\n\t\n\t this._picking.destroy();\n\t this._picking = null;\n\t\n\t this._world = null;\n\t this._scene = null;\n\t this._domScene3D = null;\n\t this._domScene2D = null;\n\t this._renderer = null;\n\t this._domRenderer3D = null;\n\t this._domRenderer2D = null;\n\t this._camera = null;\n\t this._clock = null;\n\t this._frustum = null;\n\t }\n\t }]);\n\t\n\t return Engine;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Engine;\n\t\n\t// // Initialise without requiring new keyword\n\t// export default function(container, world) {\n\t// return new Engine(container, world);\n\t// };\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 28 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _three2['default'].WebGLRenderer({\n\t antialias: true\n\t });\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // renderer.setClearColor(Scene.fog.color, 1);\n\t\n\t renderer.setClearColor(0xffffff, 1);\n\t renderer.setPixelRatio(window.devicePixelRatio);\n\t\n\t // Gamma settings make things look nicer\n\t renderer.gammaInput = true;\n\t renderer.gammaOutput = true;\n\t\n\t renderer.shadowMap.enabled = true;\n\t renderer.shadowMap.cullFace = _three2['default'].CullFaceBack;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS3DRenderer.CSS3DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS3DObject = function CSS3DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS3DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS3DObject.prototype.constructor = CSS3DObject;\n\t\n\tvar CSS3DSprite = function CSS3DSprite(element) {\n\t\n\t\tCSS3DObject.call(this, element);\n\t};\n\t\n\tCSS3DSprite.prototype = Object.create(CSS3DObject.prototype);\n\tCSS3DSprite.prototype.constructor = CSS3DSprite;\n\t\n\t//\n\t\n\tvar CSS3DRenderer = function CSS3DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS3DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar matrix = new _three2['default'].Matrix4();\n\t\n\t\tvar cache = {\n\t\t\tcamera: { fov: 0, style: '' },\n\t\t\tobjects: {}\n\t\t};\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\t\tdomElement.style.oTransformStyle = 'preserve-3d';\n\t\tdomElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tvar cameraElement = document.createElement('div');\n\t\n\t\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tdomElement.appendChild(cameraElement);\n\t\n\t\tthis.setClearColor = function () {};\n\t\n\t\tthis.getSize = function () {\n\t\n\t\t\treturn {\n\t\t\t\twidth: _width,\n\t\t\t\theight: _height\n\t\t\t};\n\t\t};\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\n\t\t\tcameraElement.style.width = width + 'px';\n\t\t\tcameraElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar epsilon = function epsilon(value) {\n\t\n\t\t\treturn Math.abs(value) < Number.EPSILON ? 0 : value;\n\t\t};\n\t\n\t\tvar getCameraCSSMatrix = function getCameraCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'matrix3d(' + epsilon(elements[0]) + ',' + epsilon(-elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(elements[6]) + ',' + epsilon(elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(-elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(-elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar getObjectCSSMatrix = function getObjectCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' + epsilon(elements[0]) + ',' + epsilon(elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(-elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(-elements[6]) + ',' + epsilon(-elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS3DObject) {\n\t\n\t\t\t\tvar style;\n\t\n\t\t\t\tif (object instanceof CSS3DSprite) {\n\t\n\t\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\t\n\t\t\t\t\tmatrix.copy(camera.matrixWorldInverse);\n\t\t\t\t\tmatrix.transpose();\n\t\t\t\t\tmatrix.copyPosition(object.matrixWorld);\n\t\t\t\t\tmatrix.scale(object.scale);\n\t\n\t\t\t\t\tmatrix.elements[3] = 0;\n\t\t\t\t\tmatrix.elements[7] = 0;\n\t\t\t\t\tmatrix.elements[11] = 0;\n\t\t\t\t\tmatrix.elements[15] = 1;\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(object.matrixWorld);\n\t\t\t\t}\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar cachedStyle = cache.objects[object.id];\n\t\n\t\t\t\tif (cachedStyle === undefined || cachedStyle !== style) {\n\t\n\t\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\t\telement.style.MozTransform = style;\n\t\t\t\t\telement.style.oTransform = style;\n\t\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\t\tcache.objects[object.id] = style;\n\t\t\t\t}\n\t\n\t\t\t\tif (element.parentNode !== cameraElement) {\n\t\n\t\t\t\t\tcameraElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tvar fov = 0.5 / Math.tan(_three2['default'].Math.degToRad(camera.fov * 0.5)) * _height;\n\t\n\t\t\tif (cache.camera.fov !== fov) {\n\t\n\t\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\t\tdomElement.style.perspective = fov + 'px';\n\t\n\t\t\t\tcache.camera.fov = fov;\n\t\t\t}\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse) + ' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\t\n\t\t\tif (cache.camera.style !== style) {\n\t\n\t\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\t\tcameraElement.style.MozTransform = style;\n\t\t\t\tcameraElement.style.oTransform = style;\n\t\t\t\tcameraElement.style.transform = style;\n\t\n\t\t\t\tcache.camera.style = style;\n\t\t\t}\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS3DObject = CSS3DObject;\n\texports.CSS3DSprite = CSS3DSprite;\n\texports.CSS3DRenderer = CSS3DRenderer;\n\t\n\t_three2['default'].CSS3DObject = CSS3DObject;\n\t_three2['default'].CSS3DSprite = CSS3DSprite;\n\t_three2['default'].CSS3DRenderer = CSS3DRenderer;\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS2DRenderer.CSS2DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS2DObject = function CSS2DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS2DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS2DObject.prototype.constructor = CSS2DObject;\n\t\n\t//\n\t\n\tvar CSS2DRenderer = function CSS2DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS2DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar vector = new _three2['default'].Vector3();\n\t\tvar viewMatrix = new _three2['default'].Matrix4();\n\t\tvar viewProjectionMatrix = new _three2['default'].Matrix4();\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS2DObject) {\n\t\n\t\t\t\tvector.setFromMatrixPosition(object.matrixWorld);\n\t\t\t\tvector.applyProjection(viewProjectionMatrix);\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar style = 'translate(-50%,-50%) translate(' + (vector.x * _widthHalf + _widthHalf) + 'px,' + (-vector.y * _heightHalf + _heightHalf) + 'px)';\n\t\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\tif (element.parentNode !== domElement) {\n\t\n\t\t\t\t\tdomElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tviewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\n\t\t\tviewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, viewMatrix);\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS2DObject = CSS2DObject;\n\texports.CSS2DRenderer = CSS2DRenderer;\n\t\n\t_three2['default'].CSS2DObject = CSS2DObject;\n\t_three2['default'].CSS2DRenderer = CSS2DRenderer;\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can only be accessed from Engine.camera if you want to reference the\n\t// same scene in multiple places\n\t\n\t// TODO: Ensure that FOV looks natural on all aspect ratios\n\t// http://stackoverflow.com/q/26655930/997339\n\t\n\texports['default'] = function (container) {\n\t var camera = new _three2['default'].PerspectiveCamera(45, 1, 1, 200000);\n\t camera.position.y = 400;\n\t camera.position.z = 400;\n\t\n\t var updateSize = function updateSize() {\n\t camera.aspect = container.clientWidth / container.clientHeight;\n\t camera.updateProjectionMatrix();\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return camera;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _PickingScene = __webpack_require__(35);\n\t\n\tvar _PickingScene2 = _interopRequireDefault(_PickingScene);\n\t\n\t// TODO: Look into a way of setting this up without passing in a renderer and\n\t// camera from the engine\n\t\n\t// TODO: Add a basic indicator on or around the mouse pointer when it is over\n\t// something pickable / clickable\n\t//\n\t// A simple transparent disc or ring at the mouse point should work to start, or\n\t// even just changing the cursor to the CSS 'pointer' style\n\t//\n\t// Probably want this on mousemove with a throttled update as not to spam the\n\t// picking method\n\t//\n\t// Relies upon the picking method not redrawing the scene every call due to\n\t// the way TileLayer invalidates the picking scene\n\t\n\tvar nextId = 1;\n\t\n\tvar Picking = (function () {\n\t function Picking(world, renderer, camera) {\n\t _classCallCheck(this, Picking);\n\t\n\t this._world = world;\n\t this._renderer = renderer;\n\t this._camera = camera;\n\t\n\t this._raycaster = new _three2['default'].Raycaster();\n\t\n\t // TODO: Match this with the line width used in the picking layers\n\t this._raycaster.linePrecision = 3;\n\t\n\t this._pickingScene = _PickingScene2['default'];\n\t this._pickingTexture = new _three2['default'].WebGLRenderTarget();\n\t this._pickingTexture.texture.minFilter = _three2['default'].LinearFilter;\n\t this._pickingTexture.texture.generateMipmaps = false;\n\t\n\t this._nextId = 1;\n\t\n\t this._resizeTexture();\n\t this._initEvents();\n\t }\n\t\n\t // Initialise without requiring new keyword\n\t\n\t _createClass(Picking, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\t\n\t // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n\t this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\t\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onMouseUp',\n\t value: function _onMouseUp(event) {\n\t // Only react to main button click\n\t if (event.button !== 0) {\n\t return;\n\t }\n\t\n\t var point = (0, _geoPoint.point)(event.clientX, event.clientY);\n\t\n\t var normalisedPoint = (0, _geoPoint.point)(0, 0);\n\t normalisedPoint.x = point.x / this._width * 2 - 1;\n\t normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\t\n\t this._pick(point, normalisedPoint);\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove() {\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n\t }, {\n\t key: '_resizeTexture',\n\t value: function _resizeTexture() {\n\t var size = this._renderer.getSize();\n\t\n\t this._width = size.width;\n\t this._height = size.height;\n\t\n\t this._pickingTexture.setSize(this._width, this._height);\n\t this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\t\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Make this only re-draw the scene if both an update is needed and the\n\t // camera has moved since the last update\n\t //\n\t // Otherwise it re-draws the scene on every click due to the way LOD updates\n\t // work in TileLayer – spamming this.add() and this.remove()\n\t //\n\t // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n\t // be a point in time where the user cares for picking functionality\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._needUpdate) {\n\t var texture = this._pickingTexture;\n\t\n\t this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\t\n\t // Read the rendering texture\n\t this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\t\n\t this._needUpdate = false;\n\t }\n\t }\n\t }, {\n\t key: '_pick',\n\t value: function _pick(point, normalisedPoint) {\n\t this._update();\n\t\n\t var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\t\n\t // Interpret the pixel as an ID\n\t var id = this._pixelBuffer[index * 4 + 2] * 255 * 255 + this._pixelBuffer[index * 4 + 1] * 255 + this._pixelBuffer[index * 4 + 0];\n\t\n\t // Skip if ID is 16646655 (white) as the background returns this\n\t if (id === 16646655) {\n\t return;\n\t }\n\t\n\t this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\t\n\t // Perform ray intersection on picking scene\n\t //\n\t // TODO: Only perform intersection test on the relevant picking mesh\n\t var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\t\n\t var _point2d = point.clone();\n\t\n\t var _point3d;\n\t if (intersects.length > 0) {\n\t _point3d = intersects[0].point.clone();\n\t }\n\t\n\t // Pass along as much data as possible for now until we know more about how\n\t // people use the picking API and what the returned data should be\n\t //\n\t // TODO: Look into the leak potential for passing so much by reference here\n\t this._world.emit('pick', id, _point2d, _point3d, intersects);\n\t this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n\t }\n\t\n\t // Add mesh to picking scene\n\t //\n\t // Picking ID should already be added as an attribute\n\t }, {\n\t key: 'add',\n\t value: function add(mesh) {\n\t this._pickingScene.add(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Remove mesh from picking scene\n\t }, {\n\t key: 'remove',\n\t value: function remove(mesh) {\n\t this._pickingScene.remove(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Returns next ID to use for picking\n\t }, {\n\t key: 'getNextId',\n\t value: function getNextId() {\n\t return nextId++;\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Find a way to properly remove these listeners as they stay\n\t // active at the moment\n\t window.removeEventListener('resize', this._resizeTexture, false);\n\t this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t if (this._pickingScene.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n\t child = this._pickingScene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._pickingScene.remove(child);\n\t\n\t // Probably not a good idea to dispose of geometry due to it being\n\t // shared with the non-picking scene\n\t // if (child.geometry) {\n\t // // Dispose of mesh and materials\n\t // child.geometry.dispose();\n\t // child.geometry = null;\n\t // }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t this._pickingScene = null;\n\t this._pickingTexture = null;\n\t this._pixelBuffer = null;\n\t\n\t this._world = null;\n\t this._renderer = null;\n\t this._camera = null;\n\t }\n\t }]);\n\t\n\t return Picking;\n\t})();\n\t\n\texports['default'] = function (world, renderer, camera) {\n\t return new Picking(world, renderer, camera);\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.pickingScene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Skybox = __webpack_require__(38);\n\t\n\tvar _Skybox2 = _interopRequireDefault(_Skybox);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar EnvironmentLayer = (function (_Layer) {\n\t _inherits(EnvironmentLayer, _Layer);\n\t\n\t function EnvironmentLayer(options) {\n\t _classCallCheck(this, EnvironmentLayer);\n\t\n\t var defaults = {\n\t skybox: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'constructor', this).call(this, _options);\n\t }\n\t\n\t _createClass(EnvironmentLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd() {\n\t this._initLights();\n\t\n\t if (this._options.skybox) {\n\t this._initSkybox();\n\t }\n\t\n\t // this._initGrid();\n\t }\n\t\n\t // Not fleshed out or thought through yet\n\t //\n\t // Lights could potentially be put it their own 'layer' to keep this class\n\t // much simpler and less messy\n\t }, {\n\t key: '_initLights',\n\t value: function _initLights() {\n\t // Position doesn't really matter (the angle is important), however it's\n\t // used here so the helpers look more natural.\n\t\n\t if (!this._options.skybox) {\n\t var directionalLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t directionalLight.position.x = 1000;\n\t directionalLight.position.y = 1000;\n\t directionalLight.position.z = 1000;\n\t\n\t // TODO: Get shadows working in non-PBR scenes\n\t\n\t // directionalLight.castShadow = true;\n\t //\n\t // var d = 100;\n\t // directionalLight.shadow.camera.left = -d;\n\t // directionalLight.shadow.camera.right = d;\n\t // directionalLight.shadow.camera.top = d;\n\t // directionalLight.shadow.camera.bottom = -d;\n\t //\n\t // directionalLight.shadow.camera.near = 10;\n\t // directionalLight.shadow.camera.far = 100;\n\t //\n\t // // TODO: Need to dial in on a good shadowmap size\n\t // directionalLight.shadow.mapSize.width = 2048;\n\t // directionalLight.shadow.mapSize.height = 2048;\n\t //\n\t // // directionalLight.shadowBias = -0.0010;\n\t // // directionalLight.shadow.darkness = 0.15;\n\t\n\t var directionalLight2 = new _three2['default'].DirectionalLight(0xffffff, 0.5);\n\t directionalLight2.position.x = -1000;\n\t directionalLight2.position.y = 1000;\n\t directionalLight2.position.z = -1000;\n\t\n\t // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n\t // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\t\n\t this.add(directionalLight);\n\t this.add(directionalLight2);\n\t\n\t // this.add(helper);\n\t // this.add(helper2);\n\t } else {\n\t // Directional light that will be projected from the sun\n\t this._skyboxLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t\n\t this._skyboxLight.castShadow = true;\n\t\n\t var d = 1000;\n\t this._skyboxLight.shadow.camera.left = -d;\n\t this._skyboxLight.shadow.camera.right = d;\n\t this._skyboxLight.shadow.camera.top = d;\n\t this._skyboxLight.shadow.camera.bottom = -d;\n\t\n\t this._skyboxLight.shadow.camera.near = 10000;\n\t this._skyboxLight.shadow.camera.far = 70000;\n\t\n\t // TODO: Need to dial in on a good shadowmap size\n\t this._skyboxLight.shadow.mapSize.width = 2048;\n\t this._skyboxLight.shadow.mapSize.height = 2048;\n\t\n\t // this._skyboxLight.shadowBias = -0.0010;\n\t // this._skyboxLight.shadow.darkness = 0.15;\n\t\n\t // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\t\n\t this.add(this._skyboxLight);\n\t }\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t this._skybox = new _Skybox2['default'](this._world, this._skyboxLight);\n\t this.add(this._skybox._mesh);\n\t }\n\t\n\t // Add grid helper for context during initial development\n\t }, {\n\t key: '_initGrid',\n\t value: function _initGrid() {\n\t var size = 4000;\n\t var step = 100;\n\t\n\t var gridHelper = new _three2['default'].GridHelper(size, step);\n\t this.add(gridHelper);\n\t }\n\t\n\t // Clean up environment\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._skyboxLight = null;\n\t\n\t this.remove(this._skybox._mesh);\n\t this._skybox.destroy();\n\t this._skybox = null;\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return EnvironmentLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = EnvironmentLayer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new EnvironmentLayer(options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.environmentLayer = noNew;\n\n/***/ },\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _engineScene = __webpack_require__(25);\n\t\n\tvar _engineScene2 = _interopRequireDefault(_engineScene);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Need a single move method that handles moving all the various object\n\t// layers so that the DOM layers stay in sync with the 3D layer\n\t\n\t// TODO: Double check that objects within the _object3D Object3D parent are frustum\n\t// culled even if the layer position stays at the default (0,0,0) and the child\n\t// objects are positioned much further away\n\t//\n\t// Or does the layer being at (0,0,0) prevent the child objects from being\n\t// culled because the layer parent is effectively always in view even if the\n\t// child is actually out of camera\n\t\n\tvar Layer = (function (_EventEmitter) {\n\t _inherits(Layer, _EventEmitter);\n\t\n\t function Layer(options) {\n\t _classCallCheck(this, Layer);\n\t\n\t _get(Object.getPrototypeOf(Layer.prototype), 'constructor', this).call(this);\n\t\n\t var defaults = {\n\t output: true\n\t };\n\t\n\t this._options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (this.isOutput()) {\n\t this._object3D = new _three2['default'].Object3D();\n\t\n\t this._dom3D = document.createElement('div');\n\t this._domObject3D = new _vendorCSS3DRenderer.CSS3DObject(this._dom3D);\n\t\n\t this._dom2D = document.createElement('div');\n\t this._domObject2D = new _vendorCSS2DRenderer.CSS2DObject(this._dom2D);\n\t }\n\t }\n\t\n\t // Add THREE object directly to layer\n\t\n\t _createClass(Layer, [{\n\t key: 'add',\n\t value: function add(object) {\n\t this._object3D.add(object);\n\t }\n\t\n\t // Remove THREE object from to layer\n\t }, {\n\t key: 'remove',\n\t value: function remove(object) {\n\t this._object3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM3D',\n\t value: function addDOM3D(object) {\n\t this._domObject3D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM3D',\n\t value: function removeDOM3D(object) {\n\t this._domObject3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM2D',\n\t value: function addDOM2D(object) {\n\t this._domObject2D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM2D',\n\t value: function removeDOM2D(object) {\n\t this._domObject2D.remove(object);\n\t }\n\t\n\t // Add layer to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addLayer(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addLayer to actually add the layer\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t this._onAdd(world);\n\t this.emit('added');\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t }, {\n\t key: 'getPickingId',\n\t value: function getPickingId() {\n\t if (this._world._engine._picking) {\n\t return this._world._engine._picking.getNextId();\n\t }\n\t\n\t return false;\n\t }\n\t\n\t // TODO: Tidy this up and don't access so many private properties to work\n\t }, {\n\t key: 'addToPicking',\n\t value: function addToPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.add(object);\n\t }\n\t }, {\n\t key: 'removeFromPicking',\n\t value: function removeFromPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.remove(object);\n\t }\n\t }, {\n\t key: 'isOutput',\n\t value: function isOutput() {\n\t return this._options.output;\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._object3D && this._object3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n\t child = this._object3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t if (this._domObject3D && this._domObject3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM3D(child);\n\t }\n\t }\n\t\n\t if (this._domObject2D && this._domObject2D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM2D(child);\n\t }\n\t }\n\t\n\t this._domObject3D = null;\n\t this._domObject2D = null;\n\t\n\t this._world = null;\n\t this._object3D = null;\n\t }\n\t }]);\n\t\n\t return Layer;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Layer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new Layer(options);\n\t};\n\t\n\texports.layer = noNew;\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Sky = __webpack_require__(39);\n\t\n\tvar _Sky2 = _interopRequireDefault(_Sky);\n\t\n\tvar _lodashThrottle = __webpack_require__(40);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar cubemap = {\n\t vertexShader: ['varying vec3 vPosition;', 'void main() {', 'vPosition = position;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t fragmentShader: ['uniform samplerCube cubemap;', 'varying vec3 vPosition;', 'void main() {', 'gl_FragColor = textureCube(cubemap, normalize(vPosition));', '}'].join('\\n')\n\t};\n\t\n\tvar Skybox = (function () {\n\t function Skybox(world, light) {\n\t _classCallCheck(this, Skybox);\n\t\n\t this._world = world;\n\t this._light = light;\n\t\n\t this._settings = {\n\t distance: 38000,\n\t turbidity: 10,\n\t reileigh: 2,\n\t mieCoefficient: 0.005,\n\t mieDirectionalG: 0.8,\n\t luminance: 1,\n\t // 0.48 is a cracking dusk / sunset\n\t // 0.4 is a beautiful early-morning / late-afternoon\n\t // 0.2 is a nice day time\n\t inclination: 0.48, // Elevation / inclination\n\t azimuth: 0.25 };\n\t\n\t // Facing front\n\t this._initSkybox();\n\t this._updateUniforms();\n\t this._initEvents();\n\t }\n\t\n\t _createClass(Skybox, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Throttled to 1 per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._update, 100);\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t // Cube camera for skybox\n\t this._cubeCamera = new _three2['default'].CubeCamera(1, 2000000, 128);\n\t\n\t // Cube material\n\t var cubeTarget = this._cubeCamera.renderTarget;\n\t\n\t // Add Sky Mesh\n\t this._sky = new _Sky2['default']();\n\t this._skyScene = new _three2['default'].Scene();\n\t this._skyScene.add(this._sky.mesh);\n\t\n\t // Add Sun Helper\n\t this._sunSphere = new _three2['default'].Mesh(new _three2['default'].SphereBufferGeometry(2000, 16, 8), new _three2['default'].MeshBasicMaterial({\n\t color: 0xffffff\n\t }));\n\t\n\t // TODO: This isn't actually visible because it's not added to the layer\n\t // this._sunSphere.visible = true;\n\t\n\t var skyboxUniforms = {\n\t cubemap: { type: 't', value: cubeTarget }\n\t };\n\t\n\t var skyboxMat = new _three2['default'].ShaderMaterial({\n\t uniforms: skyboxUniforms,\n\t vertexShader: cubemap.vertexShader,\n\t fragmentShader: cubemap.fragmentShader,\n\t side: _three2['default'].BackSide\n\t });\n\t\n\t this._mesh = new _three2['default'].Mesh(new _three2['default'].BoxGeometry(190000, 190000, 190000), skyboxMat);\n\t\n\t this._updateSkybox = true;\n\t }\n\t }, {\n\t key: '_updateUniforms',\n\t value: function _updateUniforms() {\n\t var settings = this._settings;\n\t var uniforms = this._sky.uniforms;\n\t uniforms.turbidity.value = settings.turbidity;\n\t uniforms.reileigh.value = settings.reileigh;\n\t uniforms.luminance.value = settings.luminance;\n\t uniforms.mieCoefficient.value = settings.mieCoefficient;\n\t uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\t\n\t var theta = Math.PI * (settings.inclination - 0.5);\n\t var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\t\n\t this._sunSphere.position.x = settings.distance * Math.cos(phi);\n\t this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n\t this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\t\n\t // Move directional light to sun position\n\t this._light.position.copy(this._sunSphere.position);\n\t\n\t this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update(delta) {\n\t if (this._updateSkybox) {\n\t this._updateSkybox = false;\n\t } else {\n\t return;\n\t }\n\t\n\t // if (!this._angle) {\n\t // this._angle = 0;\n\t // }\n\t //\n\t // // Animate inclination\n\t // this._angle += Math.PI * delta;\n\t // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\t\n\t // Update light intensity depending on elevation of sun (day to night)\n\t this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\t\n\t // // console.log(delta, this._angle, this._settings.inclination);\n\t //\n\t // TODO: Only do this when the uniforms have been changed\n\t this._updateUniforms();\n\t\n\t // TODO: Only do this when the cubemap has actually changed\n\t this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n\t }\n\t }, {\n\t key: 'getRenderTarget',\n\t value: function getRenderTarget() {\n\t return this._cubeCamera.renderTarget;\n\t }\n\t }, {\n\t key: 'setInclination',\n\t value: function setInclination(inclination) {\n\t this._settings.inclination = inclination;\n\t this._updateSkybox = true;\n\t }\n\t\n\t // Destroy the skybox and remove it from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._throttledWorldUpdate = null;\n\t\n\t this._world = null;\n\t this._light = null;\n\t\n\t this._cubeCamera = null;\n\t\n\t this._sky.mesh.geometry.dispose();\n\t this._sky.mesh.geometry = null;\n\t\n\t if (this._sky.mesh.material.map) {\n\t this._sky.mesh.material.map.dispose();\n\t this._sky.mesh.material.map = null;\n\t }\n\t\n\t this._sky.mesh.material.dispose();\n\t this._sky.mesh.material = null;\n\t\n\t this._sky.mesh = null;\n\t this._sky = null;\n\t\n\t this._skyScene = null;\n\t\n\t this._sunSphere.geometry.dispose();\n\t this._sunSphere.geometry = null;\n\t\n\t if (this._sunSphere.material.map) {\n\t this._sunSphere.material.map.dispose();\n\t this._sunSphere.material.map = null;\n\t }\n\t\n\t this._sunSphere.material.dispose();\n\t this._sunSphere.material = null;\n\t\n\t this._sunSphere = null;\n\t\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }]);\n\t\n\t return Skybox;\n\t})();\n\t\n\texports['default'] = Skybox;\n\t\n\tvar noNew = function noNew(world, light) {\n\t return new Skybox(world, light);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.skybox = noNew;\n\n/***/ },\n/* 39 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * @author zz85 / https://github.com/zz85\n\t *\n\t * Based on 'A Practical Analytic Model for Daylight'\n\t * aka The Preetham Model, the de facto standard analytic skydome model\n\t * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n\t *\n\t * First implemented by Simon Wallner\n\t * http://www.simonwallner.at/projects/atmospheric-scattering\n\t *\n\t * Improved by Martin Upitis\n\t * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n\t *\n\t * Three.js integration by zz85 http://twitter.com/blurspline\n\t*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t_three2['default'].ShaderLib['sky'] = {\n\t\n\t\tuniforms: {\n\t\n\t\t\tluminance: { type: 'f', value: 1 },\n\t\t\tturbidity: { type: 'f', value: 2 },\n\t\t\treileigh: { type: 'f', value: 1 },\n\t\t\tmieCoefficient: { type: 'f', value: 0.005 },\n\t\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\t\tsunPosition: { type: 'v3', value: new _three2['default'].Vector3() }\n\t\n\t\t},\n\t\n\t\tvertexShader: ['varying vec3 vWorldPosition;', 'void main() {', 'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );', 'vWorldPosition = worldPosition.xyz;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['uniform sampler2D skySampler;', 'uniform vec3 sunPosition;', 'varying vec3 vWorldPosition;', 'vec3 cameraPos = vec3(0., 0., 0.);', '// uniform sampler2D sDiffuse;', '// const float turbidity = 10.0; //', '// const float reileigh = 2.; //', '// const float luminance = 1.0; //', '// const float mieCoefficient = 0.005;', '// const float mieDirectionalG = 0.8;', 'uniform float luminance;', 'uniform float turbidity;', 'uniform float reileigh;', 'uniform float mieCoefficient;', 'uniform float mieDirectionalG;', '// constants for atmospheric scattering', 'const float e = 2.71828182845904523536028747135266249775724709369995957;', 'const float pi = 3.141592653589793238462643383279502884197169;', 'const float n = 1.0003; // refractive index of air', 'const float N = 2.545E25; // number of molecules per unit volume for air at', '// 288.15K and 1013mb (sea level -45 celsius)', 'const float pn = 0.035;\t// depolatization factor for standard air', '// wavelength of used primaries, according to preetham', 'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);', '// mie stuff', '// K coefficient for the primaries', 'const vec3 K = vec3(0.686, 0.678, 0.666);', 'const float v = 4.0;', '// optical length at zenith for molecules', 'const float rayleighZenithLength = 8.4E3;', 'const float mieZenithLength = 1.25E3;', 'const vec3 up = vec3(0.0, 1.0, 0.0);', 'const float EE = 1000.0;', 'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;', '// 66 arc seconds -> degrees, and the cosine of that', '// earth shadow hack', 'const float cutoffAngle = pi/1.95;', 'const float steepness = 1.5;', 'vec3 totalRayleigh(vec3 lambda)', '{', 'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));', '}',\n\t\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE', 'vec3 simplifiedRayleigh()', '{', 'return 0.0005 / vec3(94, 40, 18);',\n\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}', 'float rayleighPhase(float cosTheta)', '{\t ', 'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));', '}', 'vec3 totalMie(vec3 lambda, vec3 K, float T)', '{', 'float c = (0.2 * T ) * 10E-18;', 'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;', '}', 'float hgPhase(float cosTheta, float g)', '{', 'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));', '}', 'float sunIntensity(float zenithAngleCos)', '{', 'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));', '}', '// float logLuminance(vec3 c)', '// {', '// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);', '// }', '// Filmic ToneMapping http://filmicgames.com/archives/75', 'float A = 0.15;', 'float B = 0.50;', 'float C = 0.10;', 'float D = 0.20;', 'float E = 0.02;', 'float F = 0.30;', 'float W = 1000.0;', 'vec3 Uncharted2Tonemap(vec3 x)', '{', 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;', '}', 'void main() ', '{', 'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);', '// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;', '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);', 'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));', 'vec3 sunDirection = normalize(sunPosition);', 'float sunE = sunIntensity(dot(sunDirection, up));', '// extinction (absorbtion + out scattering) ', '// rayleigh coefficients',\n\t\n\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;', '// mie coefficients', 'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;', '// optical length', '// cutoff angle at 90 to avoid singularity in next formula.', 'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));', 'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', 'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', '// combined extinction factor\t', 'vec3 Fex = exp(-(betaR * sR + betaM * sM));', '// in scattering', 'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);', 'float rPhase = rayleighPhase(cosTheta*0.5+0.5);', 'vec3 betaRTheta = betaR * rPhase;', 'float mPhase = hgPhase(cosTheta, mieDirectionalG);', 'vec3 betaMTheta = betaM * mPhase;', 'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));', 'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));', '//nightsky', 'vec3 direction = normalize(vWorldPosition - cameraPos);', 'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]', 'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]', 'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);', '// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;', 'vec3 L0 = vec3(0.1) * Fex;', '// composition + solar disc', '//if (cosTheta > sunAngularDiameterCos)', 'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);', '// if (normalize(vWorldPosition - cameraPos).y>0.0)', 'L0 += (sunE * 19000.0 * Fex)*sundisk;', 'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));', 'vec3 texColor = (Lin+L0); ', 'texColor *= 0.04 ;', 'texColor += vec3(0.0,0.001,0.0025)*0.3;', 'float g_fMaxLuminance = 1.0;', 'float fLumScaled = 0.1 / luminance; ', 'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ', 'float ExposureBias = fLumCompressed;', 'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);', 'vec3 color = curr*whiteScale;', 'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));', 'gl_FragColor.rgb = retColor;', 'gl_FragColor.a = 1.0;', '}'].join('\\n')\n\t\n\t};\n\t\n\tvar Sky = function Sky() {\n\t\n\t\tvar skyShader = _three2['default'].ShaderLib['sky'];\n\t\tvar skyUniforms = _three2['default'].UniformsUtils.clone(skyShader.uniforms);\n\t\n\t\tvar skyMat = new _three2['default'].ShaderMaterial({\n\t\t\tfragmentShader: skyShader.fragmentShader,\n\t\t\tvertexShader: skyShader.vertexShader,\n\t\t\tuniforms: skyUniforms,\n\t\t\tside: _three2['default'].BackSide\n\t\t});\n\t\n\t\tvar skyGeo = new _three2['default'].SphereBufferGeometry(450000, 32, 15);\n\t\tvar skyMesh = new _three2['default'].Mesh(skyGeo, skyMat);\n\t\n\t\t// Expose variables\n\t\tthis.mesh = skyMesh;\n\t\tthis.uniforms = skyUniforms;\n\t};\n\t\n\texports['default'] = Sky;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.0 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar debounce = __webpack_require__(41);\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/**\n\t * Creates a throttled function that only invokes `func` at most once per\n\t * every `wait` milliseconds. The throttled function comes with a `cancel`\n\t * method to cancel delayed `func` invocations and a `flush` method to\n\t * immediately invoke them. Provide an options object to indicate whether\n\t * `func` should be invoked on the leading and/or trailing edge of the `wait`\n\t * timeout. The `func` is invoked with the last arguments provided to the\n\t * throttled function. Subsequent calls to the throttled function return the\n\t * result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the throttled function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.throttle` and `_.debounce`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to throttle.\n\t * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=true] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new throttled function.\n\t * @example\n\t *\n\t * // avoid excessively updating the position while scrolling\n\t * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n\t *\n\t * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n\t * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n\t * jQuery(element).on('click', throttled);\n\t *\n\t * // cancel a trailing throttled invocation\n\t * jQuery(window).on('popstate', throttled.cancel);\n\t */\n\tfunction throttle(func, wait, options) {\n\t var leading = true,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t if (isObject(options)) {\n\t leading = 'leading' in options ? !!options.leading : leading;\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t // Avoid a V8 JIT bug in Chrome 19-20.\n\t // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\tmodule.exports = throttle;\n\n\n/***/ },\n/* 41 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Gets the timestamp of the number of milliseconds that have elapsed since\n\t * the Unix epoch (1 January 1970 00:00:00 UTC).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Date\n\t * @returns {number} Returns the timestamp.\n\t * @example\n\t *\n\t * _.defer(function(stamp) {\n\t * console.log(_.now() - stamp);\n\t * }, _.now());\n\t * // => logs the number of milliseconds it took for the deferred function to be invoked\n\t */\n\tvar now = Date.now;\n\t\n\t/**\n\t * Creates a debounced function that delays invoking `func` until after `wait`\n\t * milliseconds have elapsed since the last time the debounced function was\n\t * invoked. The debounced function comes with a `cancel` method to cancel\n\t * delayed `func` invocations and a `flush` method to immediately invoke them.\n\t * Provide an options object to indicate whether `func` should be invoked on\n\t * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n\t * with the last arguments provided to the debounced function. Subsequent calls\n\t * to the debounced function return the result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the debounced function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.debounce` and `_.throttle`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to debounce.\n\t * @param {number} [wait=0] The number of milliseconds to delay.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=false] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n\t * delayed before it's invoked.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new debounced function.\n\t * @example\n\t *\n\t * // Avoid costly calculations while the window size is in flux.\n\t * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n\t *\n\t * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n\t * jQuery(element).on('click', _.debounce(sendMail, 300, {\n\t * 'leading': true,\n\t * 'trailing': false\n\t * }));\n\t *\n\t * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n\t * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n\t * var source = new EventSource('/stream');\n\t * jQuery(source).on('message', debounced);\n\t *\n\t * // Cancel the trailing debounced invocation.\n\t * jQuery(window).on('popstate', debounced.cancel);\n\t */\n\tfunction debounce(func, wait, options) {\n\t var args,\n\t maxTimeoutId,\n\t result,\n\t stamp,\n\t thisArg,\n\t timeoutId,\n\t trailingCall,\n\t lastCalled = 0,\n\t leading = false,\n\t maxWait = false,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t wait = toNumber(wait) || 0;\n\t if (isObject(options)) {\n\t leading = !!options.leading;\n\t maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t\n\t function cancel() {\n\t if (timeoutId) {\n\t clearTimeout(timeoutId);\n\t }\n\t if (maxTimeoutId) {\n\t clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = 0;\n\t args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n\t }\n\t\n\t function complete(isCalled, id) {\n\t if (id) {\n\t clearTimeout(id);\n\t }\n\t maxTimeoutId = timeoutId = trailingCall = undefined;\n\t if (isCalled) {\n\t lastCalled = now();\n\t result = func.apply(thisArg, args);\n\t if (!timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t }\n\t }\n\t\n\t function delayed() {\n\t var remaining = wait - (now() - stamp);\n\t if (remaining <= 0 || remaining > wait) {\n\t complete(trailingCall, maxTimeoutId);\n\t } else {\n\t timeoutId = setTimeout(delayed, remaining);\n\t }\n\t }\n\t\n\t function flush() {\n\t if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n\t result = func.apply(thisArg, args);\n\t }\n\t cancel();\n\t return result;\n\t }\n\t\n\t function maxDelayed() {\n\t complete(trailing, timeoutId);\n\t }\n\t\n\t function debounced() {\n\t args = arguments;\n\t stamp = now();\n\t thisArg = this;\n\t trailingCall = trailing && (timeoutId || !leading);\n\t\n\t if (maxWait === false) {\n\t var leadingCall = leading && !timeoutId;\n\t } else {\n\t if (!maxTimeoutId && !leading) {\n\t lastCalled = stamp;\n\t }\n\t var remaining = maxWait - (stamp - lastCalled),\n\t isCalled = remaining <= 0 || remaining > maxWait;\n\t\n\t if (isCalled) {\n\t if (maxTimeoutId) {\n\t maxTimeoutId = clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = stamp;\n\t result = func.apply(thisArg, args);\n\t }\n\t else if (!maxTimeoutId) {\n\t maxTimeoutId = setTimeout(maxDelayed, remaining);\n\t }\n\t }\n\t if (isCalled && timeoutId) {\n\t timeoutId = clearTimeout(timeoutId);\n\t }\n\t else if (!timeoutId && wait !== maxWait) {\n\t timeoutId = setTimeout(delayed, wait);\n\t }\n\t if (leadingCall) {\n\t isCalled = true;\n\t result = func.apply(thisArg, args);\n\t }\n\t if (isCalled && !timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t return result;\n\t }\n\t debounced.cancel = cancel;\n\t debounced.flush = flush;\n\t return debounced;\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = debounce;\n\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _ControlsOrbit = __webpack_require__(43);\n\t\n\tvar _ControlsOrbit2 = _interopRequireDefault(_ControlsOrbit);\n\t\n\tvar Controls = {\n\t Orbit: _ControlsOrbit2['default'],\n\t orbit: _ControlsOrbit.orbit, orbit: _ControlsOrbit.orbit\n\t};\n\t\n\texports['default'] = Controls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorOrbitControls = __webpack_require__(44);\n\t\n\tvar _vendorOrbitControls2 = _interopRequireDefault(_vendorOrbitControls);\n\t\n\tvar Orbit = (function (_EventEmitter) {\n\t _inherits(Orbit, _EventEmitter);\n\t\n\t function Orbit() {\n\t _classCallCheck(this, Orbit);\n\t\n\t _get(Object.getPrototypeOf(Orbit.prototype), 'constructor', this).call(this);\n\t }\n\t\n\t // Proxy control events\n\t //\n\t // There's currently no distinction between pan, orbit and zoom events\n\t\n\t _createClass(Orbit, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t var _this = this;\n\t\n\t this._controls.addEventListener('start', function (event) {\n\t _this._world.emit('controlsMoveStart', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('change', function (event) {\n\t _this._world.emit('controlsMove', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('end', function (event) {\n\t _this._world.emit('controlsMoveEnd', event.target.target);\n\t });\n\t }\n\t\n\t // Moving the camera along the [x,y,z] axis based on a target position\n\t }, {\n\t key: '_panTo',\n\t value: function _panTo(point, animate) {}\n\t }, {\n\t key: '_panBy',\n\t value: function _panBy(pointDelta, animate) {}\n\t\n\t // Zooming the camera in and out\n\t }, {\n\t key: '_zoomTo',\n\t value: function _zoomTo(metres, animate) {}\n\t }, {\n\t key: '_zoomBy',\n\t value: function _zoomBy(metresDelta, animate) {}\n\t\n\t // Force camera to look at something other than the target\n\t }, {\n\t key: '_lookAt',\n\t value: function _lookAt(point, animate) {}\n\t\n\t // Make camera look at the target\n\t }, {\n\t key: '_lookAtTarget',\n\t value: function _lookAtTarget() {}\n\t\n\t // Tilt (up and down)\n\t }, {\n\t key: '_tiltTo',\n\t value: function _tiltTo(angle, animate) {}\n\t }, {\n\t key: '_tiltBy',\n\t value: function _tiltBy(angleDelta, animate) {}\n\t\n\t // Rotate (left and right)\n\t }, {\n\t key: '_rotateTo',\n\t value: function _rotateTo(angle, animate) {}\n\t }, {\n\t key: '_rotateBy',\n\t value: function _rotateBy(angleDelta, animate) {}\n\t\n\t // Fly to the given point, animating pan and tilt/rotation to final position\n\t // with nice zoom out and in\n\t //\n\t // Calling flyTo a second time before the previous animation has completed\n\t // will immediately start the new animation from wherever the previous one\n\t // has got to\n\t }, {\n\t key: '_flyTo',\n\t value: function _flyTo(point, noZoom) {}\n\t\n\t // Proxy to OrbitControls.update()\n\t }, {\n\t key: 'update',\n\t value: function update() {\n\t this._controls.update();\n\t }\n\t\n\t // Add controls to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addControls(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addControls to actually add the controls\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t\n\t // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n\t // See: http://stackoverflow.com/a/26188674/997339\n\t this._controls = new _vendorOrbitControls2['default'](world._engine._camera, world._container);\n\t\n\t // Disable keys for now as no events are fired for them anyway\n\t this._controls.keys = false;\n\t\n\t // 89 degrees\n\t this._controls.maxPolarAngle = 1.5533;\n\t\n\t // this._controls.enableDamping = true;\n\t // this._controls.dampingFactor = 0.25;\n\t\n\t this._initEvents();\n\t\n\t this.emit('added');\n\t }\n\t\n\t // Destroys the controls and removes them from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Remove event listeners\n\t\n\t this._controls.dispose();\n\t\n\t this._world = null;\n\t this._controls = null;\n\t }\n\t }]);\n\t\n\t return Orbit;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Orbit;\n\t\n\tvar noNew = function noNew() {\n\t return new Orbit();\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.orbit = noNew;\n\n/***/ },\n/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _hammerjs = __webpack_require__(45);\n\t\n\tvar _hammerjs2 = _interopRequireDefault(_hammerjs);\n\t\n\t/**\n\t * @author qiao / https://github.com/qiao\n\t * @author mrdoob / http://mrdoob.com\n\t * @author alteredq / http://alteredqualia.com/\n\t * @author WestLangley / http://github.com/WestLangley\n\t * @author erich666 / http://erichaines.com\n\t */\n\t\n\t// This set of controls performs orbiting, dollying (zooming), and panning.\n\t// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n\t//\n\t// Orbit - left mouse / touch: one finger move\n\t// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n\t// Pan - right mouse, or arrow keys / touch: three finter swipe\n\t\n\tvar OrbitControls = function OrbitControls(object, domElement) {\n\t\n\t\tthis.object = object;\n\t\n\t\tthis.domElement = domElement !== undefined ? domElement : document;\n\t\n\t\t// Set to false to disable this control\n\t\tthis.enabled = true;\n\t\n\t\t// \"target\" sets the location of focus, where the object orbits around\n\t\tthis.target = new _three2['default'].Vector3();\n\t\n\t\t// How far you can dolly in and out ( PerspectiveCamera only )\n\t\tthis.minDistance = 0;\n\t\tthis.maxDistance = Infinity;\n\t\n\t\t// How far you can zoom in and out ( OrthographicCamera only )\n\t\tthis.minZoom = 0;\n\t\tthis.maxZoom = Infinity;\n\t\n\t\t// How far you can orbit vertically, upper and lower limits.\n\t\t// Range is 0 to Math.PI radians.\n\t\tthis.minPolarAngle = 0; // radians\n\t\tthis.maxPolarAngle = Math.PI; // radians\n\t\n\t\t// How far you can orbit horizontally, upper and lower limits.\n\t\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\t\tthis.minAzimuthAngle = -Infinity; // radians\n\t\tthis.maxAzimuthAngle = Infinity; // radians\n\t\n\t\t// Set to true to enable damping (inertia)\n\t\t// If damping is enabled, you must call controls.update() in your animation loop\n\t\tthis.enableDamping = false;\n\t\tthis.dampingFactor = 0.25;\n\t\n\t\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t\t// Set to false to disable zooming\n\t\tthis.enableZoom = true;\n\t\tthis.zoomSpeed = 1.0;\n\t\n\t\t// Set to false to disable rotating\n\t\tthis.enableRotate = true;\n\t\tthis.rotateSpeed = 1.0;\n\t\n\t\t// Set to false to disable panning\n\t\tthis.enablePan = true;\n\t\tthis.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\t\n\t\t// Set to true to automatically rotate around the target\n\t\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\t\tthis.autoRotate = false;\n\t\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\t\n\t\t// Set to false to disable use of the keys\n\t\tthis.enableKeys = true;\n\t\n\t\t// The four arrow keys\n\t\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\t\n\t\t// Mouse buttons\n\t\tthis.mouseButtons = { ORBIT: _three2['default'].MOUSE.LEFT, ZOOM: _three2['default'].MOUSE.MIDDLE, PAN: _three2['default'].MOUSE.RIGHT };\n\t\n\t\t// for reset\n\t\tthis.target0 = this.target.clone();\n\t\tthis.position0 = this.object.position.clone();\n\t\tthis.zoom0 = this.object.zoom;\n\t\n\t\t//\n\t\t// public methods\n\t\t//\n\t\n\t\tthis.getPolarAngle = function () {\n\t\n\t\t\treturn phi;\n\t\t};\n\t\n\t\tthis.getAzimuthalAngle = function () {\n\t\n\t\t\treturn theta;\n\t\t};\n\t\n\t\tthis.reset = function () {\n\t\n\t\t\tscope.target.copy(scope.target0);\n\t\t\tscope.object.position.copy(scope.position0);\n\t\t\tscope.object.zoom = scope.zoom0;\n\t\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\tscope.update();\n\t\n\t\t\tstate = STATE.NONE;\n\t\t};\n\t\n\t\t// this method is exposed, but perhaps it would be better if we can make it private...\n\t\tthis.update = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\t// so camera.up is the orbit axis\n\t\t\tvar quat = new _three2['default'].Quaternion().setFromUnitVectors(object.up, new _three2['default'].Vector3(0, 1, 0));\n\t\t\tvar quatInverse = quat.clone().inverse();\n\t\n\t\t\tvar lastPosition = new _three2['default'].Vector3();\n\t\t\tvar lastQuaternion = new _three2['default'].Quaternion();\n\t\n\t\t\treturn function () {\n\t\n\t\t\t\tvar position = scope.object.position;\n\t\n\t\t\t\toffset.copy(position).sub(scope.target);\n\t\n\t\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\t\toffset.applyQuaternion(quat);\n\t\n\t\t\t\t// angle from z-axis around y-axis\n\t\n\t\t\t\ttheta = Math.atan2(offset.x, offset.z);\n\t\n\t\t\t\t// angle from y-axis\n\t\n\t\t\t\tphi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n\t\n\t\t\t\tif (scope.autoRotate && state === STATE.NONE) {\n\t\n\t\t\t\t\trotateLeft(getAutoRotationAngle());\n\t\t\t\t}\n\t\n\t\t\t\ttheta += thetaDelta;\n\t\t\t\tphi += phiDelta;\n\t\n\t\t\t\t// restrict theta to be between desired limits\n\t\t\t\ttheta = Math.max(scope.minAzimuthAngle, Math.min(scope.maxAzimuthAngle, theta));\n\t\n\t\t\t\t// restrict phi to be between desired limits\n\t\t\t\tphi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, phi));\n\t\n\t\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\t\tphi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n\t\n\t\t\t\tvar radius = offset.length() * scale;\n\t\n\t\t\t\t// restrict radius to be between desired limits\n\t\t\t\tradius = Math.max(scope.minDistance, Math.min(scope.maxDistance, radius));\n\t\n\t\t\t\t// move target to panned location\n\t\t\t\tscope.target.add(panOffset);\n\t\n\t\t\t\toffset.x = radius * Math.sin(phi) * Math.sin(theta);\n\t\t\t\toffset.y = radius * Math.cos(phi);\n\t\t\t\toffset.z = radius * Math.sin(phi) * Math.cos(theta);\n\t\n\t\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\t\toffset.applyQuaternion(quatInverse);\n\t\n\t\t\t\tposition.copy(scope.target).add(offset);\n\t\n\t\t\t\tscope.object.lookAt(scope.target);\n\t\n\t\t\t\tif (scope.enableDamping === true) {\n\t\n\t\t\t\t\tthetaDelta *= 1 - scope.dampingFactor;\n\t\t\t\t\tphiDelta *= 1 - scope.dampingFactor;\n\t\t\t\t} else {\n\t\n\t\t\t\t\tthetaDelta = 0;\n\t\t\t\t\tphiDelta = 0;\n\t\t\t\t}\n\t\n\t\t\t\tscale = 1;\n\t\t\t\tpanOffset.set(0, 0, 0);\n\t\n\t\t\t\t// update condition is:\n\t\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\t\n\t\t\t\tif (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {\n\t\n\t\t\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\t\t\tlastPosition.copy(scope.object.position);\n\t\t\t\t\tlastQuaternion.copy(scope.object.quaternion);\n\t\t\t\t\tzoomChanged = false;\n\t\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\n\t\t\t\treturn false;\n\t\t\t};\n\t\t})();\n\t\n\t\tthis.dispose = function () {\n\t\n\t\t\tscope.domElement.removeEventListener('contextmenu', onContextMenu, false);\n\t\t\tscope.domElement.removeEventListener('mousedown', onMouseDown, false);\n\t\t\tscope.domElement.removeEventListener('mousewheel', onMouseWheel, false);\n\t\t\tscope.domElement.removeEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t\tscope.domElement.removeEventListener('touchstart', onTouchStart, false);\n\t\t\tscope.domElement.removeEventListener('touchend', onTouchEnd, false);\n\t\t\tscope.domElement.removeEventListener('touchmove', onTouchMove, false);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\twindow.removeEventListener('keydown', onKeyDown, false);\n\t\n\t\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\t\t};\n\t\n\t\t//\n\t\t// internals\n\t\t//\n\t\n\t\tvar scope = this;\n\t\n\t\tvar changeEvent = { type: 'change' };\n\t\tvar startEvent = { type: 'start' };\n\t\tvar endEvent = { type: 'end' };\n\t\n\t\tvar STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };\n\t\n\t\tvar state = STATE.NONE;\n\t\n\t\tvar EPS = 0.000001;\n\t\n\t\t// current position in spherical coordinates\n\t\tvar theta;\n\t\tvar phi;\n\t\n\t\tvar phiDelta = 0;\n\t\tvar thetaDelta = 0;\n\t\tvar scale = 1;\n\t\tvar panOffset = new _three2['default'].Vector3();\n\t\tvar zoomChanged = false;\n\t\n\t\tvar rotateStart = new _three2['default'].Vector2();\n\t\tvar rotateEnd = new _three2['default'].Vector2();\n\t\tvar rotateDelta = new _three2['default'].Vector2();\n\t\n\t\tvar panStart = new _three2['default'].Vector2();\n\t\tvar panEnd = new _three2['default'].Vector2();\n\t\tvar panDelta = new _three2['default'].Vector2();\n\t\n\t\tvar dollyStart = new _three2['default'].Vector2();\n\t\tvar dollyEnd = new _three2['default'].Vector2();\n\t\tvar dollyDelta = new _three2['default'].Vector2();\n\t\n\t\tfunction getAutoRotationAngle() {\n\t\n\t\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\t\t}\n\t\n\t\tfunction getZoomScale() {\n\t\n\t\t\treturn Math.pow(0.95, scope.zoomSpeed);\n\t\t}\n\t\n\t\tfunction rotateLeft(angle) {\n\t\n\t\t\tthetaDelta -= angle;\n\t\t}\n\t\n\t\tfunction rotateUp(angle) {\n\t\n\t\t\tphiDelta -= angle;\n\t\t}\n\t\n\t\tvar panLeft = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panLeft( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get X column of objectMatrix\n\t\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( - distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\t// Fixed panning to x/y plane\n\t\t\treturn function panLeft(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\t// var adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[0], 0, te[2]);\n\t\t\t\tv.multiplyScalar(-distance);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// Fixed panning to x/y plane\n\t\tvar panUp = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panUp( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get Y column of objectMatrix\n\t\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\treturn function panUp(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\tvar adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[4], 0, te[6]);\n\t\t\t\tv.multiplyScalar(adjDist);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// deltaX and deltaY are in pixels; right and down are positive\n\t\tvar pan = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\treturn function (deltaX, deltaY) {\n\t\n\t\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\t\t// perspective\n\t\t\t\t\tvar position = scope.object.position;\n\t\t\t\t\toffset.copy(position).sub(scope.target);\n\t\t\t\t\tvar targetDistance = offset.length();\n\t\n\t\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\t\ttargetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0);\n\t\n\t\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\t\tpanLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t\tpanUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\t\t// orthographic\n\t\t\t\t\tpanLeft(deltaX * (scope.object.right - scope.object.left) / element.clientWidth, scope.object.matrix);\n\t\t\t\t\tpanUp(deltaY * (scope.object.top - scope.object.bottom) / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.');\n\t\t\t\t\tscope.enablePan = false;\n\t\t\t\t}\n\t\t\t};\n\t\t})();\n\t\n\t\tfunction dollyIn(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale /= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\tfunction dollyOut(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale *= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\t//\n\t\t// event callbacks - update the object state\n\t\t//\n\t\n\t\tfunction handleMouseDownRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownRotate' );\n\t\n\t\t\trotateStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownDolly' );\n\t\n\t\t\tdollyStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownPan(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownPan' );\n\t\n\t\t\tpanStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.clientX, event.clientY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveDolly' );\n\t\n\t\t\tdollyEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMovePan(event) {\n\t\n\t\t\t//console.log( 'handleMouseMovePan' );\n\t\n\t\t\tpanEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseUp(event) {\n\t\n\t\t\t//console.log( 'handleMouseUp' );\n\t\n\t\t}\n\t\n\t\tfunction handleMouseWheel(event) {\n\t\n\t\t\t//console.log( 'handleMouseWheel' );\n\t\n\t\t\tvar delta = 0;\n\t\n\t\t\tif (event.wheelDelta !== undefined) {\n\t\n\t\t\t\t// WebKit / Opera / Explorer 9\n\t\n\t\t\t\tdelta = event.wheelDelta;\n\t\t\t} else if (event.detail !== undefined) {\n\t\n\t\t\t\t// Firefox\n\t\n\t\t\t\tdelta = -event.detail;\n\t\t\t}\n\t\n\t\t\tif (delta > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (delta < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleKeyDown(event) {\n\t\n\t\t\t//console.log( 'handleKeyDown' );\n\t\n\t\t\tswitch (event.keyCode) {\n\t\n\t\t\t\tcase scope.keys.UP:\n\t\t\t\t\tpan(0, scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\t\tpan(0, -scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.LEFT:\n\t\t\t\t\tpan(scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.RIGHT:\n\t\t\t\t\tpan(-scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction handleTouchStartRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartRotate' );\n\t\n\t\t\trotateStart.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t}\n\t\n\t\tfunction handleTouchStartDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyStart.set(0, distance);\n\t\t}\n\t\n\t\tfunction handleTouchStartPan(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartPan' );\n\t\n\t\t\tpanStart.set(event.deltaX, event.deltaY);\n\t\t}\n\t\n\t\tfunction handleTouchMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyEnd.set(0, distance);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMovePan(event) {\n\t\n\t\t\t//console.log( 'handleTouchMovePan' );\n\t\n\t\t\tpanEnd.set(event.deltaX, event.deltaY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchEnd(event) {}\n\t\n\t\t//console.log( 'handleTouchEnd' );\n\t\n\t\t//\n\t\t// event handlers - FSM: listen for events and reset state\n\t\t//\n\t\n\t\tfunction onMouseDown(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (event.button === scope.mouseButtons.ORBIT) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseDownRotate(event);\n\t\n\t\t\t\tstate = STATE.ROTATE;\n\t\t\t} else if (event.button === scope.mouseButtons.ZOOM) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseDownDolly(event);\n\t\n\t\t\t\tstate = STATE.DOLLY;\n\t\t\t} else if (event.button === scope.mouseButtons.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseDownPan(event);\n\t\n\t\t\t\tstate = STATE.PAN;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tdocument.addEventListener('mousemove', onMouseMove, false);\n\t\t\t\tdocument.addEventListener('mouseup', onMouseUp, false);\n\t\t\t\tdocument.addEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (state === STATE.ROTATE) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseMoveRotate(event);\n\t\t\t} else if (state === STATE.DOLLY) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseMoveDolly(event);\n\t\t\t} else if (state === STATE.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseMovePan(event);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseUp(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleMouseUp(event);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onMouseWheel(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\thandleMouseWheel(event);\n\t\n\t\t\tscope.dispatchEvent(startEvent); // not sure why these are here...\n\t\t\tscope.dispatchEvent(endEvent);\n\t\t}\n\t\n\t\tfunction onKeyDown(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableKeys === false || scope.enablePan === false) return;\n\t\n\t\t\thandleKeyDown(event);\n\t\t}\n\t\n\t\tfunction onTouchStart(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\t\thandleTouchStartPan(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchEnd(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleTouchEnd(event);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onContextMenu(event) {\n\t\n\t\t\tevent.preventDefault();\n\t\t}\n\t\n\t\t//\n\t\n\t\tscope.domElement.addEventListener('contextmenu', onContextMenu, false);\n\t\n\t\tscope.domElement.addEventListener('mousedown', onMouseDown, false);\n\t\tscope.domElement.addEventListener('mousewheel', onMouseWheel, false);\n\t\tscope.domElement.addEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\t\n\t\tscope.hammer = new _hammerjs2['default'](scope.domElement);\n\t\n\t\tscope.hammer.get('pan').set({\n\t\t\tpointers: 0,\n\t\t\tdirection: _hammerjs2['default'].DIRECTION_ALL\n\t\t});\n\t\n\t\tscope.hammer.get('pinch').set({\n\t\t\tenable: true,\n\t\t\tthreshold: 0.1\n\t\t});\n\t\n\t\tscope.hammer.on('panstart', function (event) {\n\t\t\tif (scope.enabled === false) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\thandleTouchStartPan(event);\n\t\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\t\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('panend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('panmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t\t//\n\t\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t\t//\n\t\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t\t//\n\t\t\t\t// panStart.copy( panEnd );\n\t\t\t\t//\n\t\t\t\t// scope.update();\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchstart', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyStart.set( 0, distance );\n\t\t\t//\n\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('pinchmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyEnd.set( 0, distance );\n\t\t\t//\n\t\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t\t//\n\t\t\t// if ( dollyDelta.y > 0 ) {\n\t\t\t//\n\t\t\t// \tdollyOut( getZoomScale() );\n\t\t\t//\n\t\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t\t//\n\t\t\t// \tdollyIn( getZoomScale() );\n\t\t\t//\n\t\t\t// }\n\t\t\t//\n\t\t\t// dollyStart.copy( dollyEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t});\n\t\n\t\twindow.addEventListener('keydown', onKeyDown, false);\n\t\n\t\t// force an update at start\n\t\n\t\tthis.update();\n\t};\n\t\n\tOrbitControls.prototype = Object.create(_three2['default'].EventDispatcher.prototype);\n\tOrbitControls.prototype.constructor = _three2['default'].OrbitControls;\n\t\n\tObject.defineProperties(OrbitControls.prototype, {\n\t\n\t\tcenter: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .center has been renamed to .target');\n\t\t\t\treturn this.target;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\t// backward compatibility\n\t\n\t\tnoZoom: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\treturn !this.enableZoom;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\tthis.enableZoom = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoRotate: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\treturn !this.enableRotate;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\tthis.enableRotate = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoPan: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\treturn !this.enablePan;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\tthis.enablePan = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoKeys: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\treturn !this.enableKeys;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\tthis.enableKeys = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tstaticMoving: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\treturn !this.constraint.enableDamping;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\tthis.constraint.enableDamping = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tdynamicDampingFactor: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\treturn this.constraint.dampingFactor;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\tthis.constraint.dampingFactor = value;\n\t\t\t}\n\t\n\t\t}\n\t\n\t});\n\t\n\texports['default'] = OrbitControls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 45 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.6 - 2015-12-23\n\t * http://hammerjs.github.io/\n\t *\n\t * Copyright (c) 2015 Jorik Tangelder;\n\t * Licensed under the license */\n\t(function(window, document, exportName, undefined) {\n\t 'use strict';\n\t\n\tvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n\tvar TEST_ELEMENT = document.createElement('div');\n\t\n\tvar TYPE_FUNCTION = 'function';\n\t\n\tvar round = Math.round;\n\tvar abs = Math.abs;\n\tvar now = Date.now;\n\t\n\t/**\n\t * set a timeout with a given scope\n\t * @param {Function} fn\n\t * @param {Number} timeout\n\t * @param {Object} context\n\t * @returns {number}\n\t */\n\tfunction setTimeoutContext(fn, timeout, context) {\n\t return setTimeout(bindFn(fn, context), timeout);\n\t}\n\t\n\t/**\n\t * if the argument is an array, we want to execute the fn on each entry\n\t * if it aint an array we don't want to do a thing.\n\t * this is used by all the methods that accept a single and array argument.\n\t * @param {*|Array} arg\n\t * @param {String} fn\n\t * @param {Object} [context]\n\t * @returns {Boolean}\n\t */\n\tfunction invokeArrayArg(arg, fn, context) {\n\t if (Array.isArray(arg)) {\n\t each(arg, context[fn], context);\n\t return true;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * walk objects and arrays\n\t * @param {Object} obj\n\t * @param {Function} iterator\n\t * @param {Object} context\n\t */\n\tfunction each(obj, iterator, context) {\n\t var i;\n\t\n\t if (!obj) {\n\t return;\n\t }\n\t\n\t if (obj.forEach) {\n\t obj.forEach(iterator, context);\n\t } else if (obj.length !== undefined) {\n\t i = 0;\n\t while (i < obj.length) {\n\t iterator.call(context, obj[i], i, obj);\n\t i++;\n\t }\n\t } else {\n\t for (i in obj) {\n\t obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * wrap a method with a deprecation warning and stack trace\n\t * @param {Function} method\n\t * @param {String} name\n\t * @param {String} message\n\t * @returns {Function} A new function wrapping the supplied method.\n\t */\n\tfunction deprecate(method, name, message) {\n\t var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n\t return function() {\n\t var e = new Error('get-stack-trace');\n\t var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n\t .replace(/^\\s+at\\s+/gm, '')\n\t .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\t\n\t var log = window.console && (window.console.warn || window.console.log);\n\t if (log) {\n\t log.call(window.console, deprecationMessage, stack);\n\t }\n\t return method.apply(this, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} target\n\t * @param {...Object} objects_to_assign\n\t * @returns {Object} target\n\t */\n\tvar assign;\n\tif (typeof Object.assign !== 'function') {\n\t assign = function assign(target) {\n\t if (target === undefined || target === null) {\n\t throw new TypeError('Cannot convert undefined or null to object');\n\t }\n\t\n\t var output = Object(target);\n\t for (var index = 1; index < arguments.length; index++) {\n\t var source = arguments[index];\n\t if (source !== undefined && source !== null) {\n\t for (var nextKey in source) {\n\t if (source.hasOwnProperty(nextKey)) {\n\t output[nextKey] = source[nextKey];\n\t }\n\t }\n\t }\n\t }\n\t return output;\n\t };\n\t} else {\n\t assign = Object.assign;\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @param {Boolean=false} [merge]\n\t * @returns {Object} dest\n\t */\n\tvar extend = deprecate(function extend(dest, src, merge) {\n\t var keys = Object.keys(src);\n\t var i = 0;\n\t while (i < keys.length) {\n\t if (!merge || (merge && dest[keys[i]] === undefined)) {\n\t dest[keys[i]] = src[keys[i]];\n\t }\n\t i++;\n\t }\n\t return dest;\n\t}, 'extend', 'Use `assign`.');\n\t\n\t/**\n\t * merge the values from src in the dest.\n\t * means that properties that exist in dest will not be overwritten by src\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @returns {Object} dest\n\t */\n\tvar merge = deprecate(function merge(dest, src) {\n\t return extend(dest, src, true);\n\t}, 'merge', 'Use `assign`.');\n\t\n\t/**\n\t * simple class inheritance\n\t * @param {Function} child\n\t * @param {Function} base\n\t * @param {Object} [properties]\n\t */\n\tfunction inherit(child, base, properties) {\n\t var baseP = base.prototype,\n\t childP;\n\t\n\t childP = child.prototype = Object.create(baseP);\n\t childP.constructor = child;\n\t childP._super = baseP;\n\t\n\t if (properties) {\n\t assign(childP, properties);\n\t }\n\t}\n\t\n\t/**\n\t * simple function bind\n\t * @param {Function} fn\n\t * @param {Object} context\n\t * @returns {Function}\n\t */\n\tfunction bindFn(fn, context) {\n\t return function boundFn() {\n\t return fn.apply(context, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * let a boolean value also be a function that must return a boolean\n\t * this first item in args will be used as the context\n\t * @param {Boolean|Function} val\n\t * @param {Array} [args]\n\t * @returns {Boolean}\n\t */\n\tfunction boolOrFn(val, args) {\n\t if (typeof val == TYPE_FUNCTION) {\n\t return val.apply(args ? args[0] || undefined : undefined, args);\n\t }\n\t return val;\n\t}\n\t\n\t/**\n\t * use the val2 when val1 is undefined\n\t * @param {*} val1\n\t * @param {*} val2\n\t * @returns {*}\n\t */\n\tfunction ifUndefined(val1, val2) {\n\t return (val1 === undefined) ? val2 : val1;\n\t}\n\t\n\t/**\n\t * addEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction addEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.addEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * removeEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction removeEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.removeEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * find if a node is in the given parent\n\t * @method hasParent\n\t * @param {HTMLElement} node\n\t * @param {HTMLElement} parent\n\t * @return {Boolean} found\n\t */\n\tfunction hasParent(node, parent) {\n\t while (node) {\n\t if (node == parent) {\n\t return true;\n\t }\n\t node = node.parentNode;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * small indexOf wrapper\n\t * @param {String} str\n\t * @param {String} find\n\t * @returns {Boolean} found\n\t */\n\tfunction inStr(str, find) {\n\t return str.indexOf(find) > -1;\n\t}\n\t\n\t/**\n\t * split string on whitespace\n\t * @param {String} str\n\t * @returns {Array} words\n\t */\n\tfunction splitStr(str) {\n\t return str.trim().split(/\\s+/g);\n\t}\n\t\n\t/**\n\t * find if a array contains the object using indexOf or a simple polyFill\n\t * @param {Array} src\n\t * @param {String} find\n\t * @param {String} [findByKey]\n\t * @return {Boolean|Number} false when not found, or the index\n\t */\n\tfunction inArray(src, find, findByKey) {\n\t if (src.indexOf && !findByKey) {\n\t return src.indexOf(find);\n\t } else {\n\t var i = 0;\n\t while (i < src.length) {\n\t if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n\t return i;\n\t }\n\t i++;\n\t }\n\t return -1;\n\t }\n\t}\n\t\n\t/**\n\t * convert array-like objects to real arrays\n\t * @param {Object} obj\n\t * @returns {Array}\n\t */\n\tfunction toArray(obj) {\n\t return Array.prototype.slice.call(obj, 0);\n\t}\n\t\n\t/**\n\t * unique array with objects based on a key (like 'id') or just by the array's value\n\t * @param {Array} src [{id:1},{id:2},{id:1}]\n\t * @param {String} [key]\n\t * @param {Boolean} [sort=False]\n\t * @returns {Array} [{id:1},{id:2}]\n\t */\n\tfunction uniqueArray(src, key, sort) {\n\t var results = [];\n\t var values = [];\n\t var i = 0;\n\t\n\t while (i < src.length) {\n\t var val = key ? src[i][key] : src[i];\n\t if (inArray(values, val) < 0) {\n\t results.push(src[i]);\n\t }\n\t values[i] = val;\n\t i++;\n\t }\n\t\n\t if (sort) {\n\t if (!key) {\n\t results = results.sort();\n\t } else {\n\t results = results.sort(function sortUniqueArray(a, b) {\n\t return a[key] > b[key];\n\t });\n\t }\n\t }\n\t\n\t return results;\n\t}\n\t\n\t/**\n\t * get the prefixed property\n\t * @param {Object} obj\n\t * @param {String} property\n\t * @returns {String|Undefined} prefixed\n\t */\n\tfunction prefixed(obj, property) {\n\t var prefix, prop;\n\t var camelProp = property[0].toUpperCase() + property.slice(1);\n\t\n\t var i = 0;\n\t while (i < VENDOR_PREFIXES.length) {\n\t prefix = VENDOR_PREFIXES[i];\n\t prop = (prefix) ? prefix + camelProp : property;\n\t\n\t if (prop in obj) {\n\t return prop;\n\t }\n\t i++;\n\t }\n\t return undefined;\n\t}\n\t\n\t/**\n\t * get a unique id\n\t * @returns {number} uniqueId\n\t */\n\tvar _uniqueId = 1;\n\tfunction uniqueId() {\n\t return _uniqueId++;\n\t}\n\t\n\t/**\n\t * get the window object of an element\n\t * @param {HTMLElement} element\n\t * @returns {DocumentView|Window}\n\t */\n\tfunction getWindowForElement(element) {\n\t var doc = element.ownerDocument || element;\n\t return (doc.defaultView || doc.parentWindow || window);\n\t}\n\t\n\tvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\t\n\tvar SUPPORT_TOUCH = ('ontouchstart' in window);\n\tvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n\tvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\t\n\tvar INPUT_TYPE_TOUCH = 'touch';\n\tvar INPUT_TYPE_PEN = 'pen';\n\tvar INPUT_TYPE_MOUSE = 'mouse';\n\tvar INPUT_TYPE_KINECT = 'kinect';\n\t\n\tvar COMPUTE_INTERVAL = 25;\n\t\n\tvar INPUT_START = 1;\n\tvar INPUT_MOVE = 2;\n\tvar INPUT_END = 4;\n\tvar INPUT_CANCEL = 8;\n\t\n\tvar DIRECTION_NONE = 1;\n\tvar DIRECTION_LEFT = 2;\n\tvar DIRECTION_RIGHT = 4;\n\tvar DIRECTION_UP = 8;\n\tvar DIRECTION_DOWN = 16;\n\t\n\tvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n\tvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n\tvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\t\n\tvar PROPS_XY = ['x', 'y'];\n\tvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\t\n\t/**\n\t * create new input type manager\n\t * @param {Manager} manager\n\t * @param {Function} callback\n\t * @returns {Input}\n\t * @constructor\n\t */\n\tfunction Input(manager, callback) {\n\t var self = this;\n\t this.manager = manager;\n\t this.callback = callback;\n\t this.element = manager.element;\n\t this.target = manager.options.inputTarget;\n\t\n\t // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n\t // so when disabled the input events are completely bypassed.\n\t this.domHandler = function(ev) {\n\t if (boolOrFn(manager.options.enable, [manager])) {\n\t self.handler(ev);\n\t }\n\t };\n\t\n\t this.init();\n\t\n\t}\n\t\n\tInput.prototype = {\n\t /**\n\t * should handle the inputEvent data and trigger the callback\n\t * @virtual\n\t */\n\t handler: function() { },\n\t\n\t /**\n\t * bind the events\n\t */\n\t init: function() {\n\t this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t },\n\t\n\t /**\n\t * unbind the events\n\t */\n\t destroy: function() {\n\t this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t }\n\t};\n\t\n\t/**\n\t * create new input type manager\n\t * called by the Manager constructor\n\t * @param {Hammer} manager\n\t * @returns {Input}\n\t */\n\tfunction createInputInstance(manager) {\n\t var Type;\n\t var inputClass = manager.options.inputClass;\n\t\n\t if (inputClass) {\n\t Type = inputClass;\n\t } else if (SUPPORT_POINTER_EVENTS) {\n\t Type = PointerEventInput;\n\t } else if (SUPPORT_ONLY_TOUCH) {\n\t Type = TouchInput;\n\t } else if (!SUPPORT_TOUCH) {\n\t Type = MouseInput;\n\t } else {\n\t Type = TouchMouseInput;\n\t }\n\t return new (Type)(manager, inputHandler);\n\t}\n\t\n\t/**\n\t * handle input events\n\t * @param {Manager} manager\n\t * @param {String} eventType\n\t * @param {Object} input\n\t */\n\tfunction inputHandler(manager, eventType, input) {\n\t var pointersLen = input.pointers.length;\n\t var changedPointersLen = input.changedPointers.length;\n\t var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n\t var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\t\n\t input.isFirst = !!isFirst;\n\t input.isFinal = !!isFinal;\n\t\n\t if (isFirst) {\n\t manager.session = {};\n\t }\n\t\n\t // source event is the normalized value of the domEvents\n\t // like 'touchstart, mouseup, pointerdown'\n\t input.eventType = eventType;\n\t\n\t // compute scale, rotation etc\n\t computeInputData(manager, input);\n\t\n\t // emit secret event\n\t manager.emit('hammer.input', input);\n\t\n\t manager.recognize(input);\n\t manager.session.prevInput = input;\n\t}\n\t\n\t/**\n\t * extend the data with some usable properties like scale, rotate, velocity etc\n\t * @param {Object} manager\n\t * @param {Object} input\n\t */\n\tfunction computeInputData(manager, input) {\n\t var session = manager.session;\n\t var pointers = input.pointers;\n\t var pointersLength = pointers.length;\n\t\n\t // store the first input to calculate the distance and direction\n\t if (!session.firstInput) {\n\t session.firstInput = simpleCloneInputData(input);\n\t }\n\t\n\t // to compute scale and rotation we need to store the multiple touches\n\t if (pointersLength > 1 && !session.firstMultiple) {\n\t session.firstMultiple = simpleCloneInputData(input);\n\t } else if (pointersLength === 1) {\n\t session.firstMultiple = false;\n\t }\n\t\n\t var firstInput = session.firstInput;\n\t var firstMultiple = session.firstMultiple;\n\t var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\t\n\t var center = input.center = getCenter(pointers);\n\t input.timeStamp = now();\n\t input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\t\n\t input.angle = getAngle(offsetCenter, center);\n\t input.distance = getDistance(offsetCenter, center);\n\t\n\t computeDeltaXY(session, input);\n\t input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\t\n\t var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n\t input.overallVelocityX = overallVelocity.x;\n\t input.overallVelocityY = overallVelocity.y;\n\t input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\t\n\t input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n\t input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\t\n\t input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n\t session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\t\n\t computeIntervalInputData(session, input);\n\t\n\t // find the correct target\n\t var target = manager.element;\n\t if (hasParent(input.srcEvent.target, target)) {\n\t target = input.srcEvent.target;\n\t }\n\t input.target = target;\n\t}\n\t\n\tfunction computeDeltaXY(session, input) {\n\t var center = input.center;\n\t var offset = session.offsetDelta || {};\n\t var prevDelta = session.prevDelta || {};\n\t var prevInput = session.prevInput || {};\n\t\n\t if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n\t prevDelta = session.prevDelta = {\n\t x: prevInput.deltaX || 0,\n\t y: prevInput.deltaY || 0\n\t };\n\t\n\t offset = session.offsetDelta = {\n\t x: center.x,\n\t y: center.y\n\t };\n\t }\n\t\n\t input.deltaX = prevDelta.x + (center.x - offset.x);\n\t input.deltaY = prevDelta.y + (center.y - offset.y);\n\t}\n\t\n\t/**\n\t * velocity is calculated every x ms\n\t * @param {Object} session\n\t * @param {Object} input\n\t */\n\tfunction computeIntervalInputData(session, input) {\n\t var last = session.lastInterval || input,\n\t deltaTime = input.timeStamp - last.timeStamp,\n\t velocity, velocityX, velocityY, direction;\n\t\n\t if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n\t var deltaX = input.deltaX - last.deltaX;\n\t var deltaY = input.deltaY - last.deltaY;\n\t\n\t var v = getVelocity(deltaTime, deltaX, deltaY);\n\t velocityX = v.x;\n\t velocityY = v.y;\n\t velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n\t direction = getDirection(deltaX, deltaY);\n\t\n\t session.lastInterval = input;\n\t } else {\n\t // use latest velocity info if it doesn't overtake a minimum period\n\t velocity = last.velocity;\n\t velocityX = last.velocityX;\n\t velocityY = last.velocityY;\n\t direction = last.direction;\n\t }\n\t\n\t input.velocity = velocity;\n\t input.velocityX = velocityX;\n\t input.velocityY = velocityY;\n\t input.direction = direction;\n\t}\n\t\n\t/**\n\t * create a simple clone from the input used for storage of firstInput and firstMultiple\n\t * @param {Object} input\n\t * @returns {Object} clonedInputData\n\t */\n\tfunction simpleCloneInputData(input) {\n\t // make a simple copy of the pointers because we will get a reference if we don't\n\t // we only need clientXY for the calculations\n\t var pointers = [];\n\t var i = 0;\n\t while (i < input.pointers.length) {\n\t pointers[i] = {\n\t clientX: round(input.pointers[i].clientX),\n\t clientY: round(input.pointers[i].clientY)\n\t };\n\t i++;\n\t }\n\t\n\t return {\n\t timeStamp: now(),\n\t pointers: pointers,\n\t center: getCenter(pointers),\n\t deltaX: input.deltaX,\n\t deltaY: input.deltaY\n\t };\n\t}\n\t\n\t/**\n\t * get the center of all the pointers\n\t * @param {Array} pointers\n\t * @return {Object} center contains `x` and `y` properties\n\t */\n\tfunction getCenter(pointers) {\n\t var pointersLength = pointers.length;\n\t\n\t // no need to loop when only one touch\n\t if (pointersLength === 1) {\n\t return {\n\t x: round(pointers[0].clientX),\n\t y: round(pointers[0].clientY)\n\t };\n\t }\n\t\n\t var x = 0, y = 0, i = 0;\n\t while (i < pointersLength) {\n\t x += pointers[i].clientX;\n\t y += pointers[i].clientY;\n\t i++;\n\t }\n\t\n\t return {\n\t x: round(x / pointersLength),\n\t y: round(y / pointersLength)\n\t };\n\t}\n\t\n\t/**\n\t * calculate the velocity between two points. unit is in px per ms.\n\t * @param {Number} deltaTime\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Object} velocity `x` and `y`\n\t */\n\tfunction getVelocity(deltaTime, x, y) {\n\t return {\n\t x: x / deltaTime || 0,\n\t y: y / deltaTime || 0\n\t };\n\t}\n\t\n\t/**\n\t * get the direction between two points\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Number} direction\n\t */\n\tfunction getDirection(x, y) {\n\t if (x === y) {\n\t return DIRECTION_NONE;\n\t }\n\t\n\t if (abs(x) >= abs(y)) {\n\t return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t }\n\t return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n\t}\n\t\n\t/**\n\t * calculate the absolute distance between two points\n\t * @param {Object} p1 {x, y}\n\t * @param {Object} p2 {x, y}\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} distance\n\t */\n\tfunction getDistance(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t\n\t return Math.sqrt((x * x) + (y * y));\n\t}\n\t\n\t/**\n\t * calculate the angle between two coordinates\n\t * @param {Object} p1\n\t * @param {Object} p2\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} angle\n\t */\n\tfunction getAngle(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t return Math.atan2(y, x) * 180 / Math.PI;\n\t}\n\t\n\t/**\n\t * calculate the rotation degrees between two pointersets\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} rotation\n\t */\n\tfunction getRotation(start, end) {\n\t return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n\t}\n\t\n\t/**\n\t * calculate the scale factor between two pointersets\n\t * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} scale\n\t */\n\tfunction getScale(start, end) {\n\t return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n\t}\n\t\n\tvar MOUSE_INPUT_MAP = {\n\t mousedown: INPUT_START,\n\t mousemove: INPUT_MOVE,\n\t mouseup: INPUT_END\n\t};\n\t\n\tvar MOUSE_ELEMENT_EVENTS = 'mousedown';\n\tvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\t\n\t/**\n\t * Mouse events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction MouseInput() {\n\t this.evEl = MOUSE_ELEMENT_EVENTS;\n\t this.evWin = MOUSE_WINDOW_EVENTS;\n\t\n\t this.allow = true; // used by Input.TouchMouse to disable mouse events\n\t this.pressed = false; // mousedown state\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(MouseInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function MEhandler(ev) {\n\t var eventType = MOUSE_INPUT_MAP[ev.type];\n\t\n\t // on start we want to have the left mouse button down\n\t if (eventType & INPUT_START && ev.button === 0) {\n\t this.pressed = true;\n\t }\n\t\n\t if (eventType & INPUT_MOVE && ev.which !== 1) {\n\t eventType = INPUT_END;\n\t }\n\t\n\t // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n\t if (!this.pressed || !this.allow) {\n\t return;\n\t }\n\t\n\t if (eventType & INPUT_END) {\n\t this.pressed = false;\n\t }\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: [ev],\n\t changedPointers: [ev],\n\t pointerType: INPUT_TYPE_MOUSE,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\tvar POINTER_INPUT_MAP = {\n\t pointerdown: INPUT_START,\n\t pointermove: INPUT_MOVE,\n\t pointerup: INPUT_END,\n\t pointercancel: INPUT_CANCEL,\n\t pointerout: INPUT_CANCEL\n\t};\n\t\n\t// in IE10 the pointer types is defined as an enum\n\tvar IE10_POINTER_TYPE_ENUM = {\n\t 2: INPUT_TYPE_TOUCH,\n\t 3: INPUT_TYPE_PEN,\n\t 4: INPUT_TYPE_MOUSE,\n\t 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\t};\n\t\n\tvar POINTER_ELEMENT_EVENTS = 'pointerdown';\n\tvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\t\n\t// IE10 has prefixed support, and case-sensitive\n\tif (window.MSPointerEvent && !window.PointerEvent) {\n\t POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n\t POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n\t}\n\t\n\t/**\n\t * Pointer events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction PointerEventInput() {\n\t this.evEl = POINTER_ELEMENT_EVENTS;\n\t this.evWin = POINTER_WINDOW_EVENTS;\n\t\n\t Input.apply(this, arguments);\n\t\n\t this.store = (this.manager.session.pointerEvents = []);\n\t}\n\t\n\tinherit(PointerEventInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function PEhandler(ev) {\n\t var store = this.store;\n\t var removePointer = false;\n\t\n\t var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n\t var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n\t var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\t\n\t var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\t\n\t // get index of the event in the store\n\t var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\t\n\t // start and mouse must be down\n\t if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n\t if (storeIndex < 0) {\n\t store.push(ev);\n\t storeIndex = store.length - 1;\n\t }\n\t } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n\t removePointer = true;\n\t }\n\t\n\t // it not found, so the pointer hasn't been down (so it's probably a hover)\n\t if (storeIndex < 0) {\n\t return;\n\t }\n\t\n\t // update the event in the store\n\t store[storeIndex] = ev;\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: store,\n\t changedPointers: [ev],\n\t pointerType: pointerType,\n\t srcEvent: ev\n\t });\n\t\n\t if (removePointer) {\n\t // remove from the store\n\t store.splice(storeIndex, 1);\n\t }\n\t }\n\t});\n\t\n\tvar SINGLE_TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n\tvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction SingleTouchInput() {\n\t this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n\t this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n\t this.started = false;\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(SingleTouchInput, Input, {\n\t handler: function TEhandler(ev) {\n\t var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\t\n\t // should we handle the touch events?\n\t if (type === INPUT_START) {\n\t this.started = true;\n\t }\n\t\n\t if (!this.started) {\n\t return;\n\t }\n\t\n\t var touches = normalizeSingleTouches.call(this, ev, type);\n\t\n\t // when done, reset the started state\n\t if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n\t this.started = false;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction normalizeSingleTouches(ev, type) {\n\t var all = toArray(ev.touches);\n\t var changed = toArray(ev.changedTouches);\n\t\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t all = uniqueArray(all.concat(changed), 'identifier', true);\n\t }\n\t\n\t return [all, changed];\n\t}\n\t\n\tvar TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Multi-user touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchInput() {\n\t this.evTarget = TOUCH_TARGET_EVENTS;\n\t this.targetIds = {};\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(TouchInput, Input, {\n\t handler: function MTEhandler(ev) {\n\t var type = TOUCH_INPUT_MAP[ev.type];\n\t var touches = getTouches.call(this, ev, type);\n\t if (!touches) {\n\t return;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction getTouches(ev, type) {\n\t var allTouches = toArray(ev.touches);\n\t var targetIds = this.targetIds;\n\t\n\t // when there is only one touch, the process can be simplified\n\t if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n\t targetIds[allTouches[0].identifier] = true;\n\t return [allTouches, allTouches];\n\t }\n\t\n\t var i,\n\t targetTouches,\n\t changedTouches = toArray(ev.changedTouches),\n\t changedTargetTouches = [],\n\t target = this.target;\n\t\n\t // get target touches from touches\n\t targetTouches = allTouches.filter(function(touch) {\n\t return hasParent(touch.target, target);\n\t });\n\t\n\t // collect touches\n\t if (type === INPUT_START) {\n\t i = 0;\n\t while (i < targetTouches.length) {\n\t targetIds[targetTouches[i].identifier] = true;\n\t i++;\n\t }\n\t }\n\t\n\t // filter changed touches to only contain touches that exist in the collected target ids\n\t i = 0;\n\t while (i < changedTouches.length) {\n\t if (targetIds[changedTouches[i].identifier]) {\n\t changedTargetTouches.push(changedTouches[i]);\n\t }\n\t\n\t // cleanup removed touches\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t delete targetIds[changedTouches[i].identifier];\n\t }\n\t i++;\n\t }\n\t\n\t if (!changedTargetTouches.length) {\n\t return;\n\t }\n\t\n\t return [\n\t // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n\t uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n\t changedTargetTouches\n\t ];\n\t}\n\t\n\t/**\n\t * Combined touch and mouse input\n\t *\n\t * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n\t * This because touch devices also emit mouse events while doing a touch.\n\t *\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchMouseInput() {\n\t Input.apply(this, arguments);\n\t\n\t var handler = bindFn(this.handler, this);\n\t this.touch = new TouchInput(this.manager, handler);\n\t this.mouse = new MouseInput(this.manager, handler);\n\t}\n\t\n\tinherit(TouchMouseInput, Input, {\n\t /**\n\t * handle mouse and touch events\n\t * @param {Hammer} manager\n\t * @param {String} inputEvent\n\t * @param {Object} inputData\n\t */\n\t handler: function TMEhandler(manager, inputEvent, inputData) {\n\t var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n\t isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\t\n\t // when we're in a touch event, so block all upcoming mouse events\n\t // most mobile browser also emit mouseevents, right after touchstart\n\t if (isTouch) {\n\t this.mouse.allow = false;\n\t } else if (isMouse && !this.mouse.allow) {\n\t return;\n\t }\n\t\n\t // reset the allowMouse when we're done\n\t if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n\t this.mouse.allow = true;\n\t }\n\t\n\t this.callback(manager, inputEvent, inputData);\n\t },\n\t\n\t /**\n\t * remove the event listeners\n\t */\n\t destroy: function destroy() {\n\t this.touch.destroy();\n\t this.mouse.destroy();\n\t }\n\t});\n\t\n\tvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n\tvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\t\n\t// magical touchAction value\n\tvar TOUCH_ACTION_COMPUTE = 'compute';\n\tvar TOUCH_ACTION_AUTO = 'auto';\n\tvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\tvar TOUCH_ACTION_NONE = 'none';\n\tvar TOUCH_ACTION_PAN_X = 'pan-x';\n\tvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\t\n\t/**\n\t * Touch Action\n\t * sets the touchAction property or uses the js alternative\n\t * @param {Manager} manager\n\t * @param {String} value\n\t * @constructor\n\t */\n\tfunction TouchAction(manager, value) {\n\t this.manager = manager;\n\t this.set(value);\n\t}\n\t\n\tTouchAction.prototype = {\n\t /**\n\t * set the touchAction value on the element or enable the polyfill\n\t * @param {String} value\n\t */\n\t set: function(value) {\n\t // find out the touch-action by the event handlers\n\t if (value == TOUCH_ACTION_COMPUTE) {\n\t value = this.compute();\n\t }\n\t\n\t if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n\t this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n\t }\n\t this.actions = value.toLowerCase().trim();\n\t },\n\t\n\t /**\n\t * just re-set the touchAction value\n\t */\n\t update: function() {\n\t this.set(this.manager.options.touchAction);\n\t },\n\t\n\t /**\n\t * compute the value for the touchAction property based on the recognizer's settings\n\t * @returns {String} value\n\t */\n\t compute: function() {\n\t var actions = [];\n\t each(this.manager.recognizers, function(recognizer) {\n\t if (boolOrFn(recognizer.options.enable, [recognizer])) {\n\t actions = actions.concat(recognizer.getTouchAction());\n\t }\n\t });\n\t return cleanTouchActions(actions.join(' '));\n\t },\n\t\n\t /**\n\t * this method is called on each input cycle and provides the preventing of the browser behavior\n\t * @param {Object} input\n\t */\n\t preventDefaults: function(input) {\n\t // not needed with native support for the touchAction property\n\t if (NATIVE_TOUCH_ACTION) {\n\t return;\n\t }\n\t\n\t var srcEvent = input.srcEvent;\n\t var direction = input.offsetDirection;\n\t\n\t // if the touch action did prevented once this session\n\t if (this.manager.session.prevented) {\n\t srcEvent.preventDefault();\n\t return;\n\t }\n\t\n\t var actions = this.actions;\n\t var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t\n\t if (hasNone) {\n\t //do not prevent defaults if this is a tap gesture\n\t\n\t var isTapPointer = input.pointers.length === 1;\n\t var isTapMovement = input.distance < 2;\n\t var isTapTouchTime = input.deltaTime < 250;\n\t\n\t if (isTapPointer && isTapMovement && isTapTouchTime) {\n\t return;\n\t }\n\t }\n\t\n\t if (hasPanX && hasPanY) {\n\t // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n\t return;\n\t }\n\t\n\t if (hasNone ||\n\t (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n\t (hasPanX && direction & DIRECTION_VERTICAL)) {\n\t return this.preventSrc(srcEvent);\n\t }\n\t },\n\t\n\t /**\n\t * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n\t * @param {Object} srcEvent\n\t */\n\t preventSrc: function(srcEvent) {\n\t this.manager.session.prevented = true;\n\t srcEvent.preventDefault();\n\t }\n\t};\n\t\n\t/**\n\t * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n\t * @param {String} actions\n\t * @returns {*}\n\t */\n\tfunction cleanTouchActions(actions) {\n\t // none\n\t if (inStr(actions, TOUCH_ACTION_NONE)) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t\n\t // if both pan-x and pan-y are set (different recognizers\n\t // for different directions, e.g. horizontal pan but vertical swipe?)\n\t // we need none (as otherwise with pan-x pan-y combined none of these\n\t // recognizers will work, since the browser would handle all panning\n\t if (hasPanX && hasPanY) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t // pan-x OR pan-y\n\t if (hasPanX || hasPanY) {\n\t return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n\t }\n\t\n\t // manipulation\n\t if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n\t return TOUCH_ACTION_MANIPULATION;\n\t }\n\t\n\t return TOUCH_ACTION_AUTO;\n\t}\n\t\n\t/**\n\t * Recognizer flow explained; *\n\t * All recognizers have the initial state of POSSIBLE when a input session starts.\n\t * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n\t * Example session for mouse-input: mousedown -> mousemove -> mouseup\n\t *\n\t * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n\t * which determines with state it should be.\n\t *\n\t * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n\t * POSSIBLE to give it another change on the next cycle.\n\t *\n\t * Possible\n\t * |\n\t * +-----+---------------+\n\t * | |\n\t * +-----+-----+ |\n\t * | | |\n\t * Failed Cancelled |\n\t * +-------+------+\n\t * | |\n\t * Recognized Began\n\t * |\n\t * Changed\n\t * |\n\t * Ended/Recognized\n\t */\n\tvar STATE_POSSIBLE = 1;\n\tvar STATE_BEGAN = 2;\n\tvar STATE_CHANGED = 4;\n\tvar STATE_ENDED = 8;\n\tvar STATE_RECOGNIZED = STATE_ENDED;\n\tvar STATE_CANCELLED = 16;\n\tvar STATE_FAILED = 32;\n\t\n\t/**\n\t * Recognizer\n\t * Every recognizer needs to extend from this class.\n\t * @constructor\n\t * @param {Object} options\n\t */\n\tfunction Recognizer(options) {\n\t this.options = assign({}, this.defaults, options || {});\n\t\n\t this.id = uniqueId();\n\t\n\t this.manager = null;\n\t\n\t // default is enable true\n\t this.options.enable = ifUndefined(this.options.enable, true);\n\t\n\t this.state = STATE_POSSIBLE;\n\t\n\t this.simultaneous = {};\n\t this.requireFail = [];\n\t}\n\t\n\tRecognizer.prototype = {\n\t /**\n\t * @virtual\n\t * @type {Object}\n\t */\n\t defaults: {},\n\t\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @return {Recognizer}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // also update the touchAction, in case something changed about the directions/enabled state\n\t this.manager && this.manager.touchAction.update();\n\t return this;\n\t },\n\t\n\t /**\n\t * recognize simultaneous with an other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t recognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t var simultaneous = this.simultaneous;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (!simultaneous[otherRecognizer.id]) {\n\t simultaneous[otherRecognizer.id] = otherRecognizer;\n\t otherRecognizer.recognizeWith(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRecognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t delete this.simultaneous[otherRecognizer.id];\n\t return this;\n\t },\n\t\n\t /**\n\t * recognizer can only run when an other is failing\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t requireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n\t return this;\n\t }\n\t\n\t var requireFail = this.requireFail;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (inArray(requireFail, otherRecognizer) === -1) {\n\t requireFail.push(otherRecognizer);\n\t otherRecognizer.requireFailure(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the requireFailure link. it does not remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRequireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t var index = inArray(this.requireFail, otherRecognizer);\n\t if (index > -1) {\n\t this.requireFail.splice(index, 1);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * has require failures boolean\n\t * @returns {boolean}\n\t */\n\t hasRequireFailures: function() {\n\t return this.requireFail.length > 0;\n\t },\n\t\n\t /**\n\t * if the recognizer can recognize simultaneous with an other recognizer\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Boolean}\n\t */\n\t canRecognizeWith: function(otherRecognizer) {\n\t return !!this.simultaneous[otherRecognizer.id];\n\t },\n\t\n\t /**\n\t * You should use `tryEmit` instead of `emit` directly to check\n\t * that all the needed recognizers has failed before emitting.\n\t * @param {Object} input\n\t */\n\t emit: function(input) {\n\t var self = this;\n\t var state = this.state;\n\t\n\t function emit(event) {\n\t self.manager.emit(event, input);\n\t }\n\t\n\t // 'panstart' and 'panmove'\n\t if (state < STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t\n\t emit(self.options.event); // simple 'eventName' events\n\t\n\t if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n\t emit(input.additionalEvent);\n\t }\n\t\n\t // panend and pancancel\n\t if (state >= STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t },\n\t\n\t /**\n\t * Check that all the require failure recognizers has failed,\n\t * if true, it emits a gesture event,\n\t * otherwise, setup the state to FAILED.\n\t * @param {Object} input\n\t */\n\t tryEmit: function(input) {\n\t if (this.canEmit()) {\n\t return this.emit(input);\n\t }\n\t // it's failing anyway\n\t this.state = STATE_FAILED;\n\t },\n\t\n\t /**\n\t * can we emit?\n\t * @returns {boolean}\n\t */\n\t canEmit: function() {\n\t var i = 0;\n\t while (i < this.requireFail.length) {\n\t if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n\t return false;\n\t }\n\t i++;\n\t }\n\t return true;\n\t },\n\t\n\t /**\n\t * update the recognizer\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t // make a new copy of the inputData\n\t // so we can change the inputData without messing up the other recognizers\n\t var inputDataClone = assign({}, inputData);\n\t\n\t // is is enabled and allow recognizing?\n\t if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n\t this.reset();\n\t this.state = STATE_FAILED;\n\t return;\n\t }\n\t\n\t // reset when we've reached the end\n\t if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n\t this.state = STATE_POSSIBLE;\n\t }\n\t\n\t this.state = this.process(inputDataClone);\n\t\n\t // the recognizer has recognized a gesture\n\t // so trigger an event\n\t if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n\t this.tryEmit(inputDataClone);\n\t }\n\t },\n\t\n\t /**\n\t * return the state of the recognizer\n\t * the actual recognizing happens in this method\n\t * @virtual\n\t * @param {Object} inputData\n\t * @returns {Const} STATE\n\t */\n\t process: function(inputData) { }, // jshint ignore:line\n\t\n\t /**\n\t * return the preferred touch-action\n\t * @virtual\n\t * @returns {Array}\n\t */\n\t getTouchAction: function() { },\n\t\n\t /**\n\t * called when the gesture isn't allowed to recognize\n\t * like when another is being recognized or it is disabled\n\t * @virtual\n\t */\n\t reset: function() { }\n\t};\n\t\n\t/**\n\t * get a usable string, used as event postfix\n\t * @param {Const} state\n\t * @returns {String} state\n\t */\n\tfunction stateStr(state) {\n\t if (state & STATE_CANCELLED) {\n\t return 'cancel';\n\t } else if (state & STATE_ENDED) {\n\t return 'end';\n\t } else if (state & STATE_CHANGED) {\n\t return 'move';\n\t } else if (state & STATE_BEGAN) {\n\t return 'start';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * direction cons to string\n\t * @param {Const} direction\n\t * @returns {String}\n\t */\n\tfunction directionStr(direction) {\n\t if (direction == DIRECTION_DOWN) {\n\t return 'down';\n\t } else if (direction == DIRECTION_UP) {\n\t return 'up';\n\t } else if (direction == DIRECTION_LEFT) {\n\t return 'left';\n\t } else if (direction == DIRECTION_RIGHT) {\n\t return 'right';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * get a recognizer by name if it is bound to a manager\n\t * @param {Recognizer|String} otherRecognizer\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer}\n\t */\n\tfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n\t var manager = recognizer.manager;\n\t if (manager) {\n\t return manager.get(otherRecognizer);\n\t }\n\t return otherRecognizer;\n\t}\n\t\n\t/**\n\t * This recognizer is just used as a base for the simple attribute recognizers.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction AttrRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(AttrRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof AttrRecognizer\n\t */\n\t defaults: {\n\t /**\n\t * @type {Number}\n\t * @default 1\n\t */\n\t pointers: 1\n\t },\n\t\n\t /**\n\t * Used to check if it the recognizer receives valid input, like input.distance > 10.\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {Boolean} recognized\n\t */\n\t attrTest: function(input) {\n\t var optionPointers = this.options.pointers;\n\t return optionPointers === 0 || input.pointers.length === optionPointers;\n\t },\n\t\n\t /**\n\t * Process the input and return the state for the recognizer\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {*} State\n\t */\n\t process: function(input) {\n\t var state = this.state;\n\t var eventType = input.eventType;\n\t\n\t var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n\t var isValid = this.attrTest(input);\n\t\n\t // on cancel input and we've recognized before, return STATE_CANCELLED\n\t if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n\t return state | STATE_CANCELLED;\n\t } else if (isRecognized || isValid) {\n\t if (eventType & INPUT_END) {\n\t return state | STATE_ENDED;\n\t } else if (!(state & STATE_BEGAN)) {\n\t return STATE_BEGAN;\n\t }\n\t return state | STATE_CHANGED;\n\t }\n\t return STATE_FAILED;\n\t }\n\t});\n\t\n\t/**\n\t * Pan\n\t * Recognized when the pointer is down and moved in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PanRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t\n\t this.pX = null;\n\t this.pY = null;\n\t}\n\t\n\tinherit(PanRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PanRecognizer\n\t */\n\t defaults: {\n\t event: 'pan',\n\t threshold: 10,\n\t pointers: 1,\n\t direction: DIRECTION_ALL\n\t },\n\t\n\t getTouchAction: function() {\n\t var direction = this.options.direction;\n\t var actions = [];\n\t if (direction & DIRECTION_HORIZONTAL) {\n\t actions.push(TOUCH_ACTION_PAN_Y);\n\t }\n\t if (direction & DIRECTION_VERTICAL) {\n\t actions.push(TOUCH_ACTION_PAN_X);\n\t }\n\t return actions;\n\t },\n\t\n\t directionTest: function(input) {\n\t var options = this.options;\n\t var hasMoved = true;\n\t var distance = input.distance;\n\t var direction = input.direction;\n\t var x = input.deltaX;\n\t var y = input.deltaY;\n\t\n\t // lock to axis?\n\t if (!(direction & options.direction)) {\n\t if (options.direction & DIRECTION_HORIZONTAL) {\n\t direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t hasMoved = x != this.pX;\n\t distance = Math.abs(input.deltaX);\n\t } else {\n\t direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n\t hasMoved = y != this.pY;\n\t distance = Math.abs(input.deltaY);\n\t }\n\t }\n\t input.direction = direction;\n\t return hasMoved && distance > options.threshold && direction & options.direction;\n\t },\n\t\n\t attrTest: function(input) {\n\t return AttrRecognizer.prototype.attrTest.call(this, input) &&\n\t (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n\t },\n\t\n\t emit: function(input) {\n\t\n\t this.pX = input.deltaX;\n\t this.pY = input.deltaY;\n\t\n\t var direction = directionStr(input.direction);\n\t\n\t if (direction) {\n\t input.additionalEvent = this.options.event + direction;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Pinch\n\t * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PinchRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(PinchRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'pinch',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n\t },\n\t\n\t emit: function(input) {\n\t if (input.scale !== 1) {\n\t var inOut = input.scale < 1 ? 'in' : 'out';\n\t input.additionalEvent = this.options.event + inOut;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Press\n\t * Recognized when the pointer is down for x ms without any movement.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction PressRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t this._timer = null;\n\t this._input = null;\n\t}\n\t\n\tinherit(PressRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PressRecognizer\n\t */\n\t defaults: {\n\t event: 'press',\n\t pointers: 1,\n\t time: 251, // minimal time of the pointer to be pressed\n\t threshold: 9 // a minimal movement is ok, but keep it low\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_AUTO];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTime = input.deltaTime > options.time;\n\t\n\t this._input = input;\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n\t this.reset();\n\t } else if (input.eventType & INPUT_START) {\n\t this.reset();\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.time, this);\n\t } else if (input.eventType & INPUT_END) {\n\t return STATE_RECOGNIZED;\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function(input) {\n\t if (this.state !== STATE_RECOGNIZED) {\n\t return;\n\t }\n\t\n\t if (input && (input.eventType & INPUT_END)) {\n\t this.manager.emit(this.options.event + 'up', input);\n\t } else {\n\t this._input.timeStamp = now();\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Rotate\n\t * Recognized when two or more pointer are moving in a circular motion.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction RotateRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(RotateRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof RotateRecognizer\n\t */\n\t defaults: {\n\t event: 'rotate',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n\t }\n\t});\n\t\n\t/**\n\t * Swipe\n\t * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction SwipeRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(SwipeRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof SwipeRecognizer\n\t */\n\t defaults: {\n\t event: 'swipe',\n\t threshold: 10,\n\t velocity: 0.3,\n\t direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n\t pointers: 1\n\t },\n\t\n\t getTouchAction: function() {\n\t return PanRecognizer.prototype.getTouchAction.call(this);\n\t },\n\t\n\t attrTest: function(input) {\n\t var direction = this.options.direction;\n\t var velocity;\n\t\n\t if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n\t velocity = input.overallVelocity;\n\t } else if (direction & DIRECTION_HORIZONTAL) {\n\t velocity = input.overallVelocityX;\n\t } else if (direction & DIRECTION_VERTICAL) {\n\t velocity = input.overallVelocityY;\n\t }\n\t\n\t return this._super.attrTest.call(this, input) &&\n\t direction & input.offsetDirection &&\n\t input.distance > this.options.threshold &&\n\t input.maxPointers == this.options.pointers &&\n\t abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n\t },\n\t\n\t emit: function(input) {\n\t var direction = directionStr(input.offsetDirection);\n\t if (direction) {\n\t this.manager.emit(this.options.event + direction, input);\n\t }\n\t\n\t this.manager.emit(this.options.event, input);\n\t }\n\t});\n\t\n\t/**\n\t * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n\t * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n\t * a single tap.\n\t *\n\t * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n\t * multi-taps being recognized.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction TapRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t // previous time and center,\n\t // used for tap counting\n\t this.pTime = false;\n\t this.pCenter = false;\n\t\n\t this._timer = null;\n\t this._input = null;\n\t this.count = 0;\n\t}\n\t\n\tinherit(TapRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'tap',\n\t pointers: 1,\n\t taps: 1,\n\t interval: 300, // max time between the multi-tap taps\n\t time: 250, // max time of the pointer to be down (like finger on the screen)\n\t threshold: 9, // a minimal movement is ok, but keep it low\n\t posThreshold: 10 // a multi-tap can be a bit off the initial position\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_MANIPULATION];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTouchTime = input.deltaTime < options.time;\n\t\n\t this.reset();\n\t\n\t if ((input.eventType & INPUT_START) && (this.count === 0)) {\n\t return this.failTimeout();\n\t }\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (validMovement && validTouchTime && validPointers) {\n\t if (input.eventType != INPUT_END) {\n\t return this.failTimeout();\n\t }\n\t\n\t var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n\t var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\t\n\t this.pTime = input.timeStamp;\n\t this.pCenter = input.center;\n\t\n\t if (!validMultiTap || !validInterval) {\n\t this.count = 1;\n\t } else {\n\t this.count += 1;\n\t }\n\t\n\t this._input = input;\n\t\n\t // if tap count matches we have recognized it,\n\t // else it has began recognizing...\n\t var tapCount = this.count % options.taps;\n\t if (tapCount === 0) {\n\t // no failing requirements, immediately trigger the tap event\n\t // or wait as long as the multitap interval to trigger\n\t if (!this.hasRequireFailures()) {\n\t return STATE_RECOGNIZED;\n\t } else {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.interval, this);\n\t return STATE_BEGAN;\n\t }\n\t }\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t failTimeout: function() {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_FAILED;\n\t }, this.options.interval, this);\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function() {\n\t if (this.state == STATE_RECOGNIZED) {\n\t this._input.tapCount = this.count;\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Simple way to create a manager with a default set of recognizers.\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Hammer(element, options) {\n\t options = options || {};\n\t options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n\t return new Manager(element, options);\n\t}\n\t\n\t/**\n\t * @const {string}\n\t */\n\tHammer.VERSION = '2.0.6';\n\t\n\t/**\n\t * default settings\n\t * @namespace\n\t */\n\tHammer.defaults = {\n\t /**\n\t * set if DOM events are being triggered.\n\t * But this is slower and unused by simple implementations, so disabled by default.\n\t * @type {Boolean}\n\t * @default false\n\t */\n\t domEvents: false,\n\t\n\t /**\n\t * The value for the touchAction property/fallback.\n\t * When set to `compute` it will magically set the correct value based on the added recognizers.\n\t * @type {String}\n\t * @default compute\n\t */\n\t touchAction: TOUCH_ACTION_COMPUTE,\n\t\n\t /**\n\t * @type {Boolean}\n\t * @default true\n\t */\n\t enable: true,\n\t\n\t /**\n\t * EXPERIMENTAL FEATURE -- can be removed/changed\n\t * Change the parent input target element.\n\t * If Null, then it is being set the to main element.\n\t * @type {Null|EventTarget}\n\t * @default null\n\t */\n\t inputTarget: null,\n\t\n\t /**\n\t * force an input class\n\t * @type {Null|Function}\n\t * @default null\n\t */\n\t inputClass: null,\n\t\n\t /**\n\t * Default recognizer setup when calling `Hammer()`\n\t * When creating a new Manager these will be skipped.\n\t * @type {Array}\n\t */\n\t preset: [\n\t // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n\t [RotateRecognizer, {enable: false}],\n\t [PinchRecognizer, {enable: false}, ['rotate']],\n\t [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n\t [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n\t [TapRecognizer],\n\t [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n\t [PressRecognizer]\n\t ],\n\t\n\t /**\n\t * Some CSS properties can be used to improve the working of Hammer.\n\t * Add them to this method and they will be set when creating a new Manager.\n\t * @namespace\n\t */\n\t cssProps: {\n\t /**\n\t * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userSelect: 'none',\n\t\n\t /**\n\t * Disable the Windows Phone grippers when pressing an element.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchSelect: 'none',\n\t\n\t /**\n\t * Disables the default callout shown when you touch and hold a touch target.\n\t * On iOS, when you touch and hold a touch target such as a link, Safari displays\n\t * a callout containing information about the link. This property allows you to disable that callout.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchCallout: 'none',\n\t\n\t /**\n\t * Specifies whether zooming is enabled. Used by IE10>\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t contentZooming: 'none',\n\t\n\t /**\n\t * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userDrag: 'none',\n\t\n\t /**\n\t * Overrides the highlight color shown when the user taps a link or a JavaScript\n\t * clickable element in iOS. This property obeys the alpha value, if specified.\n\t * @type {String}\n\t * @default 'rgba(0,0,0,0)'\n\t */\n\t tapHighlightColor: 'rgba(0,0,0,0)'\n\t }\n\t};\n\t\n\tvar STOP = 1;\n\tvar FORCED_STOP = 2;\n\t\n\t/**\n\t * Manager\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Manager(element, options) {\n\t this.options = assign({}, Hammer.defaults, options || {});\n\t\n\t this.options.inputTarget = this.options.inputTarget || element;\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.recognizers = [];\n\t\n\t this.element = element;\n\t this.input = createInputInstance(this);\n\t this.touchAction = new TouchAction(this, this.options.touchAction);\n\t\n\t toggleCssProps(this, true);\n\t\n\t each(this.options.recognizers, function(item) {\n\t var recognizer = this.add(new (item[0])(item[1]));\n\t item[2] && recognizer.recognizeWith(item[2]);\n\t item[3] && recognizer.requireFailure(item[3]);\n\t }, this);\n\t}\n\t\n\tManager.prototype = {\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @returns {Manager}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // Options that need a little more setup\n\t if (options.touchAction) {\n\t this.touchAction.update();\n\t }\n\t if (options.inputTarget) {\n\t // Clean up existing event listeners and reinitialize\n\t this.input.destroy();\n\t this.input.target = options.inputTarget;\n\t this.input.init();\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * stop recognizing for this session.\n\t * This session will be discarded, when a new [input]start event is fired.\n\t * When forced, the recognizer cycle is stopped immediately.\n\t * @param {Boolean} [force]\n\t */\n\t stop: function(force) {\n\t this.session.stopped = force ? FORCED_STOP : STOP;\n\t },\n\t\n\t /**\n\t * run the recognizers!\n\t * called by the inputHandler function on every movement of the pointers (touches)\n\t * it walks through all the recognizers and tries to detect the gesture that is being made\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t var session = this.session;\n\t if (session.stopped) {\n\t return;\n\t }\n\t\n\t // run the touch-action polyfill\n\t this.touchAction.preventDefaults(inputData);\n\t\n\t var recognizer;\n\t var recognizers = this.recognizers;\n\t\n\t // this holds the recognizer that is being recognized.\n\t // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n\t // if no recognizer is detecting a thing, it is set to `null`\n\t var curRecognizer = session.curRecognizer;\n\t\n\t // reset when the last recognizer is recognized\n\t // or when we're in a new session\n\t if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n\t curRecognizer = session.curRecognizer = null;\n\t }\n\t\n\t var i = 0;\n\t while (i < recognizers.length) {\n\t recognizer = recognizers[i];\n\t\n\t // find out if we are allowed try to recognize the input for this one.\n\t // 1. allow if the session is NOT forced stopped (see the .stop() method)\n\t // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n\t // that is being recognized.\n\t // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n\t // this can be setup with the `recognizeWith()` method on the recognizer.\n\t if (session.stopped !== FORCED_STOP && ( // 1\n\t !curRecognizer || recognizer == curRecognizer || // 2\n\t recognizer.canRecognizeWith(curRecognizer))) { // 3\n\t recognizer.recognize(inputData);\n\t } else {\n\t recognizer.reset();\n\t }\n\t\n\t // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n\t // current active recognizer. but only if we don't already have an active recognizer\n\t if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n\t curRecognizer = session.curRecognizer = recognizer;\n\t }\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * get a recognizer by its event name.\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Recognizer|Null}\n\t */\n\t get: function(recognizer) {\n\t if (recognizer instanceof Recognizer) {\n\t return recognizer;\n\t }\n\t\n\t var recognizers = this.recognizers;\n\t for (var i = 0; i < recognizers.length; i++) {\n\t if (recognizers[i].options.event == recognizer) {\n\t return recognizers[i];\n\t }\n\t }\n\t return null;\n\t },\n\t\n\t /**\n\t * add a recognizer to the manager\n\t * existing recognizers with the same event name will be removed\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer|Manager}\n\t */\n\t add: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'add', this)) {\n\t return this;\n\t }\n\t\n\t // remove existing\n\t var existing = this.get(recognizer.options.event);\n\t if (existing) {\n\t this.remove(existing);\n\t }\n\t\n\t this.recognizers.push(recognizer);\n\t recognizer.manager = this;\n\t\n\t this.touchAction.update();\n\t return recognizer;\n\t },\n\t\n\t /**\n\t * remove a recognizer by name or instance\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Manager}\n\t */\n\t remove: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'remove', this)) {\n\t return this;\n\t }\n\t\n\t recognizer = this.get(recognizer);\n\t\n\t // let's make sure this recognizer exists\n\t if (recognizer) {\n\t var recognizers = this.recognizers;\n\t var index = inArray(recognizers, recognizer);\n\t\n\t if (index !== -1) {\n\t recognizers.splice(index, 1);\n\t this.touchAction.update();\n\t }\n\t }\n\t\n\t return this;\n\t },\n\t\n\t /**\n\t * bind event\n\t * @param {String} events\n\t * @param {Function} handler\n\t * @returns {EventEmitter} this\n\t */\n\t on: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t handlers[event] = handlers[event] || [];\n\t handlers[event].push(handler);\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * unbind event, leave emit blank to remove all handlers\n\t * @param {String} events\n\t * @param {Function} [handler]\n\t * @returns {EventEmitter} this\n\t */\n\t off: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t if (!handler) {\n\t delete handlers[event];\n\t } else {\n\t handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * emit event to the listeners\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\t emit: function(event, data) {\n\t // we also want to trigger dom events\n\t if (this.options.domEvents) {\n\t triggerDomEvent(event, data);\n\t }\n\t\n\t // no handlers, so skip it all\n\t var handlers = this.handlers[event] && this.handlers[event].slice();\n\t if (!handlers || !handlers.length) {\n\t return;\n\t }\n\t\n\t data.type = event;\n\t data.preventDefault = function() {\n\t data.srcEvent.preventDefault();\n\t };\n\t\n\t var i = 0;\n\t while (i < handlers.length) {\n\t handlers[i](data);\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * destroy the manager and unbinds all events\n\t * it doesn't unbind dom events, that is the user own responsibility\n\t */\n\t destroy: function() {\n\t this.element && toggleCssProps(this, false);\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.input.destroy();\n\t this.element = null;\n\t }\n\t};\n\t\n\t/**\n\t * add/remove the css properties as defined in manager.options.cssProps\n\t * @param {Manager} manager\n\t * @param {Boolean} add\n\t */\n\tfunction toggleCssProps(manager, add) {\n\t var element = manager.element;\n\t if (!element.style) {\n\t return;\n\t }\n\t each(manager.options.cssProps, function(value, name) {\n\t element.style[prefixed(element.style, name)] = add ? value : '';\n\t });\n\t}\n\t\n\t/**\n\t * trigger dom event\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\tfunction triggerDomEvent(event, data) {\n\t var gestureEvent = document.createEvent('Event');\n\t gestureEvent.initEvent(event, true, true);\n\t gestureEvent.gesture = data;\n\t data.target.dispatchEvent(gestureEvent);\n\t}\n\t\n\tassign(Hammer, {\n\t INPUT_START: INPUT_START,\n\t INPUT_MOVE: INPUT_MOVE,\n\t INPUT_END: INPUT_END,\n\t INPUT_CANCEL: INPUT_CANCEL,\n\t\n\t STATE_POSSIBLE: STATE_POSSIBLE,\n\t STATE_BEGAN: STATE_BEGAN,\n\t STATE_CHANGED: STATE_CHANGED,\n\t STATE_ENDED: STATE_ENDED,\n\t STATE_RECOGNIZED: STATE_RECOGNIZED,\n\t STATE_CANCELLED: STATE_CANCELLED,\n\t STATE_FAILED: STATE_FAILED,\n\t\n\t DIRECTION_NONE: DIRECTION_NONE,\n\t DIRECTION_LEFT: DIRECTION_LEFT,\n\t DIRECTION_RIGHT: DIRECTION_RIGHT,\n\t DIRECTION_UP: DIRECTION_UP,\n\t DIRECTION_DOWN: DIRECTION_DOWN,\n\t DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n\t DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n\t DIRECTION_ALL: DIRECTION_ALL,\n\t\n\t Manager: Manager,\n\t Input: Input,\n\t TouchAction: TouchAction,\n\t\n\t TouchInput: TouchInput,\n\t MouseInput: MouseInput,\n\t PointerEventInput: PointerEventInput,\n\t TouchMouseInput: TouchMouseInput,\n\t SingleTouchInput: SingleTouchInput,\n\t\n\t Recognizer: Recognizer,\n\t AttrRecognizer: AttrRecognizer,\n\t Tap: TapRecognizer,\n\t Pan: PanRecognizer,\n\t Swipe: SwipeRecognizer,\n\t Pinch: PinchRecognizer,\n\t Rotate: RotateRecognizer,\n\t Press: PressRecognizer,\n\t\n\t on: addEventListeners,\n\t off: removeEventListeners,\n\t each: each,\n\t merge: merge,\n\t extend: extend,\n\t assign: assign,\n\t inherit: inherit,\n\t bindFn: bindFn,\n\t prefixed: prefixed\n\t});\n\t\n\t// this prevents errors when Hammer is loaded in the presence of an AMD\n\t// style loader but by script tag, not by the loader.\n\tvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\n\tfreeGlobal.Hammer = Hammer;\n\t\n\tif (true) {\n\t !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t return Hammer;\n\t }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else if (typeof module != 'undefined' && module.exports) {\n\t module.exports = Hammer;\n\t} else {\n\t window[exportName] = Hammer;\n\t}\n\t\n\t})(window, document, 'Hammer');\n\n\n/***/ },\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(47);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _ImageTile = __webpack_require__(57);\n\t\n\tvar _ImageTile2 = _interopRequireDefault(_ImageTile);\n\t\n\tvar _ImageTileLayerBaseMaterial = __webpack_require__(60);\n\t\n\tvar _ImageTileLayerBaseMaterial2 = _interopRequireDefault(_ImageTileLayerBaseMaterial);\n\t\n\tvar _lodashThrottle = __webpack_require__(40);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n\t// being removed and the new tiles being ready for display\n\t//\n\t// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n\t// of the basemap ground so it blends in a little more, or have a huge ground\n\t// plane underneath all the tiles that shows through between tile updates.\n\t//\n\t// Could keep the old tiles around until the new ones are ready, though they'd\n\t// probably need to be layered in a way so the old tiles don't overlap new ones,\n\t// which is similar to how Leaflet approaches this (it has 2 layers)\n\t//\n\t// Could keep the tile from the previous quadtree level visible until all 4\n\t// tiles at the new / current level have finished loading and are displayed.\n\t// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n\t// child quadcodes showing whether they are loaded and in view. If all true then\n\t// remove the parent tile, otherwise keep it on a lower layer.\n\t\n\t// TODO: Load and display a base layer separate to the LOD grid that is at a low\n\t// resolution – used as a backup / background to fill in empty areas / distance\n\t\n\t// DONE: Fix the issue where some tiles just don't load, or at least the texture\n\t// never shows up – tends to happen if you quickly zoom in / out past it while\n\t// it's still loading, leaving a blank space\n\t\n\t// TODO: Optimise the request of many image tiles – look at how Leaflet and\n\t// OpenWebGlobe approach this (eg. batching, queues, etc)\n\t\n\t// TODO: Cancel pending tile requests if they get removed from view before they\n\t// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n\t// images are re-requested when the tile is next in scene (even if from cache)\n\t\n\t// TODO: Consider not performing an LOD calculation on every frame, instead only\n\t// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n\t// possible for performance to tank if you pan, orbit or zoom rapidly while all\n\t// the LOD calculations are being made and new tiles requested.\n\t//\n\t// Pending tiles should continue to be requested and output to the scene on each\n\t// frame, but no new LOD calculations should be made.\n\t\n\t// This tile layer both updates the quadtree and outputs tiles on every frame\n\t// (throttled to some amount)\n\t//\n\t// This is because the computational complexity of image tiles is generally low\n\t// and so there isn't much jank when running these calculations and outputs in\n\t// realtime\n\t//\n\t// The benefit to doing this is that the underlying map layer continues to\n\t// refresh and update during movement, which is an arguably better experience\n\t\n\tvar ImageTileLayer = (function (_TileLayer) {\n\t _inherits(ImageTileLayer, _TileLayer);\n\t\n\t function ImageTileLayer(path, options) {\n\t _classCallCheck(this, ImageTileLayer);\n\t\n\t var defaults = {\n\t distance: 40000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(ImageTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Add base layer\n\t var geom = new _three2['default'].PlaneBufferGeometry(200000, 200000, 1);\n\t\n\t var baseMaterial;\n\t if (this._world._environment._skybox) {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n\t } else {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3');\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geom, baseMaterial);\n\t mesh.renderOrder = 0;\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t // TODO: It might be overkill to receive a shadow on the base layer as it's\n\t // rarely seen (good to have if performance difference is negligible)\n\t mesh.receiveShadow = true;\n\t\n\t this._baseLayer = mesh;\n\t this.add(mesh);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t this._calculateLOD();\n\t this._outputTiles();\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._moveBaseLayer(point);\n\t }\n\t }, {\n\t key: '_moveBaseLayer',\n\t value: function _moveBaseLayer(point) {\n\t this._baseLayer.position.x = point.x;\n\t this._baseLayer.position.z = point.y;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t return new _ImageTile2['default'](quadcode, this._path, layer);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Dispose of mesh and materials\n\t this._baseLayer.geometry.dispose();\n\t this._baseLayer.geometry = null;\n\t\n\t if (this._baseLayer.material.map) {\n\t this._baseLayer.material.map.dispose();\n\t this._baseLayer.material.map = null;\n\t }\n\t\n\t this._baseLayer.material.dispose();\n\t this._baseLayer.material = null;\n\t\n\t this._baseLayer = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return ImageTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = ImageTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new ImageTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTileLayer = noNew;\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _TileCache = __webpack_require__(48);\n\t\n\tvar _TileCache2 = _interopRequireDefault(_TileCache);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Consider removing picking from TileLayer instances as there aren't\n\t// (m)any situations where it would be practical\n\t//\n\t// For example, how would you even know what picking IDs to listen to and what\n\t// to do with them?\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider keeping a single TileLayer / LOD instance running by default\n\t// that keeps a standard LOD grid for other layers to utilise, rather than\n\t// having to create their own, unique LOD grid and duplicate calculations when\n\t// they're going to use the same grid setup anyway\n\t//\n\t// It still makes sense to be able to have a custom LOD grid for some layers as\n\t// they may want to customise things, maybe not even using a quadtree at all!\n\t//\n\t// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n\t// pass in the necessary parameters each time for the calculation step.\n\t//\n\t// Either way, it seems silly to force layers to have to create a new LOD grid\n\t// each time and create extra, duplicated processing every frame.\n\t\n\t// TODO: Allow passing in of options to define min/max LOD and a distance to use\n\t// for culling tiles beyond that distance.\n\t\n\t// DONE: Prevent tiles from being loaded if they are further than a certain\n\t// distance from the camera and are unlikely to be seen anyway\n\t\n\t// TODO: Avoid performing LOD calculation when it isn't required. For example,\n\t// when nothing has changed since the last frame and there are no tiles to be\n\t// loaded or in need of rendering\n\t\n\t// TODO: Only remove tiles from the layer that aren't to be rendered in the\n\t// current frame – it seems excessive to remove all tiles and re-add them on\n\t// every single frame, even if it's just array manipulation\n\t\n\t// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n\t// problems (eg. making min above 5 causes all sorts of issues)\n\t\n\t// TODO: Reuse THREE objects where possible instead of creating new instances\n\t// on every LOD calculation\n\t\n\t// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n\t// to avoid creating unnecessary memory for garbage collection\n\t\n\t// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n\t// closest to the camera) so visual inconsistancies during loading are minimised\n\t\n\tvar TileLayer = (function (_Layer) {\n\t _inherits(TileLayer, _Layer);\n\t\n\t function TileLayer(options) {\n\t var _this = this;\n\t\n\t _classCallCheck(this, TileLayer);\n\t\n\t var defaults = {\n\t picking: false,\n\t maxCache: 1000,\n\t maxLOD: 18\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._tileCache = new _TileCache2['default'](this._options.maxCache, function (tile) {\n\t _this._destroyTile(tile);\n\t });\n\t\n\t // List of tiles from the previous LOD calculation\n\t this._tileList = [];\n\t\n\t // TODO: Work out why changing the minLOD causes loads of issues\n\t this._minLOD = 3;\n\t this._maxLOD = this._options.maxLOD;\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t this._tiles = new _three2['default'].Object3D();\n\t this._tilesPicking = new _three2['default'].Object3D();\n\t }\n\t\n\t _createClass(TileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this.addToPicking(this._tilesPicking);\n\t this.add(this._tiles);\n\t }\n\t }, {\n\t key: '_updateFrustum',\n\t value: function _updateFrustum() {\n\t var camera = this._world.getCamera();\n\t var projScreenMatrix = new _three2['default'].Matrix4();\n\t projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\t\n\t this._frustum.setFromMatrix(camera.projectionMatrix);\n\t this._frustum.setFromMatrix(new _three2['default'].Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n\t }\n\t }, {\n\t key: '_tileInFrustum',\n\t value: function _tileInFrustum(tile) {\n\t var bounds = tile.getBounds();\n\t return this._frustum.intersectsBox(new _three2['default'].Box3(new _three2['default'].Vector3(bounds[0], 0, bounds[3]), new _three2['default'].Vector3(bounds[2], 0, bounds[1])));\n\t }\n\t\n\t // Update and output tiles from the previous LOD checklist\n\t }, {\n\t key: '_outputTiles',\n\t value: function _outputTiles() {\n\t var _this2 = this;\n\t\n\t if (!this._tiles) {\n\t return;\n\t }\n\t\n\t // Remove all tiles from layer\n\t this._removeTiles();\n\t\n\t // Add / re-add tiles\n\t this._tileList.forEach(function (tile) {\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t if (!tile.isReady()) {\n\t return;\n\t }\n\t\n\t // Add tile to layer (and to scene) if not already there\n\t _this2._tiles.add(tile.getMesh());\n\t\n\t if (tile.getPickingMesh()) {\n\t _this2._tilesPicking.add(tile.getPickingMesh());\n\t }\n\t });\n\t }\n\t\n\t // Works out tiles in the view frustum and stores them in an array\n\t //\n\t // Does not output the tiles, deferring this to _outputTiles()\n\t }, {\n\t key: '_calculateLOD',\n\t value: function _calculateLOD() {\n\t var _this3 = this;\n\t\n\t if (this._stop || !this._world) {\n\t return;\n\t }\n\t\n\t // var start = performance.now();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // 1. Update and retrieve camera frustum\n\t this._updateFrustum(this._frustum, camera);\n\t\n\t // 2. Add the four root items of the quadtree to a check list\n\t var checkList = this._checklist;\n\t checkList = [];\n\t checkList.push(this._requestTile('0', this));\n\t checkList.push(this._requestTile('1', this));\n\t checkList.push(this._requestTile('2', this));\n\t checkList.push(this._requestTile('3', this));\n\t\n\t // 3. Call Divide, passing in the check list\n\t this._divide(checkList);\n\t\n\t // // 4. Remove all tiles from layer\n\t //\n\t // Moved to _outputTiles() for now\n\t // this._removeTiles();\n\t\n\t // 5. Filter the tiles remaining in the check list\n\t this._tileList = checkList.filter(function (tile, index) {\n\t // Skip tile if it's not in the current view frustum\n\t if (!_this3._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t if (_this3._options.distance && _this3._options.distance > 0) {\n\t // TODO: Can probably speed this up\n\t var center = tile.getCenter();\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t // Manual distance limit to cut down on tiles so far away\n\t if (dist > _this3._options.distance) {\n\t return false;\n\t }\n\t }\n\t\n\t // Does the tile have a mesh?\n\t //\n\t // If yes, continue\n\t // If no, generate tile mesh, request texture and skip\n\t if (!tile.getMesh()) {\n\t tile.requestTileAsync();\n\t }\n\t\n\t return true;\n\t\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t // if (!tile.isReady()) {\n\t // return;\n\t // }\n\t //\n\t // // Add tile to layer (and to scene)\n\t // this._tiles.add(tile.getMesh());\n\t });\n\t\n\t // console.log(performance.now() - start);\n\t }\n\t }, {\n\t key: '_divide',\n\t value: function _divide(checkList) {\n\t var count = 0;\n\t var currentItem;\n\t var quadcode;\n\t\n\t // 1. Loop until count equals check list length\n\t while (count != checkList.length) {\n\t currentItem = checkList[count];\n\t quadcode = currentItem.getQuadcode();\n\t\n\t // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n\t if (currentItem.length === this._maxLOD) {\n\t count++;\n\t continue;\n\t }\n\t\n\t // 3. Else, calculate screen-space error metric for quadcode\n\t if (this._screenSpaceError(currentItem)) {\n\t // 4. If error is sufficient...\n\t\n\t // 4a. Remove parent item from the check list\n\t checkList.splice(count, 1);\n\t\n\t // 4b. Add 4 child items to the check list\n\t checkList.push(this._requestTile(quadcode + '0', this));\n\t checkList.push(this._requestTile(quadcode + '1', this));\n\t checkList.push(this._requestTile(quadcode + '2', this));\n\t checkList.push(this._requestTile(quadcode + '3', this));\n\t\n\t // 4d. Continue the loop without increasing count\n\t continue;\n\t } else {\n\t // 5. Else, increase count and continue loop\n\t count++;\n\t }\n\t }\n\t }\n\t }, {\n\t key: '_screenSpaceError',\n\t value: function _screenSpaceError(tile) {\n\t var minDepth = this._minLOD;\n\t var maxDepth = this._maxLOD;\n\t\n\t var quadcode = tile.getQuadcode();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // Tweak this value to refine specific point that each quad is subdivided\n\t //\n\t // It's used to multiple the dimensions of the tile sides before\n\t // comparing against the tile distance from camera\n\t var quality = 3.0;\n\t\n\t // 1. Return false if quadcode length equals maxDepth (stop dividing)\n\t if (quadcode.length === maxDepth) {\n\t return false;\n\t }\n\t\n\t // 2. Return true if quadcode length is less than minDepth\n\t if (quadcode.length < minDepth) {\n\t return true;\n\t }\n\t\n\t // 3. Return false if quadcode bounds are not in view frustum\n\t if (!this._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t var center = tile.getCenter();\n\t\n\t // 4. Calculate screen-space error metric\n\t // TODO: Use closest distance to one of the 4 tile corners\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t var error = quality * tile.getSide() / dist;\n\t\n\t // 5. Return true if error is greater than 1.0, else return false\n\t return error > 1.0;\n\t }\n\t }, {\n\t key: '_removeTiles',\n\t value: function _removeTiles() {\n\t if (!this._tiles || !this._tiles.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t\n\t if (!this._tilesPicking || !this._tilesPicking.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t // Return a new tile instance\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {}\n\t\n\t // Get a cached tile or request a new one if not in cache\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile(quadcode, layer) {\n\t var tile = this._tileCache.getTile(quadcode);\n\t\n\t if (!tile) {\n\t // Set up a brand new tile\n\t tile = this._createTile(quadcode, layer);\n\t\n\t // Add tile to cache, though it won't be ready yet as the data is being\n\t // requested from various places asynchronously\n\t this._tileCache.setTile(quadcode, tile);\n\t }\n\t\n\t return tile;\n\t }\n\t }, {\n\t key: '_destroyTile',\n\t value: function _destroyTile(tile) {\n\t // Remove tile from scene\n\t this._tiles.remove(tile.getMesh());\n\t\n\t // Delete any references to the tile within this component\n\t\n\t // Call destory on tile instance\n\t tile.destroy();\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._tiles.children) {\n\t // Remove all tiles\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t }\n\t\n\t // Remove tile from picking scene\n\t this.removeFromPicking(this._tilesPicking);\n\t\n\t if (this._tilesPicking.children) {\n\t // Remove all tiles\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t this._tileCache.destroy();\n\t this._tileCache = null;\n\t\n\t this._tiles = null;\n\t this._tilesPicking = null;\n\t this._frustum = null;\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return TileLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = TileLayer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _lruCache = __webpack_require__(49);\n\t\n\tvar _lruCache2 = _interopRequireDefault(_lruCache);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// This process is based on a similar approach taken by OpenWebGlobe\n\t// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\t\n\tvar TileCache = (function () {\n\t function TileCache(cacheLimit, onDestroyTile) {\n\t _classCallCheck(this, TileCache);\n\t\n\t this._cache = (0, _lruCache2['default'])({\n\t max: cacheLimit,\n\t dispose: function dispose(key, tile) {\n\t onDestroyTile(tile);\n\t }\n\t });\n\t }\n\t\n\t // Returns true if all specified tile providers are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(TileCache, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return false;\n\t }\n\t\n\t // Get a cached tile without requesting a new one\n\t }, {\n\t key: 'getTile',\n\t value: function getTile(quadcode) {\n\t return this._cache.get(quadcode);\n\t }\n\t\n\t // Add tile to cache\n\t }, {\n\t key: 'setTile',\n\t value: function setTile(quadcode, tile) {\n\t this._cache.set(quadcode, tile);\n\t }\n\t\n\t // Destroy the cache and remove it from memory\n\t //\n\t // TODO: Call destroy method on items in cache\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._cache.reset();\n\t this._cache = null;\n\t }\n\t }]);\n\t\n\t return TileCache;\n\t})();\n\t\n\texports['default'] = TileCache;\n\t\n\tvar noNew = function noNew(cacheLimit, onDestroyTile) {\n\t return new TileCache(cacheLimit, onDestroyTile);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.tileCache = noNew;\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = LRUCache\n\t\n\t// This will be a proper iterable 'Map' in engines that support it,\n\t// or a fakey-fake PseudoMap in older versions.\n\tvar Map = __webpack_require__(50)\n\tvar util = __webpack_require__(53)\n\t\n\t// A linked list to keep track of recently-used-ness\n\tvar Yallist = __webpack_require__(56)\n\t\n\t// use symbols if possible, otherwise just _props\n\tvar symbols = {}\n\tvar hasSymbol = typeof Symbol === 'function'\n\tvar makeSymbol\n\tif (hasSymbol) {\n\t makeSymbol = function (key) {\n\t return Symbol.for(key)\n\t }\n\t} else {\n\t makeSymbol = function (key) {\n\t return '_' + key\n\t }\n\t}\n\t\n\tfunction priv (obj, key, val) {\n\t var sym\n\t if (symbols[key]) {\n\t sym = symbols[key]\n\t } else {\n\t sym = makeSymbol(key)\n\t symbols[key] = sym\n\t }\n\t if (arguments.length === 2) {\n\t return obj[sym]\n\t } else {\n\t obj[sym] = val\n\t return val\n\t }\n\t}\n\t\n\tfunction naiveLength () { return 1 }\n\t\n\t// lruList is a yallist where the head is the youngest\n\t// item, and the tail is the oldest. the list contains the Hit\n\t// objects as the entries.\n\t// Each Hit object has a reference to its Yallist.Node. This\n\t// never changes.\n\t//\n\t// cache is a Map (or PseudoMap) that matches the keys to\n\t// the Yallist.Node object.\n\tfunction LRUCache (options) {\n\t if (!(this instanceof LRUCache)) {\n\t return new LRUCache(options)\n\t }\n\t\n\t if (typeof options === 'number') {\n\t options = { max: options }\n\t }\n\t\n\t if (!options) {\n\t options = {}\n\t }\n\t\n\t var max = priv(this, 'max', options.max)\n\t // Kind of weird to have a default max of Infinity, but oh well.\n\t if (!max ||\n\t !(typeof max === 'number') ||\n\t max <= 0) {\n\t priv(this, 'max', Infinity)\n\t }\n\t\n\t var lc = options.length || naiveLength\n\t if (typeof lc !== 'function') {\n\t lc = naiveLength\n\t }\n\t priv(this, 'lengthCalculator', lc)\n\t\n\t priv(this, 'allowStale', options.stale || false)\n\t priv(this, 'maxAge', options.maxAge || 0)\n\t priv(this, 'dispose', options.dispose)\n\t this.reset()\n\t}\n\t\n\t// resize the cache when the max changes.\n\tObject.defineProperty(LRUCache.prototype, 'max', {\n\t set: function (mL) {\n\t if (!mL || !(typeof mL === 'number') || mL <= 0) {\n\t mL = Infinity\n\t }\n\t priv(this, 'max', mL)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'max')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'allowStale', {\n\t set: function (allowStale) {\n\t priv(this, 'allowStale', !!allowStale)\n\t },\n\t get: function () {\n\t return priv(this, 'allowStale')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'maxAge', {\n\t set: function (mA) {\n\t if (!mA || !(typeof mA === 'number') || mA < 0) {\n\t mA = 0\n\t }\n\t priv(this, 'maxAge', mA)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'maxAge')\n\t },\n\t enumerable: true\n\t})\n\t\n\t// resize the cache when the lengthCalculator changes.\n\tObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n\t set: function (lC) {\n\t if (typeof lC !== 'function') {\n\t lC = naiveLength\n\t }\n\t if (lC !== priv(this, 'lengthCalculator')) {\n\t priv(this, 'lengthCalculator', lC)\n\t priv(this, 'length', 0)\n\t priv(this, 'lruList').forEach(function (hit) {\n\t hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t }, this)\n\t }\n\t trim(this)\n\t },\n\t get: function () { return priv(this, 'lengthCalculator') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'length', {\n\t get: function () { return priv(this, 'length') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'itemCount', {\n\t get: function () { return priv(this, 'lruList').length },\n\t enumerable: true\n\t})\n\t\n\tLRUCache.prototype.rforEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n\t var prev = walker.prev\n\t forEachStep(this, fn, walker, thisp)\n\t walker = prev\n\t }\n\t}\n\t\n\tfunction forEachStep (self, fn, node, thisp) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) {\n\t hit = undefined\n\t }\n\t }\n\t if (hit) {\n\t fn.call(thisp, hit.value, hit.key, self)\n\t }\n\t}\n\t\n\tLRUCache.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').head; walker !== null;) {\n\t var next = walker.next\n\t forEachStep(this, fn, walker, thisp)\n\t walker = next\n\t }\n\t}\n\t\n\tLRUCache.prototype.keys = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.key\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.values = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.value\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.reset = function () {\n\t if (priv(this, 'dispose') &&\n\t priv(this, 'lruList') &&\n\t priv(this, 'lruList').length) {\n\t priv(this, 'lruList').forEach(function (hit) {\n\t priv(this, 'dispose').call(this, hit.key, hit.value)\n\t }, this)\n\t }\n\t\n\t priv(this, 'cache', new Map()) // hash of items by key\n\t priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n\t priv(this, 'length', 0) // length of items in the list\n\t}\n\t\n\tLRUCache.prototype.dump = function () {\n\t return priv(this, 'lruList').map(function (hit) {\n\t if (!isStale(this, hit)) {\n\t return {\n\t k: hit.key,\n\t v: hit.value,\n\t e: hit.now + (hit.maxAge || 0)\n\t }\n\t }\n\t }, this).toArray().filter(function (h) {\n\t return h\n\t })\n\t}\n\t\n\tLRUCache.prototype.dumpLru = function () {\n\t return priv(this, 'lruList')\n\t}\n\t\n\tLRUCache.prototype.inspect = function (n, opts) {\n\t var str = 'LRUCache {'\n\t var extras = false\n\t\n\t var as = priv(this, 'allowStale')\n\t if (as) {\n\t str += '\\n allowStale: true'\n\t extras = true\n\t }\n\t\n\t var max = priv(this, 'max')\n\t if (max && max !== Infinity) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n max: ' + util.inspect(max, opts)\n\t extras = true\n\t }\n\t\n\t var maxAge = priv(this, 'maxAge')\n\t if (maxAge) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n\t extras = true\n\t }\n\t\n\t var lc = priv(this, 'lengthCalculator')\n\t if (lc && lc !== naiveLength) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n\t extras = true\n\t }\n\t\n\t var didFirst = false\n\t priv(this, 'lruList').forEach(function (item) {\n\t if (didFirst) {\n\t str += ',\\n '\n\t } else {\n\t if (extras) {\n\t str += ',\\n'\n\t }\n\t didFirst = true\n\t str += '\\n '\n\t }\n\t var key = util.inspect(item.key).split('\\n').join('\\n ')\n\t var val = { value: item.value }\n\t if (item.maxAge !== maxAge) {\n\t val.maxAge = item.maxAge\n\t }\n\t if (lc !== naiveLength) {\n\t val.length = item.length\n\t }\n\t if (isStale(this, item)) {\n\t val.stale = true\n\t }\n\t\n\t val = util.inspect(val, opts).split('\\n').join('\\n ')\n\t str += key + ' => ' + val\n\t })\n\t\n\t if (didFirst || extras) {\n\t str += '\\n'\n\t }\n\t str += '}'\n\t\n\t return str\n\t}\n\t\n\tLRUCache.prototype.set = function (key, value, maxAge) {\n\t maxAge = maxAge || priv(this, 'maxAge')\n\t\n\t var now = maxAge ? Date.now() : 0\n\t var len = priv(this, 'lengthCalculator').call(this, value, key)\n\t\n\t if (priv(this, 'cache').has(key)) {\n\t if (len > priv(this, 'max')) {\n\t del(this, priv(this, 'cache').get(key))\n\t return false\n\t }\n\t\n\t var node = priv(this, 'cache').get(key)\n\t var item = node.value\n\t\n\t // dispose of the old one before overwriting\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, item.value)\n\t }\n\t\n\t item.now = now\n\t item.maxAge = maxAge\n\t item.value = value\n\t priv(this, 'length', priv(this, 'length') + (len - item.length))\n\t item.length = len\n\t this.get(key)\n\t trim(this)\n\t return true\n\t }\n\t\n\t var hit = new Entry(key, value, len, now, maxAge)\n\t\n\t // oversized objects fall out of cache automatically.\n\t if (hit.length > priv(this, 'max')) {\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, value)\n\t }\n\t return false\n\t }\n\t\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t priv(this, 'lruList').unshift(hit)\n\t priv(this, 'cache').set(key, priv(this, 'lruList').head)\n\t trim(this)\n\t return true\n\t}\n\t\n\tLRUCache.prototype.has = function (key) {\n\t if (!priv(this, 'cache').has(key)) return false\n\t var hit = priv(this, 'cache').get(key).value\n\t if (isStale(this, hit)) {\n\t return false\n\t }\n\t return true\n\t}\n\t\n\tLRUCache.prototype.get = function (key) {\n\t return get(this, key, true)\n\t}\n\t\n\tLRUCache.prototype.peek = function (key) {\n\t return get(this, key, false)\n\t}\n\t\n\tLRUCache.prototype.pop = function () {\n\t var node = priv(this, 'lruList').tail\n\t if (!node) return null\n\t del(this, node)\n\t return node.value\n\t}\n\t\n\tLRUCache.prototype.del = function (key) {\n\t del(this, priv(this, 'cache').get(key))\n\t}\n\t\n\tLRUCache.prototype.load = function (arr) {\n\t // reset the cache\n\t this.reset()\n\t\n\t var now = Date.now()\n\t // A previous serialized cache has the most recent items first\n\t for (var l = arr.length - 1; l >= 0; l--) {\n\t var hit = arr[l]\n\t var expiresAt = hit.e || 0\n\t if (expiresAt === 0) {\n\t // the item was created without expiration in a non aged cache\n\t this.set(hit.k, hit.v)\n\t } else {\n\t var maxAge = expiresAt - now\n\t // dont add already expired items\n\t if (maxAge > 0) {\n\t this.set(hit.k, hit.v, maxAge)\n\t }\n\t }\n\t }\n\t}\n\t\n\tLRUCache.prototype.prune = function () {\n\t var self = this\n\t priv(this, 'cache').forEach(function (value, key) {\n\t get(self, key, false)\n\t })\n\t}\n\t\n\tfunction get (self, key, doUse) {\n\t var node = priv(self, 'cache').get(key)\n\t if (node) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) hit = undefined\n\t } else {\n\t if (doUse) {\n\t priv(self, 'lruList').unshiftNode(node)\n\t }\n\t }\n\t if (hit) hit = hit.value\n\t }\n\t return hit\n\t}\n\t\n\tfunction isStale (self, hit) {\n\t if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n\t return false\n\t }\n\t var stale = false\n\t var diff = Date.now() - hit.now\n\t if (hit.maxAge) {\n\t stale = diff > hit.maxAge\n\t } else {\n\t stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n\t }\n\t return stale\n\t}\n\t\n\tfunction trim (self) {\n\t if (priv(self, 'length') > priv(self, 'max')) {\n\t for (var walker = priv(self, 'lruList').tail;\n\t priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n\t // We know that we're about to delete this one, and also\n\t // what the next least recently used key will be, so just\n\t // go ahead and set it now.\n\t var prev = walker.prev\n\t del(self, walker)\n\t walker = prev\n\t }\n\t }\n\t}\n\t\n\tfunction del (self, node) {\n\t if (node) {\n\t var hit = node.value\n\t if (priv(self, 'dispose')) {\n\t priv(self, 'dispose').call(this, hit.key, hit.value)\n\t }\n\t priv(self, 'length', priv(self, 'length') - hit.length)\n\t priv(self, 'cache').delete(hit.key)\n\t priv(self, 'lruList').removeNode(node)\n\t }\n\t}\n\t\n\t// classy, since V8 prefers predictable objects.\n\tfunction Entry (key, value, length, now, maxAge) {\n\t this.key = key\n\t this.value = value\n\t this.length = length\n\t this.now = now\n\t this.maxAge = maxAge || 0\n\t}\n\n\n/***/ },\n/* 50 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {if (process.env.npm_package_name === 'pseudomap' &&\n\t process.env.npm_lifecycle_script === 'test')\n\t process.env.TEST_PSEUDOMAP = 'true'\n\t\n\tif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n\t module.exports = Map\n\t} else {\n\t module.exports = __webpack_require__(52)\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(51)))\n\n/***/ },\n/* 51 */\n/***/ function(module, exports) {\n\n\t// shim for using process in browser\n\t\n\tvar process = module.exports = {};\n\tvar queue = [];\n\tvar draining = false;\n\tvar currentQueue;\n\tvar queueIndex = -1;\n\t\n\tfunction cleanUpNextTick() {\n\t draining = false;\n\t if (currentQueue.length) {\n\t queue = currentQueue.concat(queue);\n\t } else {\n\t queueIndex = -1;\n\t }\n\t if (queue.length) {\n\t drainQueue();\n\t }\n\t}\n\t\n\tfunction drainQueue() {\n\t if (draining) {\n\t return;\n\t }\n\t var timeout = setTimeout(cleanUpNextTick);\n\t draining = true;\n\t\n\t var len = queue.length;\n\t while(len) {\n\t currentQueue = queue;\n\t queue = [];\n\t while (++queueIndex < len) {\n\t if (currentQueue) {\n\t currentQueue[queueIndex].run();\n\t }\n\t }\n\t queueIndex = -1;\n\t len = queue.length;\n\t }\n\t currentQueue = null;\n\t draining = false;\n\t clearTimeout(timeout);\n\t}\n\t\n\tprocess.nextTick = function (fun) {\n\t var args = new Array(arguments.length - 1);\n\t if (arguments.length > 1) {\n\t for (var i = 1; i < arguments.length; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t }\n\t queue.push(new Item(fun, args));\n\t if (queue.length === 1 && !draining) {\n\t setTimeout(drainQueue, 0);\n\t }\n\t};\n\t\n\t// v8 likes predictible objects\n\tfunction Item(fun, array) {\n\t this.fun = fun;\n\t this.array = array;\n\t}\n\tItem.prototype.run = function () {\n\t this.fun.apply(null, this.array);\n\t};\n\tprocess.title = 'browser';\n\tprocess.browser = true;\n\tprocess.env = {};\n\tprocess.argv = [];\n\tprocess.version = ''; // empty string to avoid regexp issues\n\tprocess.versions = {};\n\t\n\tfunction noop() {}\n\t\n\tprocess.on = noop;\n\tprocess.addListener = noop;\n\tprocess.once = noop;\n\tprocess.off = noop;\n\tprocess.removeListener = noop;\n\tprocess.removeAllListeners = noop;\n\tprocess.emit = noop;\n\t\n\tprocess.binding = function (name) {\n\t throw new Error('process.binding is not supported');\n\t};\n\t\n\tprocess.cwd = function () { return '/' };\n\tprocess.chdir = function (dir) {\n\t throw new Error('process.chdir is not supported');\n\t};\n\tprocess.umask = function() { return 0; };\n\n\n/***/ },\n/* 52 */\n/***/ function(module, exports) {\n\n\tvar hasOwnProperty = Object.prototype.hasOwnProperty\n\t\n\tmodule.exports = PseudoMap\n\t\n\tfunction PseudoMap (set) {\n\t if (!(this instanceof PseudoMap)) // whyyyyyyy\n\t throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\t\n\t this.clear()\n\t\n\t if (set) {\n\t if ((set instanceof PseudoMap) ||\n\t (typeof Map === 'function' && set instanceof Map))\n\t set.forEach(function (value, key) {\n\t this.set(key, value)\n\t }, this)\n\t else if (Array.isArray(set))\n\t set.forEach(function (kv) {\n\t this.set(kv[0], kv[1])\n\t }, this)\n\t else\n\t throw new TypeError('invalid argument')\n\t }\n\t}\n\t\n\tPseudoMap.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t Object.keys(this._data).forEach(function (k) {\n\t if (k !== 'size')\n\t fn.call(thisp, this._data[k].value, this._data[k].key)\n\t }, this)\n\t}\n\t\n\tPseudoMap.prototype.has = function (k) {\n\t return !!find(this._data, k)\n\t}\n\t\n\tPseudoMap.prototype.get = function (k) {\n\t var res = find(this._data, k)\n\t return res && res.value\n\t}\n\t\n\tPseudoMap.prototype.set = function (k, v) {\n\t set(this._data, k, v)\n\t}\n\t\n\tPseudoMap.prototype.delete = function (k) {\n\t var res = find(this._data, k)\n\t if (res) {\n\t delete this._data[res._index]\n\t this._data.size--\n\t }\n\t}\n\t\n\tPseudoMap.prototype.clear = function () {\n\t var data = Object.create(null)\n\t data.size = 0\n\t\n\t Object.defineProperty(this, '_data', {\n\t value: data,\n\t enumerable: false,\n\t configurable: true,\n\t writable: false\n\t })\n\t}\n\t\n\tObject.defineProperty(PseudoMap.prototype, 'size', {\n\t get: function () {\n\t return this._data.size\n\t },\n\t set: function (n) {},\n\t enumerable: true,\n\t configurable: true\n\t})\n\t\n\tPseudoMap.prototype.values =\n\tPseudoMap.prototype.keys =\n\tPseudoMap.prototype.entries = function () {\n\t throw new Error('iterators are not implemented in this version')\n\t}\n\t\n\t// Either identical, or both NaN\n\tfunction same (a, b) {\n\t return a === b || a !== a && b !== b\n\t}\n\t\n\tfunction Entry (k, v, i) {\n\t this.key = k\n\t this.value = v\n\t this._index = i\n\t}\n\t\n\tfunction find (data, k) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k))\n\t return data[key]\n\t }\n\t}\n\t\n\tfunction set (data, k, v) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k)) {\n\t data[key].value = v\n\t return\n\t }\n\t }\n\t data.size++\n\t data[key] = new Entry(k, v, key)\n\t}\n\n\n/***/ },\n/* 53 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\t\n\tvar formatRegExp = /%[sdj%]/g;\n\texports.format = function(f) {\n\t if (!isString(f)) {\n\t var objects = [];\n\t for (var i = 0; i < arguments.length; i++) {\n\t objects.push(inspect(arguments[i]));\n\t }\n\t return objects.join(' ');\n\t }\n\t\n\t var i = 1;\n\t var args = arguments;\n\t var len = args.length;\n\t var str = String(f).replace(formatRegExp, function(x) {\n\t if (x === '%%') return '%';\n\t if (i >= len) return x;\n\t switch (x) {\n\t case '%s': return String(args[i++]);\n\t case '%d': return Number(args[i++]);\n\t case '%j':\n\t try {\n\t return JSON.stringify(args[i++]);\n\t } catch (_) {\n\t return '[Circular]';\n\t }\n\t default:\n\t return x;\n\t }\n\t });\n\t for (var x = args[i]; i < len; x = args[++i]) {\n\t if (isNull(x) || !isObject(x)) {\n\t str += ' ' + x;\n\t } else {\n\t str += ' ' + inspect(x);\n\t }\n\t }\n\t return str;\n\t};\n\t\n\t\n\t// Mark that a method should not be used.\n\t// Returns a modified function which warns once by default.\n\t// If --no-deprecation is set, then it is a no-op.\n\texports.deprecate = function(fn, msg) {\n\t // Allow for deprecating things in the process of starting up.\n\t if (isUndefined(global.process)) {\n\t return function() {\n\t return exports.deprecate(fn, msg).apply(this, arguments);\n\t };\n\t }\n\t\n\t if (process.noDeprecation === true) {\n\t return fn;\n\t }\n\t\n\t var warned = false;\n\t function deprecated() {\n\t if (!warned) {\n\t if (process.throwDeprecation) {\n\t throw new Error(msg);\n\t } else if (process.traceDeprecation) {\n\t console.trace(msg);\n\t } else {\n\t console.error(msg);\n\t }\n\t warned = true;\n\t }\n\t return fn.apply(this, arguments);\n\t }\n\t\n\t return deprecated;\n\t};\n\t\n\t\n\tvar debugs = {};\n\tvar debugEnviron;\n\texports.debuglog = function(set) {\n\t if (isUndefined(debugEnviron))\n\t debugEnviron = process.env.NODE_DEBUG || '';\n\t set = set.toUpperCase();\n\t if (!debugs[set]) {\n\t if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n\t var pid = process.pid;\n\t debugs[set] = function() {\n\t var msg = exports.format.apply(exports, arguments);\n\t console.error('%s %d: %s', set, pid, msg);\n\t };\n\t } else {\n\t debugs[set] = function() {};\n\t }\n\t }\n\t return debugs[set];\n\t};\n\t\n\t\n\t/**\n\t * Echos the value of a value. Trys to print the value out\n\t * in the best way possible given the different types.\n\t *\n\t * @param {Object} obj The object to print out.\n\t * @param {Object} opts Optional options object that alters the output.\n\t */\n\t/* legacy: obj, showHidden, depth, colors*/\n\tfunction inspect(obj, opts) {\n\t // default options\n\t var ctx = {\n\t seen: [],\n\t stylize: stylizeNoColor\n\t };\n\t // legacy...\n\t if (arguments.length >= 3) ctx.depth = arguments[2];\n\t if (arguments.length >= 4) ctx.colors = arguments[3];\n\t if (isBoolean(opts)) {\n\t // legacy...\n\t ctx.showHidden = opts;\n\t } else if (opts) {\n\t // got an \"options\" object\n\t exports._extend(ctx, opts);\n\t }\n\t // set default options\n\t if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n\t if (isUndefined(ctx.depth)) ctx.depth = 2;\n\t if (isUndefined(ctx.colors)) ctx.colors = false;\n\t if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n\t if (ctx.colors) ctx.stylize = stylizeWithColor;\n\t return formatValue(ctx, obj, ctx.depth);\n\t}\n\texports.inspect = inspect;\n\t\n\t\n\t// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\n\tinspect.colors = {\n\t 'bold' : [1, 22],\n\t 'italic' : [3, 23],\n\t 'underline' : [4, 24],\n\t 'inverse' : [7, 27],\n\t 'white' : [37, 39],\n\t 'grey' : [90, 39],\n\t 'black' : [30, 39],\n\t 'blue' : [34, 39],\n\t 'cyan' : [36, 39],\n\t 'green' : [32, 39],\n\t 'magenta' : [35, 39],\n\t 'red' : [31, 39],\n\t 'yellow' : [33, 39]\n\t};\n\t\n\t// Don't use 'blue' not visible on cmd.exe\n\tinspect.styles = {\n\t 'special': 'cyan',\n\t 'number': 'yellow',\n\t 'boolean': 'yellow',\n\t 'undefined': 'grey',\n\t 'null': 'bold',\n\t 'string': 'green',\n\t 'date': 'magenta',\n\t // \"name\": intentionally not styling\n\t 'regexp': 'red'\n\t};\n\t\n\t\n\tfunction stylizeWithColor(str, styleType) {\n\t var style = inspect.styles[styleType];\n\t\n\t if (style) {\n\t return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n\t '\\u001b[' + inspect.colors[style][1] + 'm';\n\t } else {\n\t return str;\n\t }\n\t}\n\t\n\t\n\tfunction stylizeNoColor(str, styleType) {\n\t return str;\n\t}\n\t\n\t\n\tfunction arrayToHash(array) {\n\t var hash = {};\n\t\n\t array.forEach(function(val, idx) {\n\t hash[val] = true;\n\t });\n\t\n\t return hash;\n\t}\n\t\n\t\n\tfunction formatValue(ctx, value, recurseTimes) {\n\t // Provide a hook for user-specified inspect functions.\n\t // Check that value is an object with an inspect function on it\n\t if (ctx.customInspect &&\n\t value &&\n\t isFunction(value.inspect) &&\n\t // Filter out the util module, it's inspect function is special\n\t value.inspect !== exports.inspect &&\n\t // Also filter out any prototype objects using the circular check.\n\t !(value.constructor && value.constructor.prototype === value)) {\n\t var ret = value.inspect(recurseTimes, ctx);\n\t if (!isString(ret)) {\n\t ret = formatValue(ctx, ret, recurseTimes);\n\t }\n\t return ret;\n\t }\n\t\n\t // Primitive types cannot have properties\n\t var primitive = formatPrimitive(ctx, value);\n\t if (primitive) {\n\t return primitive;\n\t }\n\t\n\t // Look up the keys of the object.\n\t var keys = Object.keys(value);\n\t var visibleKeys = arrayToHash(keys);\n\t\n\t if (ctx.showHidden) {\n\t keys = Object.getOwnPropertyNames(value);\n\t }\n\t\n\t // IE doesn't make error fields non-enumerable\n\t // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n\t if (isError(value)\n\t && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n\t return formatError(value);\n\t }\n\t\n\t // Some type of object without properties can be shortcutted.\n\t if (keys.length === 0) {\n\t if (isFunction(value)) {\n\t var name = value.name ? ': ' + value.name : '';\n\t return ctx.stylize('[Function' + name + ']', 'special');\n\t }\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t }\n\t if (isDate(value)) {\n\t return ctx.stylize(Date.prototype.toString.call(value), 'date');\n\t }\n\t if (isError(value)) {\n\t return formatError(value);\n\t }\n\t }\n\t\n\t var base = '', array = false, braces = ['{', '}'];\n\t\n\t // Make Array say that they are Array\n\t if (isArray(value)) {\n\t array = true;\n\t braces = ['[', ']'];\n\t }\n\t\n\t // Make functions say that they are functions\n\t if (isFunction(value)) {\n\t var n = value.name ? ': ' + value.name : '';\n\t base = ' [Function' + n + ']';\n\t }\n\t\n\t // Make RegExps say that they are RegExps\n\t if (isRegExp(value)) {\n\t base = ' ' + RegExp.prototype.toString.call(value);\n\t }\n\t\n\t // Make dates with properties first say the date\n\t if (isDate(value)) {\n\t base = ' ' + Date.prototype.toUTCString.call(value);\n\t }\n\t\n\t // Make error with message first say the error\n\t if (isError(value)) {\n\t base = ' ' + formatError(value);\n\t }\n\t\n\t if (keys.length === 0 && (!array || value.length == 0)) {\n\t return braces[0] + base + braces[1];\n\t }\n\t\n\t if (recurseTimes < 0) {\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t } else {\n\t return ctx.stylize('[Object]', 'special');\n\t }\n\t }\n\t\n\t ctx.seen.push(value);\n\t\n\t var output;\n\t if (array) {\n\t output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n\t } else {\n\t output = keys.map(function(key) {\n\t return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n\t });\n\t }\n\t\n\t ctx.seen.pop();\n\t\n\t return reduceToSingleString(output, base, braces);\n\t}\n\t\n\t\n\tfunction formatPrimitive(ctx, value) {\n\t if (isUndefined(value))\n\t return ctx.stylize('undefined', 'undefined');\n\t if (isString(value)) {\n\t var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n\t .replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"') + '\\'';\n\t return ctx.stylize(simple, 'string');\n\t }\n\t if (isNumber(value))\n\t return ctx.stylize('' + value, 'number');\n\t if (isBoolean(value))\n\t return ctx.stylize('' + value, 'boolean');\n\t // For some reason typeof null is \"object\", so special case here.\n\t if (isNull(value))\n\t return ctx.stylize('null', 'null');\n\t}\n\t\n\t\n\tfunction formatError(value) {\n\t return '[' + Error.prototype.toString.call(value) + ']';\n\t}\n\t\n\t\n\tfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n\t var output = [];\n\t for (var i = 0, l = value.length; i < l; ++i) {\n\t if (hasOwnProperty(value, String(i))) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t String(i), true));\n\t } else {\n\t output.push('');\n\t }\n\t }\n\t keys.forEach(function(key) {\n\t if (!key.match(/^\\d+$/)) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t key, true));\n\t }\n\t });\n\t return output;\n\t}\n\t\n\t\n\tfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n\t var name, str, desc;\n\t desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n\t if (desc.get) {\n\t if (desc.set) {\n\t str = ctx.stylize('[Getter/Setter]', 'special');\n\t } else {\n\t str = ctx.stylize('[Getter]', 'special');\n\t }\n\t } else {\n\t if (desc.set) {\n\t str = ctx.stylize('[Setter]', 'special');\n\t }\n\t }\n\t if (!hasOwnProperty(visibleKeys, key)) {\n\t name = '[' + key + ']';\n\t }\n\t if (!str) {\n\t if (ctx.seen.indexOf(desc.value) < 0) {\n\t if (isNull(recurseTimes)) {\n\t str = formatValue(ctx, desc.value, null);\n\t } else {\n\t str = formatValue(ctx, desc.value, recurseTimes - 1);\n\t }\n\t if (str.indexOf('\\n') > -1) {\n\t if (array) {\n\t str = str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n').substr(2);\n\t } else {\n\t str = '\\n' + str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n');\n\t }\n\t }\n\t } else {\n\t str = ctx.stylize('[Circular]', 'special');\n\t }\n\t }\n\t if (isUndefined(name)) {\n\t if (array && key.match(/^\\d+$/)) {\n\t return str;\n\t }\n\t name = JSON.stringify('' + key);\n\t if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n\t name = name.substr(1, name.length - 2);\n\t name = ctx.stylize(name, 'name');\n\t } else {\n\t name = name.replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"')\n\t .replace(/(^\"|\"$)/g, \"'\");\n\t name = ctx.stylize(name, 'string');\n\t }\n\t }\n\t\n\t return name + ': ' + str;\n\t}\n\t\n\t\n\tfunction reduceToSingleString(output, base, braces) {\n\t var numLinesEst = 0;\n\t var length = output.reduce(function(prev, cur) {\n\t numLinesEst++;\n\t if (cur.indexOf('\\n') >= 0) numLinesEst++;\n\t return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n\t }, 0);\n\t\n\t if (length > 60) {\n\t return braces[0] +\n\t (base === '' ? '' : base + '\\n ') +\n\t ' ' +\n\t output.join(',\\n ') +\n\t ' ' +\n\t braces[1];\n\t }\n\t\n\t return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n\t}\n\t\n\t\n\t// NOTE: These type checking functions intentionally don't use `instanceof`\n\t// because it is fragile and can be easily faked with `Object.create()`.\n\tfunction isArray(ar) {\n\t return Array.isArray(ar);\n\t}\n\texports.isArray = isArray;\n\t\n\tfunction isBoolean(arg) {\n\t return typeof arg === 'boolean';\n\t}\n\texports.isBoolean = isBoolean;\n\t\n\tfunction isNull(arg) {\n\t return arg === null;\n\t}\n\texports.isNull = isNull;\n\t\n\tfunction isNullOrUndefined(arg) {\n\t return arg == null;\n\t}\n\texports.isNullOrUndefined = isNullOrUndefined;\n\t\n\tfunction isNumber(arg) {\n\t return typeof arg === 'number';\n\t}\n\texports.isNumber = isNumber;\n\t\n\tfunction isString(arg) {\n\t return typeof arg === 'string';\n\t}\n\texports.isString = isString;\n\t\n\tfunction isSymbol(arg) {\n\t return typeof arg === 'symbol';\n\t}\n\texports.isSymbol = isSymbol;\n\t\n\tfunction isUndefined(arg) {\n\t return arg === void 0;\n\t}\n\texports.isUndefined = isUndefined;\n\t\n\tfunction isRegExp(re) {\n\t return isObject(re) && objectToString(re) === '[object RegExp]';\n\t}\n\texports.isRegExp = isRegExp;\n\t\n\tfunction isObject(arg) {\n\t return typeof arg === 'object' && arg !== null;\n\t}\n\texports.isObject = isObject;\n\t\n\tfunction isDate(d) {\n\t return isObject(d) && objectToString(d) === '[object Date]';\n\t}\n\texports.isDate = isDate;\n\t\n\tfunction isError(e) {\n\t return isObject(e) &&\n\t (objectToString(e) === '[object Error]' || e instanceof Error);\n\t}\n\texports.isError = isError;\n\t\n\tfunction isFunction(arg) {\n\t return typeof arg === 'function';\n\t}\n\texports.isFunction = isFunction;\n\t\n\tfunction isPrimitive(arg) {\n\t return arg === null ||\n\t typeof arg === 'boolean' ||\n\t typeof arg === 'number' ||\n\t typeof arg === 'string' ||\n\t typeof arg === 'symbol' || // ES6 symbol\n\t typeof arg === 'undefined';\n\t}\n\texports.isPrimitive = isPrimitive;\n\t\n\texports.isBuffer = __webpack_require__(54);\n\t\n\tfunction objectToString(o) {\n\t return Object.prototype.toString.call(o);\n\t}\n\t\n\t\n\tfunction pad(n) {\n\t return n < 10 ? '0' + n.toString(10) : n.toString(10);\n\t}\n\t\n\t\n\tvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n\t 'Oct', 'Nov', 'Dec'];\n\t\n\t// 26 Feb 16:19:34\n\tfunction timestamp() {\n\t var d = new Date();\n\t var time = [pad(d.getHours()),\n\t pad(d.getMinutes()),\n\t pad(d.getSeconds())].join(':');\n\t return [d.getDate(), months[d.getMonth()], time].join(' ');\n\t}\n\t\n\t\n\t// log is just a thin wrapper to console.log that prepends a timestamp\n\texports.log = function() {\n\t console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n\t};\n\t\n\t\n\t/**\n\t * Inherit the prototype methods from one constructor into another.\n\t *\n\t * The Function.prototype.inherits from lang.js rewritten as a standalone\n\t * function (not on Function.prototype). NOTE: If this file is to be loaded\n\t * during bootstrapping this function needs to be rewritten using some native\n\t * functions as prototype setup using normal JavaScript does not work as\n\t * expected during bootstrapping (see mirror.js in r114903).\n\t *\n\t * @param {function} ctor Constructor function which needs to inherit the\n\t * prototype.\n\t * @param {function} superCtor Constructor function to inherit prototype from.\n\t */\n\texports.inherits = __webpack_require__(55);\n\t\n\texports._extend = function(origin, add) {\n\t // Don't do anything if add isn't an object\n\t if (!add || !isObject(add)) return origin;\n\t\n\t var keys = Object.keys(add);\n\t var i = keys.length;\n\t while (i--) {\n\t origin[keys[i]] = add[keys[i]];\n\t }\n\t return origin;\n\t};\n\t\n\tfunction hasOwnProperty(obj, prop) {\n\t return Object.prototype.hasOwnProperty.call(obj, prop);\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(51)))\n\n/***/ },\n/* 54 */\n/***/ function(module, exports) {\n\n\tmodule.exports = function isBuffer(arg) {\n\t return arg && typeof arg === 'object'\n\t && typeof arg.copy === 'function'\n\t && typeof arg.fill === 'function'\n\t && typeof arg.readUInt8 === 'function';\n\t}\n\n/***/ },\n/* 55 */\n/***/ function(module, exports) {\n\n\tif (typeof Object.create === 'function') {\n\t // implementation from standard node.js 'util' module\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t ctor.prototype = Object.create(superCtor.prototype, {\n\t constructor: {\n\t value: ctor,\n\t enumerable: false,\n\t writable: true,\n\t configurable: true\n\t }\n\t });\n\t };\n\t} else {\n\t // old school shim for old browsers\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t var TempCtor = function () {}\n\t TempCtor.prototype = superCtor.prototype\n\t ctor.prototype = new TempCtor()\n\t ctor.prototype.constructor = ctor\n\t }\n\t}\n\n\n/***/ },\n/* 56 */\n/***/ function(module, exports) {\n\n\tmodule.exports = Yallist\n\t\n\tYallist.Node = Node\n\tYallist.create = Yallist\n\t\n\tfunction Yallist (list) {\n\t var self = this\n\t if (!(self instanceof Yallist)) {\n\t self = new Yallist()\n\t }\n\t\n\t self.tail = null\n\t self.head = null\n\t self.length = 0\n\t\n\t if (list && typeof list.forEach === 'function') {\n\t list.forEach(function (item) {\n\t self.push(item)\n\t })\n\t } else if (arguments.length > 0) {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t self.push(arguments[i])\n\t }\n\t }\n\t\n\t return self\n\t}\n\t\n\tYallist.prototype.removeNode = function (node) {\n\t if (node.list !== this) {\n\t throw new Error('removing node which does not belong to this list')\n\t }\n\t\n\t var next = node.next\n\t var prev = node.prev\n\t\n\t if (next) {\n\t next.prev = prev\n\t }\n\t\n\t if (prev) {\n\t prev.next = next\n\t }\n\t\n\t if (node === this.head) {\n\t this.head = next\n\t }\n\t if (node === this.tail) {\n\t this.tail = prev\n\t }\n\t\n\t node.list.length --\n\t node.next = null\n\t node.prev = null\n\t node.list = null\n\t}\n\t\n\tYallist.prototype.unshiftNode = function (node) {\n\t if (node === this.head) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var head = this.head\n\t node.list = this\n\t node.next = head\n\t if (head) {\n\t head.prev = node\n\t }\n\t\n\t this.head = node\n\t if (!this.tail) {\n\t this.tail = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.pushNode = function (node) {\n\t if (node === this.tail) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var tail = this.tail\n\t node.list = this\n\t node.prev = tail\n\t if (tail) {\n\t tail.next = node\n\t }\n\t\n\t this.tail = node\n\t if (!this.head) {\n\t this.head = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.push = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t push(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.unshift = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t unshift(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.pop = function () {\n\t if (!this.tail)\n\t return undefined\n\t\n\t var res = this.tail.value\n\t this.tail = this.tail.prev\n\t this.tail.next = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.shift = function () {\n\t if (!this.head)\n\t return undefined\n\t\n\t var res = this.head.value\n\t this.head = this.head.next\n\t this.head.prev = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.head, i = 0; walker !== null; i++) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.next\n\t }\n\t}\n\t\n\tYallist.prototype.forEachReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.prev\n\t }\n\t}\n\t\n\tYallist.prototype.get = function (n) {\n\t for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.next\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.getReverse = function (n) {\n\t for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.prev\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.map = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.head; walker !== null; ) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.next\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.mapReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.tail; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.prev\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.reduce = function (fn, initial) {\n\t var acc\n\t var walker = this.head\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.head) {\n\t walker = this.head.next\n\t acc = this.head.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = 0; walker !== null; i++) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.next\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.reduceReverse = function (fn, initial) {\n\t var acc\n\t var walker = this.tail\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.tail) {\n\t walker = this.tail.prev\n\t acc = this.tail.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = this.length - 1; walker !== null; i--) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.prev\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.toArray = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.head; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.next\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.toArrayReverse = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.tail; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.prev\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.slice = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n\t walker = walker.next\n\t }\n\t for (; walker !== null && i < to; i++, walker = walker.next) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.sliceReverse = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n\t walker = walker.prev\n\t }\n\t for (; walker !== null && i > from; i--, walker = walker.prev) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.reverse = function () {\n\t var head = this.head\n\t var tail = this.tail\n\t for (var walker = head; walker !== null; walker = walker.prev) {\n\t var p = walker.prev\n\t walker.prev = walker.next\n\t walker.next = p\n\t }\n\t this.head = tail\n\t this.tail = head\n\t return this\n\t}\n\t\n\tfunction push (self, item) {\n\t self.tail = new Node(item, self.tail, null, self)\n\t if (!self.head) {\n\t self.head = self.tail\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction unshift (self, item) {\n\t self.head = new Node(item, null, self.head, self)\n\t if (!self.tail) {\n\t self.tail = self.head\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction Node (value, prev, next, list) {\n\t if (!(this instanceof Node)) {\n\t return new Node(value, prev, next, list)\n\t }\n\t\n\t this.list = list\n\t this.value = value\n\t\n\t if (prev) {\n\t prev.next = this\n\t this.prev = prev\n\t } else {\n\t this.prev = null\n\t }\n\t\n\t if (next) {\n\t next.prev = this\n\t this.next = next\n\t } else {\n\t this.next = null\n\t }\n\t}\n\n\n/***/ },\n/* 57 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(58);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(59);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar ImageTile = (function (_Tile) {\n\t _inherits(ImageTile, _Tile);\n\t\n\t function ImageTile(quadcode, path, layer) {\n\t _classCallCheck(this, ImageTile);\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(ImageTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear image reference\n\t this._image = null;\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t depthWrite: false\n\t });\n\t\n\t // var material = new THREE.MeshPhongMaterial({\n\t // depthWrite: false\n\t // });\n\t } else {\n\t // Other MeshStandardMaterial settings\n\t //\n\t // material.envMapIntensity will change the amount of colour reflected(?)\n\t // from the environment map – can be greater than 1 for more intensity\n\t\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var localMesh = new _three2['default'].Mesh(geom, material);\n\t localMesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t localMesh.receiveShadow = true;\n\t\n\t mesh.add(localMesh);\n\t mesh.renderOrder = 0.1;\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t // var box = new BoxHelper(localMesh);\n\t // mesh.add(box);\n\t //\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t var image = document.createElement('img');\n\t\n\t image.addEventListener('load', function (event) {\n\t var texture = new _three2['default'].Texture();\n\t\n\t texture.image = image;\n\t texture.needsUpdate = true;\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t // Something went wrong and the tile or its material is missing\n\t //\n\t // Possibly removed by the cache before the image loaded\n\t if (!_this2._mesh || !_this2._mesh.children[0] || !_this2._mesh.children[0].material) {\n\t return;\n\t }\n\t\n\t _this2._mesh.children[0].material.map = texture;\n\t _this2._mesh.children[0].material.needsUpdate = true;\n\t\n\t _this2._texture = texture;\n\t _this2._ready = true;\n\t }, false);\n\t\n\t // image.addEventListener('progress', event => {}, false);\n\t // image.addEventListener('error', event => {}, false);\n\t\n\t image.crossOrigin = '';\n\t\n\t // Load image\n\t image.src = url;\n\t\n\t this._image = image;\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._image) {\n\t return;\n\t }\n\t\n\t this._image.src = '';\n\t }\n\t }]);\n\t\n\t return ImageTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = ImageTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer) {\n\t return new ImageTile(quadcode, path, layer);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTile = noNew;\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// Manages a single tile and its layers\n\t\n\tvar r2d = 180 / Math.PI;\n\t\n\tvar tileURLRegex = /\\{([szxy])\\}/g;\n\t\n\tvar Tile = (function () {\n\t function Tile(quadcode, path, layer) {\n\t _classCallCheck(this, Tile);\n\t\n\t this._layer = layer;\n\t this._world = layer._world;\n\t this._quadcode = quadcode;\n\t this._path = path;\n\t\n\t this._ready = false;\n\t\n\t this._tile = this._quadcodeToTile(quadcode);\n\t\n\t // Bottom-left and top-right bounds in WGS84 coordinates\n\t this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\t\n\t // Bottom-left and top-right bounds in world coordinates\n\t this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\t\n\t // Tile center in world coordinates\n\t this._center = this._boundsToCenter(this._boundsWorld);\n\t\n\t // Tile center in projected coordinates\n\t this._centerLatlon = this._world.pointToLatLon((0, _geoPoint.point)(this._center[0], this._center[1]));\n\t\n\t // Length of a tile side in world coorindates\n\t this._side = this._getSide(this._boundsWorld);\n\t\n\t // Point scale for tile (for unit conversion)\n\t this._pointScale = this._world.pointScale(this._centerLatlon);\n\t }\n\t\n\t // Returns true if the tile mesh and texture are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(Tile, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return this._ready;\n\t }\n\t\n\t // Request data for the tile\n\t }, {\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {}\n\t }, {\n\t key: 'getQuadcode',\n\t value: function getQuadcode() {\n\t return this._quadcode;\n\t }\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {\n\t return this._boundsWorld;\n\t }\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t }, {\n\t key: 'getSide',\n\t value: function getSide() {\n\t return this._side;\n\t }\n\t }, {\n\t key: 'getMesh',\n\t value: function getMesh() {\n\t return this._mesh;\n\t }\n\t }, {\n\t key: 'getPickingMesh',\n\t value: function getPickingMesh() {\n\t return this._pickingMesh;\n\t }\n\t\n\t // Destroys the tile and removes it from the layer and memory\n\t //\n\t // Ensure that this leaves no trace of the tile – no textures, no meshes,\n\t // nothing in memory or the GPU\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Delete reference to layer and world\n\t this._layer = null;\n\t this._world = null;\n\t\n\t // Delete location references\n\t this._boundsLatLon = null;\n\t this._boundsWorld = null;\n\t this._center = null;\n\t\n\t // Done if no mesh\n\t if (!this._mesh) {\n\t return;\n\t }\n\t\n\t if (this._mesh.children) {\n\t // Dispose of mesh and materials\n\t this._mesh.children.forEach(function (child) {\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t });\n\t } else {\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {}\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {}\n\t }, {\n\t key: '_getTileURL',\n\t value: function _getTileURL(urlParams) {\n\t if (!urlParams.s) {\n\t // Default to a random choice of a, b or c\n\t urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n\t }\n\t\n\t tileURLRegex.lastIndex = 0;\n\t return this._path.replace(tileURLRegex, function (value, key) {\n\t // Replace with paramter, otherwise keep existing value\n\t return urlParams[key];\n\t });\n\t }\n\t\n\t // Convert from quadcode to TMS tile coordinates\n\t }, {\n\t key: '_quadcodeToTile',\n\t value: function _quadcodeToTile(quadcode) {\n\t var x = 0;\n\t var y = 0;\n\t var z = quadcode.length;\n\t\n\t for (var i = z; i > 0; i--) {\n\t var mask = 1 << i - 1;\n\t var q = +quadcode[z - i];\n\t if (q === 1) {\n\t x |= mask;\n\t }\n\t if (q === 2) {\n\t y |= mask;\n\t }\n\t if (q === 3) {\n\t x |= mask;\n\t y |= mask;\n\t }\n\t }\n\t\n\t return [x, y, z];\n\t }\n\t\n\t // Convert WGS84 tile bounds to world coordinates\n\t }, {\n\t key: '_tileBoundsFromWGS84',\n\t value: function _tileBoundsFromWGS84(boundsWGS84) {\n\t var sw = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[1], boundsWGS84[0]));\n\t var ne = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[3], boundsWGS84[2]));\n\t\n\t return [sw.x, sw.y, ne.x, ne.y];\n\t }\n\t\n\t // Get tile bounds in WGS84 coordinates\n\t }, {\n\t key: '_tileBoundsWGS84',\n\t value: function _tileBoundsWGS84(tile) {\n\t var e = this._tile2lon(tile[0] + 1, tile[2]);\n\t var w = this._tile2lon(tile[0], tile[2]);\n\t var s = this._tile2lat(tile[1] + 1, tile[2]);\n\t var n = this._tile2lat(tile[1], tile[2]);\n\t return [w, s, e, n];\n\t }\n\t }, {\n\t key: '_tile2lon',\n\t value: function _tile2lon(x, z) {\n\t return x / Math.pow(2, z) * 360 - 180;\n\t }\n\t }, {\n\t key: '_tile2lat',\n\t value: function _tile2lat(y, z) {\n\t var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n\t return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n\t }\n\t }, {\n\t key: '_boundsToCenter',\n\t value: function _boundsToCenter(bounds) {\n\t var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n\t var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\t\n\t return [x, y];\n\t }\n\t }, {\n\t key: '_getSide',\n\t value: function _getSide(bounds) {\n\t return new _three2['default'].Vector3(bounds[0], 0, bounds[3]).sub(new _three2['default'].Vector3(bounds[0], 0, bounds[1])).length();\n\t }\n\t }]);\n\t\n\t return Tile;\n\t})();\n\t\n\texports['default'] = Tile;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 59 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tBoxHelper = function (object) {\n\t\n\t\tvar indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]);\n\t\tvar positions = new Float32Array(8 * 3);\n\t\n\t\tvar geometry = new _three2['default'].BufferGeometry();\n\t\tgeometry.setIndex(new _three2['default'].BufferAttribute(indices, 1));\n\t\tgeometry.addAttribute('position', new _three2['default'].BufferAttribute(positions, 3));\n\t\n\t\t_three2['default'].LineSegments.call(this, geometry, new _three2['default'].LineBasicMaterial({ linewidth: 2, color: 0xff0000 }));\n\t\n\t\tif (object !== undefined) {\n\t\n\t\t\tthis.update(object);\n\t\t}\n\t};\n\t\n\tBoxHelper.prototype = Object.create(_three2['default'].LineSegments.prototype);\n\tBoxHelper.prototype.constructor = BoxHelper;\n\t\n\tBoxHelper.prototype.update = (function () {\n\t\n\t\tvar box = new _three2['default'].Box3();\n\t\n\t\treturn function (object) {\n\t\n\t\t\tbox.setFromObject(object);\n\t\n\t\t\tif (box.isEmpty()) return;\n\t\n\t\t\tvar min = box.min;\n\t\t\tvar max = box.max;\n\t\n\t\t\t/*\n\t 5____4\n\t 1/___0/|\n\t | 6__|_7\n\t 2/___3/\n\t \t0: max.x, max.y, max.z\n\t 1: min.x, max.y, max.z\n\t 2: min.x, min.y, max.z\n\t 3: max.x, min.y, max.z\n\t 4: max.x, max.y, min.z\n\t 5: min.x, max.y, min.z\n\t 6: min.x, min.y, min.z\n\t 7: max.x, min.y, min.z\n\t */\n\t\n\t\t\tvar position = this.geometry.attributes.position;\n\t\t\tvar array = position.array;\n\t\n\t\t\tarray[0] = max.x;array[1] = max.y;array[2] = max.z;\n\t\t\tarray[3] = min.x;array[4] = max.y;array[5] = max.z;\n\t\t\tarray[6] = min.x;array[7] = min.y;array[8] = max.z;\n\t\t\tarray[9] = max.x;array[10] = min.y;array[11] = max.z;\n\t\t\tarray[12] = max.x;array[13] = max.y;array[14] = min.z;\n\t\t\tarray[15] = min.x;array[16] = max.y;array[17] = min.z;\n\t\t\tarray[18] = min.x;array[19] = min.y;array[20] = min.z;\n\t\t\tarray[21] = max.x;array[22] = min.y;array[23] = min.z;\n\t\n\t\t\tposition.needsUpdate = true;\n\t\n\t\t\tthis.geometry.computeBoundingSphere();\n\t\t};\n\t})();\n\t\n\texports['default'] = BoxHelper;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 60 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\texports['default'] = function (colour, skyboxTarget) {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 1;\n\t canvas.height = 1;\n\t\n\t var context = canvas.getContext('2d');\n\t context.fillStyle = colour;\n\t context.fillRect(0, 0, canvas.width, canvas.height);\n\t // context.strokeStyle = '#D0D0CF';\n\t // context.strokeRect(0, 0, canvas.width, canvas.height);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t // //\n\t // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t\n\t // texture.wrapS = THREE.RepeatWrapping;\n\t // texture.wrapT = THREE.RepeatWrapping;\n\t // texture.repeat.set(segments, segments);\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material;\n\t\n\t if (!skyboxTarget) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t depthWrite: false\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = skyboxTarget;\n\t }\n\t\n\t return material;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 61 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(47);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _GeoJSONTile = __webpack_require__(62);\n\t\n\tvar _GeoJSONTile2 = _interopRequireDefault(_GeoJSONTile);\n\t\n\tvar _lodashThrottle = __webpack_require__(40);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n\t// tile grid using geojson-vt\n\t//\n\t// See: https://github.com/mapbox/geojson-vt\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider pausing per-frame output during movement so there's little to\n\t// no jank caused by previous tiles still processing\n\t\n\t// This tile layer only updates the quadtree after world movement has occurred\n\t//\n\t// Tiles from previous quadtree updates are updated and outputted every frame\n\t// (or at least every frame, throttled to some amount)\n\t//\n\t// This is because the complexity of TopoJSON tiles requires a lot of processing\n\t// and so makes movement janky if updates occur every frame – only updating\n\t// after movement means frame drops are less obvious due to heavy processing\n\t// occurring while the view is generally stationary\n\t//\n\t// The downside is that until new tiles are requested and outputted you will\n\t// see blank spaces as you orbit and move around\n\t//\n\t// An added benefit is that it dramatically reduces the number of tiles being\n\t// requested over a period of time and the time it takes to go from request to\n\t// screen output\n\t//\n\t// It may be possible to perform these updates per-frame once Web Worker\n\t// processing is added\n\t\n\tvar GeoJSONTileLayer = (function (_TileLayer) {\n\t _inherits(GeoJSONTileLayer, _TileLayer);\n\t\n\t function GeoJSONTileLayer(path, options) {\n\t _classCallCheck(this, GeoJSONTileLayer);\n\t\n\t var defaults = {\n\t maxLOD: 14,\n\t distance: 2000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(GeoJSONTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t this._world.on('controlsMove', this._onControlsMove, this);\n\t }\n\t\n\t // Update and output tiles each frame (throttled)\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t if (this._pauseOutput) {\n\t return;\n\t }\n\t\n\t this._outputTiles();\n\t }\n\t\n\t // Update tiles grid after world move, but don't output them\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._pauseOutput = false;\n\t this._calculateLOD();\n\t }\n\t\n\t // Pause updates during control movement for less visual jank\n\t }, {\n\t key: '_onControlsMove',\n\t value: function _onControlsMove() {\n\t this._pauseOutput = true;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t var options = {};\n\t\n\t if (this._options.filter) {\n\t options.filter = this._options.filter;\n\t }\n\t\n\t if (this._options.style) {\n\t options.style = this._options.style;\n\t }\n\t\n\t if (this._options.topojson) {\n\t options.topojson = true;\n\t }\n\t\n\t if (this._options.picking) {\n\t options.picking = true;\n\t }\n\t\n\t if (this._options.onClick) {\n\t options.onClick = this._options.onClick;\n\t }\n\t\n\t return new _GeoJSONTile2['default'](quadcode, this._path, layer, options);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = GeoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new GeoJSONTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTileLayer = noNew;\n\n/***/ },\n/* 62 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(58);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(59);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _reqwest = __webpack_require__(63);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// import Offset from 'polygon-offset';\n\t\n\tvar _utilGeoJSON = __webpack_require__(65);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\t// TODO: Look into using a GeoJSONLayer to represent and output the tile data\n\t// instead of duplicating a lot of effort within this class\n\t\n\t// TODO: Map picking IDs to some reference within the tile data / geometry so\n\t// that something useful can be done when an object is picked / clicked on\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Perform tile request and processing in a Web Worker\n\t//\n\t// Use Operative (https://github.com/padolsey/operative)\n\t//\n\t// Would it make sense to have the worker functionality defined in a static\n\t// method so it only gets initialised once and not on every tile instance?\n\t//\n\t// Otherwise, worker processing logic would have to go in the tile layer so not\n\t// to waste loads of time setting up a brand new worker with three.js for each\n\t// tile every single time.\n\t//\n\t// Unsure of the best way to get three.js and VIZI into the worker\n\t//\n\t// Would need to set up a CRS / projection identical to the world instance\n\t//\n\t// Is it possible to bypass requirements on external script by having multiple\n\t// simple worker methods that each take enough inputs to perform a single task\n\t// without requiring VIZI or three.js? So long as the heaviest logic is done in\n\t// the worker and transferrable objects are used then it should be better than\n\t// nothing. Would probably still need things like earcut...\n\t//\n\t// After all, the three.js logic and object creation will still need to be\n\t// done on the main thread regardless so the worker should try to do as much as\n\t// possible with as few dependencies as possible.\n\t//\n\t// Have a look at how this is done in Tangram before implementing anything as\n\t// the approach there is pretty similar and robust.\n\t\n\tvar GeoJSONTile = (function (_Tile) {\n\t _inherits(GeoJSONTile, _Tile);\n\t\n\t function GeoJSONTile(quadcode, path, layer, options) {\n\t _classCallCheck(this, GeoJSONTile);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t\n\t this._defaultStyle = _utilGeoJSON2['default'].defaultStyle;\n\t\n\t var defaults = {\n\t picking: false,\n\t topojson: false,\n\t filter: null,\n\t onClick: null,\n\t style: this._defaultStyle\n\t };\n\t\n\t this._options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t this._options.style = options.style;\n\t } else {\n\t this._options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(GeoJSONTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t\n\t if (_this._options.picking) {\n\t _this._pickingMesh = _this._createPickingMesh();\n\t }\n\t\n\t // this._shadowCanvas = this._createShadowCanvas();\n\t\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\t //\n\t // var material = new THREE.MeshBasicMaterial({\n\t // depthWrite: false\n\t // });\n\t //\n\t // var localMesh = new THREE.Mesh(geom, material);\n\t // localMesh.rotation.x = -90 * Math.PI / 180;\n\t //\n\t // mesh.add(localMesh);\n\t //\n\t // var box = new BoxHelper(localMesh);\n\t // mesh.add(box);\n\t //\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createPickingMesh',\n\t value: function _createPickingMesh() {\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createShadowCanvas',\n\t value: function _createShadowCanvas() {\n\t var canvas = document.createElement('canvas');\n\t\n\t // Rendered at a low resolution and later scaled up for a low-quality blur\n\t canvas.width = 512;\n\t canvas.height = 512;\n\t\n\t return canvas;\n\t }\n\t\n\t // _addShadow(coordinates) {\n\t // var ctx = this._shadowCanvas.getContext('2d');\n\t // var width = this._shadowCanvas.width;\n\t // var height = this._shadowCanvas.height;\n\t //\n\t // var _coords;\n\t // var _offset;\n\t // var offset = new Offset();\n\t //\n\t // // Transform coordinates to shadowCanvas space and draw on canvas\n\t // coordinates.forEach((ring, index) => {\n\t // ctx.beginPath();\n\t //\n\t // _coords = ring.map(coord => {\n\t // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t // return [xFrac * width, yFrac * height];\n\t // });\n\t //\n\t // if (index > 0) {\n\t // _offset = _coords;\n\t // } else {\n\t // _offset = offset.data(_coords).padding(1.3);\n\t // }\n\t //\n\t // // TODO: This is super flaky and crashes the browser if run on anything\n\t // // put the outer ring (potentially due to winding)\n\t // _offset.forEach((coord, index) => {\n\t // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t //\n\t // if (index === 0) {\n\t // ctx.moveTo(coord[0], coord[1]);\n\t // } else {\n\t // ctx.lineTo(coord[0], coord[1]);\n\t // }\n\t // });\n\t //\n\t // ctx.closePath();\n\t // });\n\t //\n\t // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n\t // ctx.fill();\n\t // }\n\t\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this2._request = null;\n\t _this2._processTileData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this2._request = null;\n\t });\n\t }\n\t }, {\n\t key: '_processTileData',\n\t value: function _processTileData(data) {\n\t var _this3 = this;\n\t\n\t console.time(this._tile);\n\t\n\t var geojson = _utilGeoJSON2['default'].mergeFeatures(data, this._options.topojson);\n\t\n\t // TODO: Check that GeoJSON is valid / usable\n\t\n\t var features = geojson.features;\n\t\n\t // Run filter, if provided\n\t if (this._options.filter) {\n\t features = geojson.features.filter(this._options.filter);\n\t }\n\t\n\t var style = this._options.style;\n\t\n\t var offset = (0, _geoPoint.point)(0, 0);\n\t offset.x = -1 * this._center[0];\n\t offset.y = -1 * this._center[1];\n\t\n\t // TODO: Wrap into a helper method so this isn't duplicated in the non-tiled\n\t // GeoJSON output layer\n\t //\n\t // Need to be careful as to not make it impossible to fork this off into a\n\t // worker script at a later stage\n\t //\n\t // Also unsure as to whether it's wise to lump so much into a black box\n\t //\n\t // var meshes = GeoJSON.createMeshes(features, offset, style);\n\t\n\t var polygons = {\n\t vertices: [],\n\t faces: [],\n\t colours: [],\n\t facesCount: 0,\n\t allFlat: true\n\t };\n\t\n\t var lines = {\n\t vertices: [],\n\t colours: [],\n\t verticesCount: 0\n\t };\n\t\n\t if (this._options.picking) {\n\t polygons.pickingIds = [];\n\t lines.pickingIds = [];\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t\n\t features.forEach(function (feature) {\n\t // feature.geometry, feature.properties\n\t\n\t // Skip features that aren't supported\n\t //\n\t // TODO: Add support for all GeoJSON geometry types, including Multi...\n\t // geometry types\n\t if (feature.geometry.type !== 'Polygon' && feature.geometry.type !== 'LineString' && feature.geometry.type !== 'MultiLineString') {\n\t return;\n\t }\n\t\n\t // Get style object, if provided\n\t if (typeof _this3._options.style === 'function') {\n\t style = (0, _lodashAssign2['default'])({}, _this3._defaultStyle, _this3._options.style(feature));\n\t }\n\t\n\t var coordinates = feature.geometry.coordinates;\n\t\n\t // if (feature.geometry.type === 'LineString') {\n\t if (feature.geometry.type === 'LineString') {\n\t colour.set(style.lineColor);\n\t\n\t coordinates = coordinates.map(function (coordinate) {\n\t var latlon = (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t var point = _this3._layer._world.latLonToPoint(latlon);\n\t return [point.x, point.y];\n\t });\n\t\n\t var height = 0;\n\t\n\t if (style.lineHeight) {\n\t height = _this3._world.metresToWorld(style.lineHeight, _this3._pointScale);\n\t }\n\t\n\t var linestringAttributes = _utilGeoJSON2['default'].lineStringAttributes(coordinates, colour, height);\n\t\n\t lines.vertices.push(linestringAttributes.vertices);\n\t lines.colours.push(linestringAttributes.colours);\n\t\n\t if (_this3._options.picking) {\n\t var pickingId = _this3._layer.getPickingId();\n\t\n\t // Inject picking ID\n\t //\n\t // TODO: Perhaps handle this within the GeoJSON helper\n\t lines.pickingIds.push(pickingId);\n\t\n\t if (_this3._options.onClick) {\n\t // TODO: Find a way to properly remove this listener on destroy\n\t _this3._world.on('pick-' + pickingId, function (point2d, point3d, intersects) {\n\t _this3._options.onClick(feature, point2d, point3d, intersects);\n\t });\n\t }\n\t }\n\t\n\t lines.verticesCount += linestringAttributes.vertices.length;\n\t }\n\t\n\t if (feature.geometry.type === 'MultiLineString') {\n\t colour.set(style.lineColor);\n\t\n\t coordinates = coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (coordinate) {\n\t var latlon = (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t var point = _this3._layer._world.latLonToPoint(latlon);\n\t return [point.x, point.y];\n\t });\n\t });\n\t\n\t var height = 0;\n\t\n\t if (style.lineHeight) {\n\t height = _this3._world.metresToWorld(style.lineHeight, _this3._pointScale);\n\t }\n\t\n\t var multiLinestringAttributes = _utilGeoJSON2['default'].multiLineStringAttributes(coordinates, colour, height);\n\t\n\t lines.vertices.push(multiLinestringAttributes.vertices);\n\t lines.colours.push(multiLinestringAttributes.colours);\n\t\n\t if (_this3._options.picking) {\n\t var pickingId = _this3._layer.getPickingId();\n\t\n\t // Inject picking ID\n\t //\n\t // TODO: Perhaps handle this within the GeoJSON helper\n\t lines.pickingIds.push(pickingId);\n\t\n\t if (_this3._options.onClick) {\n\t // TODO: Find a way to properly remove this listener on destroy\n\t _this3._world.on('pick-' + pickingId, function (point2d, point3d, intersects) {\n\t _this3._options.onClick(feature, point2d, point3d, intersects);\n\t });\n\t }\n\t }\n\t\n\t lines.verticesCount += multiLinestringAttributes.vertices.length;\n\t }\n\t\n\t if (feature.geometry.type === 'Polygon') {\n\t colour.set(style.color);\n\t\n\t coordinates = coordinates.map(function (ring) {\n\t return ring.map(function (coordinate) {\n\t var latlon = (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t var point = _this3._layer._world.latLonToPoint(latlon);\n\t return [point.x, point.y];\n\t });\n\t });\n\t\n\t var height = 0;\n\t\n\t if (style.height) {\n\t height = _this3._world.metresToWorld(style.height, _this3._pointScale);\n\t }\n\t\n\t // Draw footprint on shadow canvas\n\t //\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t // this._addShadow(coordinates);\n\t\n\t var polygonAttributes = _utilGeoJSON2['default'].polygonAttributes(coordinates, colour, height);\n\t\n\t polygons.vertices.push(polygonAttributes.vertices);\n\t polygons.faces.push(polygonAttributes.faces);\n\t polygons.colours.push(polygonAttributes.colours);\n\t\n\t if (_this3._options.picking) {\n\t var pickingId = _this3._layer.getPickingId();\n\t\n\t // Inject picking ID\n\t //\n\t // TODO: Perhaps handle this within the GeoJSON helper\n\t polygons.pickingIds.push(pickingId);\n\t\n\t if (_this3._options.onClick) {\n\t // TODO: Find a way to properly remove this listener on destroy\n\t _this3._world.on('pick-' + pickingId, function (point2d, point3d, intersects) {\n\t _this3._options.onClick(feature, point2d, point3d, intersects);\n\t });\n\t }\n\t }\n\t\n\t if (polygons.allFlat && !polygonAttributes.flat) {\n\t polygons.allFlat = false;\n\t }\n\t\n\t polygons.facesCount += polygonAttributes.faces.length;\n\t }\n\t });\n\t\n\t // Output shadow canvas\n\t //\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t\n\t // var texture = new THREE.Texture(this._shadowCanvas);\n\t //\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t //\n\t // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t //\n\t // texture.needsUpdate = true;\n\t //\n\t // var material;\n\t // if (!this._world._environment._skybox) {\n\t // material = new THREE.MeshBasicMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // } else {\n\t // material = new THREE.MeshStandardMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // material.roughness = 1;\n\t // material.metalness = 0.1;\n\t // material.envMap = this._world._environment._skybox.getRenderTarget();\n\t // }\n\t //\n\t // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\t // var mesh = new THREE.Mesh(geom, material);\n\t //\n\t // mesh.castShadow = false;\n\t // mesh.receiveShadow = false;\n\t // mesh.renderOrder = 1;\n\t //\n\t // mesh.rotation.x = -90 * Math.PI / 180;\n\t //\n\t // this._mesh.add(mesh);\n\t\n\t var geometry;\n\t var material;\n\t var mesh;\n\t\n\t // Output lines\n\t if (lines.vertices.length > 0) {\n\t geometry = _utilBuffer2['default'].createLineGeometry(lines, offset);\n\t\n\t material = new _three2['default'].LineBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t\n\t mesh = new _three2['default'].LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t // TODO: Can a line cast a shadow?\n\t // mesh.castShadow = true;\n\t\n\t this._mesh.add(mesh);\n\t\n\t if (this._options.picking) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new _three2['default'].LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t }\n\t\n\t // Output polygons\n\t if (polygons.facesCount > 0) {\n\t geometry = _utilBuffer2['default'].createGeometry(polygons, offset);\n\t\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshPhongMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t\n\t if (polygons.allFlat) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t this._mesh.add(mesh);\n\t\n\t if (this._options.picking) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t }\n\t\n\t this._ready = true;\n\t console.timeEnd(this._tile);\n\t console.log(this._tile + ': ' + features.length + ' features');\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t }]);\n\t\n\t return GeoJSONTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = GeoJSONTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer, options) {\n\t return new GeoJSONTile(quadcode, path, layer, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTile = noNew;\n\n/***/ },\n/* 63 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n\t * Reqwest! A general purpose XHR connection manager\n\t * license MIT (c) Dustin Diaz 2015\n\t * https://github.com/ded/reqwest\n\t */\n\t\n\t!function (name, context, definition) {\n\t if (typeof module != 'undefined' && module.exports) module.exports = definition()\n\t else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\t else context[name] = definition()\n\t}('reqwest', this, function () {\n\t\n\t var context = this\n\t\n\t if ('window' in context) {\n\t var doc = document\n\t , byTag = 'getElementsByTagName'\n\t , head = doc[byTag]('head')[0]\n\t } else {\n\t var XHR2\n\t try {\n\t XHR2 = __webpack_require__(64)\n\t } catch (ex) {\n\t throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n\t }\n\t }\n\t\n\t\n\t var httpsRe = /^http/\n\t , protocolRe = /(^\\w+):\\/\\//\n\t , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n\t , readyState = 'readyState'\n\t , contentType = 'Content-Type'\n\t , requestedWith = 'X-Requested-With'\n\t , uniqid = 0\n\t , callbackPrefix = 'reqwest_' + (+new Date())\n\t , lastValue // data stored by the most recent JSONP callback\n\t , xmlHttpRequest = 'XMLHttpRequest'\n\t , xDomainRequest = 'XDomainRequest'\n\t , noop = function () {}\n\t\n\t , isArray = typeof Array.isArray == 'function'\n\t ? Array.isArray\n\t : function (a) {\n\t return a instanceof Array\n\t }\n\t\n\t , defaultHeaders = {\n\t 'contentType': 'application/x-www-form-urlencoded'\n\t , 'requestedWith': xmlHttpRequest\n\t , 'accept': {\n\t '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n\t , 'xml': 'application/xml, text/xml'\n\t , 'html': 'text/html'\n\t , 'text': 'text/plain'\n\t , 'json': 'application/json, text/javascript'\n\t , 'js': 'application/javascript, text/javascript'\n\t }\n\t }\n\t\n\t , xhr = function(o) {\n\t // is it x-domain\n\t if (o['crossOrigin'] === true) {\n\t var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n\t if (xhr && 'withCredentials' in xhr) {\n\t return xhr\n\t } else if (context[xDomainRequest]) {\n\t return new XDomainRequest()\n\t } else {\n\t throw new Error('Browser does not support cross-origin requests')\n\t }\n\t } else if (context[xmlHttpRequest]) {\n\t return new XMLHttpRequest()\n\t } else if (XHR2) {\n\t return new XHR2()\n\t } else {\n\t return new ActiveXObject('Microsoft.XMLHTTP')\n\t }\n\t }\n\t , globalSetupOptions = {\n\t dataFilter: function (data) {\n\t return data\n\t }\n\t }\n\t\n\t function succeed(r) {\n\t var protocol = protocolRe.exec(r.url)\n\t protocol = (protocol && protocol[1]) || context.location.protocol\n\t return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n\t }\n\t\n\t function handleReadyState(r, success, error) {\n\t return function () {\n\t // use _aborted to mitigate against IE err c00c023f\n\t // (can't read props on aborted request objects)\n\t if (r._aborted) return error(r.request)\n\t if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n\t if (r.request && r.request[readyState] == 4) {\n\t r.request.onreadystatechange = noop\n\t if (succeed(r)) success(r.request)\n\t else\n\t error(r.request)\n\t }\n\t }\n\t }\n\t\n\t function setHeaders(http, o) {\n\t var headers = o['headers'] || {}\n\t , h\n\t\n\t headers['Accept'] = headers['Accept']\n\t || defaultHeaders['accept'][o['type']]\n\t || defaultHeaders['accept']['*']\n\t\n\t var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n\t // breaks cross-origin requests with legacy browsers\n\t if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n\t if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n\t for (h in headers)\n\t headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n\t }\n\t\n\t function setCredentials(http, o) {\n\t if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n\t http.withCredentials = !!o['withCredentials']\n\t }\n\t }\n\t\n\t function generalCallback(data) {\n\t lastValue = data\n\t }\n\t\n\t function urlappend (url, s) {\n\t return url + (/\\?/.test(url) ? '&' : '?') + s\n\t }\n\t\n\t function handleJsonp(o, fn, err, url) {\n\t var reqId = uniqid++\n\t , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n\t , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n\t , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n\t , match = url.match(cbreg)\n\t , script = doc.createElement('script')\n\t , loaded = 0\n\t , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\t\n\t if (match) {\n\t if (match[3] === '?') {\n\t url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n\t } else {\n\t cbval = match[3] // provided callback func name\n\t }\n\t } else {\n\t url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n\t }\n\t\n\t context[cbval] = generalCallback\n\t\n\t script.type = 'text/javascript'\n\t script.src = url\n\t script.async = true\n\t if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n\t // need this for IE due to out-of-order onreadystatechange(), binding script\n\t // execution to an event listener gives us control over when the script\n\t // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n\t script.htmlFor = script.id = '_reqwest_' + reqId\n\t }\n\t\n\t script.onload = script.onreadystatechange = function () {\n\t if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n\t return false\n\t }\n\t script.onload = script.onreadystatechange = null\n\t script.onclick && script.onclick()\n\t // Call the user callback with the last value stored and clean up values and scripts.\n\t fn(lastValue)\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t\n\t // Add the script to the DOM head\n\t head.appendChild(script)\n\t\n\t // Enable JSONP timeout\n\t return {\n\t abort: function () {\n\t script.onload = script.onreadystatechange = null\n\t err({}, 'Request is aborted: timeout', {})\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t }\n\t }\n\t\n\t function getRequest(fn, err) {\n\t var o = this.o\n\t , method = (o['method'] || 'GET').toUpperCase()\n\t , url = typeof o === 'string' ? o : o['url']\n\t // convert non-string objects to query-string form unless o['processData'] is false\n\t , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n\t ? reqwest.toQueryString(o['data'])\n\t : (o['data'] || null)\n\t , http\n\t , sendWait = false\n\t\n\t // if we're working on a GET request and we have data then we should append\n\t // query string to end of URL and not post data\n\t if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n\t url = urlappend(url, data)\n\t data = null\n\t }\n\t\n\t if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\t\n\t // get the xhr from the factory if passed\n\t // if the factory returns null, fall-back to ours\n\t http = (o.xhr && o.xhr(o)) || xhr(o)\n\t\n\t http.open(method, url, o['async'] === false ? false : true)\n\t setHeaders(http, o)\n\t setCredentials(http, o)\n\t if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n\t http.onload = fn\n\t http.onerror = err\n\t // NOTE: see\n\t // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n\t http.onprogress = function() {}\n\t sendWait = true\n\t } else {\n\t http.onreadystatechange = handleReadyState(this, fn, err)\n\t }\n\t o['before'] && o['before'](http)\n\t if (sendWait) {\n\t setTimeout(function () {\n\t http.send(data)\n\t }, 200)\n\t } else {\n\t http.send(data)\n\t }\n\t return http\n\t }\n\t\n\t function Reqwest(o, fn) {\n\t this.o = o\n\t this.fn = fn\n\t\n\t init.apply(this, arguments)\n\t }\n\t\n\t function setType(header) {\n\t // json, javascript, text/plain, text/html, xml\n\t if (header === null) return undefined; //In case of no content-type.\n\t if (header.match('json')) return 'json'\n\t if (header.match('javascript')) return 'js'\n\t if (header.match('text')) return 'html'\n\t if (header.match('xml')) return 'xml'\n\t }\n\t\n\t function init(o, fn) {\n\t\n\t this.url = typeof o == 'string' ? o : o['url']\n\t this.timeout = null\n\t\n\t // whether request has been fulfilled for purpose\n\t // of tracking the Promises\n\t this._fulfilled = false\n\t // success handlers\n\t this._successHandler = function(){}\n\t this._fulfillmentHandlers = []\n\t // error handlers\n\t this._errorHandlers = []\n\t // complete (both success and fail) handlers\n\t this._completeHandlers = []\n\t this._erred = false\n\t this._responseArgs = {}\n\t\n\t var self = this\n\t\n\t fn = fn || function () {}\n\t\n\t if (o['timeout']) {\n\t this.timeout = setTimeout(function () {\n\t timedOut()\n\t }, o['timeout'])\n\t }\n\t\n\t if (o['success']) {\n\t this._successHandler = function () {\n\t o['success'].apply(o, arguments)\n\t }\n\t }\n\t\n\t if (o['error']) {\n\t this._errorHandlers.push(function () {\n\t o['error'].apply(o, arguments)\n\t })\n\t }\n\t\n\t if (o['complete']) {\n\t this._completeHandlers.push(function () {\n\t o['complete'].apply(o, arguments)\n\t })\n\t }\n\t\n\t function complete (resp) {\n\t o['timeout'] && clearTimeout(self.timeout)\n\t self.timeout = null\n\t while (self._completeHandlers.length > 0) {\n\t self._completeHandlers.shift()(resp)\n\t }\n\t }\n\t\n\t function success (resp) {\n\t var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n\t resp = (type !== 'jsonp') ? self.request : resp\n\t // use global data filter on response text\n\t var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n\t , r = filteredResponse\n\t try {\n\t resp.responseText = r\n\t } catch (e) {\n\t // can't assign this in IE<=8, just ignore\n\t }\n\t if (r) {\n\t switch (type) {\n\t case 'json':\n\t try {\n\t resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n\t } catch (err) {\n\t return error(resp, 'Could not parse JSON in response', err)\n\t }\n\t break\n\t case 'js':\n\t resp = eval(r)\n\t break\n\t case 'html':\n\t resp = r\n\t break\n\t case 'xml':\n\t resp = resp.responseXML\n\t && resp.responseXML.parseError // IE trololo\n\t && resp.responseXML.parseError.errorCode\n\t && resp.responseXML.parseError.reason\n\t ? null\n\t : resp.responseXML\n\t break\n\t }\n\t }\n\t\n\t self._responseArgs.resp = resp\n\t self._fulfilled = true\n\t fn(resp)\n\t self._successHandler(resp)\n\t while (self._fulfillmentHandlers.length > 0) {\n\t resp = self._fulfillmentHandlers.shift()(resp)\n\t }\n\t\n\t complete(resp)\n\t }\n\t\n\t function timedOut() {\n\t self._timedOut = true\n\t self.request.abort()\n\t }\n\t\n\t function error(resp, msg, t) {\n\t resp = self.request\n\t self._responseArgs.resp = resp\n\t self._responseArgs.msg = msg\n\t self._responseArgs.t = t\n\t self._erred = true\n\t while (self._errorHandlers.length > 0) {\n\t self._errorHandlers.shift()(resp, msg, t)\n\t }\n\t complete(resp)\n\t }\n\t\n\t this.request = getRequest.call(this, success, error)\n\t }\n\t\n\t Reqwest.prototype = {\n\t abort: function () {\n\t this._aborted = true\n\t this.request.abort()\n\t }\n\t\n\t , retry: function () {\n\t init.call(this, this.o, this.fn)\n\t }\n\t\n\t /**\n\t * Small deviation from the Promises A CommonJs specification\n\t * http://wiki.commonjs.org/wiki/Promises/A\n\t */\n\t\n\t /**\n\t * `then` will execute upon successful requests\n\t */\n\t , then: function (success, fail) {\n\t success = success || function () {}\n\t fail = fail || function () {}\n\t if (this._fulfilled) {\n\t this._responseArgs.resp = success(this._responseArgs.resp)\n\t } else if (this._erred) {\n\t fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._fulfillmentHandlers.push(success)\n\t this._errorHandlers.push(fail)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `always` will execute whether the request succeeds or fails\n\t */\n\t , always: function (fn) {\n\t if (this._fulfilled || this._erred) {\n\t fn(this._responseArgs.resp)\n\t } else {\n\t this._completeHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `fail` will execute when the request fails\n\t */\n\t , fail: function (fn) {\n\t if (this._erred) {\n\t fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._errorHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t , 'catch': function (fn) {\n\t return this.fail(fn)\n\t }\n\t }\n\t\n\t function reqwest(o, fn) {\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t // normalize newline variants according to spec -> CRLF\n\t function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }\n\t\n\t function serial(el, cb) {\n\t var n = el.name\n\t , t = el.tagName.toLowerCase()\n\t , optCb = function (o) {\n\t // IE gives value=\"\" even where there is no value attribute\n\t // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n\t if (o && !o['disabled'])\n\t cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n\t }\n\t , ch, ra, val, i\n\t\n\t // don't serialize elements that are disabled or without a name\n\t if (el.disabled || !n) return\n\t\n\t switch (t) {\n\t case 'input':\n\t if (!/reset|button|image|file/i.test(el.type)) {\n\t ch = /checkbox/i.test(el.type)\n\t ra = /radio/i.test(el.type)\n\t val = el.value\n\t // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n\t ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n\t }\n\t break\n\t case 'textarea':\n\t cb(n, normalize(el.value))\n\t break\n\t case 'select':\n\t if (el.type.toLowerCase() === 'select-one') {\n\t optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n\t } else {\n\t for (i = 0; el.length && i < el.length; i++) {\n\t el.options[i].selected && optCb(el.options[i])\n\t }\n\t }\n\t break\n\t }\n\t }\n\t\n\t // collect up all form elements found from the passed argument elements all\n\t // the way down to child elements; pass a '' or form fields.\n\t // called with 'this'=callback to use for serial() on each element\n\t function eachFormElement() {\n\t var cb = this\n\t , e, i\n\t , serializeSubtags = function (e, tags) {\n\t var i, j, fa\n\t for (i = 0; i < tags.length; i++) {\n\t fa = e[byTag](tags[i])\n\t for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n\t }\n\t }\n\t\n\t for (i = 0; i < arguments.length; i++) {\n\t e = arguments[i]\n\t if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n\t serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n\t }\n\t }\n\t\n\t // standard query string style serialization\n\t function serializeQueryString() {\n\t return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n\t }\n\t\n\t // { 'name': 'value', ... } style serialization\n\t function serializeHash() {\n\t var hash = {}\n\t eachFormElement.apply(function (name, value) {\n\t if (name in hash) {\n\t hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n\t hash[name].push(value)\n\t } else hash[name] = value\n\t }, arguments)\n\t return hash\n\t }\n\t\n\t // [ { name: 'name', value: 'value' }, ... ] style serialization\n\t reqwest.serializeArray = function () {\n\t var arr = []\n\t eachFormElement.apply(function (name, value) {\n\t arr.push({name: name, value: value})\n\t }, arguments)\n\t return arr\n\t }\n\t\n\t reqwest.serialize = function () {\n\t if (arguments.length === 0) return ''\n\t var opt, fn\n\t , args = Array.prototype.slice.call(arguments, 0)\n\t\n\t opt = args.pop()\n\t opt && opt.nodeType && args.push(opt) && (opt = null)\n\t opt && (opt = opt.type)\n\t\n\t if (opt == 'map') fn = serializeHash\n\t else if (opt == 'array') fn = reqwest.serializeArray\n\t else fn = serializeQueryString\n\t\n\t return fn.apply(null, args)\n\t }\n\t\n\t reqwest.toQueryString = function (o, trad) {\n\t var prefix, i\n\t , traditional = trad || false\n\t , s = []\n\t , enc = encodeURIComponent\n\t , add = function (key, value) {\n\t // If value is a function, invoke it and return its value\n\t value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n\t s[s.length] = enc(key) + '=' + enc(value)\n\t }\n\t // If an array was passed in, assume that it is an array of form elements.\n\t if (isArray(o)) {\n\t for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n\t } else {\n\t // If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t // did it), otherwise encode params recursively.\n\t for (prefix in o) {\n\t if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n\t }\n\t }\n\t\n\t // spaces should be + according to spec\n\t return s.join('&').replace(/%20/g, '+')\n\t }\n\t\n\t function buildParams(prefix, obj, traditional, add) {\n\t var name, i, v\n\t , rbracket = /\\[\\]$/\n\t\n\t if (isArray(obj)) {\n\t // Serialize array item.\n\t for (i = 0; obj && i < obj.length; i++) {\n\t v = obj[i]\n\t if (traditional || rbracket.test(prefix)) {\n\t // Treat each array item as a scalar.\n\t add(prefix, v)\n\t } else {\n\t buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n\t }\n\t }\n\t } else if (obj && obj.toString() === '[object Object]') {\n\t // Serialize object item.\n\t for (name in obj) {\n\t buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n\t }\n\t\n\t } else {\n\t // Serialize scalar item.\n\t add(prefix, obj)\n\t }\n\t }\n\t\n\t reqwest.getcallbackPrefix = function () {\n\t return callbackPrefix\n\t }\n\t\n\t // jQuery and Zepto compatibility, differences can be remapped here so you can call\n\t // .ajax.compat(options, callback)\n\t reqwest.compat = function (o, fn) {\n\t if (o) {\n\t o['type'] && (o['method'] = o['type']) && delete o['type']\n\t o['dataType'] && (o['type'] = o['dataType'])\n\t o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n\t o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n\t }\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t reqwest.ajaxSetup = function (options) {\n\t options = options || {}\n\t for (var k in options) {\n\t globalSetupOptions[k] = options[k]\n\t }\n\t }\n\t\n\t return reqwest\n\t});\n\n\n/***/ },\n/* 64 */\n/***/ function(module, exports) {\n\n\t/* (ignored) */\n\n/***/ },\n/* 65 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * GeoJSON helpers for handling data and generating objects\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _topojson2 = __webpack_require__(66);\n\t\n\tvar _topojson3 = _interopRequireDefault(_topojson2);\n\t\n\tvar _geojsonMerge = __webpack_require__(67);\n\t\n\tvar _geojsonMerge2 = _interopRequireDefault(_geojsonMerge);\n\t\n\t// TODO: Make it so height can be per-coordinate / point but connected together\n\t// as a linestring (eg. GPS points with an elevation at each point)\n\t//\n\t// This isn't really valid GeoJSON so perhaps something best left to an external\n\t// component for now, until a better approach can be considered\n\t//\n\t// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\t\n\t// Light and dark colours used for poor-mans AO gradient on object sides\n\tvar light = new _three2['default'].Color(0xffffff);\n\tvar shadow = new _three2['default'].Color(0x666666);\n\t\n\tvar GeoJSON = (function () {\n\t var defaultStyle = {\n\t color: '#ffffff',\n\t height: 0,\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t };\n\t\n\t // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n\t // into a single FeatureCollection\n\t var collectFeatures = function collectFeatures(data, _topojson) {\n\t var collections = [];\n\t\n\t if (_topojson) {\n\t // TODO: Allow TopoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var tk in data.objects) {\n\t collections.push(_topojson3['default'].feature(data, data.objects[tk]));\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else {\n\t // If root doesn't have a type then let's see if there are features in the\n\t // next step down\n\t if (!data.type) {\n\t // TODO: Allow GeoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var gk in data) {\n\t if (!data[gk].type) {\n\t continue;\n\t }\n\t\n\t collections.push(data[gk]);\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else if (Array.isArray(data)) {\n\t return (0, _geojsonMerge2['default'])(data);\n\t } else {\n\t return data;\n\t }\n\t }\n\t };\n\t\n\t return {\n\t defaultStyle: defaultStyle,\n\t collectFeatures: collectFeatures\n\t };\n\t})();\n\t\n\texports['default'] = GeoJSON;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t(function (global, factory) {\n\t true ? factory(exports) :\n\t typeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t (factory((global.topojson = {})));\n\t}(this, function (exports) { 'use strict';\n\t\n\t function noop() {}\n\t\n\t function absolute(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t point[0] = (x0 += point[0]) * kx + dx;\n\t point[1] = (y0 += point[1]) * ky + dy;\n\t };\n\t }\n\t\n\t function relative(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t var x1 = (point[0] - dx) / kx | 0,\n\t y1 = (point[1] - dy) / ky | 0;\n\t point[0] = x1 - x0;\n\t point[1] = y1 - y0;\n\t x0 = x1;\n\t y0 = y1;\n\t };\n\t }\n\t\n\t function reverse(array, n) {\n\t var t, j = array.length, i = j - n;\n\t while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n\t }\n\t\n\t function bisect(a, x) {\n\t var lo = 0, hi = a.length;\n\t while (lo < hi) {\n\t var mid = lo + hi >>> 1;\n\t if (a[mid] < x) lo = mid + 1;\n\t else hi = mid;\n\t }\n\t return lo;\n\t }\n\t\n\t function feature(topology, o) {\n\t return o.type === \"GeometryCollection\" ? {\n\t type: \"FeatureCollection\",\n\t features: o.geometries.map(function(o) { return feature$1(topology, o); })\n\t } : feature$1(topology, o);\n\t }\n\t\n\t function feature$1(topology, o) {\n\t var f = {\n\t type: \"Feature\",\n\t id: o.id,\n\t properties: o.properties || {},\n\t geometry: object(topology, o)\n\t };\n\t if (o.id == null) delete f.id;\n\t return f;\n\t }\n\t\n\t function object(topology, o) {\n\t var absolute$$ = absolute(topology.transform),\n\t arcs = topology.arcs;\n\t\n\t function arc(i, points) {\n\t if (points.length) points.pop();\n\t for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n\t points.push(p = a[k].slice());\n\t absolute$$(p, k);\n\t }\n\t if (i < 0) reverse(points, n);\n\t }\n\t\n\t function point(p) {\n\t p = p.slice();\n\t absolute$$(p, 0);\n\t return p;\n\t }\n\t\n\t function line(arcs) {\n\t var points = [];\n\t for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n\t if (points.length < 2) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function ring(arcs) {\n\t var points = line(arcs);\n\t while (points.length < 4) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function polygon(arcs) {\n\t return arcs.map(ring);\n\t }\n\t\n\t function geometry(o) {\n\t var t = o.type;\n\t return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n\t : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n\t : null;\n\t }\n\t\n\t var geometryType = {\n\t Point: function(o) { return point(o.coordinates); },\n\t MultiPoint: function(o) { return o.coordinates.map(point); },\n\t LineString: function(o) { return line(o.arcs); },\n\t MultiLineString: function(o) { return o.arcs.map(line); },\n\t Polygon: function(o) { return polygon(o.arcs); },\n\t MultiPolygon: function(o) { return o.arcs.map(polygon); }\n\t };\n\t\n\t return geometry(o);\n\t }\n\t\n\t function stitchArcs(topology, arcs) {\n\t var stitchedArcs = {},\n\t fragmentByStart = {},\n\t fragmentByEnd = {},\n\t fragments = [],\n\t emptyIndex = -1;\n\t\n\t // Stitch empty arcs first, since they may be subsumed by other arcs.\n\t arcs.forEach(function(i, j) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], t;\n\t if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n\t t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n\t }\n\t });\n\t\n\t arcs.forEach(function(i) {\n\t var e = ends(i),\n\t start = e[0],\n\t end = e[1],\n\t f, g;\n\t\n\t if (f = fragmentByEnd[start]) {\n\t delete fragmentByEnd[f.end];\n\t f.push(i);\n\t f.end = end;\n\t if (g = fragmentByStart[end]) {\n\t delete fragmentByStart[g.start];\n\t var fg = g === f ? f : f.concat(g);\n\t fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else if (f = fragmentByStart[end]) {\n\t delete fragmentByStart[f.start];\n\t f.unshift(i);\n\t f.start = start;\n\t if (g = fragmentByEnd[start]) {\n\t delete fragmentByEnd[g.end];\n\t var gf = g === f ? f : g.concat(f);\n\t fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else {\n\t f = [i];\n\t fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n\t }\n\t });\n\t\n\t function ends(i) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n\t if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n\t else p1 = arc[arc.length - 1];\n\t return i < 0 ? [p1, p0] : [p0, p1];\n\t }\n\t\n\t function flush(fragmentByEnd, fragmentByStart) {\n\t for (var k in fragmentByEnd) {\n\t var f = fragmentByEnd[k];\n\t delete fragmentByStart[f.start];\n\t delete f.start;\n\t delete f.end;\n\t f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n\t fragments.push(f);\n\t }\n\t }\n\t\n\t flush(fragmentByEnd, fragmentByStart);\n\t flush(fragmentByStart, fragmentByEnd);\n\t arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\t\n\t return fragments;\n\t }\n\t\n\t function mesh(topology) {\n\t return object(topology, meshArcs.apply(this, arguments));\n\t }\n\t\n\t function meshArcs(topology, o, filter) {\n\t var arcs = [];\n\t\n\t function arc(i) {\n\t var j = i < 0 ? ~i : i;\n\t (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n\t }\n\t\n\t function line(arcs) {\n\t arcs.forEach(arc);\n\t }\n\t\n\t function polygon(arcs) {\n\t arcs.forEach(line);\n\t }\n\t\n\t function geometry(o) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n\t else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n\t }\n\t\n\t if (arguments.length > 1) {\n\t var geomsByArc = [],\n\t geom;\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n\t };\n\t\n\t geometry(o);\n\t\n\t geomsByArc.forEach(arguments.length < 3\n\t ? function(geoms) { arcs.push(geoms[0].i); }\n\t : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n\t } else {\n\t for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n\t }\n\t\n\t return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n\t }\n\t\n\t function triangle(triangle) {\n\t var a = triangle[0], b = triangle[1], c = triangle[2];\n\t return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n\t }\n\t\n\t function ring(ring) {\n\t var i = -1,\n\t n = ring.length,\n\t a,\n\t b = ring[n - 1],\n\t area = 0;\n\t\n\t while (++i < n) {\n\t a = b;\n\t b = ring[i];\n\t area += a[0] * b[1] - a[1] * b[0];\n\t }\n\t\n\t return area / 2;\n\t }\n\t\n\t function merge(topology) {\n\t return object(topology, mergeArcs.apply(this, arguments));\n\t }\n\t\n\t function mergeArcs(topology, objects) {\n\t var polygonsByArc = {},\n\t polygons = [],\n\t components = [];\n\t\n\t objects.forEach(function(o) {\n\t if (o.type === \"Polygon\") register(o.arcs);\n\t else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n\t });\n\t\n\t function register(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n\t });\n\t });\n\t polygons.push(polygon);\n\t }\n\t\n\t function exterior(ring$$) {\n\t return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n\t }\n\t\n\t polygons.forEach(function(polygon) {\n\t if (!polygon._) {\n\t var component = [],\n\t neighbors = [polygon];\n\t polygon._ = 1;\n\t components.push(component);\n\t while (polygon = neighbors.pop()) {\n\t component.push(polygon);\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n\t if (!polygon._) {\n\t polygon._ = 1;\n\t neighbors.push(polygon);\n\t }\n\t });\n\t });\n\t });\n\t }\n\t }\n\t });\n\t\n\t polygons.forEach(function(polygon) {\n\t delete polygon._;\n\t });\n\t\n\t return {\n\t type: \"MultiPolygon\",\n\t arcs: components.map(function(polygons) {\n\t var arcs = [], n;\n\t\n\t // Extract the exterior (unique) arcs.\n\t polygons.forEach(function(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n\t arcs.push(arc);\n\t }\n\t });\n\t });\n\t });\n\t\n\t // Stitch the arcs into one or more rings.\n\t arcs = stitchArcs(topology, arcs);\n\t\n\t // If more than one ring is returned,\n\t // at most one of these rings can be the exterior;\n\t // this exterior ring has the same winding order\n\t // as any exterior ring in the original polygons.\n\t if ((n = arcs.length) > 1) {\n\t var sgn = exterior(polygons[0][0]);\n\t for (var i = 0, t; i < n; ++i) {\n\t if (sgn === exterior(arcs[i])) {\n\t t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t return arcs;\n\t })\n\t };\n\t }\n\t\n\t function neighbors(objects) {\n\t var indexesByArc = {}, // arc index -> array of object indexes\n\t neighbors = objects.map(function() { return []; });\n\t\n\t function line(arcs, i) {\n\t arcs.forEach(function(a) {\n\t if (a < 0) a = ~a;\n\t var o = indexesByArc[a];\n\t if (o) o.push(i);\n\t else indexesByArc[a] = [i];\n\t });\n\t }\n\t\n\t function polygon(arcs, i) {\n\t arcs.forEach(function(arc) { line(arc, i); });\n\t }\n\t\n\t function geometry(o, i) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n\t else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n\t }\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n\t };\n\t\n\t objects.forEach(geometry);\n\t\n\t for (var i in indexesByArc) {\n\t for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n\t for (var k = j + 1; k < m; ++k) {\n\t var ij = indexes[j], ik = indexes[k], n;\n\t if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n\t if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n\t }\n\t }\n\t }\n\t\n\t return neighbors;\n\t }\n\t\n\t function compareArea(a, b) {\n\t return a[1][2] - b[1][2];\n\t }\n\t\n\t function minAreaHeap() {\n\t var heap = {},\n\t array = [],\n\t size = 0;\n\t\n\t heap.push = function(object) {\n\t up(array[object._ = size] = object, size++);\n\t return size;\n\t };\n\t\n\t heap.pop = function() {\n\t if (size <= 0) return;\n\t var removed = array[0], object;\n\t if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n\t return removed;\n\t };\n\t\n\t heap.remove = function(removed) {\n\t var i = removed._, object;\n\t if (array[i] !== removed) return; // invalid request\n\t if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n\t return i;\n\t };\n\t\n\t function up(object, i) {\n\t while (i > 0) {\n\t var j = ((i + 1) >> 1) - 1,\n\t parent = array[j];\n\t if (compareArea(object, parent) >= 0) break;\n\t array[parent._ = i] = parent;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t function down(object, i) {\n\t while (true) {\n\t var r = (i + 1) << 1,\n\t l = r - 1,\n\t j = i,\n\t child = array[j];\n\t if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n\t if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n\t if (j === i) break;\n\t array[child._ = i] = child;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t return heap;\n\t }\n\t\n\t function presimplify(topology, triangleArea) {\n\t var absolute$$ = absolute(topology.transform),\n\t relative$$ = relative(topology.transform),\n\t heap = minAreaHeap();\n\t\n\t if (!triangleArea) triangleArea = triangle;\n\t\n\t topology.arcs.forEach(function(arc) {\n\t var triangles = [],\n\t maxArea = 0,\n\t triangle,\n\t i,\n\t n,\n\t p;\n\t\n\t // To store each point’s effective area, we create a new array rather than\n\t // extending the passed-in point to workaround a Chrome/V8 bug (getting\n\t // stuck in smi mode). For midpoints, the initial effective area of\n\t // Infinity will be computed in the next step.\n\t for (i = 0, n = arc.length; i < n; ++i) {\n\t p = arc[i];\n\t absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n\t }\n\t\n\t for (i = 1, n = arc.length - 1; i < n; ++i) {\n\t triangle = arc.slice(i - 1, i + 2);\n\t triangle[1][2] = triangleArea(triangle);\n\t triangles.push(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t for (i = 0, n = triangles.length; i < n; ++i) {\n\t triangle = triangles[i];\n\t triangle.previous = triangles[i - 1];\n\t triangle.next = triangles[i + 1];\n\t }\n\t\n\t while (triangle = heap.pop()) {\n\t var previous = triangle.previous,\n\t next = triangle.next;\n\t\n\t // If the area of the current point is less than that of the previous point\n\t // to be eliminated, use the latter's area instead. This ensures that the\n\t // current point cannot be eliminated without eliminating previously-\n\t // eliminated points.\n\t if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n\t else maxArea = triangle[1][2];\n\t\n\t if (previous) {\n\t previous.next = next;\n\t previous[2] = triangle[2];\n\t update(previous);\n\t }\n\t\n\t if (next) {\n\t next.previous = previous;\n\t next[0] = triangle[0];\n\t update(next);\n\t }\n\t }\n\t\n\t arc.forEach(relative$$);\n\t });\n\t\n\t function update(triangle) {\n\t heap.remove(triangle);\n\t triangle[1][2] = triangleArea(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t return topology;\n\t }\n\t\n\t var version = \"1.6.24\";\n\t\n\t exports.version = version;\n\t exports.mesh = mesh;\n\t exports.meshArcs = meshArcs;\n\t exports.merge = merge;\n\t exports.mergeArcs = mergeArcs;\n\t exports.feature = feature;\n\t exports.neighbors = neighbors;\n\t exports.presimplify = presimplify;\n\t\n\t}));\n\n/***/ },\n/* 67 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar normalize = __webpack_require__(68);\n\t\n\tmodule.exports = function(inputs) {\n\t return {\n\t type: 'FeatureCollection',\n\t features: inputs.reduce(function(memo, input) {\n\t return memo.concat(normalize(input).features);\n\t }, [])\n\t };\n\t};\n\n\n/***/ },\n/* 68 */\n/***/ function(module, exports) {\n\n\tmodule.exports = normalize;\n\t\n\tvar types = {\n\t Point: 'geometry',\n\t MultiPoint: 'geometry',\n\t LineString: 'geometry',\n\t MultiLineString: 'geometry',\n\t Polygon: 'geometry',\n\t MultiPolygon: 'geometry',\n\t GeometryCollection: 'geometry',\n\t Feature: 'feature',\n\t FeatureCollection: 'featurecollection'\n\t};\n\t\n\t/**\n\t * Normalize a GeoJSON feature into a FeatureCollection.\n\t *\n\t * @param {object} gj geojson data\n\t * @returns {object} normalized geojson data\n\t */\n\tfunction normalize(gj) {\n\t if (!gj || !gj.type) return null;\n\t var type = types[gj.type];\n\t if (!type) return null;\n\t\n\t if (type === 'geometry') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [{\n\t type: 'Feature',\n\t properties: {},\n\t geometry: gj\n\t }]\n\t };\n\t } else if (type === 'feature') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [gj]\n\t };\n\t } else if (type === 'featurecollection') {\n\t return gj;\n\t }\n\t}\n\n\n/***/ },\n/* 69 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * BufferGeometry helpers\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar Buffer = (function () {\n\t // Merge multiple attribute objects into a single attribute object\n\t //\n\t // Attribute objects must all use the same attribute keys\n\t var mergeAttributes = function mergeAttributes(attributes) {\n\t var lengths = {};\n\t\n\t // Find array lengths\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lengths[k]) {\n\t lengths[k] = 0;\n\t }\n\t\n\t lengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t var mergedAttributes = {};\n\t\n\t // Set up arrays to merge into\n\t for (var k in lengths) {\n\t mergedAttributes[k] = new Float32Array(lengths[k]);\n\t }\n\t\n\t var lastLengths = {};\n\t\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lastLengths[k]) {\n\t lastLengths[k] = 0;\n\t }\n\t\n\t mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\t\n\t lastLengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t return mergedAttributes;\n\t };\n\t\n\t var createLineGeometry = function createLineGeometry(lines, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t var vertices = new Float32Array(lines.verticesCount * 3);\n\t var colours = new Float32Array(lines.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (lines.pickingIds) {\n\t // One component per vertex (1)\n\t pickingIds = new Float32Array(lines.verticesCount);\n\t }\n\t\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < lines.vertices.length; i++) {\n\t _vertices = lines.vertices[i];\n\t _colour = lines.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = lines.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _vertices.length; j++) {\n\t var ax = _vertices[j][0] + offset.x;\n\t var ay = _vertices[j][1];\n\t var az = _vertices[j][2] + offset.y;\n\t\n\t var c1 = _colour[j];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t // TODO: Make picking IDs optional\n\t var createGeometry = function createGeometry(attributes, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(attributes.facesCount * 9);\n\t var normals = new Float32Array(attributes.facesCount * 9);\n\t var colours = new Float32Array(attributes.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (attributes.pickingIds) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(attributes.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t var _faces;\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t var lastIndex = 0;\n\t for (var i = 0; i < attributes.faces.length; i++) {\n\t _faces = attributes.faces[i];\n\t _vertices = attributes.vertices[i];\n\t _colour = attributes.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = attributes.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _faces.length; j++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[j][0];\n\t\n\t var ax = _vertices[index][0] + offset.x;\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2] + offset.y;\n\t\n\t var c1 = _colour[j][0];\n\t\n\t index = _faces[j][1];\n\t\n\t var bx = _vertices[index][0] + offset.x;\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2] + offset.y;\n\t\n\t var c2 = _colour[j][1];\n\t\n\t index = _faces[j][2];\n\t\n\t var cx = _vertices[index][0] + offset.x;\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2] + offset.y;\n\t\n\t var c3 = _colour[j][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t return {\n\t mergeAttributes: mergeAttributes,\n\t createLineGeometry: createLineGeometry,\n\t createGeometry: createGeometry\n\t };\n\t})();\n\t\n\texports['default'] = Buffer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _PickingShader = __webpack_require__(71);\n\t\n\tvar _PickingShader2 = _interopRequireDefault(_PickingShader);\n\t\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingMaterial = function PickingMaterial() {\n\t _three2['default'].ShaderMaterial.call(this, {\n\t uniforms: {\n\t size: {\n\t type: 'f',\n\t value: 0.01\n\t },\n\t scale: {\n\t type: 'f',\n\t value: 400\n\t }\n\t },\n\t // attributes: ['position', 'id'],\n\t vertexShader: _PickingShader2['default'].vertexShader,\n\t fragmentShader: _PickingShader2['default'].fragmentShader\n\t });\n\t\n\t this.linePadding = 2;\n\t};\n\t\n\tPickingMaterial.prototype = Object.create(_three2['default'].ShaderMaterial.prototype);\n\t\n\tPickingMaterial.prototype.constructor = PickingMaterial;\n\t\n\tPickingMaterial.prototype.setPointSize = function (size) {\n\t this.uniforms.size.value = size;\n\t};\n\t\n\tPickingMaterial.prototype.setPointScale = function (scale) {\n\t this.uniforms.scale.value = scale;\n\t};\n\t\n\texports['default'] = PickingMaterial;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 71 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingShader = {\n\t\tvertexShader: ['attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'', 'varying vec4 worldId;', '', 'void main() {', ' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);', ' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);', ' worldId = vec4(a,1);', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['#ifdef GL_ES\\n', 'precision highp float;\\n', '#endif\\n', '', 'varying vec4 worldId;', '', 'void main() {', ' gl_FragColor = worldId;', '}'].join('\\n')\n\t};\n\t\n\texports['default'] = PickingShader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 72 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONTileLayer2 = __webpack_require__(61);\n\t\n\tvar _GeoJSONTileLayer3 = _interopRequireDefault(_GeoJSONTileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONTileLayer = (function (_GeoJSONTileLayer) {\n\t _inherits(TopoJSONTileLayer, _GeoJSONTileLayer);\n\t\n\t function TopoJSONTileLayer(path, options) {\n\t _classCallCheck(this, TopoJSONTileLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONTileLayer.prototype), 'constructor', this).call(this, path, options);\n\t }\n\t\n\t return TopoJSONTileLayer;\n\t})(_GeoJSONTileLayer3['default']);\n\t\n\texports['default'] = TopoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new TopoJSONTileLayer(path, options);\n\t};\n\t\n\texports.topoJSONTileLayer = noNew;\n\n/***/ },\n/* 73 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Consider adopting GeoJSON CSS\n\t// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\t\n\tvar _LayerGroup2 = __webpack_require__(74);\n\t\n\tvar _LayerGroup3 = _interopRequireDefault(_LayerGroup2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _reqwest = __webpack_require__(63);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _utilGeoJSON = __webpack_require__(65);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _geometryPolygonLayer = __webpack_require__(75);\n\t\n\tvar _geometryPolygonLayer2 = _interopRequireDefault(_geometryPolygonLayer);\n\t\n\tvar _geometryPolylineLayer = __webpack_require__(78);\n\t\n\tvar _geometryPolylineLayer2 = _interopRequireDefault(_geometryPolylineLayer);\n\t\n\tvar _geometryPointLayer = __webpack_require__(79);\n\t\n\tvar _geometryPointLayer2 = _interopRequireDefault(_geometryPointLayer);\n\t\n\tvar GeoJSONLayer = (function (_LayerGroup) {\n\t _inherits(GeoJSONLayer, _LayerGroup);\n\t\n\t function GeoJSONLayer(geojson, options) {\n\t _classCallCheck(this, GeoJSONLayer);\n\t\n\t var defaults = {\n\t output: false,\n\t interactive: false,\n\t topojson: false,\n\t filter: null,\n\t onEachFeature: null,\n\t polygonMaterial: null,\n\t onPolygonMesh: null,\n\t onPolygonBufferAttributes: null,\n\t polylineMaterial: null,\n\t onPolylineMesh: null,\n\t onPolylineBufferAttributes: null,\n\t pointGeometry: null,\n\t pointMaterial: null,\n\t onPointMesh: null,\n\t style: _utilGeoJSON2['default'].defaultStyle\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t _options.style = options.style;\n\t } else {\n\t _options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._geojson = geojson;\n\t }\n\t\n\t _createClass(GeoJSONLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new THREE.Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t // Request data from URL if needed\n\t if (typeof this._geojson === 'string') {\n\t this._requestData(this._geojson);\n\t } else {\n\t // Process and add GeoJSON to layer\n\t this._processData(this._geojson);\n\t }\n\t }\n\t }, {\n\t key: '_requestData',\n\t value: function _requestData(url) {\n\t var _this = this;\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this._request = null;\n\t _this._processData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this._request = null;\n\t });\n\t }\n\t\n\t // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n\t // GeoJSON output layer\n\t //\n\t // Need to be careful as to not make it impossible to fork this off into a\n\t // worker script at a later stage\n\t }, {\n\t key: '_processData',\n\t value: function _processData(data) {\n\t var _this2 = this;\n\t\n\t // Collects features into a single FeatureCollection\n\t //\n\t // Also converts TopoJSON to GeoJSON if instructed\n\t this._geojson = _utilGeoJSON2['default'].collectFeatures(data, this._options.topojson);\n\t\n\t // TODO: Check that GeoJSON is valid / usable\n\t\n\t var features = this._geojson.features;\n\t\n\t // Run filter, if provided\n\t if (this._options.filter) {\n\t features = this._geojson.features.filter(this._options.filter);\n\t }\n\t\n\t var defaults = {};\n\t\n\t // Assume that a style won't be set per feature\n\t var style = this._options.style;\n\t\n\t var options;\n\t features.forEach(function (feature) {\n\t // Get per-feature style object, if provided\n\t if (typeof _this2._options.style === 'function') {\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, _this2._options.style(feature));\n\t }\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, {\n\t // If merging feature layers, stop them outputting themselves\n\t // If not, let feature layers output themselves to the world\n\t output: !_this2.isOutput(),\n\t interactive: _this2._options.interactive,\n\t style: style\n\t });\n\t\n\t var layer = _this2._featureToLayer(feature, options);\n\t\n\t if (!layer) {\n\t return;\n\t }\n\t\n\t layer.feature = feature;\n\t\n\t // If defined, call a function for each feature\n\t //\n\t // This is commonly used for adding event listeners from the user script\n\t if (_this2._options.onEachFeature) {\n\t _this2._options.onEachFeature(feature, layer);\n\t }\n\t\n\t _this2.addLayer(layer);\n\t });\n\t\n\t // If merging layers do that now, otherwise skip as the geometry layers\n\t // should have already outputted themselves\n\t if (!this.isOutput()) {\n\t return;\n\t }\n\t\n\t // From here on we can assume that we want to merge the layers\n\t\n\t var polygonAttributes = [];\n\t var polygonFlat = true;\n\t\n\t var polylineAttributes = [];\n\t var pointAttributes = [];\n\t\n\t this._layers.forEach(function (layer) {\n\t if (layer instanceof _geometryPolygonLayer2['default']) {\n\t polygonAttributes.push(layer.getBufferAttributes());\n\t\n\t if (polygonFlat && !layer.isFlat()) {\n\t polygonFlat = false;\n\t }\n\t } else if (layer instanceof _geometryPolylineLayer2['default']) {\n\t polylineAttributes.push(layer.getBufferAttributes());\n\t } else if (layer instanceof _geometryPointLayer2['default']) {\n\t pointAttributes.push(layer.getBufferAttributes());\n\t }\n\t });\n\t\n\t if (polygonAttributes.length > 0) {\n\t var mergedPolygonAttributes = _utilBuffer2['default'].mergeAttributes(polygonAttributes);\n\t this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n\t this.add(this._polygonMesh);\n\t }\n\t\n\t if (polylineAttributes.length > 0) {\n\t var mergedPolylineAttributes = _utilBuffer2['default'].mergeAttributes(polylineAttributes);\n\t this._setPolylineMesh(mergedPolylineAttributes);\n\t this.add(this._polylineMesh);\n\t }\n\t\n\t if (pointAttributes.length > 0) {\n\t var mergedPointAttributes = _utilBuffer2['default'].mergeAttributes(pointAttributes);\n\t this._setPointMesh(mergedPointAttributes);\n\t this.add(this._pointMesh);\n\t }\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // TODO: De-dupe this from the individual mesh creation logic within each\n\t // geometry layer (materials, settings, etc)\n\t //\n\t // Could make this an abstract method for each geometry layer\n\t }, {\n\t key: '_setPolygonMesh',\n\t value: function _setPolygonMesh(attributes, flat) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t\n\t if (flat) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onPolygonMesh === 'function') {\n\t this._options.onPolygonMesh(mesh);\n\t }\n\t\n\t this._polygonMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPolylineMesh',\n\t value: function _setPolylineMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t // TODO: Make this work when style is a function per feature\n\t var style = typeof this._options.style === 'function' ? this._options.style(this._geojson.features[0]) : this._options.style;\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, style);\n\t\n\t var material;\n\t if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) {\n\t material = this._options.material;\n\t } else {\n\t material = new THREE.LineBasicMaterial({\n\t vertexColors: THREE.VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t }\n\t\n\t var mesh = new THREE.LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new THREE.LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onPolylineMesh === 'function') {\n\t this._options.onPolylineMesh(mesh);\n\t }\n\t\n\t this._polylineMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPointMesh',\n\t value: function _setPointMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t // Pass mesh callback, if defined\n\t if (typeof this._options.onPointMesh === 'function') {\n\t this._options.onPointMesh(mesh);\n\t }\n\t\n\t this._pointMesh = mesh;\n\t }\n\t\n\t // TODO: Support all GeoJSON geometry types\n\t }, {\n\t key: '_featureToLayer',\n\t value: function _featureToLayer(feature, options) {\n\t var geometry = feature.geometry;\n\t var coordinates = geometry.coordinates ? geometry.coordinates : null;\n\t\n\t if (!coordinates || !geometry) {\n\t return;\n\t }\n\t\n\t if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n\t // Get material instance to use for polygon, if provided\n\t if (typeof this._options.polygonMaterial === 'function') {\n\t options.geometry = this._options.polygonMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPolygonMesh === 'function') {\n\t options.onMesh = this._options.onPolygonMesh;\n\t }\n\t\n\t // Pass onBufferAttributes callback, if defined\n\t if (typeof this._options.onPolygonBufferAttributes === 'function') {\n\t options.onBufferAttributes = this._options.onPolygonBufferAttributes;\n\t }\n\t\n\t return new _geometryPolygonLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n\t // Get material instance to use for line, if provided\n\t if (typeof this._options.lineMaterial === 'function') {\n\t options.geometry = this._options.lineMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPolylineMesh === 'function') {\n\t options.onMesh = this._options.onPolylineMesh;\n\t }\n\t\n\t // Pass onBufferAttributes callback, if defined\n\t if (typeof this._options.onPolylineBufferAttributes === 'function') {\n\t options.onBufferAttributes = this._options.onPolylineBufferAttributes;\n\t }\n\t\n\t return new _geometryPolylineLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n\t // Get geometry object to use for point, if provided\n\t if (typeof this._options.pointGeometry === 'function') {\n\t options.geometry = this._options.pointGeometry(feature);\n\t }\n\t\n\t // Get material instance to use for point, if provided\n\t if (typeof this._options.pointMaterial === 'function') {\n\t options.geometry = this._options.pointMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPointMesh === 'function') {\n\t options.onMesh = this._options.onPointMesh;\n\t }\n\t\n\t return new _geometryPointLayer2['default'](coordinates, options);\n\t }\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONLayer;\n\t})(_LayerGroup3['default']);\n\t\n\texports['default'] = GeoJSONLayer;\n\t\n\tvar noNew = function noNew(geojson, options) {\n\t return new GeoJSONLayer(geojson, options);\n\t};\n\t\n\texports.geoJSONLayer = noNew;\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar LayerGroup = (function (_Layer) {\n\t _inherits(LayerGroup, _Layer);\n\t\n\t function LayerGroup(options) {\n\t _classCallCheck(this, LayerGroup);\n\t\n\t var defaults = {\n\t output: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._layers = [];\n\t }\n\t\n\t _createClass(LayerGroup, [{\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t this._layers.push(layer);\n\t this._world.addLayer(layer);\n\t }\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t this._world.removeLayer(layer);\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t for (var i = 0; i < this._layers.length; i++) {\n\t this._layers[i].destroy();\n\t }\n\t\n\t this._layers = null;\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return LayerGroup;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = LayerGroup;\n\t\n\tvar noNew = function noNew(options) {\n\t return new LayerGroup(options);\n\t};\n\t\n\texports.layerGroup = noNew;\n\n/***/ },\n/* 75 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\t// TODO: Allow _setBufferAttributes to use a custom function passed in to\n\t// generate a custom mesh\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _earcut2 = __webpack_require__(76);\n\t\n\tvar _earcut3 = _interopRequireDefault(_earcut2);\n\t\n\tvar _utilExtrudePolygon = __webpack_require__(77);\n\t\n\tvar _utilExtrudePolygon2 = _interopRequireDefault(_utilExtrudePolygon);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolygonLayer = (function (_Layer) {\n\t _inherits(PolygonLayer, _Layer);\n\t\n\t function PolygonLayer(coordinates, options) {\n\t _classCallCheck(this, PolygonLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t onBufferAttributes: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t color: '#ffffff',\n\t height: 0\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of polygons so it's easy to support\n\t // MultiPolygon features (a single polygon would be a MultiPolygon with a\n\t // single polygon in the array)\n\t this._coordinates = PolygonLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t }\n\t\n\t _createClass(PolygonLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polygon as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._coordinates[0][0][0];\n\t }\n\t\n\t // Return polygon bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var attributes;\n\t\n\t // Only use this if you know what you're doing\n\t if (typeof this._options.onBufferAttributes === 'function') {\n\t // TODO: Probably want to pass something less general as arguments,\n\t // though passing the instance will do for now (it's everything)\n\t attributes = this._options.onBufferAttributes(this);\n\t } else {\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.height && this._options.style.height !== 0) {\n\t height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.color);\n\t\n\t // Light and dark colours used for poor-mans AO gradient on object sides\n\t var light = new _three2['default'].Color(0xffffff);\n\t var shadow = new _three2['default'].Color(0x666666);\n\t\n\t // For each polygon\n\t attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t // Convert coordinates to earcut format\n\t var _earcut = _this2._toEarcut(_projectedCoordinates);\n\t\n\t // Triangulate faces using earcut\n\t var faces = _this2._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\t\n\t var groupedVertices = [];\n\t for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n\t groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n\t }\n\t\n\t var extruded = (0, _utilExtrudePolygon2['default'])(groupedVertices, faces, {\n\t bottom: 0,\n\t top: height\n\t });\n\t\n\t var topColor = colour.clone().multiply(light);\n\t var bottomColor = colour.clone().multiply(shadow);\n\t\n\t var _vertices = extruded.positions;\n\t var _faces = [];\n\t var _colours = [];\n\t\n\t var _colour;\n\t extruded.top.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t\n\t _this2._flat = true;\n\t\n\t if (extruded.sides) {\n\t _this2._flat = false;\n\t\n\t // Set up colours for every vertex with poor-mans AO on the sides\n\t extruded.sides.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t // First face is always bottom-bottom-top\n\t if (fi % 2 === 0) {\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t // Reverse winding for the second face\n\t // top-top-bottom\n\t } else {\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t }\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t }\n\t\n\t // Skip bottom as there's no point rendering it\n\t // allFaces.push(extruded.faces);\n\t\n\t var polygon = {\n\t vertices: _vertices,\n\t faces: _faces,\n\t colours: _colours,\n\t facesCount: _faces.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t polygon.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert polygon representation to proper attribute arrays\n\t return _this2._toAttributes(polygon);\n\t });\n\t }\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshPhongMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t\n\t if (this.isFlat()) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t this._options.onMesh(mesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Convert coordinates array to something earcut can understand\n\t }, {\n\t key: '_toEarcut',\n\t value: function _toEarcut(coordinates) {\n\t var dim = 2;\n\t var result = { vertices: [], holes: [], dimensions: dim };\n\t var holeIndex = 0;\n\t\n\t for (var i = 0; i < coordinates.length; i++) {\n\t for (var j = 0; j < coordinates[i].length; j++) {\n\t // for (var d = 0; d < dim; d++) {\n\t result.vertices.push(coordinates[i][j].x);\n\t result.vertices.push(coordinates[i][j].y);\n\t // }\n\t }\n\t if (i > 0) {\n\t holeIndex += coordinates[i - 1].length;\n\t result.holes.push(holeIndex);\n\t }\n\t }\n\t\n\t return result;\n\t }\n\t\n\t // Triangulate earcut-based input using earcut\n\t }, {\n\t key: '_triangulate',\n\t value: function _triangulate(contour, holes, dim) {\n\t // console.time('earcut');\n\t\n\t var faces = (0, _earcut3['default'])(contour, holes, dim);\n\t var result = [];\n\t\n\t for (i = 0, il = faces.length; i < il; i += 3) {\n\t result.push(faces.slice(i, i + 3));\n\t }\n\t\n\t // console.timeEnd('earcut');\n\t\n\t return result;\n\t }\n\t\n\t // Transform polygon representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(polygon) {\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(polygon.facesCount * 9);\n\t var normals = new Float32Array(polygon.facesCount * 9);\n\t var colours = new Float32Array(polygon.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (polygon.pickingId) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(polygon.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t\n\t var _faces = polygon.faces;\n\t var _vertices = polygon.vertices;\n\t var _colour = polygon.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = polygon.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _faces.length; i++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[i][0];\n\t\n\t var ax = _vertices[index][0];\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2];\n\t\n\t var c1 = _colour[i][0];\n\t\n\t index = _faces[i][1];\n\t\n\t var bx = _vertices[index][0];\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2];\n\t\n\t var c2 = _colour[i][1];\n\t\n\t index = _faces[i][2];\n\t\n\t var cx = _vertices[index][0];\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2];\n\t\n\t var c3 = _colour[i][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t normals: normals,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the polygon is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPolygon GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0][0]);\n\t }\n\t }]);\n\t\n\t return PolygonLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolygonLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolygonLayer(coordinates, options);\n\t};\n\t\n\texports.polygonLayer = noNew;\n\n/***/ },\n/* 76 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = earcut;\n\t\n\tfunction earcut(data, holeIndices, dim) {\n\t\n\t dim = dim || 2;\n\t\n\t var hasHoles = holeIndices && holeIndices.length,\n\t outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n\t outerNode = linkedList(data, 0, outerLen, dim, true),\n\t triangles = [];\n\t\n\t if (!outerNode) return triangles;\n\t\n\t var minX, minY, maxX, maxY, x, y, size;\n\t\n\t if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\t\n\t // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t if (data.length > 80 * dim) {\n\t minX = maxX = data[0];\n\t minY = maxY = data[1];\n\t\n\t for (var i = dim; i < outerLen; i += dim) {\n\t x = data[i];\n\t y = data[i + 1];\n\t if (x < minX) minX = x;\n\t if (y < minY) minY = y;\n\t if (x > maxX) maxX = x;\n\t if (y > maxY) maxY = y;\n\t }\n\t\n\t // minX, minY and size are later used to transform coords into integers for z-order calculation\n\t size = Math.max(maxX - minX, maxY - minY);\n\t }\n\t\n\t earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\t\n\t return triangles;\n\t}\n\t\n\t// create a circular doubly linked list from polygon points in the specified winding order\n\tfunction linkedList(data, start, end, dim, clockwise) {\n\t var sum = 0,\n\t i, j, last;\n\t\n\t // calculate original winding order of a polygon ring\n\t for (i = start, j = end - dim; i < end; i += dim) {\n\t sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n\t j = i;\n\t }\n\t\n\t // link points into circular doubly-linked list in the specified winding order\n\t if (clockwise === (sum > 0)) {\n\t for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n\t } else {\n\t for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n\t }\n\t\n\t return last;\n\t}\n\t\n\t// eliminate colinear or duplicate points\n\tfunction filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\t\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\t\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\t\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\t\n\t return end;\n\t}\n\t\n\t// main ear slicing loop which triangulates a polygon (given as a linked list)\n\tfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n\t if (!ear) return;\n\t\n\t // interlink polygon nodes in z-order\n\t if (!pass && size) indexCurve(ear, minX, minY, size);\n\t\n\t var stop = ear,\n\t prev, next;\n\t\n\t // iterate through ears, slicing them one by one\n\t while (ear.prev !== ear.next) {\n\t prev = ear.prev;\n\t next = ear.next;\n\t\n\t if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n\t // cut off the triangle\n\t triangles.push(prev.i / dim);\n\t triangles.push(ear.i / dim);\n\t triangles.push(next.i / dim);\n\t\n\t removeNode(ear);\n\t\n\t // skipping the next vertice leads to less sliver triangles\n\t ear = next.next;\n\t stop = next.next;\n\t\n\t continue;\n\t }\n\t\n\t ear = next;\n\t\n\t // if we looped through the whole remaining polygon and can't find any more ears\n\t if (ear === stop) {\n\t // try filtering points and slicing again\n\t if (!pass) {\n\t earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\t\n\t // if this didn't work, try curing all small self-intersections locally\n\t } else if (pass === 1) {\n\t ear = cureLocalIntersections(ear, triangles, dim);\n\t earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\t\n\t // as a last resort, try splitting the remaining polygon into two\n\t } else if (pass === 2) {\n\t splitEarcut(ear, triangles, dim, minX, minY, size);\n\t }\n\t\n\t break;\n\t }\n\t }\n\t}\n\t\n\t// check whether a polygon node forms a valid ear with adjacent nodes\n\tfunction isEar(ear) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // now make sure we don't have other points inside the potential ear\n\t var p = ear.next.next;\n\t\n\t while (p !== ear.prev) {\n\t if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.next;\n\t }\n\t\n\t return true;\n\t}\n\t\n\tfunction isEarHashed(ear, minX, minY, size) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // triangle bbox; min & max are calculated like this for speed\n\t var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n\t minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n\t maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n\t maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\t\n\t // z-order range for the current triangle bbox;\n\t var minZ = zOrder(minTX, minTY, minX, minY, size),\n\t maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\t\n\t // first look for points inside the triangle in increasing z-order\n\t var p = ear.nextZ;\n\t\n\t while (p && p.z <= maxZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.nextZ;\n\t }\n\t\n\t // then look for points in decreasing z-order\n\t p = ear.prevZ;\n\t\n\t while (p && p.z >= minZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.prevZ;\n\t }\n\t\n\t return true;\n\t}\n\t\n\t// go through all polygon nodes and cure small local self-intersections\n\tfunction cureLocalIntersections(start, triangles, dim) {\n\t var p = start;\n\t do {\n\t var a = p.prev,\n\t b = p.next.next;\n\t\n\t // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n\t if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\t\n\t triangles.push(a.i / dim);\n\t triangles.push(p.i / dim);\n\t triangles.push(b.i / dim);\n\t\n\t // remove two nodes involved\n\t removeNode(p);\n\t removeNode(p.next);\n\t\n\t p = start = b;\n\t }\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return p;\n\t}\n\t\n\t// try splitting polygon into two and triangulate them independently\n\tfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n\t // look for a valid diagonal that divides the polygon into two\n\t var a = start;\n\t do {\n\t var b = a.next.next;\n\t while (b !== a.prev) {\n\t if (a.i !== b.i && isValidDiagonal(a, b)) {\n\t // split the polygon in two by the diagonal\n\t var c = splitPolygon(a, b);\n\t\n\t // filter colinear points around the cuts\n\t a = filterPoints(a, a.next);\n\t c = filterPoints(c, c.next);\n\t\n\t // run earcut on each half\n\t earcutLinked(a, triangles, dim, minX, minY, size);\n\t earcutLinked(c, triangles, dim, minX, minY, size);\n\t return;\n\t }\n\t b = b.next;\n\t }\n\t a = a.next;\n\t } while (a !== start);\n\t}\n\t\n\t// link every hole into the outer loop, producing a single-ring polygon without holes\n\tfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n\t var queue = [],\n\t i, len, start, end, list;\n\t\n\t for (i = 0, len = holeIndices.length; i < len; i++) {\n\t start = holeIndices[i] * dim;\n\t end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n\t list = linkedList(data, start, end, dim, false);\n\t if (list === list.next) list.steiner = true;\n\t queue.push(getLeftmost(list));\n\t }\n\t\n\t queue.sort(compareX);\n\t\n\t // process holes from left to right\n\t for (i = 0; i < queue.length; i++) {\n\t eliminateHole(queue[i], outerNode);\n\t outerNode = filterPoints(outerNode, outerNode.next);\n\t }\n\t\n\t return outerNode;\n\t}\n\t\n\tfunction compareX(a, b) {\n\t return a.x - b.x;\n\t}\n\t\n\t// find a bridge between vertices that connects hole with an outer ring and and link it\n\tfunction eliminateHole(hole, outerNode) {\n\t outerNode = findHoleBridge(hole, outerNode);\n\t if (outerNode) {\n\t var b = splitPolygon(outerNode, hole);\n\t filterPoints(b, b.next);\n\t }\n\t}\n\t\n\t// David Eberly's algorithm for finding a bridge between hole and outer polygon\n\tfunction findHoleBridge(hole, outerNode) {\n\t var p = outerNode,\n\t hx = hole.x,\n\t hy = hole.y,\n\t qx = -Infinity,\n\t m;\n\t\n\t // find a segment intersected by a ray from the hole's leftmost point to the left;\n\t // segment's endpoint with lesser x will be potential connection point\n\t do {\n\t if (hy <= p.y && hy >= p.next.y) {\n\t var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n\t if (x <= hx && x > qx) {\n\t qx = x;\n\t m = p.x < p.next.x ? p : p.next;\n\t }\n\t }\n\t p = p.next;\n\t } while (p !== outerNode);\n\t\n\t if (!m) return null;\n\t\n\t if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\t\n\t // look for points inside the triangle of hole point, segment intersection and endpoint;\n\t // if there are no points found, we have a valid connection;\n\t // otherwise choose the point of the minimum angle with the ray as connection point\n\t\n\t var stop = m,\n\t tanMin = Infinity,\n\t tan;\n\t\n\t p = m.next;\n\t\n\t while (p !== stop) {\n\t if (hx >= p.x && p.x >= m.x &&\n\t pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\t\n\t tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\t\n\t if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n\t m = p;\n\t tanMin = tan;\n\t }\n\t }\n\t\n\t p = p.next;\n\t }\n\t\n\t return m;\n\t}\n\t\n\t// interlink polygon nodes in z-order\n\tfunction indexCurve(start, minX, minY, size) {\n\t var p = start;\n\t do {\n\t if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n\t p.prevZ = p.prev;\n\t p.nextZ = p.next;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t p.prevZ.nextZ = null;\n\t p.prevZ = null;\n\t\n\t sortLinked(p);\n\t}\n\t\n\t// Simon Tatham's linked list merge sort algorithm\n\t// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\n\tfunction sortLinked(list) {\n\t var i, p, q, e, tail, numMerges, pSize, qSize,\n\t inSize = 1;\n\t\n\t do {\n\t p = list;\n\t list = null;\n\t tail = null;\n\t numMerges = 0;\n\t\n\t while (p) {\n\t numMerges++;\n\t q = p;\n\t pSize = 0;\n\t for (i = 0; i < inSize; i++) {\n\t pSize++;\n\t q = q.nextZ;\n\t if (!q) break;\n\t }\n\t\n\t qSize = inSize;\n\t\n\t while (pSize > 0 || (qSize > 0 && q)) {\n\t\n\t if (pSize === 0) {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t } else if (qSize === 0 || !q) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else if (p.z <= q.z) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t }\n\t\n\t if (tail) tail.nextZ = e;\n\t else list = e;\n\t\n\t e.prevZ = tail;\n\t tail = e;\n\t }\n\t\n\t p = q;\n\t }\n\t\n\t tail.nextZ = null;\n\t inSize *= 2;\n\t\n\t } while (numMerges > 1);\n\t\n\t return list;\n\t}\n\t\n\t// z-order of a point given coords and size of the data bounding box\n\tfunction zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\t\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\t\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\t\n\t return x | (y << 1);\n\t}\n\t\n\t// find the leftmost node of a polygon ring\n\tfunction getLeftmost(start) {\n\t var p = start,\n\t leftmost = start;\n\t do {\n\t if (p.x < leftmost.x) leftmost = p;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return leftmost;\n\t}\n\t\n\t// check if a point lies within a convex triangle\n\tfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}\n\t\n\t// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\n\tfunction isValidDiagonal(a, b) {\n\t return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n\t locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n\t}\n\t\n\t// signed area of a triangle\n\tfunction area(p, q, r) {\n\t return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n\t}\n\t\n\t// check if two points are equal\n\tfunction equals(p1, p2) {\n\t return p1.x === p2.x && p1.y === p2.y;\n\t}\n\t\n\t// check if two segments intersect\n\tfunction intersects(p1, q1, p2, q2) {\n\t return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n\t area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n\t}\n\t\n\t// check if a polygon diagonal intersects any polygon segments\n\tfunction intersectsPolygon(a, b) {\n\t var p = a;\n\t do {\n\t if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t intersects(p, p.next, a, b)) return true;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return false;\n\t}\n\t\n\t// check if a polygon diagonal is locally inside the polygon\n\tfunction locallyInside(a, b) {\n\t return area(a.prev, a, a.next) < 0 ?\n\t area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n\t area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n\t}\n\t\n\t// check if the middle point of a polygon diagonal is inside the polygon\n\tfunction middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return inside;\n\t}\n\t\n\t// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n\t// if one belongs to the outer ring and another to a hole, it merges it into a single ring\n\tfunction splitPolygon(a, b) {\n\t var a2 = new Node(a.i, a.x, a.y),\n\t b2 = new Node(b.i, b.x, b.y),\n\t an = a.next,\n\t bp = b.prev;\n\t\n\t a.next = b;\n\t b.prev = a;\n\t\n\t a2.next = an;\n\t an.prev = a2;\n\t\n\t b2.next = a2;\n\t a2.prev = b2;\n\t\n\t bp.next = b2;\n\t b2.prev = bp;\n\t\n\t return b2;\n\t}\n\t\n\t// create a node and optionally link it with previous one (in a circular doubly linked list)\n\tfunction insertNode(i, x, y, last) {\n\t var p = new Node(i, x, y);\n\t\n\t if (!last) {\n\t p.prev = p;\n\t p.next = p;\n\t\n\t } else {\n\t p.next = last.next;\n\t p.prev = last;\n\t last.next.prev = p;\n\t last.next = p;\n\t }\n\t return p;\n\t}\n\t\n\tfunction removeNode(p) {\n\t p.next.prev = p.prev;\n\t p.prev.next = p.next;\n\t\n\t if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n\t if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n\t}\n\t\n\tfunction Node(i, x, y) {\n\t // vertice index in coordinates array\n\t this.i = i;\n\t\n\t // vertex coordinates\n\t this.x = x;\n\t this.y = y;\n\t\n\t // previous and next vertice nodes in a polygon ring\n\t this.prev = null;\n\t this.next = null;\n\t\n\t // z-order curve value\n\t this.z = null;\n\t\n\t // previous and next nodes in z-order\n\t this.prevZ = null;\n\t this.nextZ = null;\n\t\n\t // indicates whether this is a steiner point\n\t this.steiner = false;\n\t}\n\n\n/***/ },\n/* 77 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Extrude a polygon given its vertices and triangulated faces\n\t *\n\t * Based on:\n\t * https://github.com/freeman-lab/extrude\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar extrudePolygon = function extrudePolygon(points, faces, _options) {\n\t var defaults = {\n\t top: 1,\n\t bottom: 0,\n\t closed: true\n\t };\n\t\n\t var options = (0, _lodashAssign2['default'])({}, defaults, _options);\n\t\n\t var n = points.length;\n\t var positions;\n\t var cells;\n\t var topCells;\n\t var bottomCells;\n\t var sideCells;\n\t\n\t // If bottom and top values are identical then return the flat shape\n\t options.top === options.bottom ? flat() : full();\n\t\n\t function flat() {\n\t positions = points.map(function (p) {\n\t return [p[0], options.top, p[1]];\n\t });\n\t cells = faces;\n\t topCells = faces;\n\t }\n\t\n\t function full() {\n\t positions = [];\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.top, p[1]]);\n\t });\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.bottom, p[1]]);\n\t });\n\t\n\t cells = [];\n\t for (var i = 0; i < n; i++) {\n\t if (i === n - 1) {\n\t cells.push([i + n, n, i]);\n\t cells.push([0, i, n]);\n\t } else {\n\t cells.push([i + n, i + n + 1, i]);\n\t cells.push([i + 1, i, i + n + 1]);\n\t }\n\t }\n\t\n\t sideCells = [].concat(cells);\n\t\n\t if (options.closed) {\n\t var top = faces;\n\t var bottom = top.map(function (p) {\n\t return p.map(function (v) {\n\t return v + n;\n\t });\n\t });\n\t bottom = bottom.map(function (p) {\n\t return [p[0], p[2], p[1]];\n\t });\n\t cells = cells.concat(top).concat(bottom);\n\t\n\t topCells = top;\n\t bottomCells = bottom;\n\t }\n\t }\n\t\n\t return {\n\t positions: positions,\n\t faces: cells,\n\t top: topCells,\n\t bottom: bottomCells,\n\t sides: sideCells\n\t };\n\t};\n\t\n\texports['default'] = extrudePolygon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 78 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Provide alternative output using tubes and splines / curves\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\t// TODO: Allow _setBufferAttributes to use a custom function passed in to\n\t// generate a custom mesh\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolylineLayer = (function (_Layer) {\n\t _inherits(PolylineLayer, _Layer);\n\t\n\t function PolylineLayer(coordinates, options) {\n\t _classCallCheck(this, PolylineLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t onBufferAttributes: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of lines so it's easy to support\n\t // MultiLineString features (a single line would be a MultiLineString with a\n\t // single line in the array)\n\t this._coordinates = PolylineLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Polyline features are always flat (for now at least)\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PolylineLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polyline as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._coordinates[0][0];\n\t }\n\t\n\t // Return line bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var attributes;\n\t\n\t // Only use this if you know what you're doing\n\t if (typeof this._options.onBufferAttributes === 'function') {\n\t // TODO: Probably want to pass something less general as arguments,\n\t // though passing the instance will do for now (it's everything)\n\t attributes = this._options.onBufferAttributes(this);\n\t } else {\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.lineHeight) {\n\t height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.lineColor);\n\t\n\t // For each line\n\t attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t var _vertices = [];\n\t var _colours = [];\n\t\n\t // Connect coordinate with the next to make a pair\n\t //\n\t // LineSegments requires pairs of vertices so repeat the last point if\n\t // there's an odd number of vertices\n\t var nextCoord;\n\t _projectedCoordinates.forEach(function (coordinate, index) {\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([coordinate.x, height, coordinate.y]);\n\t\n\t nextCoord = _projectedCoordinates[index + 1] ? _projectedCoordinates[index + 1] : coordinate;\n\t\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([nextCoord.x, height, nextCoord.y]);\n\t });\n\t\n\t var line = {\n\t vertices: _vertices,\n\t colours: _colours,\n\t verticesCount: _vertices.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t line.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert line representation to proper attribute arrays\n\t return _this2._toAttributes(line);\n\t });\n\t }\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var style = this._options.style;\n\t var material;\n\t\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else {\n\t material = new _three2['default'].LineBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t }\n\t\n\t var mesh = new _three2['default'].LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new _three2['default'].LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t this._options.onMesh(mesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiLineString GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0]);\n\t }\n\t }]);\n\t\n\t return PolylineLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolylineLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolylineLayer(coordinates, options);\n\t};\n\t\n\texports.polylineLayer = noNew;\n\n/***/ },\n/* 79 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Point features may be using custom models / meshes and so an approach\n\t// needs to be found to allow these to be brokwn down into buffer attributes for\n\t// merging\n\t//\n\t// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n\t// and pull out the attributes\n\t\n\t// TODO: Support sprite objects using textures\n\t\n\t// TODO: Provide option to billboard geometry so it always faces the camera\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\tvar _Layer2 = __webpack_require__(37);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(70);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(69);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PointLayer = (function (_Layer) {\n\t _inherits(PointLayer, _Layer);\n\t\n\t function PointLayer(coordinates, options) {\n\t _classCallCheck(this, PointLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // THREE.Geometry or THREE.BufferGeometry to use for point output\n\t geometry: null,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t pointColor: '#ff0000'\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of points so it's easy to support\n\t // MultiPoint features (a single point would be a MultiPoint with a\n\t // single point in the array)\n\t this._coordinates = PointLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Point features are always flat (for now at least)\n\t //\n\t // This won't always be the case once custom point objects / meshes are\n\t // added\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PointLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of point as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._coordinates;\n\t }\n\t\n\t // Return point bounds in geographic coordinates\n\t //\n\t // While not useful for single points, it could be useful for MultiPoint\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.pointHeight) {\n\t height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.pointColor);\n\t\n\t var geometry;\n\t\n\t // Use default geometry if none has been provided or the provided geometry\n\t // isn't valid\n\t if (!this._options.geometry || !this._options.geometry instanceof _three2['default'].Geometry || !this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t // Debug geometry for points is a thin bar\n\t //\n\t // TODO: Allow point geometry to be customised / overridden\n\t var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n\t var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n\t var _geometry = new _three2['default'].BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\t\n\t // Shift geometry up so it sits on the ground\n\t _geometry.translate(0, geometryHeight * 0.5, 0);\n\t\n\t // Pull attributes out of debug geometry\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(_geometry);\n\t } else {\n\t if (this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t geometry = this._options.geometry;\n\t } else {\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(this._options.geometry);\n\t }\n\t }\n\t\n\t // For each point\n\t var attributes = this._projectedCoordinates.map(function (coordinate) {\n\t var _vertices = [];\n\t var _normals = [];\n\t var _colours = [];\n\t\n\t var _geometry = geometry.clone();\n\t\n\t _geometry.translate(coordinate.x, height, coordinate.y);\n\t\n\t var _vertices = _geometry.attributes.position.clone().array;\n\t var _normals = _geometry.attributes.normal.clone().array;\n\t var _colours = _geometry.attributes.color.clone().array;\n\t\n\t for (var i = 0; i < _colours.length; i += 3) {\n\t _colours[i] = colour.r;\n\t _colours[i + 1] = colour.g;\n\t _colours[i + 2] = colour.b;\n\t }\n\t\n\t var _point = {\n\t vertices: _vertices,\n\t normals: _normals,\n\t colours: _colours\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t // point.pickingId = this._pickingId;\n\t _point.pickingIds = new Float32Array(_vertices.length / 3);\n\t for (var i = 0; i < _point.pickingIds.length; i++) {\n\t _point.pickingIds[i] = _this2._pickingId;\n\t }\n\t }\n\t\n\t // Convert point representation to proper attribute arrays\n\t // return this._toAttributes(_point);\n\t return _point;\n\t });\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t this._options.onMesh(mesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var _point;\n\t return this._coordinates.map(function (latlon) {\n\t _point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * _point.x;\n\t _this3._offset.y = -1 * _point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return _point;\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPoint GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0]);\n\t }\n\t }]);\n\t\n\t return PointLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PointLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PointLayer(coordinates, options);\n\t};\n\t\n\texports.pointLayer = noNew;\n\n/***/ },\n/* 80 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONLayer2 = __webpack_require__(73);\n\t\n\tvar _GeoJSONLayer3 = _interopRequireDefault(_GeoJSONLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONLayer = (function (_GeoJSONLayer) {\n\t _inherits(TopoJSONLayer, _GeoJSONLayer);\n\t\n\t function TopoJSONLayer(topojson, options) {\n\t _classCallCheck(this, TopoJSONLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONLayer.prototype), 'constructor', this).call(this, topojson, options);\n\t }\n\t\n\t return TopoJSONLayer;\n\t})(_GeoJSONLayer3['default']);\n\t\n\texports['default'] = TopoJSONLayer;\n\t\n\tvar noNew = function noNew(topojson, options) {\n\t return new TopoJSONLayer(topojson, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.topoJSONLayer = noNew;\n\n/***/ }\n/******/ ])\n});\n;"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 47c645ebef69113e558a\n **/","import World, {world} from './World';\nimport Controls from './controls/index';\n\nimport Layer, {layer} from './layer/Layer';\nimport EnvironmentLayer, {environmentLayer} from './layer/environment/EnvironmentLayer';\nimport ImageTileLayer, {imageTileLayer} from './layer/tile/ImageTileLayer';\nimport GeoJSONTileLayer, {geoJSONTileLayer} from './layer/tile/GeoJSONTileLayer';\nimport TopoJSONTileLayer, {topoJSONTileLayer} from './layer/tile/TopoJSONTileLayer';\nimport GeoJSONLayer, {geoJSONLayer} from './layer/GeoJSONLayer';\nimport TopoJSONLayer, {topoJSONLayer} from './layer/TopoJSONLayer';\nimport PolygonLayer, {polygonLayer} from './layer/geometry/PolygonLayer';\nimport PolylineLayer, {polylineLayer} from './layer/geometry/PolylineLayer';\nimport PointLayer, {pointLayer} from './layer/geometry/PointLayer';\n\nimport Point, {point} from './geo/Point';\nimport LatLon, {latLon} from './geo/LatLon';\n\nconst VIZI = {\n version: '0.3',\n\n // Public API\n World: World,\n world: world,\n Controls: Controls,\n Layer: Layer,\n layer: layer,\n EnvironmentLayer: EnvironmentLayer,\n environmentLayer: environmentLayer,\n ImageTileLayer: ImageTileLayer,\n imageTileLayer: imageTileLayer,\n GeoJSONTileLayer: GeoJSONTileLayer,\n geoJSONTileLayer: geoJSONTileLayer,\n TopoJSONTileLayer: TopoJSONTileLayer,\n topoJSONTileLayer: topoJSONTileLayer,\n GeoJSONLayer: GeoJSONLayer,\n geoJSONLayer: geoJSONLayer,\n TopoJSONLayer: TopoJSONLayer,\n topoJSONLayer: topoJSONLayer,\n PolygonLayer: PolygonLayer,\n polygonLayer: polygonLayer,\n PolylineLayer: PolylineLayer,\n polylineLayer: polylineLayer,\n PointLayer: PointLayer,\n pointLayer: pointLayer,\n Point: Point,\n point: point,\n LatLon: LatLon,\n latLon: latLon\n};\n\nexport default VIZI;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vizicities.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport CRS from './geo/crs/index';\nimport {point as Point} from './geo/Point';\nimport {latLon as LatLon} from './geo/LatLon';\nimport Engine from './engine/Engine';\nimport EnvironmentLayer from './layer/environment/EnvironmentLayer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Pretty much any event someone using ViziCities would need will be emitted or\n// proxied by World (eg. render events, etc)\n\nclass World extends EventEmitter {\n constructor(domId, options) {\n super();\n\n var defaults = {\n crs: CRS.EPSG3857,\n skybox: false\n };\n\n this.options = extend({}, defaults, options);\n\n this._layers = [];\n this._controls = [];\n\n this._initContainer(domId);\n this._initEngine();\n this._initEnvironment();\n this._initEvents();\n\n this._pause = false;\n\n // Kick off the update and render loop\n this._update();\n }\n\n _initContainer(domId) {\n this._container = document.getElementById(domId);\n }\n\n _initEngine() {\n this._engine = new Engine(this._container, this);\n\n // Engine events\n //\n // Consider proxying these through events on World for public access\n // this._engine.on('preRender', () => {});\n // this._engine.on('postRender', () => {});\n }\n\n _initEnvironment() {\n // Not sure if I want to keep this as a private API\n //\n // Makes sense to allow others to customise their environment so perhaps\n // add some method of disable / overriding the environment settings\n this._environment = new EnvironmentLayer({\n skybox: this.options.skybox\n }).addTo(this);\n }\n\n _initEvents() {\n this.on('controlsMoveEnd', this._onControlsMoveEnd);\n }\n\n _onControlsMoveEnd(point) {\n var _point = Point(point.x, point.z);\n this._resetView(this.pointToLatLon(_point), _point);\n }\n\n // Reset world view\n _resetView(latlon, point) {\n this.emit('preResetView');\n\n this._moveStart();\n this._move(latlon, point);\n this._moveEnd();\n\n this.emit('postResetView');\n }\n\n _moveStart() {\n this.emit('moveStart');\n }\n\n _move(latlon, point) {\n this._lastPosition = latlon;\n this.emit('move', latlon, point);\n }\n _moveEnd() {\n this.emit('moveEnd');\n }\n\n _update() {\n if (this._pause) {\n return;\n }\n\n var delta = this._engine.clock.getDelta();\n\n // Once _update is called it will run forever, for now\n window.requestAnimationFrame(this._update.bind(this));\n\n // Update controls\n this._controls.forEach(controls => {\n controls.update();\n });\n\n this.emit('preUpdate', delta);\n this._engine.update(delta);\n this.emit('postUpdate', delta);\n }\n\n // Set world view\n setView(latlon) {\n // Store initial geographic coordinate for the [0,0,0] world position\n //\n // The origin point doesn't move in three.js / 3D space so only set it once\n // here instead of every time _resetView is called\n //\n // If it was updated every time then coorindates would shift over time and\n // would be out of place / context with previously-placed points (0,0 would\n // refer to a different point each time)\n this._originLatlon = latlon;\n this._originPoint = this.project(latlon);\n\n this._resetView(latlon);\n return this;\n }\n\n // Return world geographic position\n getPosition() {\n return this._lastPosition;\n }\n\n // Transform geographic coordinate to world point\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the origin point of the projection (not the world)\n project(latlon) {\n return this.options.crs.latLonToPoint(LatLon(latlon));\n }\n\n // Transform world point to geographic coordinate\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a point relative to the origin point of the\n // projection (not the world) and returns a geographic coordinate\n unproject(point) {\n return this.options.crs.pointToLatLon(Point(point));\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the three.js / 3D origin (0,0)\n latLonToPoint(latlon) {\n var projectedPoint = this.project(LatLon(latlon));\n return projectedPoint._subtract(this._originPoint);\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a point relative to the three.js / 3D origin (0,0)\n // and returns the exact geographic coordinate at that point\n pointToLatLon(point) {\n var projectedPoint = Point(point).add(this._originPoint);\n return this.unproject(projectedPoint);\n }\n\n // Return pointscale for a given geographic coordinate\n pointScale(latlon, accurate) {\n return this.options.crs.pointScale(latlon, accurate);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n metresToWorld(metres, pointScale, zoom) {\n return this.options.crs.metresToWorld(metres, pointScale, zoom);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n worldToMetres(worldUnits, pointScale, zoom) {\n return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n }\n\n // Unsure if it's a good idea to expose this here for components like\n // GridLayer to use (eg. to keep track of a frustum)\n getCamera() {\n return this._engine._camera;\n }\n\n addLayer(layer) {\n layer._addToWorld(this);\n\n this._layers.push(layer);\n\n if (layer.isOutput()) {\n // Could move this into Layer but it'll do here for now\n this._engine._scene.add(layer._object3D);\n this._engine._domScene3D.add(layer._domObject3D);\n this._engine._domScene2D.add(layer._domObject2D);\n }\n\n this.emit('layerAdded', layer);\n return this;\n }\n\n // Remove layer from world and scene but don't destroy it entirely\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n if (layer.isOutput()) {\n this._engine._scene.remove(layer._object3D);\n this._engine._domScene3D.remove(layer._domObject3D);\n this._engine._domScene2D.remove(layer._domObject2D);\n }\n\n this.emit('layerRemoved');\n return this;\n }\n\n addControls(controls) {\n controls._addToWorld(this);\n\n this._controls.push(controls);\n\n this.emit('controlsAdded', controls);\n return this;\n }\n\n // Remove controls from world but don't destroy them entirely\n removeControls(controls) {\n var controlsIndex = this._controls.indexOf(controlsIndex);\n\n if (controlsIndex > -1) {\n this._controls.splice(controlsIndex, 1);\n };\n\n this.emit('controlsRemoved', controls);\n return this;\n }\n\n stop() {\n this._pause = true;\n }\n\n start() {\n this._pause = false;\n this._update();\n }\n\n // Destroys the world(!) and removes it from the scene and memory\n //\n // TODO: World out why so much three.js stuff is left in the heap after this\n destroy() {\n this.stop();\n\n // Remove listeners\n this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\n var i;\n\n // Remove all controls\n var controls;\n for (i = this._controls.length - 1; i >= 0; i--) {\n controls = this._controls[0];\n this.removeControls(controls);\n controls.destroy();\n };\n\n // Remove all layers\n var layer;\n for (i = this._layers.length - 1; i >= 0; i--) {\n layer = this._layers[0];\n this.removeLayer(layer);\n layer.destroy();\n };\n\n // Environment layer is removed with the other layers\n this._environment = null;\n\n this._engine.destroy();\n this._engine = null;\n\n // TODO: Probably should clean the container too / remove the canvas\n this._container = null;\n }\n}\n\nexport default World;\n\nvar noNew = function(domId, options) {\n return new World(domId, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as world};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/World.js\n **/","'use strict';\n\n//\n// We store our EE objects in a plain object whose properties are event names.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// `~` to make sure that the built-in object properties are not overridden or\n// used as an attack vector.\n// We also assume that `Object.create(null)` is available when the event name\n// is an ES6 Symbol.\n//\nvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\n/**\n * Representation of a single EventEmitter function.\n *\n * @param {Function} fn Event handler to be called.\n * @param {Mixed} context Context for function execution.\n * @param {Boolean} once Only emit once\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal EventEmitter interface that is molded against the Node.js\n * EventEmitter interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() { /* Nothing to set */ }\n\n/**\n * Holds the assigned EventEmitters by name.\n *\n * @type {Object}\n * @private\n */\nEventEmitter.prototype._events = undefined;\n\n/**\n * Return a list of assigned event listeners.\n *\n * @param {String} event The events that should be listed.\n * @param {Boolean} exists We only need to know if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events && this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Emit an event to all registered event listeners.\n *\n * @param {String} event The name of the event.\n * @returns {Boolean} Indication if we've emitted an event.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if ('function' === typeof listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Register a new EventListener for the given event.\n *\n * @param {String} event Name of the event.\n * @param {Functon} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Add an EventListener that's only called once.\n *\n * @param {String} event Name of the event.\n * @param {Function} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Remove event listeners.\n *\n * @param {String} event The event we want to remove.\n * @param {Function} fn The listener that we need to find.\n * @param {Mixed} context Only remove listeners matching this context.\n * @param {Boolean} once Only remove once listeners.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return this;\n\n var listeners = this._events[evt]\n , events = [];\n\n if (fn) {\n if (listeners.fn) {\n if (\n listeners.fn !== fn\n || (once && !listeners.once)\n || (context && listeners.context !== context)\n ) {\n events.push(listeners);\n }\n } else {\n for (var i = 0, length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) {\n this._events[evt] = events.length === 1 ? events[0] : events;\n } else {\n delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners or only the listeners for the specified event.\n *\n * @param {String} event The event want to remove all listeners for.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n if (!this._events) return this;\n\n if (event) delete this._events[prefix ? prefix + event : event];\n else this._events = prefix ? {} : Object.create(null);\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/eventemitter3/index.js\n ** module id = 2\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar keys = require('lodash.keys'),\n rest = require('lodash.rest');\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if ((!eq(objValue, value) ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object) {\n return copyObjectWith(source, props, object);\n}\n\n/**\n * This function is like `copyObject` except that it accepts a function to\n * customize copied values.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObjectWith(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\n assignValue(object, key, newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return rest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Assigns own enumerable properties of source objects to the destination\n * object. Source objects are applied from left to right. Subsequent sources\n * overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.c = 3;\n * }\n *\n * function Bar() {\n * this.e = 5;\n * }\n *\n * Foo.prototype.d = 4;\n * Bar.prototype.f = 6;\n *\n * _.assign({ 'a': 1 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3, 'e': 5 }\n */\nvar assign = createAssigner(function(object, source) {\n copyObject(source, keys(source), object);\n});\n\nmodule.exports = assign;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.assign/index.js\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n stringTag = '[object String]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar getPrototypeOf = Object.getPrototypeOf,\n propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = Object.keys;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n // that are composed entirely of index properties, return `false` for\n // `hasOwnProperty` checks of them.\n return hasOwnProperty.call(object, key) ||\n (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n}\n\n/**\n * The base implementation of `_.keys` which doesn't skip the constructor\n * property of prototypes or treat sparse arrays as dense.\n *\n * @private\n * @type Function\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n return nativeKeys(Object(object));\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Creates an array of index keys for `object` values of arrays,\n * `arguments` objects, and strings, otherwise `null` is returned.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array|null} Returns index keys, else `null`.\n */\nfunction indexKeys(object) {\n var length = object ? object.length : undefined;\n if (isLength(length) &&\n (isArray(object) || isString(object) || isArguments(object))) {\n return baseTimes(length, String);\n }\n return null;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n var isProto = isPrototype(object);\n if (!(isProto || isArrayLike(object))) {\n return baseKeys(object);\n }\n var indexes = indexKeys(object),\n skipIndexes = !!indexes,\n result = indexes || [],\n length = result.length;\n\n for (var key in object) {\n if (baseHas(object, key) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n !(isProto && key == 'constructor')) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.keys/index.js\n ** module id = 4\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n var length = args.length;\n switch (length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, array);\n case 1: return func.call(this, args[0], array);\n case 2: return func.call(this, args[0], args[1], array);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3');\n * // => 3\n */\nfunction toInteger(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n var remainder = value % 1;\n return value === value ? (remainder ? value - remainder : value) : 0;\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = rest;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.rest/index.js\n ** module id = 5\n ** module chunks = 0\n **/","import EPSG3857 from './CRS.EPSG3857';\nimport {EPSG900913} from './CRS.EPSG3857';\nimport EPSG3395 from './CRS.EPSG3395';\nimport EPSG4326 from './CRS.EPSG4326';\nimport Simple from './CRS.Simple';\nimport Proj4 from './CRS.Proj4';\n\nconst CRS = {};\n\nCRS.EPSG3857 = EPSG3857;\nCRS.EPSG900913 = EPSG900913;\nCRS.EPSG3395 = EPSG3395;\nCRS.EPSG4326 = EPSG4326;\nCRS.Simple = Simple;\nCRS.Proj4 = Proj4;\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/index.js\n **/","/*\n * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport SphericalMercator from '../projection/Projection.SphericalMercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3857 = {\n code: 'EPSG:3857',\n projection: SphericalMercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * SphericalMercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * SphericalMercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3857 = extend({}, Earth, _EPSG3857);\n\nconst EPSG900913 = extend({}, EPSG3857, {\n code: 'EPSG:900913'\n});\n\nexport {EPSG900913};\n\nexport default EPSG3857;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3857.js\n **/","/*\n * CRS.Earth is the base class for all CRS representing Earth.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport {latLon as LatLon} from '../LatLon';\n\nconst Earth = {\n wrapLon: [-180, 180],\n\n R: 6378137,\n\n // Distance between two geographical points using spherical law of cosines\n // approximation or Haversine\n //\n // See: http://www.movable-type.co.uk/scripts/latlong.html\n distance: function(latlon1, latlon2, accurate) {\n var rad = Math.PI / 180;\n\n var lat1;\n var lat2;\n\n var a;\n\n if (!accurate) {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\n return this.R * Math.acos(Math.min(a, 1));\n } else {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n var lon1 = latlon1.lon * rad;\n var lon2 = latlon2.lon * rad;\n\n var deltaLat = lat2 - lat1;\n var deltaLon = lon2 - lon1;\n\n var halfDeltaLat = deltaLat / 2;\n var halfDeltaLon = deltaLon / 2;\n\n a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return this.R * c;\n }\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Defaults to a scale factor of 1 if no calculation method exists\n //\n // Probably need to run this through the CRS transformation or similar so the\n // resulting scale is relative to the dimensions of the world space\n // Eg. 1 metre in projected space is likly scaled up or down to some other\n // number\n pointScale: function(latlon, accurate) {\n return (this.projection.pointScale) ? this.projection.pointScale(latlon, accurate) : [1, 1];\n },\n\n // Convert real metres to projected units\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n metresToProjected: function(metres, pointScale) {\n return metres * pointScale[1];\n },\n\n // Convert projected units to real metres\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n projectedToMetres: function(projectedUnits, pointScale) {\n return projectedUnits / pointScale[1];\n },\n\n // Convert real metres to a value in world (WebGL) units\n metresToWorld: function(metres, pointScale, zoom) {\n // Transform metres to projected metres using the latitude point scale\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n var projectedMetres = this.metresToProjected(metres, pointScale);\n\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n // Scale projected metres\n var scaledMetres = (scale * (this.transformScale * projectedMetres));\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n scaledMetres /= pointScale[1];\n }\n\n return scaledMetres;\n },\n\n // Convert world (WebGL) units to a value in real metres\n worldToMetres: function(worldUnits, pointScale, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var projectedUnits = ((worldUnits / scale) / this.transformScale);\n var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n realMetres *= pointScale[1];\n }\n\n return realMetres;\n }\n};\n\nexport default extend({}, CRS, Earth);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Earth.js\n **/","/*\n * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\nimport wrapNum from '../../util/wrapNum';\n\nconst CRS = {\n // Scale factor determines final dimensions of world space\n //\n // Projection transformation in range -1 to 1 is multiplied by scale factor to\n // find final world coordinates\n //\n // Scale factor can be considered as half the amount of the desired dimension\n // for the largest side when transformation is equal to 1 or -1, or as the\n // distance between 0 and 1 on the largest side\n //\n // For example, if you want the world dimensions to be between -1000 and 1000\n // then the scale factor will be 1000\n scaleFactor: 1000000,\n\n // Converts geo coords to pixel / WebGL ones\n latLonToPoint: function(latlon, zoom) {\n var projectedPoint = this.projection.project(latlon);\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n return this.transformation._transform(projectedPoint, scale);\n },\n\n // Converts pixel / WebGL coords to geo coords\n pointToLatLon: function(point, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var untransformedPoint = this.transformation.untransform(point, scale);\n\n return this.projection.unproject(untransformedPoint);\n },\n\n // Converts geo coords to projection-specific coords (e.g. in meters)\n project: function(latlon) {\n return this.projection.project(latlon);\n },\n\n // Converts projected coords to geo coords\n unproject: function(point) {\n return this.projection.unproject(point);\n },\n\n // If zoom is provided, returns the map width in pixels for a given zoom\n // Else, provides fixed scale value\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom >= 0) {\n return 256 * Math.pow(2, zoom);\n // Else, return fixed scale value to expand projected coordinates from\n // their 0 to 1 range into something more practical\n } else {\n return this.scaleFactor;\n }\n },\n\n // Returns zoom level for a given scale value\n // This only works with a scale value that is based on map pixel width\n zoom: function(scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n\n // Returns the bounds of the world in projected coords if applicable\n getProjectedBounds: function(zoom) {\n if (this.infinite) { return null; }\n\n var b = this.projection.bounds;\n var s = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n s /= 2;\n }\n\n // Bottom left\n var min = this.transformation.transform(Point(b[0]), s);\n\n // Top right\n var max = this.transformation.transform(Point(b[1]), s);\n\n return [min, max];\n },\n\n // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n // wrapLon: [min, max],\n // wrapLat: [min, max],\n\n // If true, the coordinate space will be unbounded (infinite in all directions)\n // infinite: false,\n\n // Wraps geo coords in certain ranges if applicable\n wrapLatLon: function(latlon) {\n var lat = this.wrapLat ? wrapNum(latlon.lat, this.wrapLat, true) : latlon.lat;\n var lon = this.wrapLon ? wrapNum(latlon.lon, this.wrapLon, true) : latlon.lon;\n var alt = latlon.alt;\n\n return LatLon(lat, lon, alt);\n }\n};\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.js\n **/","/*\n * LatLon is a helper class for ensuring consistent geographic coordinates.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n */\n\nclass LatLon {\n constructor(lat, lon, alt) {\n if (isNaN(lat) || isNaN(lon)) {\n throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n }\n\n this.lat = +lat;\n this.lon = +lon;\n\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n\n clone() {\n return new LatLon(this.lat, this.lon, this.alt);\n }\n}\n\nexport default LatLon;\n\n// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n// Also converts between lng and lon\nvar noNew = function(a, b, c) {\n if (a instanceof LatLon) {\n return a;\n }\n if (Array.isArray(a) && typeof a[0] !== 'object') {\n if (a.length === 3) {\n return new LatLon(a[0], a[1], a[2]);\n }\n if (a.length === 2) {\n return new LatLon(a[0], a[1]);\n }\n return null;\n }\n if (a === undefined || a === null) {\n return a;\n }\n if (typeof a === 'object' && 'lat' in a) {\n return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n }\n if (b === undefined) {\n return null;\n }\n return new LatLon(a, b, c);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as latLon};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/LatLon.js\n **/","/*\n * Point is a helper class for ensuring consistent world positions.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n */\n\nclass Point {\n constructor(x, y, round) {\n this.x = (round ? Math.round(x) : x);\n this.y = (round ? Math.round(y) : y);\n }\n\n clone() {\n return new Point(this.x, this.y);\n }\n\n // Non-destructive\n add(point) {\n return this.clone()._add(_point(point));\n }\n\n // Destructive\n _add(point) {\n this.x += point.x;\n this.y += point.y;\n return this;\n }\n\n // Non-destructive\n subtract(point) {\n return this.clone()._subtract(_point(point));\n }\n\n // Destructive\n _subtract(point) {\n this.x -= point.x;\n this.y -= point.y;\n return this;\n }\n}\n\nexport default Point;\n\n// Accepts (point), ([x, y]) and (x, y, round)\nvar _point = function(x, y, round) {\n if (x instanceof Point) {\n return x;\n }\n if (Array.isArray(x)) {\n return new Point(x[0], x[1]);\n }\n if (x === undefined || x === null) {\n return x;\n }\n return new Point(x, y, round);\n};\n\n// Initialise without requiring new keyword\nexport {_point as point};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/Point.js\n **/","/*\n * Wrap the given number to lie within a certain range (eg. longitude)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n */\n\nvar wrapNum = function(x, range, includeMax) {\n var max = range[1];\n var min = range[0];\n var d = max - min;\n return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n};\n\nexport default wrapNum;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/wrapNum.js\n **/","/*\n * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n * used by default.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst SphericalMercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var max = this.MAX_LATITUDE;\n var lat = Math.max(Math.min(max, latlon.lat), -max);\n var sin = Math.sin(lat * d);\n\n return Point(\n this.R * latlon.lon * d,\n this.R * Math.log((1 + sin) / (1 - sin)) / 2\n );\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n\n return LatLon(\n (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\n point.x * d / this.R\n );\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Accurate scale factor uses proper Web Mercator scaling\n // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n // See: http://jsfiddle.net/robhawkes/yws924cf/\n pointScale: function(latlon, accurate) {\n var rad = Math.PI / 180;\n\n var k;\n\n if (!accurate) {\n k = 1 / Math.cos(latlon.lat * rad);\n\n // [scaleX, scaleY]\n return [k, k];\n } else {\n var lat = latlon.lat * rad;\n var lon = latlon.lon * rad;\n\n var a = this.R;\n\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n\n var cosLat = Math.cos(lat);\n\n // Radius meridian\n var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\n // Radius prime meridian\n var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\n // Scale N/S\n var h = (a / p) / cosLat;\n\n // Scale E/W\n k = (a / v) / cosLat;\n\n // [scaleX, scaleY]\n return [k, h];\n }\n },\n\n // Not using this.R due to scoping\n bounds: (function() {\n var d = 6378137 * Math.PI;\n return [[-d, -d], [d, d]];\n })()\n};\n\nexport default SphericalMercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.SphericalMercator.js\n **/","/*\n * Transformation is an utility class to perform simple point transformations\n * through a 2d-matrix.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n */\n\nimport {point as Point} from '../geo/Point';\n\nclass Transformation {\n constructor(a, b, c, d) {\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n\n transform(point, scale) {\n // Copy input point as to not destroy the original data\n return this._transform(point.clone(), scale);\n }\n\n // Destructive transform (faster)\n _transform(point, scale) {\n scale = scale || 1;\n\n point.x = scale * (this._a * point.x + this._b);\n point.y = scale * (this._c * point.y + this._d);\n return point;\n }\n\n untransform(point, scale) {\n scale = scale || 1;\n return Point(\n (point.x / scale - this._b) / this._a,\n (point.y / scale - this._d) / this._c\n );\n }\n}\n\nexport default Transformation;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Transformation.js\n **/","/*\n * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Mercator from '../projection/Projection.Mercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3395 = {\n code: 'EPSG:3395',\n projection: Mercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * Mercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * Mercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3395 = extend({}, Earth, _EPSG3395);\n\nexport default EPSG3395;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3395.js\n **/","/*\n * Mercator projection that takes into account that the Earth is not a perfect\n * sphere. Less popular than spherical mercator; used by projections like\n * EPSG:3395.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Mercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n R_MINOR: 6356752.314245179,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var r = this.R;\n var y = latlon.lat * d;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var con = e * Math.sin(y);\n\n var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n y = -r * Math.log(Math.max(ts, 1E-10));\n\n return Point(latlon.lon * d * r, y);\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n var r = this.R;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var ts = Math.exp(-point.y / r);\n var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\n for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n con = e * Math.sin(phi);\n con = Math.pow((1 - con) / (1 + con), e / 2);\n dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n phi += dphi;\n }\n\n return LatLon(phi * d, point.x * d / r);\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n pointScale: function(latlon) {\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n var cosLat = Math.cos(lat);\n\n var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\n // [scaleX, scaleY]\n return [k, k];\n },\n\n bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n};\n\nexport default Mercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Mercator.js\n **/","/*\n * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG4326 = {\n code: 'EPSG:4326',\n projection: LatLonProjection,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / 180,\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n //\n // TODO: Cannot use this.transformScale due to scope\n transformation: new Transformation(1 / 180, 0, -1 / 180, 0)\n};\n\nconst EPSG4326 = extend({}, Earth, _EPSG4326);\n\nexport default EPSG4326;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG4326.js\n **/","/*\n * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n * and Simple.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst ProjectionLatLon = {\n project: function(latlon) {\n return Point(latlon.lon, latlon.lat);\n },\n\n unproject: function(point) {\n return LatLon(point.y, point.x);\n },\n\n // Scale factor for converting between real metres and degrees\n //\n // degrees = realMetres * pointScale\n // realMetres = degrees / pointScale\n //\n // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n pointScale: function(latlon) {\n var m1 = 111132.92;\n var m2 = -559.82;\n var m3 = 1.175;\n var m4 = -0.0023;\n var p1 = 111412.84;\n var p2 = -93.5;\n var p3 = 0.118;\n\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n\n var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\n return [1 / latlen, 1 / lonlen];\n },\n\n bounds: [[-180, -90], [180, 90]]\n};\n\nexport default ProjectionLatLon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.LatLon.js\n **/","/*\n * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n * maps.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _Simple = {\n projection: LatLonProjection,\n\n // Straight 1:1 mapping (-1, -1 would be top-left)\n transformation: new Transformation(1, 0, 1, 0),\n\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom) {\n return Math.pow(2, zoom);\n // Else, make no change to scale – may need to increase this or make it a\n // user-definable variable\n } else {\n return 1;\n }\n },\n\n zoom: function(scale) {\n return Math.log(scale) / Math.LN2;\n },\n\n distance: function(latlon1, latlon2) {\n var dx = latlon2.lon - latlon1.lon;\n var dy = latlon2.lat - latlon1.lat;\n\n return Math.sqrt(dx * dx + dy * dy);\n },\n\n infinite: true\n};\n\nconst Simple = extend({}, CRS, _Simple);\n\nexport default Simple;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Simple.js\n **/","/*\n * CRS.Proj4 for any Proj4-supported CRS.\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Proj4Projection from '../projection/Projection.Proj4';\nimport Transformation from '../../util/Transformation';\n\nvar _Proj4 = function(code, def, bounds) {\n var projection = Proj4Projection(def, bounds);\n\n // Transformation calcuations\n var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\n var halfX = diffX / 2;\n var halfY = diffY / 2;\n\n // This is the raw scale factor\n var scaleX = 1 / halfX;\n var scaleY = 1 / halfY;\n\n // Find the minimum scale factor\n //\n // The minimum scale factor comes from the largest side and is the one\n // you want to use for both axis so they stay relative in dimension\n var scale = Math.min(scaleX, scaleY);\n\n // Find amount to offset each axis by to make the central point lie on\n // the [0,0] origin\n var offsetX = scale * (projection.bounds[0][0] + halfX);\n var offsetY = scale * (projection.bounds[0][1] + halfY);\n\n return {\n code: code,\n projection: projection,\n\n transformScale: scale,\n\n // Map the input to a [-1,1] range with [0,0] in the centre\n transformation: new Transformation(scale, -offsetX, -scale, offsetY)\n };\n};\n\nconst Proj4 = function(code, def, bounds) {\n return extend({}, Earth, _Proj4(code, def, bounds));\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Proj4.js\n **/","/*\n * Proj4 support for any projection.\n */\n\nimport proj4 from 'proj4';\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Proj4 = function(def, bounds) {\n var proj = proj4(def);\n\n var project = function(latlon) {\n return Point(proj.forward([latlon.lon, latlon.lat]));\n };\n\n var unproject = function(point) {\n var inverse = proj.inverse([point.x, point.y]);\n return LatLon(inverse[1], inverse[0]);\n };\n\n return {\n project: project,\n unproject: unproject,\n\n // Scale factor for converting between real metres and projected metres\\\n //\n // Need to work out the best way to provide the pointScale calculations\n // for custom, unknown projections (if wanting to override default)\n //\n // For now, user can manually override crs.pointScale or\n // crs.projection.pointScale\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n pointScale: function(latlon, accurate) {\n return [1, 1];\n },\n\n // Try and calculate bounds if none are provided\n //\n // This will provide incorrect bounds for some projections, so perhaps make\n // bounds a required input instead\n bounds: (function() {\n if (bounds) {\n return bounds;\n } else {\n var bottomLeft = project([-90, -180]);\n var topRight = project([90, 180]);\n\n return [bottomLeft, topRight];\n }\n })()\n };\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Proj4.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"proj4\"\n ** module id = 22\n ** module chunks = 0\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport Scene from './Scene';\nimport DOMScene3D from './DOMScene3D';\nimport DOMScene2D from './DOMScene2D';\nimport Renderer from './Renderer';\nimport DOMRenderer3D from './DOMRenderer3D';\nimport DOMRenderer2D from './DOMRenderer2D';\nimport Camera from './Camera';\nimport Picking from './Picking';\n\nclass Engine extends EventEmitter {\n constructor(container, world) {\n console.log('Init Engine');\n\n super();\n\n this._world = world;\n\n this._scene = Scene;\n this._domScene3D = DOMScene3D;\n this._domScene2D = DOMScene2D;\n\n this._renderer = Renderer(container);\n this._domRenderer3D = DOMRenderer3D(container);\n this._domRenderer2D = DOMRenderer2D(container);\n\n this._camera = Camera(container);\n\n // TODO: Make this optional\n this._picking = Picking(this._world, this._renderer, this._camera);\n\n this.clock = new THREE.Clock();\n\n this._frustum = new THREE.Frustum();\n }\n\n update(delta) {\n this.emit('preRender');\n\n this._renderer.render(this._scene, this._camera);\n\n // Render picking scene\n // this._renderer.render(this._picking._pickingScene, this._camera);\n\n // Render DOM scenes\n this._domRenderer3D.render(this._domScene3D, this._camera);\n this._domRenderer2D.render(this._domScene2D, this._camera);\n\n this.emit('postRender');\n }\n\n destroy() {\n // Remove any remaining objects from scene\n var child;\n for (var i = this._scene.children.length - 1; i >= 0; i--) {\n child = this._scene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._scene.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n };\n\n for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n child = this._domScene3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene3D.remove(child);\n };\n\n for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n child = this._domScene2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene2D.remove(child);\n };\n\n this._picking.destroy();\n this._picking = null;\n\n this._world = null;\n this._scene = null;\n this._domScene3D = null;\n this._domScene2D = null;\n this._renderer = null;\n this._domRenderer3D = null;\n this._domRenderer2D = null;\n this._camera = null;\n this._clock = null;\n this._frustum = null;\n }\n}\n\nexport default Engine;\n\n// // Initialise without requiring new keyword\n// export default function(container, world) {\n// return new Engine(container, world);\n// };\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Engine.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"THREE\"\n ** module id = 24\n ** module chunks = 0\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n\n // TODO: Re-enable when this works with the skybox\n // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Scene.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene3D.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene2D.js\n **/","import THREE from 'three';\nimport Scene from './Scene';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new THREE.WebGLRenderer({\n antialias: true\n });\n\n // TODO: Re-enable when this works with the skybox\n // renderer.setClearColor(Scene.fog.color, 1);\n\n renderer.setClearColor(0xffffff, 1);\n renderer.setPixelRatio(window.devicePixelRatio);\n\n // Gamma settings make things look nicer\n renderer.gammaInput = true;\n renderer.gammaOutput = true;\n\n renderer.shadowMap.enabled = true;\n renderer.shadowMap.cullFace = THREE.CullFaceBack;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Renderer.js\n **/","import THREE from 'three';\nimport {CSS3DRenderer} from '../vendor/CSS3DRenderer';\nimport DOMScene3D from './DOMScene3D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS3DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer3D.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS3DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS3DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS3DObject.prototype.constructor = CSS3DObject;\n\nvar CSS3DSprite = function ( element ) {\n\n\tCSS3DObject.call( this, element );\n\n};\n\nCSS3DSprite.prototype = Object.create( CSS3DObject.prototype );\nCSS3DSprite.prototype.constructor = CSS3DSprite;\n\n//\n\nvar CSS3DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS3DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar matrix = new THREE.Matrix4();\n\n\tvar cache = {\n\t\tcamera: { fov: 0, style: '' },\n\t\tobjects: {}\n\t};\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\tdomElement.style.oTransformStyle = 'preserve-3d';\n\tdomElement.style.transformStyle = 'preserve-3d';\n\n\tthis.domElement = domElement;\n\n\tvar cameraElement = document.createElement( 'div' );\n\n\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\tcameraElement.style.transformStyle = 'preserve-3d';\n\n\tdomElement.appendChild( cameraElement );\n\n\tthis.setClearColor = function () {};\n\n\tthis.getSize = function() {\n\n\t\treturn {\n\t\t\twidth: _width,\n\t\t\theight: _height\n\t\t};\n\n\t};\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t\tcameraElement.style.width = width + 'px';\n\t\tcameraElement.style.height = height + 'px';\n\n\t};\n\n\tvar epsilon = function ( value ) {\n\n\t\treturn Math.abs( value ) < Number.EPSILON ? 0 : value;\n\n\t};\n\n\tvar getCameraCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( - elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( elements[ 6 ] ) + ',' +\n\t\t\tepsilon( elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( - elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( - elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar getObjectCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( - elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( - elements[ 6 ] ) + ',' +\n\t\t\tepsilon( - elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS3DObject ) {\n\n\t\t\tvar style;\n\n\t\t\tif ( object instanceof CSS3DSprite ) {\n\n\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\n\t\t\t\tmatrix.copy( camera.matrixWorldInverse );\n\t\t\t\tmatrix.transpose();\n\t\t\t\tmatrix.copyPosition( object.matrixWorld );\n\t\t\t\tmatrix.scale( object.scale );\n\n\t\t\t\tmatrix.elements[ 3 ] = 0;\n\t\t\t\tmatrix.elements[ 7 ] = 0;\n\t\t\t\tmatrix.elements[ 11 ] = 0;\n\t\t\t\tmatrix.elements[ 15 ] = 1;\n\n\t\t\t\tstyle = getObjectCSSMatrix( matrix );\n\n\t\t\t} else {\n\n\t\t\t\tstyle = getObjectCSSMatrix( object.matrixWorld );\n\n\t\t\t}\n\n\t\t\tvar element = object.element;\n\t\t\tvar cachedStyle = cache.objects[ object.id ];\n\n\t\t\tif ( cachedStyle === undefined || cachedStyle !== style ) {\n\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\n\t\t\t\tcache.objects[ object.id ] = style;\n\n\t\t\t}\n\n\t\t\tif ( element.parentNode !== cameraElement ) {\n\n\t\t\t\tcameraElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tvar fov = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * _height;\n\n\t\tif ( cache.camera.fov !== fov ) {\n\n\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\tdomElement.style.perspective = fov + 'px';\n\n\t\t\tcache.camera.fov = fov;\n\n\t\t}\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse ) +\n\t\t\t' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\n\t\tif ( cache.camera.style !== style ) {\n\n\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\tcameraElement.style.MozTransform = style;\n\t\t\tcameraElement.style.oTransform = style;\n\t\t\tcameraElement.style.transform = style;\n\n\t\t\tcache.camera.style = style;\n\n\t\t}\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS3DObject as CSS3DObject};\nexport {CSS3DSprite as CSS3DSprite};\nexport {CSS3DRenderer as CSS3DRenderer};\n\nTHREE.CSS3DObject = CSS3DObject;\nTHREE.CSS3DSprite = CSS3DSprite;\nTHREE.CSS3DRenderer = CSS3DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS3DRenderer.js\n **/","import THREE from 'three';\nimport {CSS2DRenderer} from '../vendor/CSS2DRenderer';\nimport DOMScene2D from './DOMScene2D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS2DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer2D.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS2DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS2DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS2DObject.prototype.constructor = CSS2DObject;\n\n//\n\nvar CSS2DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS2DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar vector = new THREE.Vector3();\n\tvar viewMatrix = new THREE.Matrix4();\n\tvar viewProjectionMatrix = new THREE.Matrix4();\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tthis.domElement = domElement;\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS2DObject ) {\n\n\t\t\tvector.setFromMatrixPosition( object.matrixWorld );\n\t\t\tvector.applyProjection( viewProjectionMatrix );\n\n\t\t\tvar element = object.element;\n\t\t\tvar style = 'translate(-50%,-50%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)';\n\n\t\t\telement.style.WebkitTransform = style;\n\t\t\telement.style.MozTransform = style;\n\t\t\telement.style.oTransform = style;\n\t\t\telement.style.transform = style;\n\n\t\t\tif ( element.parentNode !== domElement ) {\n\n\t\t\t\tdomElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tviewMatrix.copy( camera.matrixWorldInverse.getInverse( camera.matrixWorld ) );\n\t\tviewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS2DObject as CSS2DObject};\nexport {CSS2DRenderer as CSS2DRenderer};\n\nTHREE.CSS2DObject = CSS2DObject;\nTHREE.CSS2DRenderer = CSS2DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS2DRenderer.js\n **/","import THREE from 'three';\n\n// This can only be accessed from Engine.camera if you want to reference the\n// same scene in multiple places\n\n// TODO: Ensure that FOV looks natural on all aspect ratios\n// http://stackoverflow.com/q/26655930/997339\n\nexport default function(container) {\n var camera = new THREE.PerspectiveCamera(45, 1, 1, 200000);\n camera.position.y = 400;\n camera.position.z = 400;\n\n var updateSize = function() {\n camera.aspect = container.clientWidth / container.clientHeight;\n camera.updateProjectionMatrix();\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return camera;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Camera.js\n **/","import THREE from 'three';\nimport {point as Point} from '../geo/Point';\nimport PickingScene from './PickingScene';\n\n// TODO: Look into a way of setting this up without passing in a renderer and\n// camera from the engine\n\n// TODO: Add a basic indicator on or around the mouse pointer when it is over\n// something pickable / clickable\n//\n// A simple transparent disc or ring at the mouse point should work to start, or\n// even just changing the cursor to the CSS 'pointer' style\n//\n// Probably want this on mousemove with a throttled update as not to spam the\n// picking method\n//\n// Relies upon the picking method not redrawing the scene every call due to\n// the way TileLayer invalidates the picking scene\n\nvar nextId = 1;\n\nclass Picking {\n constructor(world, renderer, camera) {\n this._world = world;\n this._renderer = renderer;\n this._camera = camera;\n\n this._raycaster = new THREE.Raycaster();\n\n // TODO: Match this with the line width used in the picking layers\n this._raycaster.linePrecision = 3;\n\n this._pickingScene = PickingScene;\n this._pickingTexture = new THREE.WebGLRenderTarget();\n this._pickingTexture.texture.minFilter = THREE.LinearFilter;\n this._pickingTexture.texture.generateMipmaps = false;\n\n this._nextId = 1;\n\n this._resizeTexture();\n this._initEvents();\n }\n\n _initEvents() {\n window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\n // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onMouseUp(event) {\n // Only react to main button click\n if (event.button !== 0) {\n return;\n }\n\n var point = Point(event.clientX, event.clientY);\n\n var normalisedPoint = Point(0, 0);\n normalisedPoint.x = (point.x / this._width) * 2 - 1;\n normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\n this._pick(point, normalisedPoint);\n }\n\n _onWorldMove() {\n this._needUpdate = true;\n }\n\n // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n _resizeTexture() {\n var size = this._renderer.getSize();\n\n this._width = size.width;\n this._height = size.height;\n\n this._pickingTexture.setSize(this._width, this._height);\n this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\n this._needUpdate = true;\n }\n\n // TODO: Make this only re-draw the scene if both an update is needed and the\n // camera has moved since the last update\n //\n // Otherwise it re-draws the scene on every click due to the way LOD updates\n // work in TileLayer – spamming this.add() and this.remove()\n //\n // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n // be a point in time where the user cares for picking functionality\n _update() {\n if (this._needUpdate) {\n var texture = this._pickingTexture;\n\n this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\n // Read the rendering texture\n this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\n this._needUpdate = false;\n }\n }\n\n _pick(point, normalisedPoint) {\n this._update();\n\n var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\n // Interpret the pixel as an ID\n var id = (this._pixelBuffer[index * 4 + 2] * 255 * 255) + (this._pixelBuffer[index * 4 + 1] * 255) + (this._pixelBuffer[index * 4 + 0]);\n\n // Skip if ID is 16646655 (white) as the background returns this\n if (id === 16646655) {\n return;\n }\n\n this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\n // Perform ray intersection on picking scene\n //\n // TODO: Only perform intersection test on the relevant picking mesh\n var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\n var _point2d = point.clone();\n\n var _point3d;\n if (intersects.length > 0) {\n _point3d = intersects[0].point.clone();\n }\n\n // Pass along as much data as possible for now until we know more about how\n // people use the picking API and what the returned data should be\n //\n // TODO: Look into the leak potential for passing so much by reference here\n this._world.emit('pick', id, _point2d, _point3d, intersects);\n this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n }\n\n // Add mesh to picking scene\n //\n // Picking ID should already be added as an attribute\n add(mesh) {\n this._pickingScene.add(mesh);\n this._needUpdate = true;\n }\n\n // Remove mesh from picking scene\n remove(mesh) {\n this._pickingScene.remove(mesh);\n this._needUpdate = true;\n }\n\n // Returns next ID to use for picking\n getNextId() {\n return nextId++;\n }\n\n destroy() {\n // TODO: Find a way to properly remove these listeners as they stay\n // active at the moment\n window.removeEventListener('resize', this._resizeTexture, false);\n this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n this._world.off('move', this._onWorldMove);\n\n if (this._pickingScene.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n child = this._pickingScene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._pickingScene.remove(child);\n\n // Probably not a good idea to dispose of geometry due to it being\n // shared with the non-picking scene\n // if (child.geometry) {\n // // Dispose of mesh and materials\n // child.geometry.dispose();\n // child.geometry = null;\n // }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n this._pickingScene = null;\n this._pickingTexture = null;\n this._pixelBuffer = null;\n\n this._world = null;\n this._renderer = null;\n this._camera = null;\n }\n}\n\n// Initialise without requiring new keyword\nexport default function(world, renderer, camera) {\n return new Picking(world, renderer, camera);\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Picking.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.pickingScene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingScene.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Skybox from './Skybox';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass EnvironmentLayer extends Layer {\n constructor(options) {\n var defaults = {\n skybox: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n }\n\n _onAdd() {\n this._initLights();\n\n if (this._options.skybox) {\n this._initSkybox();\n }\n\n // this._initGrid();\n }\n\n // Not fleshed out or thought through yet\n //\n // Lights could potentially be put it their own 'layer' to keep this class\n // much simpler and less messy\n _initLights() {\n // Position doesn't really matter (the angle is important), however it's\n // used here so the helpers look more natural.\n\n if (!this._options.skybox) {\n var directionalLight = new THREE.DirectionalLight(0xffffff, 1);\n directionalLight.position.x = 1000;\n directionalLight.position.y = 1000;\n directionalLight.position.z = 1000;\n\n // TODO: Get shadows working in non-PBR scenes\n\n // directionalLight.castShadow = true;\n //\n // var d = 100;\n // directionalLight.shadow.camera.left = -d;\n // directionalLight.shadow.camera.right = d;\n // directionalLight.shadow.camera.top = d;\n // directionalLight.shadow.camera.bottom = -d;\n //\n // directionalLight.shadow.camera.near = 10;\n // directionalLight.shadow.camera.far = 100;\n //\n // // TODO: Need to dial in on a good shadowmap size\n // directionalLight.shadow.mapSize.width = 2048;\n // directionalLight.shadow.mapSize.height = 2048;\n //\n // // directionalLight.shadowBias = -0.0010;\n // // directionalLight.shadow.darkness = 0.15;\n\n var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5);\n directionalLight2.position.x = -1000;\n directionalLight2.position.y = 1000;\n directionalLight2.position.z = -1000;\n\n // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\n this.add(directionalLight);\n this.add(directionalLight2);\n\n // this.add(helper);\n // this.add(helper2);\n } else {\n // Directional light that will be projected from the sun\n this._skyboxLight = new THREE.DirectionalLight(0xffffff, 1);\n\n this._skyboxLight.castShadow = true;\n\n var d = 1000;\n this._skyboxLight.shadow.camera.left = -d;\n this._skyboxLight.shadow.camera.right = d;\n this._skyboxLight.shadow.camera.top = d;\n this._skyboxLight.shadow.camera.bottom = -d;\n\n this._skyboxLight.shadow.camera.near = 10000;\n this._skyboxLight.shadow.camera.far = 70000;\n\n // TODO: Need to dial in on a good shadowmap size\n this._skyboxLight.shadow.mapSize.width = 2048;\n this._skyboxLight.shadow.mapSize.height = 2048;\n\n // this._skyboxLight.shadowBias = -0.0010;\n // this._skyboxLight.shadow.darkness = 0.15;\n\n // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\n this.add(this._skyboxLight);\n }\n }\n\n _initSkybox() {\n this._skybox = new Skybox(this._world, this._skyboxLight);\n this.add(this._skybox._mesh);\n }\n\n // Add grid helper for context during initial development\n _initGrid() {\n var size = 4000;\n var step = 100;\n\n var gridHelper = new THREE.GridHelper(size, step);\n this.add(gridHelper);\n }\n\n // Clean up environment\n destroy() {\n this._skyboxLight = null;\n\n this.remove(this._skybox._mesh);\n this._skybox.destroy();\n this._skybox = null;\n\n super.destroy();\n }\n}\n\nexport default EnvironmentLayer;\n\nvar noNew = function(options) {\n return new EnvironmentLayer(options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as environmentLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/EnvironmentLayer.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Scene from '../engine/Scene';\nimport {CSS3DObject} from '../vendor/CSS3DRenderer';\nimport {CSS2DObject} from '../vendor/CSS2DRenderer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Need a single move method that handles moving all the various object\n// layers so that the DOM layers stay in sync with the 3D layer\n\n// TODO: Double check that objects within the _object3D Object3D parent are frustum\n// culled even if the layer position stays at the default (0,0,0) and the child\n// objects are positioned much further away\n//\n// Or does the layer being at (0,0,0) prevent the child objects from being\n// culled because the layer parent is effectively always in view even if the\n// child is actually out of camera\n\nclass Layer extends EventEmitter {\n constructor(options) {\n super();\n\n var defaults = {\n output: true\n };\n\n this._options = extend({}, defaults, options);\n\n if (this.isOutput()) {\n this._object3D = new THREE.Object3D();\n\n this._dom3D = document.createElement('div');\n this._domObject3D = new CSS3DObject(this._dom3D);\n\n this._dom2D = document.createElement('div');\n this._domObject2D = new CSS2DObject(this._dom2D);\n }\n }\n\n // Add THREE object directly to layer\n add(object) {\n this._object3D.add(object);\n }\n\n // Remove THREE object from to layer\n remove(object) {\n this._object3D.remove(object);\n }\n\n addDOM3D(object) {\n this._domObject3D.add(object);\n }\n\n removeDOM3D(object) {\n this._domObject3D.remove(object);\n }\n\n addDOM2D(object) {\n this._domObject2D.add(object);\n }\n\n removeDOM2D(object) {\n this._domObject2D.remove(object);\n }\n\n // Add layer to world instance and store world reference\n addTo(world) {\n world.addLayer(this);\n return this;\n }\n\n // Internal method called by World.addLayer to actually add the layer\n _addToWorld(world) {\n this._world = world;\n this._onAdd(world);\n this.emit('added');\n }\n\n _onAdd(world) {}\n\n getPickingId() {\n if (this._world._engine._picking) {\n return this._world._engine._picking.getNextId();\n }\n\n return false;\n }\n\n // TODO: Tidy this up and don't access so many private properties to work\n addToPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.add(object);\n }\n\n removeFromPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.remove(object);\n }\n\n isOutput() {\n return this._options.output;\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._object3D && this._object3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n child = this._object3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n if (this._domObject3D && this._domObject3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n child = this._domObject3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM3D(child);\n }\n }\n\n if (this._domObject2D && this._domObject2D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n child = this._domObject2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM2D(child);\n }\n }\n\n this._domObject3D = null;\n this._domObject2D = null;\n\n this._world = null;\n this._object3D = null;\n }\n}\n\nexport default Layer;\n\nvar noNew = function(options) {\n return new Layer(options);\n};\n\nexport {noNew as layer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/Layer.js\n **/","import THREE from 'three';\nimport Sky from './Sky';\nimport throttle from 'lodash.throttle';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nvar cubemap = {\n vertexShader: [\n\t\t'varying vec3 vPosition;',\n\t\t'void main() {',\n\t\t\t'vPosition = position;',\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n 'uniform samplerCube cubemap;',\n 'varying vec3 vPosition;',\n\n 'void main() {',\n 'gl_FragColor = textureCube(cubemap, normalize(vPosition));',\n '}'\n ].join('\\n')\n};\n\nclass Skybox {\n constructor(world, light) {\n this._world = world;\n this._light = light;\n\n this._settings = {\n distance: 38000,\n turbidity: 10,\n reileigh: 2,\n mieCoefficient: 0.005,\n mieDirectionalG: 0.8,\n luminance: 1,\n // 0.48 is a cracking dusk / sunset\n // 0.4 is a beautiful early-morning / late-afternoon\n // 0.2 is a nice day time\n inclination: 0.48, // Elevation / inclination\n azimuth: 0.25, // Facing front\n };\n\n this._initSkybox();\n this._updateUniforms();\n this._initEvents();\n }\n\n _initEvents() {\n // Throttled to 1 per 100ms\n this._throttledWorldUpdate = throttle(this._update, 100);\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n }\n\n _initSkybox() {\n // Cube camera for skybox\n this._cubeCamera = new THREE.CubeCamera(1, 2000000, 128);\n\n // Cube material\n var cubeTarget = this._cubeCamera.renderTarget;\n\n // Add Sky Mesh\n this._sky = new Sky();\n this._skyScene = new THREE.Scene();\n this._skyScene.add(this._sky.mesh);\n\n // Add Sun Helper\n this._sunSphere = new THREE.Mesh(\n new THREE.SphereBufferGeometry(2000, 16, 8),\n new THREE.MeshBasicMaterial({\n color: 0xffffff\n })\n );\n\n // TODO: This isn't actually visible because it's not added to the layer\n // this._sunSphere.visible = true;\n\n var skyboxUniforms = {\n cubemap: { type: 't', value: cubeTarget }\n };\n\n var skyboxMat = new THREE.ShaderMaterial({\n uniforms: skyboxUniforms,\n vertexShader: cubemap.vertexShader,\n fragmentShader: cubemap.fragmentShader,\n side: THREE.BackSide\n });\n\n this._mesh = new THREE.Mesh(new THREE.BoxGeometry(190000, 190000, 190000), skyboxMat);\n\n this._updateSkybox = true;\n }\n\n _updateUniforms() {\n var settings = this._settings;\n var uniforms = this._sky.uniforms;\n uniforms.turbidity.value = settings.turbidity;\n uniforms.reileigh.value = settings.reileigh;\n uniforms.luminance.value = settings.luminance;\n uniforms.mieCoefficient.value = settings.mieCoefficient;\n uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\n var theta = Math.PI * (settings.inclination - 0.5);\n var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\n this._sunSphere.position.x = settings.distance * Math.cos(phi);\n this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\n // Move directional light to sun position\n this._light.position.copy(this._sunSphere.position);\n\n this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n }\n\n _update(delta) {\n if (this._updateSkybox) {\n this._updateSkybox = false;\n } else {\n return;\n }\n\n // if (!this._angle) {\n // this._angle = 0;\n // }\n //\n // // Animate inclination\n // this._angle += Math.PI * delta;\n // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\n // Update light intensity depending on elevation of sun (day to night)\n this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\n // // console.log(delta, this._angle, this._settings.inclination);\n //\n // TODO: Only do this when the uniforms have been changed\n this._updateUniforms();\n\n // TODO: Only do this when the cubemap has actually changed\n this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n }\n\n getRenderTarget() {\n return this._cubeCamera.renderTarget;\n }\n\n setInclination(inclination) {\n this._settings.inclination = inclination;\n this._updateSkybox = true;\n }\n\n // Destroy the skybox and remove it from memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._throttledWorldUpdate = null;\n\n this._world = null;\n this._light = null;\n\n this._cubeCamera = null;\n\n this._sky.mesh.geometry.dispose();\n this._sky.mesh.geometry = null;\n\n if (this._sky.mesh.material.map) {\n this._sky.mesh.material.map.dispose();\n this._sky.mesh.material.map = null;\n }\n\n this._sky.mesh.material.dispose();\n this._sky.mesh.material = null;\n\n this._sky.mesh = null;\n this._sky = null;\n\n this._skyScene = null;\n\n this._sunSphere.geometry.dispose();\n this._sunSphere.geometry = null;\n\n if (this._sunSphere.material.map) {\n this._sunSphere.material.map.dispose();\n this._sunSphere.material.map = null;\n }\n\n this._sunSphere.material.dispose();\n this._sunSphere.material = null;\n\n this._sunSphere = null;\n\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n}\n\nexport default Skybox;\n\nvar noNew = function(world, light) {\n return new Skybox(world, light);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as skybox};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Skybox.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * @author zz85 / https://github.com/zz85\n *\n * Based on 'A Practical Analytic Model for Daylight'\n * aka The Preetham Model, the de facto standard analytic skydome model\n * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n *\n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nimport THREE from 'three';\n\nTHREE.ShaderLib[ 'sky' ] = {\n\n\tuniforms: {\n\n\t\tluminance:\t { type: 'f', value: 1 },\n\t\tturbidity:\t { type: 'f', value: 2 },\n\t\treileigh:\t { type: 'f', value: 1 },\n\t\tmieCoefficient:\t { type: 'f', value: 0.005 },\n\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\tsunPosition: \t { type: 'v3', value: new THREE.Vector3() }\n\n\t},\n\n\tvertexShader: [\n\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'void main() {',\n\n\t\t\t'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n\t\t\t'vWorldPosition = worldPosition.xyz;',\n\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n\t\t'}',\n\n\t].join( '\\n' ),\n\n\tfragmentShader: [\n\n\t\t'uniform sampler2D skySampler;',\n\t\t'uniform vec3 sunPosition;',\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'vec3 cameraPos = vec3(0., 0., 0.);',\n\t\t'// uniform sampler2D sDiffuse;',\n\t\t'// const float turbidity = 10.0; //',\n\t\t'// const float reileigh = 2.; //',\n\t\t'// const float luminance = 1.0; //',\n\t\t'// const float mieCoefficient = 0.005;',\n\t\t'// const float mieDirectionalG = 0.8;',\n\n\t\t'uniform float luminance;',\n\t\t'uniform float turbidity;',\n\t\t'uniform float reileigh;',\n\t\t'uniform float mieCoefficient;',\n\t\t'uniform float mieDirectionalG;',\n\n\t\t'// constants for atmospheric scattering',\n\t\t'const float e = 2.71828182845904523536028747135266249775724709369995957;',\n\t\t'const float pi = 3.141592653589793238462643383279502884197169;',\n\n\t\t'const float n = 1.0003; // refractive index of air',\n\t\t'const float N = 2.545E25; // number of molecules per unit volume for air at',\n\t\t\t\t\t\t\t\t'// 288.15K and 1013mb (sea level -45 celsius)',\n\t\t'const float pn = 0.035;\t// depolatization factor for standard air',\n\n\t\t'// wavelength of used primaries, according to preetham',\n\t\t'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);',\n\n\t\t'// mie stuff',\n\t\t'// K coefficient for the primaries',\n\t\t'const vec3 K = vec3(0.686, 0.678, 0.666);',\n\t\t'const float v = 4.0;',\n\n\t\t'// optical length at zenith for molecules',\n\t\t'const float rayleighZenithLength = 8.4E3;',\n\t\t'const float mieZenithLength = 1.25E3;',\n\t\t'const vec3 up = vec3(0.0, 1.0, 0.0);',\n\n\t\t'const float EE = 1000.0;',\n\t\t'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;',\n\t\t'// 66 arc seconds -> degrees, and the cosine of that',\n\n\t\t'// earth shadow hack',\n\t\t'const float cutoffAngle = pi/1.95;',\n\t\t'const float steepness = 1.5;',\n\n\n\t\t'vec3 totalRayleigh(vec3 lambda)',\n\t\t'{',\n\t\t\t'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));',\n\t\t'}',\n\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE',\n\t\t'vec3 simplifiedRayleigh()',\n\t\t'{',\n\t\t\t'return 0.0005 / vec3(94, 40, 18);',\n\t\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}',\n\n\t\t'float rayleighPhase(float cosTheta)',\n\t\t'{\t ',\n\t\t\t'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'}',\n\n\t\t'vec3 totalMie(vec3 lambda, vec3 K, float T)',\n\t\t'{',\n\t\t\t'float c = (0.2 * T ) * 10E-18;',\n\t\t\t'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;',\n\t\t'}',\n\n\t\t'float hgPhase(float cosTheta, float g)',\n\t\t'{',\n\t\t\t'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));',\n\t\t'}',\n\n\t\t'float sunIntensity(float zenithAngleCos)',\n\t\t'{',\n\t\t\t'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));',\n\t\t'}',\n\n\t\t'// float logLuminance(vec3 c)',\n\t\t'// {',\n\t\t'// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);',\n\t\t'// }',\n\n\t\t'// Filmic ToneMapping http://filmicgames.com/archives/75',\n\t\t'float A = 0.15;',\n\t\t'float B = 0.50;',\n\t\t'float C = 0.10;',\n\t\t'float D = 0.20;',\n\t\t'float E = 0.02;',\n\t\t'float F = 0.30;',\n\t\t'float W = 1000.0;',\n\n\t\t'vec3 Uncharted2Tonemap(vec3 x)',\n\t\t'{',\n\t\t 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;',\n\t\t'}',\n\n\n\t\t'void main() ',\n\t\t'{',\n\t\t\t'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);',\n\n\t\t\t'// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;',\n\n\t\t\t '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);',\n\n\t\t\t'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));',\n\n\t\t\t'vec3 sunDirection = normalize(sunPosition);',\n\n\t\t\t'float sunE = sunIntensity(dot(sunDirection, up));',\n\n\t\t\t'// extinction (absorbtion + out scattering) ',\n\t\t\t'// rayleigh coefficients',\n\n\t\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;',\n\n\t\t\t'// mie coefficients',\n\t\t\t'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;',\n\n\t\t\t'// optical length',\n\t\t\t'// cutoff angle at 90 to avoid singularity in next formula.',\n\t\t\t'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));',\n\t\t\t'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\t\t\t'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\n\n\n\t\t\t'// combined extinction factor\t',\n\t\t\t'vec3 Fex = exp(-(betaR * sR + betaM * sM));',\n\n\t\t\t'// in scattering',\n\t\t\t'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);',\n\n\t\t\t'float rPhase = rayleighPhase(cosTheta*0.5+0.5);',\n\t\t\t'vec3 betaRTheta = betaR * rPhase;',\n\n\t\t\t'float mPhase = hgPhase(cosTheta, mieDirectionalG);',\n\t\t\t'vec3 betaMTheta = betaM * mPhase;',\n\n\n\t\t\t'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));',\n\t\t\t'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));',\n\n\t\t\t'//nightsky',\n\t\t\t'vec3 direction = normalize(vWorldPosition - cameraPos);',\n\t\t\t'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]',\n\t\t\t'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]',\n\t\t\t'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);',\n\t\t\t'// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;',\n\t\t\t'vec3 L0 = vec3(0.1) * Fex;',\n\n\t\t\t'// composition + solar disc',\n\t\t\t'//if (cosTheta > sunAngularDiameterCos)',\n\t\t\t'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);',\n\t\t\t'// if (normalize(vWorldPosition - cameraPos).y>0.0)',\n\t\t\t'L0 += (sunE * 19000.0 * Fex)*sundisk;',\n\n\n\t\t\t'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));',\n\n\t\t\t'vec3 texColor = (Lin+L0); ',\n\t\t\t'texColor *= 0.04 ;',\n\t\t\t'texColor += vec3(0.0,0.001,0.0025)*0.3;',\n\n\t\t\t'float g_fMaxLuminance = 1.0;',\n\t\t\t'float fLumScaled = 0.1 / luminance; ',\n\t\t\t'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ',\n\n\t\t\t'float ExposureBias = fLumCompressed;',\n\n\t\t\t'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);',\n\t\t\t'vec3 color = curr*whiteScale;',\n\n\t\t\t'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));',\n\n\n\t\t\t'gl_FragColor.rgb = retColor;',\n\n\t\t\t'gl_FragColor.a = 1.0;',\n\t\t'}',\n\n\t].join( '\\n' )\n\n};\n\nvar Sky = function () {\n\n\tvar skyShader = THREE.ShaderLib[ 'sky' ];\n\tvar skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );\n\n\tvar skyMat = new THREE.ShaderMaterial( {\n\t\tfragmentShader: skyShader.fragmentShader,\n\t\tvertexShader: skyShader.vertexShader,\n\t\tuniforms: skyUniforms,\n\t\tside: THREE.BackSide\n\t} );\n\n\tvar skyGeo = new THREE.SphereBufferGeometry( 450000, 32, 15 );\n\tvar skyMesh = new THREE.Mesh( skyGeo, skyMat );\n\n\n\t// Expose variables\n\tthis.mesh = skyMesh;\n\tthis.uniforms = skyUniforms;\n\n};\n\nexport default Sky;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Sky.js\n **/","/**\n * lodash 4.0.0 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar debounce = require('lodash.debounce');\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide an options object to indicate whether\n * `func` should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the throttled function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=true] Specify invoking on the leading\n * edge of the timeout.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // avoid excessively updating the position while scrolling\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // cancel a trailing throttled invocation\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = throttle;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/index.js\n ** module id = 40\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\nvar now = Date.now;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide an options object to indicate whether `func` should be invoked on\n * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent calls\n * to the debounced function return the result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it's invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n leading = false,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function flush() {\n if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n result = func.apply(thisArg, args);\n }\n cancel();\n return result;\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/~/lodash.debounce/index.js\n ** module id = 41\n ** module chunks = 0\n **/","import Orbit, {orbit} from './Controls.Orbit';\n\nconst Controls = {\n Orbit: Orbit,\n orbit, orbit\n};\n\nexport default Controls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/index.js\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport OrbitControls from '../vendor/OrbitControls';\n\nclass Orbit extends EventEmitter {\n constructor() {\n super();\n }\n\n // Proxy control events\n //\n // There's currently no distinction between pan, orbit and zoom events\n _initEvents() {\n this._controls.addEventListener('start', (event) => {\n this._world.emit('controlsMoveStart', event.target.target);\n });\n\n this._controls.addEventListener('change', (event) => {\n this._world.emit('controlsMove', event.target.target);\n });\n\n this._controls.addEventListener('end', (event) => {\n this._world.emit('controlsMoveEnd', event.target.target);\n });\n }\n\n // Moving the camera along the [x,y,z] axis based on a target position\n _panTo(point, animate) {}\n _panBy(pointDelta, animate) {}\n\n // Zooming the camera in and out\n _zoomTo(metres, animate) {}\n _zoomBy(metresDelta, animate) {}\n\n // Force camera to look at something other than the target\n _lookAt(point, animate) {}\n\n // Make camera look at the target\n _lookAtTarget() {}\n\n // Tilt (up and down)\n _tiltTo(angle, animate) {}\n _tiltBy(angleDelta, animate) {}\n\n // Rotate (left and right)\n _rotateTo(angle, animate) {}\n _rotateBy(angleDelta, animate) {}\n\n // Fly to the given point, animating pan and tilt/rotation to final position\n // with nice zoom out and in\n //\n // Calling flyTo a second time before the previous animation has completed\n // will immediately start the new animation from wherever the previous one\n // has got to\n _flyTo(point, noZoom) {}\n\n // Proxy to OrbitControls.update()\n update() {\n this._controls.update();\n }\n\n // Add controls to world instance and store world reference\n addTo(world) {\n world.addControls(this);\n return this;\n }\n\n // Internal method called by World.addControls to actually add the controls\n _addToWorld(world) {\n this._world = world;\n\n // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n // See: http://stackoverflow.com/a/26188674/997339\n this._controls = new OrbitControls(world._engine._camera, world._container);\n\n // Disable keys for now as no events are fired for them anyway\n this._controls.keys = false;\n\n // 89 degrees\n this._controls.maxPolarAngle = 1.5533;\n\n // this._controls.enableDamping = true;\n // this._controls.dampingFactor = 0.25;\n\n this._initEvents();\n\n this.emit('added');\n }\n\n // Destroys the controls and removes them from memory\n destroy() {\n // TODO: Remove event listeners\n\n this._controls.dispose();\n\n this._world = null;\n this._controls = null;\n }\n}\n\nexport default Orbit;\n\nvar noNew = function() {\n return new Orbit();\n};\n\n// Initialise without requiring new keyword\nexport {noNew as orbit};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/Controls.Orbit.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\nimport THREE from 'three';\nimport Hammer from 'hammerjs';\n\n/**\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author erich666 / http://erichaines.com\n */\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one finger move\n// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n// Pan - right mouse, or arrow keys / touch: three finter swipe\n\nvar OrbitControls = function ( object, domElement ) {\n\n\tthis.object = object;\n\n\tthis.domElement = ( domElement !== undefined ) ? domElement : document;\n\n\t// Set to false to disable this control\n\tthis.enabled = true;\n\n\t// \"target\" sets the location of focus, where the object orbits around\n\tthis.target = new THREE.Vector3();\n\n\t// How far you can dolly in and out ( PerspectiveCamera only )\n\tthis.minDistance = 0;\n\tthis.maxDistance = Infinity;\n\n\t// How far you can zoom in and out ( OrthographicCamera only )\n\tthis.minZoom = 0;\n\tthis.maxZoom = Infinity;\n\n\t// How far you can orbit vertically, upper and lower limits.\n\t// Range is 0 to Math.PI radians.\n\tthis.minPolarAngle = 0; // radians\n\tthis.maxPolarAngle = Math.PI; // radians\n\n\t// How far you can orbit horizontally, upper and lower limits.\n\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\tthis.minAzimuthAngle = - Infinity; // radians\n\tthis.maxAzimuthAngle = Infinity; // radians\n\n\t// Set to true to enable damping (inertia)\n\t// If damping is enabled, you must call controls.update() in your animation loop\n\tthis.enableDamping = false;\n\tthis.dampingFactor = 0.25;\n\n\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t// Set to false to disable zooming\n\tthis.enableZoom = true;\n\tthis.zoomSpeed = 1.0;\n\n\t// Set to false to disable rotating\n\tthis.enableRotate = true;\n\tthis.rotateSpeed = 1.0;\n\n\t// Set to false to disable panning\n\tthis.enablePan = true;\n\tthis.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\n\t// Set to true to automatically rotate around the target\n\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\tthis.autoRotate = false;\n\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n\t// Set to false to disable use of the keys\n\tthis.enableKeys = true;\n\n\t// The four arrow keys\n\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\n\t// Mouse buttons\n\tthis.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };\n\n\t// for reset\n\tthis.target0 = this.target.clone();\n\tthis.position0 = this.object.position.clone();\n\tthis.zoom0 = this.object.zoom;\n\n\t//\n\t// public methods\n\t//\n\n\tthis.getPolarAngle = function () {\n\n\t\treturn phi;\n\n\t};\n\n\tthis.getAzimuthalAngle = function () {\n\n\t\treturn theta;\n\n\t};\n\n\tthis.reset = function () {\n\n\t\tscope.target.copy( scope.target0 );\n\t\tscope.object.position.copy( scope.position0 );\n\t\tscope.object.zoom = scope.zoom0;\n\n\t\tscope.object.updateProjectionMatrix();\n\t\tscope.dispatchEvent( changeEvent );\n\n\t\tscope.update();\n\n\t\tstate = STATE.NONE;\n\n\t};\n\n\t// this method is exposed, but perhaps it would be better if we can make it private...\n\tthis.update = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\t// so camera.up is the orbit axis\n\t\tvar quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );\n\t\tvar quatInverse = quat.clone().inverse();\n\n\t\tvar lastPosition = new THREE.Vector3();\n\t\tvar lastQuaternion = new THREE.Quaternion();\n\n\t\treturn function () {\n\n\t\t\tvar position = scope.object.position;\n\n\t\t\toffset.copy( position ).sub( scope.target );\n\n\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\toffset.applyQuaternion( quat );\n\n\t\t\t// angle from z-axis around y-axis\n\n\t\t\ttheta = Math.atan2( offset.x, offset.z );\n\n\t\t\t// angle from y-axis\n\n\t\t\tphi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );\n\n\t\t\tif ( scope.autoRotate && state === STATE.NONE ) {\n\n\t\t\t\trotateLeft( getAutoRotationAngle() );\n\n\t\t\t}\n\n\t\t\ttheta += thetaDelta;\n\t\t\tphi += phiDelta;\n\n\t\t\t// restrict theta to be between desired limits\n\t\t\ttheta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, theta ) );\n\n\t\t\t// restrict phi to be between desired limits\n\t\t\tphi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, phi ) );\n\n\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\tphi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );\n\n\t\t\tvar radius = offset.length() * scale;\n\n\t\t\t// restrict radius to be between desired limits\n\t\t\tradius = Math.max( scope.minDistance, Math.min( scope.maxDistance, radius ) );\n\n\t\t\t// move target to panned location\n\t\t\tscope.target.add( panOffset );\n\n\t\t\toffset.x = radius * Math.sin( phi ) * Math.sin( theta );\n\t\t\toffset.y = radius * Math.cos( phi );\n\t\t\toffset.z = radius * Math.sin( phi ) * Math.cos( theta );\n\n\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\toffset.applyQuaternion( quatInverse );\n\n\t\t\tposition.copy( scope.target ).add( offset );\n\n\t\t\tscope.object.lookAt( scope.target );\n\n\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\tthetaDelta *= ( 1 - scope.dampingFactor );\n\t\t\t\tphiDelta *= ( 1 - scope.dampingFactor );\n\n\t\t\t} else {\n\n\t\t\t\tthetaDelta = 0;\n\t\t\t\tphiDelta = 0;\n\n\t\t\t}\n\n\t\t\tscale = 1;\n\t\t\tpanOffset.set( 0, 0, 0 );\n\n\t\t\t// update condition is:\n\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n\t\t\tif ( zoomChanged ||\n\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n\t\t\t\tscope.dispatchEvent( changeEvent );\n\n\t\t\t\tlastPosition.copy( scope.object.position );\n\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\tzoomChanged = false;\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t}();\n\n\tthis.dispose = function() {\n\n\t\tscope.domElement.removeEventListener( 'contextmenu', onContextMenu, false );\n\t\tscope.domElement.removeEventListener( 'mousedown', onMouseDown, false );\n\t\tscope.domElement.removeEventListener( 'mousewheel', onMouseWheel, false );\n\t\tscope.domElement.removeEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t\tscope.domElement.removeEventListener( 'touchstart', onTouchStart, false );\n\t\tscope.domElement.removeEventListener( 'touchend', onTouchEnd, false );\n\t\tscope.domElement.removeEventListener( 'touchmove', onTouchMove, false );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\twindow.removeEventListener( 'keydown', onKeyDown, false );\n\n\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\n\t};\n\n\t//\n\t// internals\n\t//\n\n\tvar scope = this;\n\n\tvar changeEvent = { type: 'change' };\n\tvar startEvent = { type: 'start' };\n\tvar endEvent = { type: 'end' };\n\n\tvar STATE = { NONE : - 1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };\n\n\tvar state = STATE.NONE;\n\n\tvar EPS = 0.000001;\n\n\t// current position in spherical coordinates\n\tvar theta;\n\tvar phi;\n\n\tvar phiDelta = 0;\n\tvar thetaDelta = 0;\n\tvar scale = 1;\n\tvar panOffset = new THREE.Vector3();\n\tvar zoomChanged = false;\n\n\tvar rotateStart = new THREE.Vector2();\n\tvar rotateEnd = new THREE.Vector2();\n\tvar rotateDelta = new THREE.Vector2();\n\n\tvar panStart = new THREE.Vector2();\n\tvar panEnd = new THREE.Vector2();\n\tvar panDelta = new THREE.Vector2();\n\n\tvar dollyStart = new THREE.Vector2();\n\tvar dollyEnd = new THREE.Vector2();\n\tvar dollyDelta = new THREE.Vector2();\n\n\tfunction getAutoRotationAngle() {\n\n\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\n\t}\n\n\tfunction getZoomScale() {\n\n\t\treturn Math.pow( 0.95, scope.zoomSpeed );\n\n\t}\n\n\tfunction rotateLeft( angle ) {\n\n\t\tthetaDelta -= angle;\n\n\t}\n\n\tfunction rotateUp( angle ) {\n\n\t\tphiDelta -= angle;\n\n\t}\n\n\tvar panLeft = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panLeft( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get X column of objectMatrix\n\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n //\n\t\t// \tv.multiplyScalar( - distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n // Fixed panning to x/y plane\n return function panLeft(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t // var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 0 ], 0, te[ 2 ]);\n\t v.multiplyScalar(-distance);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n // Fixed panning to x/y plane\n\tvar panUp = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panUp( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get Y column of objectMatrix\n\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n //\n\t\t// \tv.multiplyScalar( distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n return function panUp(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 4 ], 0, te[ 6 ]);\n\t v.multiplyScalar(adjDist);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n\t// deltaX and deltaY are in pixels; right and down are positive\n\tvar pan = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\treturn function( deltaX, deltaY ) {\n\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\t\t// perspective\n\t\t\t\tvar position = scope.object.position;\n\t\t\t\toffset.copy( position ).sub( scope.target );\n\t\t\t\tvar targetDistance = offset.length();\n\n\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\ttargetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\tpanLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n\t\t\t\tpanUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\t\t// orthographic\n\t\t\t\tpanLeft( deltaX * ( scope.object.right - scope.object.left ) / element.clientWidth, scope.object.matrix );\n\t\t\t\tpanUp( deltaY * ( scope.object.top - scope.object.bottom ) / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else {\n\n\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n\t\t\t\tscope.enablePan = false;\n\n\t\t\t}\n\n\t\t};\n\n\t}();\n\n\tfunction dollyIn( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale /= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\tfunction dollyOut( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale *= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\t//\n\t// event callbacks - update the object state\n\t//\n\n\tfunction handleMouseDownRotate( event ) {\n\n\t\t//console.log( 'handleMouseDownRotate' );\n\n\t\trotateStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownDolly( event ) {\n\n\t\t//console.log( 'handleMouseDownDolly' );\n\n\t\tdollyStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownPan( event ) {\n\n\t\t//console.log( 'handleMouseDownPan' );\n\n\t\tpanStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseMoveRotate( event ) {\n\n\t\t//console.log( 'handleMouseMoveRotate' );\n\n\t\trotateEnd.set( event.clientX, event.clientY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMoveDolly( event ) {\n\n\t\t//console.log( 'handleMouseMoveDolly' );\n\n\t\tdollyEnd.set( event.clientX, event.clientY );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMovePan( event ) {\n\n\t\t//console.log( 'handleMouseMovePan' );\n\n\t\tpanEnd.set( event.clientX, event.clientY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseUp( event ) {\n\n\t\t//console.log( 'handleMouseUp' );\n\n\t}\n\n\tfunction handleMouseWheel( event ) {\n\n\t\t//console.log( 'handleMouseWheel' );\n\n\t\tvar delta = 0;\n\n\t\tif ( event.wheelDelta !== undefined ) {\n\n\t\t\t// WebKit / Opera / Explorer 9\n\n\t\t\tdelta = event.wheelDelta;\n\n\t\t} else if ( event.detail !== undefined ) {\n\n\t\t\t// Firefox\n\n\t\t\tdelta = - event.detail;\n\n\t\t}\n\n\t\tif ( delta > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( delta < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleKeyDown( event ) {\n\n\t\t//console.log( 'handleKeyDown' );\n\n\t\tswitch ( event.keyCode ) {\n\n\t\t\tcase scope.keys.UP:\n\t\t\t\tpan( 0, scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\tpan( 0, - scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.LEFT:\n\t\t\t\tpan( scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.RIGHT:\n\t\t\t\tpan( - scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction handleTouchStartRotate( event ) {\n\n\t\t//console.log( 'handleTouchStartRotate' );\n\n\t\trotateStart.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\n\t}\n\n\tfunction handleTouchStartDolly( event ) {\n\n\t\t//console.log( 'handleTouchStartDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyStart.set( 0, distance );\n\n\t}\n\n\tfunction handleTouchStartPan( event ) {\n\n\t\t//console.log( 'handleTouchStartPan' );\n\n\t\tpanStart.set( event.deltaX, event.deltaY );\n\n\t}\n\n\tfunction handleTouchMoveRotate( event ) {\n\n\t\t//console.log( 'handleTouchMoveRotate' );\n\n\t\trotateEnd.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMoveDolly( event ) {\n\n\t\t//console.log( 'handleTouchMoveDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyEnd.set( 0, distance );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMovePan( event ) {\n\n\t\t//console.log( 'handleTouchMovePan' );\n\n\t\tpanEnd.set( event.deltaX, event.deltaY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchEnd( event ) {\n\n\t\t//console.log( 'handleTouchEnd' );\n\n\t}\n\n\t//\n\t// event handlers - FSM: listen for events and reset state\n\t//\n\n\tfunction onMouseDown( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.button === scope.mouseButtons.ORBIT ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseDownRotate( event );\n\n\t\t\tstate = STATE.ROTATE;\n\n\t\t} else if ( event.button === scope.mouseButtons.ZOOM ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseDownDolly( event );\n\n\t\t\tstate = STATE.DOLLY;\n\n\t\t} else if ( event.button === scope.mouseButtons.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseDownPan( event );\n\n\t\t\tstate = STATE.PAN;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tdocument.addEventListener( 'mousemove', onMouseMove, false );\n\t\t\tdocument.addEventListener( 'mouseup', onMouseUp, false );\n\t\t\tdocument.addEventListener( 'mouseout', onMouseUp, false );\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( state === STATE.ROTATE ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseMoveRotate( event );\n\n\t\t} else if ( state === STATE.DOLLY ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseMoveDolly( event );\n\n\t\t} else if ( state === STATE.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseMovePan( event );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseUp( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleMouseUp( event );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onMouseWheel( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\thandleMouseWheel( event );\n\n\t\tscope.dispatchEvent( startEvent ); // not sure why these are here...\n\t\tscope.dispatchEvent( endEvent );\n\n\t}\n\n\tfunction onKeyDown( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;\n\n\t\thandleKeyDown( event );\n\n\t}\n\n\tfunction onTouchStart( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1:\t// one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\thandleTouchStartRotate( event );\n\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\t// two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\thandleTouchStartDolly( event );\n\n\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\thandleTouchStartPan( event );\n\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onTouchMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1: // one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveRotate( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2: // two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveDolly( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\t\thandleTouchMovePan( event );\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t}\n\n\tfunction onTouchEnd( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleTouchEnd( event );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onContextMenu( event ) {\n\n\t\tevent.preventDefault();\n\n\t}\n\n\t//\n\n\tscope.domElement.addEventListener( 'contextmenu', onContextMenu, false );\n\n\tscope.domElement.addEventListener( 'mousedown', onMouseDown, false );\n\tscope.domElement.addEventListener( 'mousewheel', onMouseWheel, false );\n\tscope.domElement.addEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\n\tscope.hammer = new Hammer(scope.domElement);\n\n\tscope.hammer.get('pan').set({\n\t\tpointers: 0,\n\t\tdirection: Hammer.DIRECTION_ALL\n\t});\n\n\tscope.hammer.get('pinch').set({\n\t\tenable: true,\n\t\tthreshold: 0.1\n\t});\n\n\tscope.hammer.on('panstart', function(event) {\n\t\tif (scope.enabled === false) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif (scope.enablePan === false) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\thandleTouchStartPan(event);\n\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\n\t\t\tstate = STATE.TOUCH_PAN;\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleTouchStartRotate( event );\n\n\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t}\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('panend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('panmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif ( scope.enablePan === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\thandleTouchMovePan( event );\n\n\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t//\n\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t//\n\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t//\n\t\t\t// panStart.copy( panEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\thandleTouchMoveRotate( event );\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchstart', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( scope.enableZoom === false ) return;\n\n\t\thandleTouchStartDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyStart.set( 0, distance );\n\t\t//\n\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('pinchmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif ( scope.enableZoom === false ) return;\n\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\thandleTouchMoveDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyEnd.set( 0, distance );\n\t\t//\n\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t//\n\t\t// if ( dollyDelta.y > 0 ) {\n\t\t//\n\t\t// \tdollyOut( getZoomScale() );\n\t\t//\n\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t//\n\t\t// \tdollyIn( getZoomScale() );\n\t\t//\n\t\t// }\n\t\t//\n\t\t// dollyStart.copy( dollyEnd );\n\t\t//\n\t\t// scope.update();\n\t});\n\n\twindow.addEventListener( 'keydown', onKeyDown, false );\n\n\t// force an update at start\n\n\tthis.update();\n\n};\n\nOrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );\nOrbitControls.prototype.constructor = THREE.OrbitControls;\n\nObject.defineProperties( OrbitControls.prototype, {\n\n\tcenter: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .center has been renamed to .target' );\n\t\t\treturn this.target;\n\n\t\t}\n\n\t},\n\n\t// backward compatibility\n\n\tnoZoom: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\treturn ! this.enableZoom;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\tthis.enableZoom = ! value;\n\n\t\t}\n\n\t},\n\n\tnoRotate: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\treturn ! this.enableRotate;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\tthis.enableRotate = ! value;\n\n\t\t}\n\n\t},\n\n\tnoPan: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\treturn ! this.enablePan;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\tthis.enablePan = ! value;\n\n\t\t}\n\n\t},\n\n\tnoKeys: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\treturn ! this.enableKeys;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\tthis.enableKeys = ! value;\n\n\t\t}\n\n\t},\n\n\tstaticMoving : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\treturn ! this.constraint.enableDamping;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\tthis.constraint.enableDamping = ! value;\n\n\t\t}\n\n\t},\n\n\tdynamicDampingFactor : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\treturn this.constraint.dampingFactor;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\tthis.constraint.dampingFactor = value;\n\n\t\t}\n\n\t}\n\n} );\n\nexport default OrbitControls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/OrbitControls.js\n **/","/*! Hammer.JS - v2.0.6 - 2015-12-23\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2015 Jorik Tangelder;\n * Licensed under the license */\n(function(window, document, exportName, undefined) {\n 'use strict';\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = document.createElement('div');\n\nvar TYPE_FUNCTION = 'function';\n\nvar round = Math.round;\nvar abs = Math.abs;\nvar now = Date.now;\n\n/**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\nfunction setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n}\n\n/**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n}\n\n/**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function() {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n .replace(/^\\s+at\\s+/gm, '')\n .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean=false} [merge]\n * @returns {Object} dest\n */\nvar extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\nvar merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\nfunction inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign(childP, properties);\n }\n}\n\n/**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\nfunction boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n}\n\n/**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\nfunction ifUndefined(val1, val2) {\n return (val1 === undefined) ? val2 : val1;\n}\n\n/**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n}\n\n/**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n return i;\n }\n i++;\n }\n return -1;\n }\n}\n\n/**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\n/**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\nfunction prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = (prefix) ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n}\n\n/**\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return (doc.defaultView || doc.parentWindow || window);\n}\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\nvar SUPPORT_TOUCH = ('ontouchstart' in window);\nvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\n\nvar COMPUTE_INTERVAL = 25;\n\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\n\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\n\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\nfunction Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function(ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n\n}\n\nInput.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function() { },\n\n /**\n * bind the events\n */\n init: function() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n\n /**\n * unbind the events\n */\n destroy: function() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n};\n\n/**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\nfunction createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new (Type)(manager, inputHandler);\n}\n\n/**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\n input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity, velocityX, velocityY, direction;\n\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\nfunction getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0, y = 0, i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\n/**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n\n return Math.sqrt((x * x) + (y * y));\n}\n\n/**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\n\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n/**\n * Mouse events input\n * @constructor\n * @extends Input\n */\nfunction MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n\n this.allow = true; // used by Input.TouchMouse to disable mouse events\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n}\n\ninherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n if (!this.pressed || !this.allow) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n});\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n};\n\n// in IE10 the pointer types is defined as an enum\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n};\n\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n// IE10 has prefixed support, and case-sensitive\nif (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n\n/**\n * Pointer events input\n * @constructor\n * @extends Input\n */\nfunction PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n\n Input.apply(this, arguments);\n\n this.store = (this.manager.session.pointerEvents = []);\n}\n\ninherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\n var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n});\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Touch events input\n * @constructor\n * @extends Input\n */\nfunction SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n\n Input.apply(this, arguments);\n}\n\ninherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\nfunction TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n\n Input.apply(this, arguments);\n}\n\ninherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function(touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n changedTargetTouches\n ];\n}\n\n/**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\nfunction TouchMouseInput() {\n Input.apply(this, arguments);\n\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n}\n\ninherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\n // when we're in a touch event, so block all upcoming mouse events\n // most mobile browser also emit mouseevents, right after touchstart\n if (isTouch) {\n this.mouse.allow = false;\n } else if (isMouse && !this.mouse.allow) {\n return;\n }\n\n // reset the allowMouse when we're done\n if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n this.mouse.allow = true;\n }\n\n this.callback(manager, inputEvent, inputData);\n },\n\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n});\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n// magical touchAction value\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\n/**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\nfunction TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n}\n\nTouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function(value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n\n /**\n * just re-set the touchAction value\n */\n update: function() {\n this.set(this.manager.options.touchAction);\n },\n\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function() {\n var actions = [];\n each(this.manager.recognizers, function(recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function(input) {\n // not needed with native support for the touchAction property\n if (NATIVE_TOUCH_ACTION) {\n return;\n }\n\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)) {\n return this.preventSrc(srcEvent);\n }\n },\n\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n};\n\n/**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\nfunction Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n\n this.id = uniqueId();\n\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n\n this.state = STATE_POSSIBLE;\n\n this.simultaneous = {};\n this.requireFail = [];\n}\n\nRecognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function(options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function() {\n return this.requireFail.length > 0;\n },\n\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function(input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function() {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function(inputData) { }, // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function() { },\n\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function() { }\n};\n\n/**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n}\n\n/**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\nfunction directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n}\n\n/**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n}\n\n/**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\nfunction AttrRecognizer() {\n Recognizer.apply(this, arguments);\n}\n\ninherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function(input) {\n var state = this.state;\n var eventType = input.eventType;\n\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n});\n\n/**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n\n this.pX = null;\n this.pY = null;\n}\n\ninherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n\n getTouchAction: function() {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n\n directionTest: function(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n\n attrTest: function(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n },\n\n emit: function(input) {\n\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n\n emit: function(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\nfunction PressRecognizer() {\n Recognizer.apply(this, arguments);\n\n this._timer = null;\n this._input = null;\n}\n\ninherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251, // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_AUTO];\n },\n\n process: function(input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && (input.eventType & INPUT_END)) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n});\n\n/**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n\n getTouchAction: function() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n\n attrTest: function(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n\n emit: function(input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n }\n});\n\n/**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\nfunction TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n\n this._timer = null;\n this._input = null;\n this.count = 0;\n}\n\ninherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300, // max time between the multi-tap taps\n time: 250, // max time of the pointer to be down (like finger on the screen)\n threshold: 9, // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_MANIPULATION];\n },\n\n process: function(input) {\n var options = this.options;\n\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n\n this.reset();\n\n if ((input.eventType & INPUT_START) && (this.count === 0)) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n\n failTimeout: function() {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function() {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n}\n\n/**\n * @const {string}\n */\nHammer.VERSION = '2.0.6';\n\n/**\n * default settings\n * @namespace\n */\nHammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {enable: false}],\n [PinchRecognizer, {enable: false}, ['rotate']],\n [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n [PressRecognizer]\n ],\n\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n};\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n\n/**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n\n this.options.inputTarget = this.options.inputTarget || element;\n\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n\n toggleCssProps(this, true);\n\n each(this.options.recognizers, function(item) {\n var recognizer = this.add(new (item[0])(item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n}\n\nManager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function(options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n curRecognizer = session.curRecognizer = null;\n }\n\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) { // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function(recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n\n this.touchAction.update();\n return recognizer;\n },\n\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function(recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n },\n\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n data.preventDefault = function() {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function() {\n this.element && toggleCssProps(this, false);\n\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n};\n\n/**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n each(manager.options.cssProps, function(value, name) {\n element.style[prefixed(element.style, name)] = add ? value : '';\n });\n}\n\n/**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n\nassign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n});\n\n// this prevents errors when Hammer is loaded in the presence of an AMD\n// style loader but by script tag, not by the loader.\nvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\nfreeGlobal.Hammer = Hammer;\n\nif (typeof define === 'function' && define.amd) {\n define(function() {\n return Hammer;\n });\n} else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n} else {\n window[exportName] = Hammer;\n}\n\n})(window, document, 'Hammer');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/hammerjs/hammer.js\n ** module id = 45\n ** module chunks = 0\n **/","import TileLayer from './TileLayer';\nimport ImageTile from './ImageTile';\nimport ImageTileLayerBaseMaterial from './ImageTileLayerBaseMaterial';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\nimport extend from 'lodash.assign';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n// being removed and the new tiles being ready for display\n//\n// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n// of the basemap ground so it blends in a little more, or have a huge ground\n// plane underneath all the tiles that shows through between tile updates.\n//\n// Could keep the old tiles around until the new ones are ready, though they'd\n// probably need to be layered in a way so the old tiles don't overlap new ones,\n// which is similar to how Leaflet approaches this (it has 2 layers)\n//\n// Could keep the tile from the previous quadtree level visible until all 4\n// tiles at the new / current level have finished loading and are displayed.\n// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n// child quadcodes showing whether they are loaded and in view. If all true then\n// remove the parent tile, otherwise keep it on a lower layer.\n\n// TODO: Load and display a base layer separate to the LOD grid that is at a low\n// resolution – used as a backup / background to fill in empty areas / distance\n\n// DONE: Fix the issue where some tiles just don't load, or at least the texture\n// never shows up – tends to happen if you quickly zoom in / out past it while\n// it's still loading, leaving a blank space\n\n// TODO: Optimise the request of many image tiles – look at how Leaflet and\n// OpenWebGlobe approach this (eg. batching, queues, etc)\n\n// TODO: Cancel pending tile requests if they get removed from view before they\n// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n// images are re-requested when the tile is next in scene (even if from cache)\n\n// TODO: Consider not performing an LOD calculation on every frame, instead only\n// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n// possible for performance to tank if you pan, orbit or zoom rapidly while all\n// the LOD calculations are being made and new tiles requested.\n//\n// Pending tiles should continue to be requested and output to the scene on each\n// frame, but no new LOD calculations should be made.\n\n// This tile layer both updates the quadtree and outputs tiles on every frame\n// (throttled to some amount)\n//\n// This is because the computational complexity of image tiles is generally low\n// and so there isn't much jank when running these calculations and outputs in\n// realtime\n//\n// The benefit to doing this is that the underlying map layer continues to\n// refresh and update during movement, which is an arguably better experience\n\nclass ImageTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n distance: 40000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Add base layer\n var geom = new THREE.PlaneBufferGeometry(200000, 200000, 1);\n\n var baseMaterial;\n if (this._world._environment._skybox) {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n } else {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3');\n }\n\n var mesh = new THREE.Mesh(geom, baseMaterial);\n mesh.renderOrder = 0;\n mesh.rotation.x = -90 * Math.PI / 180;\n\n // TODO: It might be overkill to receive a shadow on the base layer as it's\n // rarely seen (good to have if performance difference is negligible)\n mesh.receiveShadow = true;\n\n this._baseLayer = mesh;\n this.add(mesh);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onWorldUpdate() {\n this._calculateLOD();\n this._outputTiles();\n }\n\n _onWorldMove(latlon, point) {\n this._moveBaseLayer(point);\n }\n\n _moveBaseLayer(point) {\n this._baseLayer.position.x = point.x;\n this._baseLayer.position.z = point.y;\n }\n\n _createTile(quadcode, layer) {\n return new ImageTile(quadcode, this._path, layer);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Dispose of mesh and materials\n this._baseLayer.geometry.dispose();\n this._baseLayer.geometry = null;\n\n if (this._baseLayer.material.map) {\n this._baseLayer.material.map.dispose();\n this._baseLayer.material.map = null;\n }\n\n this._baseLayer.material.dispose();\n this._baseLayer.material = null;\n\n this._baseLayer = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default ImageTileLayer;\n\nvar noNew = function(path, options) {\n return new ImageTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayer.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport TileCache from './TileCache';\nimport THREE from 'three';\n\n// TODO: Consider removing picking from TileLayer instances as there aren't\n// (m)any situations where it would be practical\n//\n// For example, how would you even know what picking IDs to listen to and what\n// to do with them?\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider keeping a single TileLayer / LOD instance running by default\n// that keeps a standard LOD grid for other layers to utilise, rather than\n// having to create their own, unique LOD grid and duplicate calculations when\n// they're going to use the same grid setup anyway\n//\n// It still makes sense to be able to have a custom LOD grid for some layers as\n// they may want to customise things, maybe not even using a quadtree at all!\n//\n// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n// pass in the necessary parameters each time for the calculation step.\n//\n// Either way, it seems silly to force layers to have to create a new LOD grid\n// each time and create extra, duplicated processing every frame.\n\n// TODO: Allow passing in of options to define min/max LOD and a distance to use\n// for culling tiles beyond that distance.\n\n// DONE: Prevent tiles from being loaded if they are further than a certain\n// distance from the camera and are unlikely to be seen anyway\n\n// TODO: Avoid performing LOD calculation when it isn't required. For example,\n// when nothing has changed since the last frame and there are no tiles to be\n// loaded or in need of rendering\n\n// TODO: Only remove tiles from the layer that aren't to be rendered in the\n// current frame – it seems excessive to remove all tiles and re-add them on\n// every single frame, even if it's just array manipulation\n\n// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n// problems (eg. making min above 5 causes all sorts of issues)\n\n// TODO: Reuse THREE objects where possible instead of creating new instances\n// on every LOD calculation\n\n// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n// to avoid creating unnecessary memory for garbage collection\n\n// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n// closest to the camera) so visual inconsistancies during loading are minimised\n\nclass TileLayer extends Layer {\n constructor(options) {\n var defaults = {\n picking: false,\n maxCache: 1000,\n maxLOD: 18\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._tileCache = new TileCache(this._options.maxCache, tile => {\n this._destroyTile(tile);\n });\n\n // List of tiles from the previous LOD calculation\n this._tileList = [];\n\n // TODO: Work out why changing the minLOD causes loads of issues\n this._minLOD = 3;\n this._maxLOD = this._options.maxLOD;\n\n this._frustum = new THREE.Frustum();\n this._tiles = new THREE.Object3D();\n this._tilesPicking = new THREE.Object3D();\n }\n\n _onAdd(world) {\n this.addToPicking(this._tilesPicking);\n this.add(this._tiles);\n }\n\n _updateFrustum() {\n var camera = this._world.getCamera();\n var projScreenMatrix = new THREE.Matrix4();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\n this._frustum.setFromMatrix(camera.projectionMatrix);\n this._frustum.setFromMatrix(new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n }\n\n _tileInFrustum(tile) {\n var bounds = tile.getBounds();\n return this._frustum.intersectsBox(new THREE.Box3(new THREE.Vector3(bounds[0], 0, bounds[3]), new THREE.Vector3(bounds[2], 0, bounds[1])));\n }\n\n // Update and output tiles from the previous LOD checklist\n _outputTiles() {\n if (!this._tiles) {\n return;\n }\n\n // Remove all tiles from layer\n this._removeTiles();\n\n // Add / re-add tiles\n this._tileList.forEach(tile => {\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n if (!tile.isReady()) {\n return;\n }\n\n // Add tile to layer (and to scene) if not already there\n this._tiles.add(tile.getMesh());\n\n if (tile.getPickingMesh()) {\n this._tilesPicking.add(tile.getPickingMesh());\n }\n });\n }\n\n // Works out tiles in the view frustum and stores them in an array\n //\n // Does not output the tiles, deferring this to _outputTiles()\n _calculateLOD() {\n if (this._stop || !this._world) {\n return;\n }\n\n // var start = performance.now();\n\n var camera = this._world.getCamera();\n\n // 1. Update and retrieve camera frustum\n this._updateFrustum(this._frustum, camera);\n\n // 2. Add the four root items of the quadtree to a check list\n var checkList = this._checklist;\n checkList = [];\n checkList.push(this._requestTile('0', this));\n checkList.push(this._requestTile('1', this));\n checkList.push(this._requestTile('2', this));\n checkList.push(this._requestTile('3', this));\n\n // 3. Call Divide, passing in the check list\n this._divide(checkList);\n\n // // 4. Remove all tiles from layer\n //\n // Moved to _outputTiles() for now\n // this._removeTiles();\n\n // 5. Filter the tiles remaining in the check list\n this._tileList = checkList.filter((tile, index) => {\n // Skip tile if it's not in the current view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n if (this._options.distance && this._options.distance > 0) {\n // TODO: Can probably speed this up\n var center = tile.getCenter();\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n // Manual distance limit to cut down on tiles so far away\n if (dist > this._options.distance) {\n return false;\n }\n }\n\n // Does the tile have a mesh?\n //\n // If yes, continue\n // If no, generate tile mesh, request texture and skip\n if (!tile.getMesh()) {\n tile.requestTileAsync();\n }\n\n return true;\n\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n // if (!tile.isReady()) {\n // return;\n // }\n //\n // // Add tile to layer (and to scene)\n // this._tiles.add(tile.getMesh());\n });\n\n // console.log(performance.now() - start);\n }\n\n _divide(checkList) {\n var count = 0;\n var currentItem;\n var quadcode;\n\n // 1. Loop until count equals check list length\n while (count != checkList.length) {\n currentItem = checkList[count];\n quadcode = currentItem.getQuadcode();\n\n // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n if (currentItem.length === this._maxLOD) {\n count++;\n continue;\n }\n\n // 3. Else, calculate screen-space error metric for quadcode\n if (this._screenSpaceError(currentItem)) {\n // 4. If error is sufficient...\n\n // 4a. Remove parent item from the check list\n checkList.splice(count, 1);\n\n // 4b. Add 4 child items to the check list\n checkList.push(this._requestTile(quadcode + '0', this));\n checkList.push(this._requestTile(quadcode + '1', this));\n checkList.push(this._requestTile(quadcode + '2', this));\n checkList.push(this._requestTile(quadcode + '3', this));\n\n // 4d. Continue the loop without increasing count\n continue;\n } else {\n // 5. Else, increase count and continue loop\n count++;\n }\n }\n }\n\n _screenSpaceError(tile) {\n var minDepth = this._minLOD;\n var maxDepth = this._maxLOD;\n\n var quadcode = tile.getQuadcode();\n\n var camera = this._world.getCamera();\n\n // Tweak this value to refine specific point that each quad is subdivided\n //\n // It's used to multiple the dimensions of the tile sides before\n // comparing against the tile distance from camera\n var quality = 3.0;\n\n // 1. Return false if quadcode length equals maxDepth (stop dividing)\n if (quadcode.length === maxDepth) {\n return false;\n }\n\n // 2. Return true if quadcode length is less than minDepth\n if (quadcode.length < minDepth) {\n return true;\n }\n\n // 3. Return false if quadcode bounds are not in view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n var center = tile.getCenter();\n\n // 4. Calculate screen-space error metric\n // TODO: Use closest distance to one of the 4 tile corners\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n var error = quality * tile.getSide() / dist;\n\n // 5. Return true if error is greater than 1.0, else return false\n return (error > 1.0);\n }\n\n _removeTiles() {\n if (!this._tiles || !this._tiles.children) {\n return;\n }\n\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n\n if (!this._tilesPicking || !this._tilesPicking.children) {\n return;\n }\n\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n // Return a new tile instance\n _createTile(quadcode, layer) {}\n\n // Get a cached tile or request a new one if not in cache\n _requestTile(quadcode, layer) {\n var tile = this._tileCache.getTile(quadcode);\n\n if (!tile) {\n // Set up a brand new tile\n tile = this._createTile(quadcode, layer);\n\n // Add tile to cache, though it won't be ready yet as the data is being\n // requested from various places asynchronously\n this._tileCache.setTile(quadcode, tile);\n }\n\n return tile;\n }\n\n _destroyTile(tile) {\n // Remove tile from scene\n this._tiles.remove(tile.getMesh());\n\n // Delete any references to the tile within this component\n\n // Call destory on tile instance\n tile.destroy();\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._tiles.children) {\n // Remove all tiles\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n }\n\n // Remove tile from picking scene\n this.removeFromPicking(this._tilesPicking);\n\n if (this._tilesPicking.children) {\n // Remove all tiles\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n this._tileCache.destroy();\n this._tileCache = null;\n\n this._tiles = null;\n this._tilesPicking = null;\n this._frustum = null;\n\n super.destroy();\n }\n}\n\nexport default TileLayer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileLayer.js\n **/","import LRUCache from 'lru-cache';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// This process is based on a similar approach taken by OpenWebGlobe\n// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\nclass TileCache {\n constructor(cacheLimit, onDestroyTile) {\n this._cache = LRUCache({\n max: cacheLimit,\n dispose: (key, tile) => {\n onDestroyTile(tile);\n }\n });\n }\n\n // Returns true if all specified tile providers are ready to be used\n // Otherwise, returns false\n isReady() {\n return false;\n }\n\n // Get a cached tile without requesting a new one\n getTile(quadcode) {\n return this._cache.get(quadcode);\n }\n\n // Add tile to cache\n setTile(quadcode, tile) {\n this._cache.set(quadcode, tile);\n }\n\n // Destroy the cache and remove it from memory\n //\n // TODO: Call destroy method on items in cache\n destroy() {\n this._cache.reset();\n this._cache = null;\n }\n}\n\nexport default TileCache;\n\nvar noNew = function(cacheLimit, onDestroyTile) {\n return new TileCache(cacheLimit, onDestroyTile);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as tileCache};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileCache.js\n **/","module.exports = LRUCache\n\n// This will be a proper iterable 'Map' in engines that support it,\n// or a fakey-fake PseudoMap in older versions.\nvar Map = require('pseudomap')\nvar util = require('util')\n\n// A linked list to keep track of recently-used-ness\nvar Yallist = require('yallist')\n\n// use symbols if possible, otherwise just _props\nvar symbols = {}\nvar hasSymbol = typeof Symbol === 'function'\nvar makeSymbol\nif (hasSymbol) {\n makeSymbol = function (key) {\n return Symbol.for(key)\n }\n} else {\n makeSymbol = function (key) {\n return '_' + key\n }\n}\n\nfunction priv (obj, key, val) {\n var sym\n if (symbols[key]) {\n sym = symbols[key]\n } else {\n sym = makeSymbol(key)\n symbols[key] = sym\n }\n if (arguments.length === 2) {\n return obj[sym]\n } else {\n obj[sym] = val\n return val\n }\n}\n\nfunction naiveLength () { return 1 }\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nfunction LRUCache (options) {\n if (!(this instanceof LRUCache)) {\n return new LRUCache(options)\n }\n\n if (typeof options === 'number') {\n options = { max: options }\n }\n\n if (!options) {\n options = {}\n }\n\n var max = priv(this, 'max', options.max)\n // Kind of weird to have a default max of Infinity, but oh well.\n if (!max ||\n !(typeof max === 'number') ||\n max <= 0) {\n priv(this, 'max', Infinity)\n }\n\n var lc = options.length || naiveLength\n if (typeof lc !== 'function') {\n lc = naiveLength\n }\n priv(this, 'lengthCalculator', lc)\n\n priv(this, 'allowStale', options.stale || false)\n priv(this, 'maxAge', options.maxAge || 0)\n priv(this, 'dispose', options.dispose)\n this.reset()\n}\n\n// resize the cache when the max changes.\nObject.defineProperty(LRUCache.prototype, 'max', {\n set: function (mL) {\n if (!mL || !(typeof mL === 'number') || mL <= 0) {\n mL = Infinity\n }\n priv(this, 'max', mL)\n trim(this)\n },\n get: function () {\n return priv(this, 'max')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'allowStale', {\n set: function (allowStale) {\n priv(this, 'allowStale', !!allowStale)\n },\n get: function () {\n return priv(this, 'allowStale')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'maxAge', {\n set: function (mA) {\n if (!mA || !(typeof mA === 'number') || mA < 0) {\n mA = 0\n }\n priv(this, 'maxAge', mA)\n trim(this)\n },\n get: function () {\n return priv(this, 'maxAge')\n },\n enumerable: true\n})\n\n// resize the cache when the lengthCalculator changes.\nObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n set: function (lC) {\n if (typeof lC !== 'function') {\n lC = naiveLength\n }\n if (lC !== priv(this, 'lengthCalculator')) {\n priv(this, 'lengthCalculator', lC)\n priv(this, 'length', 0)\n priv(this, 'lruList').forEach(function (hit) {\n hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n priv(this, 'length', priv(this, 'length') + hit.length)\n }, this)\n }\n trim(this)\n },\n get: function () { return priv(this, 'lengthCalculator') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'length', {\n get: function () { return priv(this, 'length') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'itemCount', {\n get: function () { return priv(this, 'lruList').length },\n enumerable: true\n})\n\nLRUCache.prototype.rforEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n var prev = walker.prev\n forEachStep(this, fn, walker, thisp)\n walker = prev\n }\n}\n\nfunction forEachStep (self, fn, node, thisp) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) {\n hit = undefined\n }\n }\n if (hit) {\n fn.call(thisp, hit.value, hit.key, self)\n }\n}\n\nLRUCache.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').head; walker !== null;) {\n var next = walker.next\n forEachStep(this, fn, walker, thisp)\n walker = next\n }\n}\n\nLRUCache.prototype.keys = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.key\n }, this)\n}\n\nLRUCache.prototype.values = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.value\n }, this)\n}\n\nLRUCache.prototype.reset = function () {\n if (priv(this, 'dispose') &&\n priv(this, 'lruList') &&\n priv(this, 'lruList').length) {\n priv(this, 'lruList').forEach(function (hit) {\n priv(this, 'dispose').call(this, hit.key, hit.value)\n }, this)\n }\n\n priv(this, 'cache', new Map()) // hash of items by key\n priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n priv(this, 'length', 0) // length of items in the list\n}\n\nLRUCache.prototype.dump = function () {\n return priv(this, 'lruList').map(function (hit) {\n if (!isStale(this, hit)) {\n return {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }\n }\n }, this).toArray().filter(function (h) {\n return h\n })\n}\n\nLRUCache.prototype.dumpLru = function () {\n return priv(this, 'lruList')\n}\n\nLRUCache.prototype.inspect = function (n, opts) {\n var str = 'LRUCache {'\n var extras = false\n\n var as = priv(this, 'allowStale')\n if (as) {\n str += '\\n allowStale: true'\n extras = true\n }\n\n var max = priv(this, 'max')\n if (max && max !== Infinity) {\n if (extras) {\n str += ','\n }\n str += '\\n max: ' + util.inspect(max, opts)\n extras = true\n }\n\n var maxAge = priv(this, 'maxAge')\n if (maxAge) {\n if (extras) {\n str += ','\n }\n str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n extras = true\n }\n\n var lc = priv(this, 'lengthCalculator')\n if (lc && lc !== naiveLength) {\n if (extras) {\n str += ','\n }\n str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n extras = true\n }\n\n var didFirst = false\n priv(this, 'lruList').forEach(function (item) {\n if (didFirst) {\n str += ',\\n '\n } else {\n if (extras) {\n str += ',\\n'\n }\n didFirst = true\n str += '\\n '\n }\n var key = util.inspect(item.key).split('\\n').join('\\n ')\n var val = { value: item.value }\n if (item.maxAge !== maxAge) {\n val.maxAge = item.maxAge\n }\n if (lc !== naiveLength) {\n val.length = item.length\n }\n if (isStale(this, item)) {\n val.stale = true\n }\n\n val = util.inspect(val, opts).split('\\n').join('\\n ')\n str += key + ' => ' + val\n })\n\n if (didFirst || extras) {\n str += '\\n'\n }\n str += '}'\n\n return str\n}\n\nLRUCache.prototype.set = function (key, value, maxAge) {\n maxAge = maxAge || priv(this, 'maxAge')\n\n var now = maxAge ? Date.now() : 0\n var len = priv(this, 'lengthCalculator').call(this, value, key)\n\n if (priv(this, 'cache').has(key)) {\n if (len > priv(this, 'max')) {\n del(this, priv(this, 'cache').get(key))\n return false\n }\n\n var node = priv(this, 'cache').get(key)\n var item = node.value\n\n // dispose of the old one before overwriting\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, item.value)\n }\n\n item.now = now\n item.maxAge = maxAge\n item.value = value\n priv(this, 'length', priv(this, 'length') + (len - item.length))\n item.length = len\n this.get(key)\n trim(this)\n return true\n }\n\n var hit = new Entry(key, value, len, now, maxAge)\n\n // oversized objects fall out of cache automatically.\n if (hit.length > priv(this, 'max')) {\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, value)\n }\n return false\n }\n\n priv(this, 'length', priv(this, 'length') + hit.length)\n priv(this, 'lruList').unshift(hit)\n priv(this, 'cache').set(key, priv(this, 'lruList').head)\n trim(this)\n return true\n}\n\nLRUCache.prototype.has = function (key) {\n if (!priv(this, 'cache').has(key)) return false\n var hit = priv(this, 'cache').get(key).value\n if (isStale(this, hit)) {\n return false\n }\n return true\n}\n\nLRUCache.prototype.get = function (key) {\n return get(this, key, true)\n}\n\nLRUCache.prototype.peek = function (key) {\n return get(this, key, false)\n}\n\nLRUCache.prototype.pop = function () {\n var node = priv(this, 'lruList').tail\n if (!node) return null\n del(this, node)\n return node.value\n}\n\nLRUCache.prototype.del = function (key) {\n del(this, priv(this, 'cache').get(key))\n}\n\nLRUCache.prototype.load = function (arr) {\n // reset the cache\n this.reset()\n\n var now = Date.now()\n // A previous serialized cache has the most recent items first\n for (var l = arr.length - 1; l >= 0; l--) {\n var hit = arr[l]\n var expiresAt = hit.e || 0\n if (expiresAt === 0) {\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v)\n } else {\n var maxAge = expiresAt - now\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge)\n }\n }\n }\n}\n\nLRUCache.prototype.prune = function () {\n var self = this\n priv(this, 'cache').forEach(function (value, key) {\n get(self, key, false)\n })\n}\n\nfunction get (self, key, doUse) {\n var node = priv(self, 'cache').get(key)\n if (node) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) hit = undefined\n } else {\n if (doUse) {\n priv(self, 'lruList').unshiftNode(node)\n }\n }\n if (hit) hit = hit.value\n }\n return hit\n}\n\nfunction isStale (self, hit) {\n if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n return false\n }\n var stale = false\n var diff = Date.now() - hit.now\n if (hit.maxAge) {\n stale = diff > hit.maxAge\n } else {\n stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n }\n return stale\n}\n\nfunction trim (self) {\n if (priv(self, 'length') > priv(self, 'max')) {\n for (var walker = priv(self, 'lruList').tail;\n priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n var prev = walker.prev\n del(self, walker)\n walker = prev\n }\n }\n}\n\nfunction del (self, node) {\n if (node) {\n var hit = node.value\n if (priv(self, 'dispose')) {\n priv(self, 'dispose').call(this, hit.key, hit.value)\n }\n priv(self, 'length', priv(self, 'length') - hit.length)\n priv(self, 'cache').delete(hit.key)\n priv(self, 'lruList').removeNode(node)\n }\n}\n\n// classy, since V8 prefers predictable objects.\nfunction Entry (key, value, length, now, maxAge) {\n this.key = key\n this.value = value\n this.length = length\n this.now = now\n this.maxAge = maxAge || 0\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lru-cache/lib/lru-cache.js\n ** module id = 49\n ** module chunks = 0\n **/","if (process.env.npm_package_name === 'pseudomap' &&\n process.env.npm_lifecycle_script === 'test')\n process.env.TEST_PSEUDOMAP = 'true'\n\nif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n module.exports = Map\n} else {\n module.exports = require('./pseudomap')\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/map.js\n ** module id = 50\n ** module chunks = 0\n **/","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 51\n ** module chunks = 0\n **/","var hasOwnProperty = Object.prototype.hasOwnProperty\n\nmodule.exports = PseudoMap\n\nfunction PseudoMap (set) {\n if (!(this instanceof PseudoMap)) // whyyyyyyy\n throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\n this.clear()\n\n if (set) {\n if ((set instanceof PseudoMap) ||\n (typeof Map === 'function' && set instanceof Map))\n set.forEach(function (value, key) {\n this.set(key, value)\n }, this)\n else if (Array.isArray(set))\n set.forEach(function (kv) {\n this.set(kv[0], kv[1])\n }, this)\n else\n throw new TypeError('invalid argument')\n }\n}\n\nPseudoMap.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n Object.keys(this._data).forEach(function (k) {\n if (k !== 'size')\n fn.call(thisp, this._data[k].value, this._data[k].key)\n }, this)\n}\n\nPseudoMap.prototype.has = function (k) {\n return !!find(this._data, k)\n}\n\nPseudoMap.prototype.get = function (k) {\n var res = find(this._data, k)\n return res && res.value\n}\n\nPseudoMap.prototype.set = function (k, v) {\n set(this._data, k, v)\n}\n\nPseudoMap.prototype.delete = function (k) {\n var res = find(this._data, k)\n if (res) {\n delete this._data[res._index]\n this._data.size--\n }\n}\n\nPseudoMap.prototype.clear = function () {\n var data = Object.create(null)\n data.size = 0\n\n Object.defineProperty(this, '_data', {\n value: data,\n enumerable: false,\n configurable: true,\n writable: false\n })\n}\n\nObject.defineProperty(PseudoMap.prototype, 'size', {\n get: function () {\n return this._data.size\n },\n set: function (n) {},\n enumerable: true,\n configurable: true\n})\n\nPseudoMap.prototype.values =\nPseudoMap.prototype.keys =\nPseudoMap.prototype.entries = function () {\n throw new Error('iterators are not implemented in this version')\n}\n\n// Either identical, or both NaN\nfunction same (a, b) {\n return a === b || a !== a && b !== b\n}\n\nfunction Entry (k, v, i) {\n this.key = k\n this.value = v\n this._index = i\n}\n\nfunction find (data, k) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k))\n return data[key]\n }\n}\n\nfunction set (data, k, v) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k)) {\n data[key].value = v\n return\n }\n }\n data.size++\n data[key] = new Entry(k, v, key)\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/pseudomap.js\n ** module id = 52\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/util.js\n ** module id = 53\n ** module chunks = 0\n **/","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/support/isBufferBrowser.js\n ** module id = 54\n ** module chunks = 0\n **/","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/inherits/inherits_browser.js\n ** module id = 55\n ** module chunks = 0\n **/","module.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length --\n node.next = null\n node.prev = null\n node.list = null\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length ++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length ++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail)\n return undefined\n\n var res = this.tail.value\n this.tail = this.tail.prev\n this.tail.next = null\n this.length --\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head)\n return undefined\n\n var res = this.head.value\n this.head = this.head.next\n this.head.prev = null\n this.length --\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length ++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length ++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/yallist/yallist.js\n ** module id = 56\n ** module chunks = 0\n **/","import Tile from './Tile';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass ImageTile extends Tile {\n constructor(quadcode, path, layer) {\n super(quadcode, path, layer);\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n this._requestTile();\n }\n }, 0);\n }\n\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear image reference\n this._image = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n depthWrite: false\n });\n\n // var material = new THREE.MeshPhongMaterial({\n // depthWrite: false\n // });\n } else {\n // Other MeshStandardMaterial settings\n //\n // material.envMapIntensity will change the amount of colour reflected(?)\n // from the environment map – can be greater than 1 for more intensity\n\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var localMesh = new THREE.Mesh(geom, material);\n localMesh.rotation.x = -90 * Math.PI / 180;\n\n localMesh.receiveShadow = true;\n\n mesh.add(localMesh);\n mesh.renderOrder = 0.1;\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n // var box = new BoxHelper(localMesh);\n // mesh.add(box);\n //\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n var image = document.createElement('img');\n\n image.addEventListener('load', event => {\n var texture = new THREE.Texture();\n\n texture.image = image;\n texture.needsUpdate = true;\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n // Something went wrong and the tile or its material is missing\n //\n // Possibly removed by the cache before the image loaded\n if (!this._mesh || !this._mesh.children[0] || !this._mesh.children[0].material) {\n return;\n }\n\n this._mesh.children[0].material.map = texture;\n this._mesh.children[0].material.needsUpdate = true;\n\n this._texture = texture;\n this._ready = true;\n }, false);\n\n // image.addEventListener('progress', event => {}, false);\n // image.addEventListener('error', event => {}, false);\n\n image.crossOrigin = '';\n\n // Load image\n image.src = url;\n\n this._image = image;\n }\n\n _abortRequest() {\n if (!this._image) {\n return;\n }\n\n this._image.src = '';\n }\n}\n\nexport default ImageTile;\n\nvar noNew = function(quadcode, path, layer) {\n return new ImageTile(quadcode, path, layer);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTile.js\n **/","import {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Manages a single tile and its layers\n\nvar r2d = 180 / Math.PI;\n\nvar tileURLRegex = /\\{([szxy])\\}/g;\n\nclass Tile {\n constructor(quadcode, path, layer) {\n this._layer = layer;\n this._world = layer._world;\n this._quadcode = quadcode;\n this._path = path;\n\n this._ready = false;\n\n this._tile = this._quadcodeToTile(quadcode);\n\n // Bottom-left and top-right bounds in WGS84 coordinates\n this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\n // Bottom-left and top-right bounds in world coordinates\n this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\n // Tile center in world coordinates\n this._center = this._boundsToCenter(this._boundsWorld);\n\n // Tile center in projected coordinates\n this._centerLatlon = this._world.pointToLatLon(Point(this._center[0], this._center[1]));\n\n // Length of a tile side in world coorindates\n this._side = this._getSide(this._boundsWorld);\n\n // Point scale for tile (for unit conversion)\n this._pointScale = this._world.pointScale(this._centerLatlon);\n }\n\n // Returns true if the tile mesh and texture are ready to be used\n // Otherwise, returns false\n isReady() {\n return this._ready;\n }\n\n // Request data for the tile\n requestTileAsync() {}\n\n getQuadcode() {\n return this._quadcode;\n }\n\n getBounds() {\n return this._boundsWorld;\n }\n\n getCenter() {\n return this._center;\n }\n\n getSide() {\n return this._side;\n }\n\n getMesh() {\n return this._mesh;\n }\n\n getPickingMesh() {\n return this._pickingMesh;\n }\n\n // Destroys the tile and removes it from the layer and memory\n //\n // Ensure that this leaves no trace of the tile – no textures, no meshes,\n // nothing in memory or the GPU\n destroy() {\n // Delete reference to layer and world\n this._layer = null;\n this._world = null;\n\n // Delete location references\n this._boundsLatLon = null;\n this._boundsWorld = null;\n this._center = null;\n\n // Done if no mesh\n if (!this._mesh) {\n return;\n }\n\n if (this._mesh.children) {\n // Dispose of mesh and materials\n this._mesh.children.forEach(child => {\n child.geometry.dispose();\n child.geometry = null;\n\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n });\n } else {\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n }\n\n _createMesh() {}\n _createDebugMesh() {}\n\n _getTileURL(urlParams) {\n if (!urlParams.s) {\n // Default to a random choice of a, b or c\n urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n }\n\n tileURLRegex.lastIndex = 0;\n return this._path.replace(tileURLRegex, function(value, key) {\n // Replace with paramter, otherwise keep existing value\n return urlParams[key];\n });\n }\n\n // Convert from quadcode to TMS tile coordinates\n _quadcodeToTile(quadcode) {\n var x = 0;\n var y = 0;\n var z = quadcode.length;\n\n for (var i = z; i > 0; i--) {\n var mask = 1 << (i - 1);\n var q = +quadcode[z - i];\n if (q === 1) {\n x |= mask;\n }\n if (q === 2) {\n y |= mask;\n }\n if (q === 3) {\n x |= mask;\n y |= mask;\n }\n }\n\n return [x, y, z];\n }\n\n // Convert WGS84 tile bounds to world coordinates\n _tileBoundsFromWGS84(boundsWGS84) {\n var sw = this._layer._world.latLonToPoint(LatLon(boundsWGS84[1], boundsWGS84[0]));\n var ne = this._layer._world.latLonToPoint(LatLon(boundsWGS84[3], boundsWGS84[2]));\n\n return [sw.x, sw.y, ne.x, ne.y];\n }\n\n // Get tile bounds in WGS84 coordinates\n _tileBoundsWGS84(tile) {\n var e = this._tile2lon(tile[0] + 1, tile[2]);\n var w = this._tile2lon(tile[0], tile[2]);\n var s = this._tile2lat(tile[1] + 1, tile[2]);\n var n = this._tile2lat(tile[1], tile[2]);\n return [w, s, e, n];\n }\n\n _tile2lon(x, z) {\n return x / Math.pow(2, z) * 360 - 180;\n }\n\n _tile2lat(y, z) {\n var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n }\n\n _boundsToCenter(bounds) {\n var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\n return [x, y];\n }\n\n _getSide(bounds) {\n return (new THREE.Vector3(bounds[0], 0, bounds[3])).sub(new THREE.Vector3(bounds[0], 0, bounds[1])).length();\n }\n}\n\nexport default Tile;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/Tile.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\nimport THREE from 'three';\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nBoxHelper = function ( object ) {\n\n\tvar indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\tvar positions = new Float32Array( 8 * 3 );\n\n\tvar geometry = new THREE.BufferGeometry();\n\tgeometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );\n\n\tTHREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { linewidth: 2, color: 0xff0000 } ) );\n\n\tif ( object !== undefined ) {\n\n\t\tthis.update( object );\n\n\t}\n\n};\n\nBoxHelper.prototype = Object.create( THREE.LineSegments.prototype );\nBoxHelper.prototype.constructor = BoxHelper;\n\nBoxHelper.prototype.update = ( function () {\n\n\tvar box = new THREE.Box3();\n\n\treturn function ( object ) {\n\n\t\tbox.setFromObject( object );\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tvar min = box.min;\n\t\tvar max = box.max;\n\n\t\t/*\n\t\t 5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tvar position = this.geometry.attributes.position;\n\t\tvar array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t};\n\n} )();\n\nexport default BoxHelper;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/BoxHelper.js\n **/","import THREE from 'three';\n\nexport default function(colour, skyboxTarget) {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n\n var context = canvas.getContext('2d');\n context.fillStyle = colour;\n context.fillRect(0, 0, canvas.width, canvas.height);\n // context.strokeStyle = '#D0D0CF';\n // context.strokeRect(0, 0, canvas.width, canvas.height);\n\n var texture = new THREE.Texture(canvas);\n\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n // //\n // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n\n // texture.wrapS = THREE.RepeatWrapping;\n // texture.wrapT = THREE.RepeatWrapping;\n // texture.repeat.set(segments, segments);\n\n texture.needsUpdate = true;\n\n var material;\n\n if (!skyboxTarget) {\n material = new THREE.MeshBasicMaterial({\n map: texture,\n depthWrite: false\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = skyboxTarget;\n }\n\n return material;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayerBaseMaterial.js\n **/","import TileLayer from './TileLayer';\nimport extend from 'lodash.assign';\nimport GeoJSONTile from './GeoJSONTile';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\n\n// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n// tile grid using geojson-vt\n//\n// See: https://github.com/mapbox/geojson-vt\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider pausing per-frame output during movement so there's little to\n// no jank caused by previous tiles still processing\n\n// This tile layer only updates the quadtree after world movement has occurred\n//\n// Tiles from previous quadtree updates are updated and outputted every frame\n// (or at least every frame, throttled to some amount)\n//\n// This is because the complexity of TopoJSON tiles requires a lot of processing\n// and so makes movement janky if updates occur every frame – only updating\n// after movement means frame drops are less obvious due to heavy processing\n// occurring while the view is generally stationary\n//\n// The downside is that until new tiles are requested and outputted you will\n// see blank spaces as you orbit and move around\n//\n// An added benefit is that it dramatically reduces the number of tiles being\n// requested over a period of time and the time it takes to go from request to\n// screen output\n//\n// It may be possible to perform these updates per-frame once Web Worker\n// processing is added\n\nclass GeoJSONTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n maxLOD: 14,\n distance: 2000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n this._world.on('controlsMove', this._onControlsMove, this);\n }\n\n // Update and output tiles each frame (throttled)\n _onWorldUpdate() {\n if (this._pauseOutput) {\n return;\n }\n\n this._outputTiles();\n }\n\n // Update tiles grid after world move, but don't output them\n _onWorldMove(latlon, point) {\n this._pauseOutput = false;\n this._calculateLOD();\n }\n\n // Pause updates during control movement for less visual jank\n _onControlsMove() {\n this._pauseOutput = true;\n }\n\n _createTile(quadcode, layer) {\n var options = {};\n\n if (this._options.filter) {\n options.filter = this._options.filter;\n }\n\n if (this._options.style) {\n options.style = this._options.style;\n }\n\n if (this._options.topojson) {\n options.topojson = true;\n }\n\n if (this._options.picking) {\n options.picking = true;\n }\n\n if (this._options.onClick) {\n options.onClick = this._options.onClick;\n }\n\n return new GeoJSONTile(quadcode, this._path, layer, options);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new GeoJSONTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTileLayer.js\n **/","import Tile from './Tile';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\nimport reqwest from 'reqwest';\nimport {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport extend from 'lodash.assign';\n// import Offset from 'polygon-offset';\nimport GeoJSON from '../../util/GeoJSON';\nimport Buffer from '../../util/Buffer';\nimport PickingMaterial from '../../engine/PickingMaterial';\n\n// TODO: Look into using a GeoJSONLayer to represent and output the tile data\n// instead of duplicating a lot of effort within this class\n\n// TODO: Map picking IDs to some reference within the tile data / geometry so\n// that something useful can be done when an object is picked / clicked on\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Perform tile request and processing in a Web Worker\n//\n// Use Operative (https://github.com/padolsey/operative)\n//\n// Would it make sense to have the worker functionality defined in a static\n// method so it only gets initialised once and not on every tile instance?\n//\n// Otherwise, worker processing logic would have to go in the tile layer so not\n// to waste loads of time setting up a brand new worker with three.js for each\n// tile every single time.\n//\n// Unsure of the best way to get three.js and VIZI into the worker\n//\n// Would need to set up a CRS / projection identical to the world instance\n//\n// Is it possible to bypass requirements on external script by having multiple\n// simple worker methods that each take enough inputs to perform a single task\n// without requiring VIZI or three.js? So long as the heaviest logic is done in\n// the worker and transferrable objects are used then it should be better than\n// nothing. Would probably still need things like earcut...\n//\n// After all, the three.js logic and object creation will still need to be\n// done on the main thread regardless so the worker should try to do as much as\n// possible with as few dependencies as possible.\n//\n// Have a look at how this is done in Tangram before implementing anything as\n// the approach there is pretty similar and robust.\n\nclass GeoJSONTile extends Tile {\n constructor(quadcode, path, layer, options) {\n super(quadcode, path, layer);\n\n this._defaultStyle = GeoJSON.defaultStyle;\n\n var defaults = {\n picking: false,\n topojson: false,\n filter: null,\n onClick: null,\n style: this._defaultStyle\n };\n\n this._options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n this._options.style = options.style;\n } else {\n this._options.style = extend({}, defaults.style, options.style);\n }\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n\n if (this._options.picking) {\n this._pickingMesh = this._createPickingMesh();\n }\n\n // this._shadowCanvas = this._createShadowCanvas();\n\n this._requestTile();\n }\n }, 0);\n }\n\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n //\n // var material = new THREE.MeshBasicMaterial({\n // depthWrite: false\n // });\n //\n // var localMesh = new THREE.Mesh(geom, material);\n // localMesh.rotation.x = -90 * Math.PI / 180;\n //\n // mesh.add(localMesh);\n //\n // var box = new BoxHelper(localMesh);\n // mesh.add(box);\n //\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createPickingMesh() {\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n _createShadowCanvas() {\n var canvas = document.createElement('canvas');\n\n // Rendered at a low resolution and later scaled up for a low-quality blur\n canvas.width = 512;\n canvas.height = 512;\n\n return canvas;\n }\n\n // _addShadow(coordinates) {\n // var ctx = this._shadowCanvas.getContext('2d');\n // var width = this._shadowCanvas.width;\n // var height = this._shadowCanvas.height;\n //\n // var _coords;\n // var _offset;\n // var offset = new Offset();\n //\n // // Transform coordinates to shadowCanvas space and draw on canvas\n // coordinates.forEach((ring, index) => {\n // ctx.beginPath();\n //\n // _coords = ring.map(coord => {\n // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n // return [xFrac * width, yFrac * height];\n // });\n //\n // if (index > 0) {\n // _offset = _coords;\n // } else {\n // _offset = offset.data(_coords).padding(1.3);\n // }\n //\n // // TODO: This is super flaky and crashes the browser if run on anything\n // // put the outer ring (potentially due to winding)\n // _offset.forEach((coord, index) => {\n // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n //\n // if (index === 0) {\n // ctx.moveTo(coord[0], coord[1]);\n // } else {\n // ctx.lineTo(coord[0], coord[1]);\n // }\n // });\n //\n // ctx.closePath();\n // });\n //\n // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n // ctx.fill();\n // }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processTileData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n _processTileData(data) {\n console.time(this._tile);\n\n var geojson = GeoJSON.mergeFeatures(data, this._options.topojson);\n\n // TODO: Check that GeoJSON is valid / usable\n\n var features = geojson.features;\n\n // Run filter, if provided\n if (this._options.filter) {\n features = geojson.features.filter(this._options.filter);\n }\n\n var style = this._options.style;\n\n var offset = Point(0, 0);\n offset.x = -1 * this._center[0];\n offset.y = -1 * this._center[1];\n\n // TODO: Wrap into a helper method so this isn't duplicated in the non-tiled\n // GeoJSON output layer\n //\n // Need to be careful as to not make it impossible to fork this off into a\n // worker script at a later stage\n //\n // Also unsure as to whether it's wise to lump so much into a black box\n //\n // var meshes = GeoJSON.createMeshes(features, offset, style);\n\n var polygons = {\n vertices: [],\n faces: [],\n colours: [],\n facesCount: 0,\n allFlat: true\n };\n\n var lines = {\n vertices: [],\n colours: [],\n verticesCount: 0\n };\n\n if (this._options.picking) {\n polygons.pickingIds = [];\n lines.pickingIds = [];\n }\n\n var colour = new THREE.Color();\n\n features.forEach(feature => {\n // feature.geometry, feature.properties\n\n // Skip features that aren't supported\n //\n // TODO: Add support for all GeoJSON geometry types, including Multi...\n // geometry types\n if (\n feature.geometry.type !== 'Polygon' &&\n feature.geometry.type !== 'LineString' &&\n feature.geometry.type !== 'MultiLineString'\n ) {\n return;\n }\n\n // Get style object, if provided\n if (typeof this._options.style === 'function') {\n style = extend({}, this._defaultStyle, this._options.style(feature));\n }\n\n var coordinates = feature.geometry.coordinates;\n\n // if (feature.geometry.type === 'LineString') {\n if (feature.geometry.type === 'LineString') {\n colour.set(style.lineColor);\n\n coordinates = coordinates.map(coordinate => {\n var latlon = LatLon(coordinate[1], coordinate[0]);\n var point = this._layer._world.latLonToPoint(latlon);\n return [point.x, point.y];\n });\n\n var height = 0;\n\n if (style.lineHeight) {\n height = this._world.metresToWorld(style.lineHeight, this._pointScale);\n }\n\n var linestringAttributes = GeoJSON.lineStringAttributes(coordinates, colour, height);\n\n lines.vertices.push(linestringAttributes.vertices);\n lines.colours.push(linestringAttributes.colours);\n\n if (this._options.picking) {\n var pickingId = this._layer.getPickingId();\n\n // Inject picking ID\n //\n // TODO: Perhaps handle this within the GeoJSON helper\n lines.pickingIds.push(pickingId);\n\n if (this._options.onClick) {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + pickingId, (point2d, point3d, intersects) => {\n this._options.onClick(feature, point2d, point3d, intersects);\n });\n }\n }\n\n lines.verticesCount += linestringAttributes.vertices.length;\n }\n\n if (feature.geometry.type === 'MultiLineString') {\n colour.set(style.lineColor);\n\n coordinates = coordinates.map(_coordinates => {\n return _coordinates.map(coordinate => {\n var latlon = LatLon(coordinate[1], coordinate[0]);\n var point = this._layer._world.latLonToPoint(latlon);\n return [point.x, point.y];\n });\n });\n\n var height = 0;\n\n if (style.lineHeight) {\n height = this._world.metresToWorld(style.lineHeight, this._pointScale);\n }\n\n var multiLinestringAttributes = GeoJSON.multiLineStringAttributes(coordinates, colour, height);\n\n lines.vertices.push(multiLinestringAttributes.vertices);\n lines.colours.push(multiLinestringAttributes.colours);\n\n if (this._options.picking) {\n var pickingId = this._layer.getPickingId();\n\n // Inject picking ID\n //\n // TODO: Perhaps handle this within the GeoJSON helper\n lines.pickingIds.push(pickingId);\n\n if (this._options.onClick) {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + pickingId, (point2d, point3d, intersects) => {\n this._options.onClick(feature, point2d, point3d, intersects);\n });\n }\n }\n\n lines.verticesCount += multiLinestringAttributes.vertices.length;\n }\n\n if (feature.geometry.type === 'Polygon') {\n colour.set(style.color);\n\n coordinates = coordinates.map(ring => {\n return ring.map(coordinate => {\n var latlon = LatLon(coordinate[1], coordinate[0]);\n var point = this._layer._world.latLonToPoint(latlon);\n return [point.x, point.y];\n });\n });\n\n var height = 0;\n\n if (style.height) {\n height = this._world.metresToWorld(style.height, this._pointScale);\n }\n\n // Draw footprint on shadow canvas\n //\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n // this._addShadow(coordinates);\n\n var polygonAttributes = GeoJSON.polygonAttributes(coordinates, colour, height);\n\n polygons.vertices.push(polygonAttributes.vertices);\n polygons.faces.push(polygonAttributes.faces);\n polygons.colours.push(polygonAttributes.colours);\n\n if (this._options.picking) {\n var pickingId = this._layer.getPickingId();\n\n // Inject picking ID\n //\n // TODO: Perhaps handle this within the GeoJSON helper\n polygons.pickingIds.push(pickingId);\n\n if (this._options.onClick) {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + pickingId, (point2d, point3d, intersects) => {\n this._options.onClick(feature, point2d, point3d, intersects);\n });\n }\n }\n\n if (polygons.allFlat && !polygonAttributes.flat) {\n polygons.allFlat = false;\n }\n\n polygons.facesCount += polygonAttributes.faces.length;\n }\n });\n\n // Output shadow canvas\n //\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n\n // var texture = new THREE.Texture(this._shadowCanvas);\n //\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n //\n // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n //\n // texture.needsUpdate = true;\n //\n // var material;\n // if (!this._world._environment._skybox) {\n // material = new THREE.MeshBasicMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // } else {\n // material = new THREE.MeshStandardMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // material.roughness = 1;\n // material.metalness = 0.1;\n // material.envMap = this._world._environment._skybox.getRenderTarget();\n // }\n //\n // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n // var mesh = new THREE.Mesh(geom, material);\n //\n // mesh.castShadow = false;\n // mesh.receiveShadow = false;\n // mesh.renderOrder = 1;\n //\n // mesh.rotation.x = -90 * Math.PI / 180;\n //\n // this._mesh.add(mesh);\n\n var geometry;\n var material;\n var mesh;\n\n // Output lines\n if (lines.vertices.length > 0) {\n geometry = Buffer.createLineGeometry(lines, offset);\n\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n\n mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n // TODO: Can a line cast a shadow?\n // mesh.castShadow = true;\n\n this._mesh.add(mesh);\n\n if (this._options.picking) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n }\n\n // Output polygons\n if (polygons.facesCount > 0) {\n geometry = Buffer.createGeometry(polygons, offset);\n\n if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n\n if (polygons.allFlat) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n this._mesh.add(mesh);\n\n if (this._options.picking) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n }\n\n this._ready = true;\n console.timeEnd(this._tile);\n console.log(`${this._tile}: ${features.length} features`);\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n}\n\nexport default GeoJSONTile;\n\nvar noNew = function(quadcode, path, layer, options) {\n return new GeoJSONTile(quadcode, path, layer, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTile.js\n **/","/*!\n * Reqwest! A general purpose XHR connection manager\n * license MIT (c) Dustin Diaz 2015\n * https://github.com/ded/reqwest\n */\n\n!function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else context[name] = definition()\n}('reqwest', this, function () {\n\n var context = this\n\n if ('window' in context) {\n var doc = document\n , byTag = 'getElementsByTagName'\n , head = doc[byTag]('head')[0]\n } else {\n var XHR2\n try {\n XHR2 = require('xhr2')\n } catch (ex) {\n throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n }\n }\n\n\n var httpsRe = /^http/\n , protocolRe = /(^\\w+):\\/\\//\n , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n , readyState = 'readyState'\n , contentType = 'Content-Type'\n , requestedWith = 'X-Requested-With'\n , uniqid = 0\n , callbackPrefix = 'reqwest_' + (+new Date())\n , lastValue // data stored by the most recent JSONP callback\n , xmlHttpRequest = 'XMLHttpRequest'\n , xDomainRequest = 'XDomainRequest'\n , noop = function () {}\n\n , isArray = typeof Array.isArray == 'function'\n ? Array.isArray\n : function (a) {\n return a instanceof Array\n }\n\n , defaultHeaders = {\n 'contentType': 'application/x-www-form-urlencoded'\n , 'requestedWith': xmlHttpRequest\n , 'accept': {\n '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n , 'xml': 'application/xml, text/xml'\n , 'html': 'text/html'\n , 'text': 'text/plain'\n , 'json': 'application/json, text/javascript'\n , 'js': 'application/javascript, text/javascript'\n }\n }\n\n , xhr = function(o) {\n // is it x-domain\n if (o['crossOrigin'] === true) {\n var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n if (xhr && 'withCredentials' in xhr) {\n return xhr\n } else if (context[xDomainRequest]) {\n return new XDomainRequest()\n } else {\n throw new Error('Browser does not support cross-origin requests')\n }\n } else if (context[xmlHttpRequest]) {\n return new XMLHttpRequest()\n } else if (XHR2) {\n return new XHR2()\n } else {\n return new ActiveXObject('Microsoft.XMLHTTP')\n }\n }\n , globalSetupOptions = {\n dataFilter: function (data) {\n return data\n }\n }\n\n function succeed(r) {\n var protocol = protocolRe.exec(r.url)\n protocol = (protocol && protocol[1]) || context.location.protocol\n return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n }\n\n function handleReadyState(r, success, error) {\n return function () {\n // use _aborted to mitigate against IE err c00c023f\n // (can't read props on aborted request objects)\n if (r._aborted) return error(r.request)\n if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n if (r.request && r.request[readyState] == 4) {\n r.request.onreadystatechange = noop\n if (succeed(r)) success(r.request)\n else\n error(r.request)\n }\n }\n }\n\n function setHeaders(http, o) {\n var headers = o['headers'] || {}\n , h\n\n headers['Accept'] = headers['Accept']\n || defaultHeaders['accept'][o['type']]\n || defaultHeaders['accept']['*']\n\n var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n // breaks cross-origin requests with legacy browsers\n if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n for (h in headers)\n headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n }\n\n function setCredentials(http, o) {\n if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n http.withCredentials = !!o['withCredentials']\n }\n }\n\n function generalCallback(data) {\n lastValue = data\n }\n\n function urlappend (url, s) {\n return url + (/\\?/.test(url) ? '&' : '?') + s\n }\n\n function handleJsonp(o, fn, err, url) {\n var reqId = uniqid++\n , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n , match = url.match(cbreg)\n , script = doc.createElement('script')\n , loaded = 0\n , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\n if (match) {\n if (match[3] === '?') {\n url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n } else {\n cbval = match[3] // provided callback func name\n }\n } else {\n url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n }\n\n context[cbval] = generalCallback\n\n script.type = 'text/javascript'\n script.src = url\n script.async = true\n if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n // need this for IE due to out-of-order onreadystatechange(), binding script\n // execution to an event listener gives us control over when the script\n // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n script.htmlFor = script.id = '_reqwest_' + reqId\n }\n\n script.onload = script.onreadystatechange = function () {\n if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n return false\n }\n script.onload = script.onreadystatechange = null\n script.onclick && script.onclick()\n // Call the user callback with the last value stored and clean up values and scripts.\n fn(lastValue)\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n\n // Add the script to the DOM head\n head.appendChild(script)\n\n // Enable JSONP timeout\n return {\n abort: function () {\n script.onload = script.onreadystatechange = null\n err({}, 'Request is aborted: timeout', {})\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n }\n }\n\n function getRequest(fn, err) {\n var o = this.o\n , method = (o['method'] || 'GET').toUpperCase()\n , url = typeof o === 'string' ? o : o['url']\n // convert non-string objects to query-string form unless o['processData'] is false\n , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n ? reqwest.toQueryString(o['data'])\n : (o['data'] || null)\n , http\n , sendWait = false\n\n // if we're working on a GET request and we have data then we should append\n // query string to end of URL and not post data\n if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n url = urlappend(url, data)\n data = null\n }\n\n if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\n // get the xhr from the factory if passed\n // if the factory returns null, fall-back to ours\n http = (o.xhr && o.xhr(o)) || xhr(o)\n\n http.open(method, url, o['async'] === false ? false : true)\n setHeaders(http, o)\n setCredentials(http, o)\n if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n http.onload = fn\n http.onerror = err\n // NOTE: see\n // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n http.onprogress = function() {}\n sendWait = true\n } else {\n http.onreadystatechange = handleReadyState(this, fn, err)\n }\n o['before'] && o['before'](http)\n if (sendWait) {\n setTimeout(function () {\n http.send(data)\n }, 200)\n } else {\n http.send(data)\n }\n return http\n }\n\n function Reqwest(o, fn) {\n this.o = o\n this.fn = fn\n\n init.apply(this, arguments)\n }\n\n function setType(header) {\n // json, javascript, text/plain, text/html, xml\n if (header === null) return undefined; //In case of no content-type.\n if (header.match('json')) return 'json'\n if (header.match('javascript')) return 'js'\n if (header.match('text')) return 'html'\n if (header.match('xml')) return 'xml'\n }\n\n function init(o, fn) {\n\n this.url = typeof o == 'string' ? o : o['url']\n this.timeout = null\n\n // whether request has been fulfilled for purpose\n // of tracking the Promises\n this._fulfilled = false\n // success handlers\n this._successHandler = function(){}\n this._fulfillmentHandlers = []\n // error handlers\n this._errorHandlers = []\n // complete (both success and fail) handlers\n this._completeHandlers = []\n this._erred = false\n this._responseArgs = {}\n\n var self = this\n\n fn = fn || function () {}\n\n if (o['timeout']) {\n this.timeout = setTimeout(function () {\n timedOut()\n }, o['timeout'])\n }\n\n if (o['success']) {\n this._successHandler = function () {\n o['success'].apply(o, arguments)\n }\n }\n\n if (o['error']) {\n this._errorHandlers.push(function () {\n o['error'].apply(o, arguments)\n })\n }\n\n if (o['complete']) {\n this._completeHandlers.push(function () {\n o['complete'].apply(o, arguments)\n })\n }\n\n function complete (resp) {\n o['timeout'] && clearTimeout(self.timeout)\n self.timeout = null\n while (self._completeHandlers.length > 0) {\n self._completeHandlers.shift()(resp)\n }\n }\n\n function success (resp) {\n var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n resp = (type !== 'jsonp') ? self.request : resp\n // use global data filter on response text\n var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n , r = filteredResponse\n try {\n resp.responseText = r\n } catch (e) {\n // can't assign this in IE<=8, just ignore\n }\n if (r) {\n switch (type) {\n case 'json':\n try {\n resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n } catch (err) {\n return error(resp, 'Could not parse JSON in response', err)\n }\n break\n case 'js':\n resp = eval(r)\n break\n case 'html':\n resp = r\n break\n case 'xml':\n resp = resp.responseXML\n && resp.responseXML.parseError // IE trololo\n && resp.responseXML.parseError.errorCode\n && resp.responseXML.parseError.reason\n ? null\n : resp.responseXML\n break\n }\n }\n\n self._responseArgs.resp = resp\n self._fulfilled = true\n fn(resp)\n self._successHandler(resp)\n while (self._fulfillmentHandlers.length > 0) {\n resp = self._fulfillmentHandlers.shift()(resp)\n }\n\n complete(resp)\n }\n\n function timedOut() {\n self._timedOut = true\n self.request.abort()\n }\n\n function error(resp, msg, t) {\n resp = self.request\n self._responseArgs.resp = resp\n self._responseArgs.msg = msg\n self._responseArgs.t = t\n self._erred = true\n while (self._errorHandlers.length > 0) {\n self._errorHandlers.shift()(resp, msg, t)\n }\n complete(resp)\n }\n\n this.request = getRequest.call(this, success, error)\n }\n\n Reqwest.prototype = {\n abort: function () {\n this._aborted = true\n this.request.abort()\n }\n\n , retry: function () {\n init.call(this, this.o, this.fn)\n }\n\n /**\n * Small deviation from the Promises A CommonJs specification\n * http://wiki.commonjs.org/wiki/Promises/A\n */\n\n /**\n * `then` will execute upon successful requests\n */\n , then: function (success, fail) {\n success = success || function () {}\n fail = fail || function () {}\n if (this._fulfilled) {\n this._responseArgs.resp = success(this._responseArgs.resp)\n } else if (this._erred) {\n fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._fulfillmentHandlers.push(success)\n this._errorHandlers.push(fail)\n }\n return this\n }\n\n /**\n * `always` will execute whether the request succeeds or fails\n */\n , always: function (fn) {\n if (this._fulfilled || this._erred) {\n fn(this._responseArgs.resp)\n } else {\n this._completeHandlers.push(fn)\n }\n return this\n }\n\n /**\n * `fail` will execute when the request fails\n */\n , fail: function (fn) {\n if (this._erred) {\n fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._errorHandlers.push(fn)\n }\n return this\n }\n , 'catch': function (fn) {\n return this.fail(fn)\n }\n }\n\n function reqwest(o, fn) {\n return new Reqwest(o, fn)\n }\n\n // normalize newline variants according to spec -> CRLF\n function normalize(s) {\n return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n }\n\n function serial(el, cb) {\n var n = el.name\n , t = el.tagName.toLowerCase()\n , optCb = function (o) {\n // IE gives value=\"\" even where there is no value attribute\n // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n if (o && !o['disabled'])\n cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n }\n , ch, ra, val, i\n\n // don't serialize elements that are disabled or without a name\n if (el.disabled || !n) return\n\n switch (t) {\n case 'input':\n if (!/reset|button|image|file/i.test(el.type)) {\n ch = /checkbox/i.test(el.type)\n ra = /radio/i.test(el.type)\n val = el.value\n // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n }\n break\n case 'textarea':\n cb(n, normalize(el.value))\n break\n case 'select':\n if (el.type.toLowerCase() === 'select-one') {\n optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n } else {\n for (i = 0; el.length && i < el.length; i++) {\n el.options[i].selected && optCb(el.options[i])\n }\n }\n break\n }\n }\n\n // collect up all form elements found from the passed argument elements all\n // the way down to child elements; pass a '' or form fields.\n // called with 'this'=callback to use for serial() on each element\n function eachFormElement() {\n var cb = this\n , e, i\n , serializeSubtags = function (e, tags) {\n var i, j, fa\n for (i = 0; i < tags.length; i++) {\n fa = e[byTag](tags[i])\n for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n }\n }\n\n for (i = 0; i < arguments.length; i++) {\n e = arguments[i]\n if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n }\n }\n\n // standard query string style serialization\n function serializeQueryString() {\n return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n }\n\n // { 'name': 'value', ... } style serialization\n function serializeHash() {\n var hash = {}\n eachFormElement.apply(function (name, value) {\n if (name in hash) {\n hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n hash[name].push(value)\n } else hash[name] = value\n }, arguments)\n return hash\n }\n\n // [ { name: 'name', value: 'value' }, ... ] style serialization\n reqwest.serializeArray = function () {\n var arr = []\n eachFormElement.apply(function (name, value) {\n arr.push({name: name, value: value})\n }, arguments)\n return arr\n }\n\n reqwest.serialize = function () {\n if (arguments.length === 0) return ''\n var opt, fn\n , args = Array.prototype.slice.call(arguments, 0)\n\n opt = args.pop()\n opt && opt.nodeType && args.push(opt) && (opt = null)\n opt && (opt = opt.type)\n\n if (opt == 'map') fn = serializeHash\n else if (opt == 'array') fn = reqwest.serializeArray\n else fn = serializeQueryString\n\n return fn.apply(null, args)\n }\n\n reqwest.toQueryString = function (o, trad) {\n var prefix, i\n , traditional = trad || false\n , s = []\n , enc = encodeURIComponent\n , add = function (key, value) {\n // If value is a function, invoke it and return its value\n value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n s[s.length] = enc(key) + '=' + enc(value)\n }\n // If an array was passed in, assume that it is an array of form elements.\n if (isArray(o)) {\n for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n } else {\n // If traditional, encode the \"old\" way (the way 1.3.2 or older\n // did it), otherwise encode params recursively.\n for (prefix in o) {\n if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n }\n }\n\n // spaces should be + according to spec\n return s.join('&').replace(/%20/g, '+')\n }\n\n function buildParams(prefix, obj, traditional, add) {\n var name, i, v\n , rbracket = /\\[\\]$/\n\n if (isArray(obj)) {\n // Serialize array item.\n for (i = 0; obj && i < obj.length; i++) {\n v = obj[i]\n if (traditional || rbracket.test(prefix)) {\n // Treat each array item as a scalar.\n add(prefix, v)\n } else {\n buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n }\n }\n } else if (obj && obj.toString() === '[object Object]') {\n // Serialize object item.\n for (name in obj) {\n buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n }\n\n } else {\n // Serialize scalar item.\n add(prefix, obj)\n }\n }\n\n reqwest.getcallbackPrefix = function () {\n return callbackPrefix\n }\n\n // jQuery and Zepto compatibility, differences can be remapped here so you can call\n // .ajax.compat(options, callback)\n reqwest.compat = function (o, fn) {\n if (o) {\n o['type'] && (o['method'] = o['type']) && delete o['type']\n o['dataType'] && (o['type'] = o['dataType'])\n o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n }\n return new Reqwest(o, fn)\n }\n\n reqwest.ajaxSetup = function (options) {\n options = options || {}\n for (var k in options) {\n globalSetupOptions[k] = options[k]\n }\n }\n\n return reqwest\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/reqwest/reqwest.js\n ** module id = 63\n ** module chunks = 0\n **/","/*\n * GeoJSON helpers for handling data and generating objects\n */\n\nimport THREE from 'three';\nimport topojson from 'topojson';\nimport geojsonMerge from 'geojson-merge';\n\n// TODO: Make it so height can be per-coordinate / point but connected together\n// as a linestring (eg. GPS points with an elevation at each point)\n//\n// This isn't really valid GeoJSON so perhaps something best left to an external\n// component for now, until a better approach can be considered\n//\n// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\n// Light and dark colours used for poor-mans AO gradient on object sides\nvar light = new THREE.Color(0xffffff);\nvar shadow = new THREE.Color(0x666666);\n\nvar GeoJSON = (function() {\n var defaultStyle = {\n color: '#ffffff',\n height: 0,\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n };\n\n // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n // into a single FeatureCollection\n var collectFeatures = function(data, _topojson) {\n var collections = [];\n\n if (_topojson) {\n // TODO: Allow TopoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var tk in data.objects) {\n collections.push(topojson.feature(data, data.objects[tk]));\n }\n\n return geojsonMerge(collections);\n } else {\n // If root doesn't have a type then let's see if there are features in the\n // next step down\n if (!data.type) {\n // TODO: Allow GeoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var gk in data) {\n if (!data[gk].type) {\n continue;\n }\n\n collections.push(data[gk]);\n }\n\n return geojsonMerge(collections);\n } else if (Array.isArray(data)) {\n return geojsonMerge(data);\n } else {\n return data;\n }\n }\n };\n\n return {\n defaultStyle: defaultStyle,\n collectFeatures: collectFeatures\n };\n})();\n\nexport default GeoJSON;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/GeoJSON.js\n **/","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.topojson = {})));\n}(this, function (exports) { 'use strict';\n\n function noop() {}\n\n function absolute(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n point[0] = (x0 += point[0]) * kx + dx;\n point[1] = (y0 += point[1]) * ky + dy;\n };\n }\n\n function relative(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n var x1 = (point[0] - dx) / kx | 0,\n y1 = (point[1] - dy) / ky | 0;\n point[0] = x1 - x0;\n point[1] = y1 - y0;\n x0 = x1;\n y0 = y1;\n };\n }\n\n function reverse(array, n) {\n var t, j = array.length, i = j - n;\n while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n }\n\n function bisect(a, x) {\n var lo = 0, hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (a[mid] < x) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function feature(topology, o) {\n return o.type === \"GeometryCollection\" ? {\n type: \"FeatureCollection\",\n features: o.geometries.map(function(o) { return feature$1(topology, o); })\n } : feature$1(topology, o);\n }\n\n function feature$1(topology, o) {\n var f = {\n type: \"Feature\",\n id: o.id,\n properties: o.properties || {},\n geometry: object(topology, o)\n };\n if (o.id == null) delete f.id;\n return f;\n }\n\n function object(topology, o) {\n var absolute$$ = absolute(topology.transform),\n arcs = topology.arcs;\n\n function arc(i, points) {\n if (points.length) points.pop();\n for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n points.push(p = a[k].slice());\n absolute$$(p, k);\n }\n if (i < 0) reverse(points, n);\n }\n\n function point(p) {\n p = p.slice();\n absolute$$(p, 0);\n return p;\n }\n\n function line(arcs) {\n var points = [];\n for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n if (points.length < 2) points.push(points[0].slice());\n return points;\n }\n\n function ring(arcs) {\n var points = line(arcs);\n while (points.length < 4) points.push(points[0].slice());\n return points;\n }\n\n function polygon(arcs) {\n return arcs.map(ring);\n }\n\n function geometry(o) {\n var t = o.type;\n return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n : null;\n }\n\n var geometryType = {\n Point: function(o) { return point(o.coordinates); },\n MultiPoint: function(o) { return o.coordinates.map(point); },\n LineString: function(o) { return line(o.arcs); },\n MultiLineString: function(o) { return o.arcs.map(line); },\n Polygon: function(o) { return polygon(o.arcs); },\n MultiPolygon: function(o) { return o.arcs.map(polygon); }\n };\n\n return geometry(o);\n }\n\n function stitchArcs(topology, arcs) {\n var stitchedArcs = {},\n fragmentByStart = {},\n fragmentByEnd = {},\n fragments = [],\n emptyIndex = -1;\n\n // Stitch empty arcs first, since they may be subsumed by other arcs.\n arcs.forEach(function(i, j) {\n var arc = topology.arcs[i < 0 ? ~i : i], t;\n if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n }\n });\n\n arcs.forEach(function(i) {\n var e = ends(i),\n start = e[0],\n end = e[1],\n f, g;\n\n if (f = fragmentByEnd[start]) {\n delete fragmentByEnd[f.end];\n f.push(i);\n f.end = end;\n if (g = fragmentByStart[end]) {\n delete fragmentByStart[g.start];\n var fg = g === f ? f : f.concat(g);\n fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else if (f = fragmentByStart[end]) {\n delete fragmentByStart[f.start];\n f.unshift(i);\n f.start = start;\n if (g = fragmentByEnd[start]) {\n delete fragmentByEnd[g.end];\n var gf = g === f ? f : g.concat(f);\n fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else {\n f = [i];\n fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n }\n });\n\n function ends(i) {\n var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n else p1 = arc[arc.length - 1];\n return i < 0 ? [p1, p0] : [p0, p1];\n }\n\n function flush(fragmentByEnd, fragmentByStart) {\n for (var k in fragmentByEnd) {\n var f = fragmentByEnd[k];\n delete fragmentByStart[f.start];\n delete f.start;\n delete f.end;\n f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n fragments.push(f);\n }\n }\n\n flush(fragmentByEnd, fragmentByStart);\n flush(fragmentByStart, fragmentByEnd);\n arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\n return fragments;\n }\n\n function mesh(topology) {\n return object(topology, meshArcs.apply(this, arguments));\n }\n\n function meshArcs(topology, o, filter) {\n var arcs = [];\n\n function arc(i) {\n var j = i < 0 ? ~i : i;\n (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n }\n\n function line(arcs) {\n arcs.forEach(arc);\n }\n\n function polygon(arcs) {\n arcs.forEach(line);\n }\n\n function geometry(o) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n }\n\n if (arguments.length > 1) {\n var geomsByArc = [],\n geom;\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n };\n\n geometry(o);\n\n geomsByArc.forEach(arguments.length < 3\n ? function(geoms) { arcs.push(geoms[0].i); }\n : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n } else {\n for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n }\n\n return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n }\n\n function triangle(triangle) {\n var a = triangle[0], b = triangle[1], c = triangle[2];\n return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n }\n\n function ring(ring) {\n var i = -1,\n n = ring.length,\n a,\n b = ring[n - 1],\n area = 0;\n\n while (++i < n) {\n a = b;\n b = ring[i];\n area += a[0] * b[1] - a[1] * b[0];\n }\n\n return area / 2;\n }\n\n function merge(topology) {\n return object(topology, mergeArcs.apply(this, arguments));\n }\n\n function mergeArcs(topology, objects) {\n var polygonsByArc = {},\n polygons = [],\n components = [];\n\n objects.forEach(function(o) {\n if (o.type === \"Polygon\") register(o.arcs);\n else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n });\n\n function register(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n });\n });\n polygons.push(polygon);\n }\n\n function exterior(ring$$) {\n return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n }\n\n polygons.forEach(function(polygon) {\n if (!polygon._) {\n var component = [],\n neighbors = [polygon];\n polygon._ = 1;\n components.push(component);\n while (polygon = neighbors.pop()) {\n component.push(polygon);\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n if (!polygon._) {\n polygon._ = 1;\n neighbors.push(polygon);\n }\n });\n });\n });\n }\n }\n });\n\n polygons.forEach(function(polygon) {\n delete polygon._;\n });\n\n return {\n type: \"MultiPolygon\",\n arcs: components.map(function(polygons) {\n var arcs = [], n;\n\n // Extract the exterior (unique) arcs.\n polygons.forEach(function(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n arcs.push(arc);\n }\n });\n });\n });\n\n // Stitch the arcs into one or more rings.\n arcs = stitchArcs(topology, arcs);\n\n // If more than one ring is returned,\n // at most one of these rings can be the exterior;\n // this exterior ring has the same winding order\n // as any exterior ring in the original polygons.\n if ((n = arcs.length) > 1) {\n var sgn = exterior(polygons[0][0]);\n for (var i = 0, t; i < n; ++i) {\n if (sgn === exterior(arcs[i])) {\n t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n break;\n }\n }\n }\n\n return arcs;\n })\n };\n }\n\n function neighbors(objects) {\n var indexesByArc = {}, // arc index -> array of object indexes\n neighbors = objects.map(function() { return []; });\n\n function line(arcs, i) {\n arcs.forEach(function(a) {\n if (a < 0) a = ~a;\n var o = indexesByArc[a];\n if (o) o.push(i);\n else indexesByArc[a] = [i];\n });\n }\n\n function polygon(arcs, i) {\n arcs.forEach(function(arc) { line(arc, i); });\n }\n\n function geometry(o, i) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n }\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n };\n\n objects.forEach(geometry);\n\n for (var i in indexesByArc) {\n for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n for (var k = j + 1; k < m; ++k) {\n var ij = indexes[j], ik = indexes[k], n;\n if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n }\n }\n }\n\n return neighbors;\n }\n\n function compareArea(a, b) {\n return a[1][2] - b[1][2];\n }\n\n function minAreaHeap() {\n var heap = {},\n array = [],\n size = 0;\n\n heap.push = function(object) {\n up(array[object._ = size] = object, size++);\n return size;\n };\n\n heap.pop = function() {\n if (size <= 0) return;\n var removed = array[0], object;\n if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n return removed;\n };\n\n heap.remove = function(removed) {\n var i = removed._, object;\n if (array[i] !== removed) return; // invalid request\n if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n return i;\n };\n\n function up(object, i) {\n while (i > 0) {\n var j = ((i + 1) >> 1) - 1,\n parent = array[j];\n if (compareArea(object, parent) >= 0) break;\n array[parent._ = i] = parent;\n array[object._ = i = j] = object;\n }\n }\n\n function down(object, i) {\n while (true) {\n var r = (i + 1) << 1,\n l = r - 1,\n j = i,\n child = array[j];\n if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n if (j === i) break;\n array[child._ = i] = child;\n array[object._ = i = j] = object;\n }\n }\n\n return heap;\n }\n\n function presimplify(topology, triangleArea) {\n var absolute$$ = absolute(topology.transform),\n relative$$ = relative(topology.transform),\n heap = minAreaHeap();\n\n if (!triangleArea) triangleArea = triangle;\n\n topology.arcs.forEach(function(arc) {\n var triangles = [],\n maxArea = 0,\n triangle,\n i,\n n,\n p;\n\n // To store each point’s effective area, we create a new array rather than\n // extending the passed-in point to workaround a Chrome/V8 bug (getting\n // stuck in smi mode). For midpoints, the initial effective area of\n // Infinity will be computed in the next step.\n for (i = 0, n = arc.length; i < n; ++i) {\n p = arc[i];\n absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n }\n\n for (i = 1, n = arc.length - 1; i < n; ++i) {\n triangle = arc.slice(i - 1, i + 2);\n triangle[1][2] = triangleArea(triangle);\n triangles.push(triangle);\n heap.push(triangle);\n }\n\n for (i = 0, n = triangles.length; i < n; ++i) {\n triangle = triangles[i];\n triangle.previous = triangles[i - 1];\n triangle.next = triangles[i + 1];\n }\n\n while (triangle = heap.pop()) {\n var previous = triangle.previous,\n next = triangle.next;\n\n // If the area of the current point is less than that of the previous point\n // to be eliminated, use the latter's area instead. This ensures that the\n // current point cannot be eliminated without eliminating previously-\n // eliminated points.\n if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n else maxArea = triangle[1][2];\n\n if (previous) {\n previous.next = next;\n previous[2] = triangle[2];\n update(previous);\n }\n\n if (next) {\n next.previous = previous;\n next[0] = triangle[0];\n update(next);\n }\n }\n\n arc.forEach(relative$$);\n });\n\n function update(triangle) {\n heap.remove(triangle);\n triangle[1][2] = triangleArea(triangle);\n heap.push(triangle);\n }\n\n return topology;\n }\n\n var version = \"1.6.24\";\n\n exports.version = version;\n exports.mesh = mesh;\n exports.meshArcs = meshArcs;\n exports.merge = merge;\n exports.mergeArcs = mergeArcs;\n exports.feature = feature;\n exports.neighbors = neighbors;\n exports.presimplify = presimplify;\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/topojson/build/topojson.js\n ** module id = 66\n ** module chunks = 0\n **/","var normalize = require('geojson-normalize');\n\nmodule.exports = function(inputs) {\n return {\n type: 'FeatureCollection',\n features: inputs.reduce(function(memo, input) {\n return memo.concat(normalize(input).features);\n }, [])\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/index.js\n ** module id = 67\n ** module chunks = 0\n **/","module.exports = normalize;\n\nvar types = {\n Point: 'geometry',\n MultiPoint: 'geometry',\n LineString: 'geometry',\n MultiLineString: 'geometry',\n Polygon: 'geometry',\n MultiPolygon: 'geometry',\n GeometryCollection: 'geometry',\n Feature: 'feature',\n FeatureCollection: 'featurecollection'\n};\n\n/**\n * Normalize a GeoJSON feature into a FeatureCollection.\n *\n * @param {object} gj geojson data\n * @returns {object} normalized geojson data\n */\nfunction normalize(gj) {\n if (!gj || !gj.type) return null;\n var type = types[gj.type];\n if (!type) return null;\n\n if (type === 'geometry') {\n return {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: gj\n }]\n };\n } else if (type === 'feature') {\n return {\n type: 'FeatureCollection',\n features: [gj]\n };\n } else if (type === 'featurecollection') {\n return gj;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/~/geojson-normalize/index.js\n ** module id = 68\n ** module chunks = 0\n **/","/*\n * BufferGeometry helpers\n */\n\nimport THREE from 'three';\n\nvar Buffer = (function() {\n // Merge multiple attribute objects into a single attribute object\n //\n // Attribute objects must all use the same attribute keys\n var mergeAttributes = function(attributes) {\n var lengths = {};\n\n // Find array lengths\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lengths[k]) {\n lengths[k] = 0;\n }\n\n lengths[k] += _attributes[k].length;\n }\n });\n\n var mergedAttributes = {};\n\n // Set up arrays to merge into\n for (var k in lengths) {\n mergedAttributes[k] = new Float32Array(lengths[k]);\n }\n\n var lastLengths = {};\n\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lastLengths[k]) {\n lastLengths[k] = 0;\n }\n\n mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\n lastLengths[k] += _attributes[k].length;\n }\n });\n\n return mergedAttributes;\n };\n\n var createLineGeometry = function(lines, offset) {\n var geometry = new THREE.BufferGeometry();\n\n var vertices = new Float32Array(lines.verticesCount * 3);\n var colours = new Float32Array(lines.verticesCount * 3);\n\n var pickingIds;\n if (lines.pickingIds) {\n // One component per vertex (1)\n pickingIds = new Float32Array(lines.verticesCount);\n }\n\n var _vertices;\n var _colour;\n var _pickingId;\n\n var lastIndex = 0;\n\n for (var i = 0; i < lines.vertices.length; i++) {\n _vertices = lines.vertices[i];\n _colour = lines.colours[i];\n\n if (pickingIds) {\n _pickingId = lines.pickingIds[i];\n }\n\n for (var j = 0; j < _vertices.length; j++) {\n var ax = _vertices[j][0] + offset.x;\n var ay = _vertices[j][1];\n var az = _vertices[j][2] + offset.y;\n\n var c1 = _colour[j];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n // TODO: Make picking IDs optional\n var createGeometry = function(attributes, offset) {\n var geometry = new THREE.BufferGeometry();\n\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(attributes.facesCount * 9);\n var normals = new Float32Array(attributes.facesCount * 9);\n var colours = new Float32Array(attributes.facesCount * 9);\n\n var pickingIds;\n if (attributes.pickingIds) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(attributes.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n var _faces;\n var _vertices;\n var _colour;\n var _pickingId;\n var lastIndex = 0;\n for (var i = 0; i < attributes.faces.length; i++) {\n _faces = attributes.faces[i];\n _vertices = attributes.vertices[i];\n _colour = attributes.colours[i];\n\n if (pickingIds) {\n _pickingId = attributes.pickingIds[i];\n }\n\n for (var j = 0; j < _faces.length; j++) {\n // Array of vertex indexes for the face\n index = _faces[j][0];\n\n var ax = _vertices[index][0] + offset.x;\n var ay = _vertices[index][1];\n var az = _vertices[index][2] + offset.y;\n\n var c1 = _colour[j][0];\n\n index = _faces[j][1];\n\n var bx = _vertices[index][0] + offset.x;\n var by = _vertices[index][1];\n var bz = _vertices[index][2] + offset.y;\n\n var c2 = _colour[j][1];\n\n index = _faces[j][2];\n\n var cx = _vertices[index][0] + offset.x;\n var cy = _vertices[index][1];\n var cz = _vertices[index][2] + offset.y;\n\n var c3 = _colour[j][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n return {\n mergeAttributes: mergeAttributes,\n createLineGeometry: createLineGeometry,\n createGeometry: createGeometry\n };\n})();\n\nexport default Buffer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Buffer.js\n **/","import THREE from 'three';\nimport PickingShader from './PickingShader';\n\n// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingMaterial = function() {\n THREE.ShaderMaterial.call(this, {\n uniforms: {\n size: {\n type: 'f',\n value: 0.01,\n },\n scale: {\n type: 'f',\n value: 400,\n }\n },\n // attributes: ['position', 'id'],\n vertexShader: PickingShader.vertexShader,\n fragmentShader: PickingShader.fragmentShader\n });\n\n this.linePadding = 2;\n};\n\nPickingMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype);\n\nPickingMaterial.prototype.constructor = PickingMaterial;\n\nPickingMaterial.prototype.setPointSize = function(size) {\n this.uniforms.size.value = size;\n};\n\nPickingMaterial.prototype.setPointScale = function(scale) {\n this.uniforms.scale.value = scale;\n};\n\nexport default PickingMaterial;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingMaterial.js\n **/","// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingShader = {\n vertexShader: [\n\t\t'attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);',\n\t\t' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);',\n\t\t' worldId = vec4(a,1);',\n\t\t' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n\t\t'#ifdef GL_ES\\n',\n\t\t'precision highp float;\\n',\n\t\t'#endif\\n',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' gl_FragColor = worldId;',\n\t\t'}'\n\t].join('\\n')\n};\n\nexport default PickingShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingShader.js\n **/","import GeoJSONTileLayer from './GeoJSONTileLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONTileLayer extends GeoJSONTileLayer {\n constructor(path, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(path, options);\n }\n}\n\nexport default TopoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new TopoJSONTileLayer(path, options);\n};\n\nexport {noNew as topoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TopoJSONTileLayer.js\n **/","// TODO: Consider adopting GeoJSON CSS\n// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\nimport LayerGroup from './LayerGroup';\nimport extend from 'lodash.assign';\nimport reqwest from 'reqwest';\nimport GeoJSON from '../util/GeoJSON';\nimport Buffer from '../util/Buffer';\nimport PickingMaterial from '../engine/PickingMaterial';\nimport PolygonLayer from './geometry/PolygonLayer';\nimport PolylineLayer from './geometry/PolylineLayer';\nimport PointLayer from './geometry/PointLayer';\n\nclass GeoJSONLayer extends LayerGroup {\n constructor(geojson, options) {\n var defaults = {\n output: false,\n interactive: false,\n topojson: false,\n filter: null,\n onEachFeature: null,\n polygonMaterial: null,\n onPolygonMesh: null,\n onPolygonBufferAttributes: null,\n polylineMaterial: null,\n onPolylineMesh: null,\n onPolylineBufferAttributes: null,\n pointGeometry: null,\n pointMaterial: null,\n onPointMesh: null,\n style: GeoJSON.defaultStyle\n };\n\n var _options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n _options.style = options.style;\n } else {\n _options.style = extend({}, defaults.style, options.style);\n }\n\n super(_options);\n\n this._geojson = geojson;\n }\n\n _onAdd(world) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n // Request data from URL if needed\n if (typeof this._geojson === 'string') {\n this._requestData(this._geojson);\n } else {\n // Process and add GeoJSON to layer\n this._processData(this._geojson);\n }\n }\n\n _requestData(url) {\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n // GeoJSON output layer\n //\n // Need to be careful as to not make it impossible to fork this off into a\n // worker script at a later stage\n _processData(data) {\n // Collects features into a single FeatureCollection\n //\n // Also converts TopoJSON to GeoJSON if instructed\n this._geojson = GeoJSON.collectFeatures(data, this._options.topojson);\n\n // TODO: Check that GeoJSON is valid / usable\n\n var features = this._geojson.features;\n\n // Run filter, if provided\n if (this._options.filter) {\n features = this._geojson.features.filter(this._options.filter);\n }\n\n var defaults = {};\n\n // Assume that a style won't be set per feature\n var style = this._options.style;\n\n var options;\n features.forEach(feature => {\n // Get per-feature style object, if provided\n if (typeof this._options.style === 'function') {\n style = extend({}, GeoJSON.defaultStyle, this._options.style(feature));\n }\n\n options = extend({}, defaults, {\n // If merging feature layers, stop them outputting themselves\n // If not, let feature layers output themselves to the world\n output: !this.isOutput(),\n interactive: this._options.interactive,\n style: style\n });\n\n var layer = this._featureToLayer(feature, options);\n\n if (!layer) {\n return;\n }\n\n layer.feature = feature;\n\n // If defined, call a function for each feature\n //\n // This is commonly used for adding event listeners from the user script\n if (this._options.onEachFeature) {\n this._options.onEachFeature(feature, layer);\n }\n\n this.addLayer(layer);\n });\n\n // If merging layers do that now, otherwise skip as the geometry layers\n // should have already outputted themselves\n if (!this.isOutput()) {\n return;\n }\n\n // From here on we can assume that we want to merge the layers\n\n var polygonAttributes = [];\n var polygonFlat = true;\n\n var polylineAttributes = [];\n var pointAttributes = [];\n\n this._layers.forEach(layer => {\n if (layer instanceof PolygonLayer) {\n polygonAttributes.push(layer.getBufferAttributes());\n\n if (polygonFlat && !layer.isFlat()) {\n polygonFlat = false;\n }\n } else if (layer instanceof PolylineLayer) {\n polylineAttributes.push(layer.getBufferAttributes());\n } else if (layer instanceof PointLayer) {\n pointAttributes.push(layer.getBufferAttributes());\n }\n });\n\n if (polygonAttributes.length > 0) {\n var mergedPolygonAttributes = Buffer.mergeAttributes(polygonAttributes);\n this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n this.add(this._polygonMesh);\n }\n\n if (polylineAttributes.length > 0) {\n var mergedPolylineAttributes = Buffer.mergeAttributes(polylineAttributes);\n this._setPolylineMesh(mergedPolylineAttributes);\n this.add(this._polylineMesh);\n }\n\n if (pointAttributes.length > 0) {\n var mergedPointAttributes = Buffer.mergeAttributes(pointAttributes);\n this._setPointMesh(mergedPointAttributes);\n this.add(this._pointMesh);\n }\n }\n\n // Create and store mesh from buffer attributes\n //\n // TODO: De-dupe this from the individual mesh creation logic within each\n // geometry layer (materials, settings, etc)\n //\n // Could make this an abstract method for each geometry layer\n _setPolygonMesh(attributes, flat) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n\n if (flat) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onPolygonMesh === 'function') {\n this._options.onPolygonMesh(mesh);\n }\n\n this._polygonMesh = mesh;\n }\n\n _setPolylineMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n // TODO: Make this work when style is a function per feature\n var style = (typeof this._options.style === 'function') ? this._options.style(this._geojson.features[0]) : this._options.style;\n style = extend({}, GeoJSON.defaultStyle, style);\n\n var material;\n if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) {\n material = this._options.material;\n } else {\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n }\n\n var mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onPolylineMesh === 'function') {\n this._options.onPolylineMesh(mesh);\n }\n\n this._polylineMesh = mesh;\n }\n\n _setPointMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n // Pass mesh callback, if defined\n if (typeof this._options.onPointMesh === 'function') {\n this._options.onPointMesh(mesh);\n }\n\n this._pointMesh = mesh;\n }\n\n // TODO: Support all GeoJSON geometry types\n _featureToLayer(feature, options) {\n var geometry = feature.geometry;\n var coordinates = (geometry.coordinates) ? geometry.coordinates : null;\n\n if (!coordinates || !geometry) {\n return;\n }\n\n if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n // Get material instance to use for polygon, if provided\n if (typeof this._options.polygonMaterial === 'function') {\n options.geometry = this._options.polygonMaterial(feature);\n }\n\n if (typeof this._options.onPolygonMesh === 'function') {\n options.onMesh = this._options.onPolygonMesh;\n }\n\n // Pass onBufferAttributes callback, if defined\n if (typeof this._options.onPolygonBufferAttributes === 'function') {\n options.onBufferAttributes = this._options.onPolygonBufferAttributes;\n }\n\n return new PolygonLayer(coordinates, options);\n }\n\n if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n // Get material instance to use for line, if provided\n if (typeof this._options.lineMaterial === 'function') {\n options.geometry = this._options.lineMaterial(feature);\n }\n\n if (typeof this._options.onPolylineMesh === 'function') {\n options.onMesh = this._options.onPolylineMesh;\n }\n\n // Pass onBufferAttributes callback, if defined\n if (typeof this._options.onPolylineBufferAttributes === 'function') {\n options.onBufferAttributes = this._options.onPolylineBufferAttributes;\n }\n\n return new PolylineLayer(coordinates, options);\n }\n\n if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n // Get geometry object to use for point, if provided\n if (typeof this._options.pointGeometry === 'function') {\n options.geometry = this._options.pointGeometry(feature);\n }\n\n // Get material instance to use for point, if provided\n if (typeof this._options.pointMaterial === 'function') {\n options.geometry = this._options.pointMaterial(feature);\n }\n\n if (typeof this._options.onPointMesh === 'function') {\n options.onMesh = this._options.onPointMesh;\n }\n\n return new PointLayer(coordinates, options);\n }\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONLayer;\n\nvar noNew = function(geojson, options) {\n return new GeoJSONLayer(geojson, options);\n};\n\nexport {noNew as geoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/GeoJSONLayer.js\n **/","import Layer from './Layer';\nimport extend from 'lodash.assign';\n\nclass LayerGroup extends Layer {\n constructor(options) {\n var defaults = {\n output: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._layers = [];\n }\n\n addLayer(layer) {\n this._layers.push(layer);\n this._world.addLayer(layer);\n }\n\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n this._world.removeLayer(layer);\n }\n\n _onAdd(world) {}\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].destroy();\n }\n\n this._layers = null;\n\n super.destroy();\n }\n}\n\nexport default LayerGroup;\n\nvar noNew = function(options) {\n return new LayerGroup(options);\n};\n\nexport {noNew as layerGroup};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/LayerGroup.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\n// TODO: Allow _setBufferAttributes to use a custom function passed in to\n// generate a custom mesh\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport earcut from 'earcut';\nimport extrudePolygon from '../../util/extrudePolygon';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolygonLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n onBufferAttributes: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n color: '#ffffff',\n height: 0\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of polygons so it's easy to support\n // MultiPolygon features (a single polygon would be a MultiPolygon with a\n // single polygon in the array)\n this._coordinates = (PolygonLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polygon as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n getCenter() {\n return this._coordinates[0][0][0];\n }\n\n // Return polygon bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var attributes;\n\n // Only use this if you know what you're doing\n if (typeof this._options.onBufferAttributes === 'function') {\n // TODO: Probably want to pass something less general as arguments,\n // though passing the instance will do for now (it's everything)\n attributes = this._options.onBufferAttributes(this);\n } else {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.height && this._options.style.height !== 0) {\n height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.color);\n\n // Light and dark colours used for poor-mans AO gradient on object sides\n var light = new THREE.Color(0xffffff);\n var shadow = new THREE.Color(0x666666);\n\n // For each polygon\n attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n // Convert coordinates to earcut format\n var _earcut = this._toEarcut(_projectedCoordinates);\n\n // Triangulate faces using earcut\n var faces = this._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\n var groupedVertices = [];\n for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n }\n\n var extruded = extrudePolygon(groupedVertices, faces, {\n bottom: 0,\n top: height\n });\n\n var topColor = colour.clone().multiply(light);\n var bottomColor = colour.clone().multiply(shadow);\n\n var _vertices = extruded.positions;\n var _faces = [];\n var _colours = [];\n\n var _colour;\n extruded.top.forEach((face, fi) => {\n _colour = [];\n\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n\n _faces.push(face);\n _colours.push(_colour);\n });\n\n this._flat = true;\n\n if (extruded.sides) {\n this._flat = false;\n\n // Set up colours for every vertex with poor-mans AO on the sides\n extruded.sides.forEach((face, fi) => {\n _colour = [];\n\n // First face is always bottom-bottom-top\n if (fi % 2 === 0) {\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n // Reverse winding for the second face\n // top-top-bottom\n } else {\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n }\n\n _faces.push(face);\n _colours.push(_colour);\n });\n }\n\n // Skip bottom as there's no point rendering it\n // allFaces.push(extruded.faces);\n\n var polygon = {\n vertices: _vertices,\n faces: _faces,\n colours: _colours,\n facesCount: _faces.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n polygon.pickingId = this._pickingId;\n }\n\n // Convert polygon representation to proper attribute arrays\n return this._toAttributes(polygon);\n });\n }\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n\n if (this.isFlat()) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n this._options.onMesh(mesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n });\n }\n\n // Convert coordinates array to something earcut can understand\n _toEarcut(coordinates) {\n var dim = 2;\n var result = {vertices: [], holes: [], dimensions: dim};\n var holeIndex = 0;\n\n for (var i = 0; i < coordinates.length; i++) {\n for (var j = 0; j < coordinates[i].length; j++) {\n // for (var d = 0; d < dim; d++) {\n result.vertices.push(coordinates[i][j].x);\n result.vertices.push(coordinates[i][j].y);\n // }\n }\n if (i > 0) {\n holeIndex += coordinates[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n\n return result;\n }\n\n // Triangulate earcut-based input using earcut\n _triangulate(contour, holes, dim) {\n // console.time('earcut');\n\n var faces = earcut(contour, holes, dim);\n var result = [];\n\n for (i = 0, il = faces.length; i < il; i += 3) {\n result.push(faces.slice(i, i + 3));\n }\n\n // console.timeEnd('earcut');\n\n return result;\n }\n\n // Transform polygon representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(polygon) {\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(polygon.facesCount * 9);\n var normals = new Float32Array(polygon.facesCount * 9);\n var colours = new Float32Array(polygon.facesCount * 9);\n\n var pickingIds;\n if (polygon.pickingId) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(polygon.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n\n var _faces = polygon.faces;\n var _vertices = polygon.vertices;\n var _colour = polygon.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = polygon.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _faces.length; i++) {\n // Array of vertex indexes for the face\n index = _faces[i][0];\n\n var ax = _vertices[index][0];\n var ay = _vertices[index][1];\n var az = _vertices[index][2];\n\n var c1 = _colour[i][0];\n\n index = _faces[i][1];\n\n var bx = _vertices[index][0];\n var by = _vertices[index][1];\n var bz = _vertices[index][2];\n\n var c2 = _colour[i][1];\n\n index = _faces[i][2];\n\n var cx = _vertices[index][0];\n var cy = _vertices[index][1];\n var cz = _vertices[index][2];\n\n var c3 = _colour[i][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n normals: normals,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the polygon is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPolygon GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0][0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolygonLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolygonLayer(coordinates, options);\n};\n\nexport {noNew as polygonLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolygonLayer.js\n **/","'use strict';\n\nmodule.exports = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, size;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY);\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var sum = 0,\n i, j, last;\n\n // calculate original winding order of a polygon ring\n for (i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n\n // link points into circular doubly-linked list in the specified winding order\n if (clockwise === (sum > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && size) indexCurve(ear, minX, minY, size);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, size);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, size) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n var p = ear.nextZ;\n\n while (p && p.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.nextZ;\n }\n\n // then look for points in decreasing z-order\n p = ear.prevZ;\n\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, size);\n earcutLinked(c, triangles, dim, minX, minY, size);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= m.x &&\n pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, size) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize === 0) {\n e = q;\n q = q.nextZ;\n qSize--;\n } else if (qSize === 0 || !q) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else if (p.z <= q.z) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and size of the data bounding box\nfunction zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/earcut/src/earcut.js\n ** module id = 76\n ** module chunks = 0\n **/","/*\n * Extrude a polygon given its vertices and triangulated faces\n *\n * Based on:\n * https://github.com/freeman-lab/extrude\n */\n\nimport extend from 'lodash.assign';\n\nvar extrudePolygon = function(points, faces, _options) {\n var defaults = {\n top: 1,\n bottom: 0,\n closed: true\n };\n\n var options = extend({}, defaults, _options);\n\n var n = points.length;\n var positions;\n var cells;\n var topCells;\n var bottomCells;\n var sideCells;\n\n // If bottom and top values are identical then return the flat shape\n (options.top === options.bottom) ? flat() : full();\n\n function flat() {\n positions = points.map(function(p) { return [p[0], options.top, p[1]]; });\n cells = faces;\n topCells = faces;\n }\n\n function full() {\n positions = [];\n points.forEach(function(p) { positions.push([p[0], options.top, p[1]]); });\n points.forEach(function(p) { positions.push([p[0], options.bottom, p[1]]); });\n\n cells = [];\n for (var i = 0; i < n; i++) {\n if (i === (n - 1)) {\n cells.push([i + n, n, i]);\n cells.push([0, i, n]);\n } else {\n cells.push([i + n, i + n + 1, i]);\n cells.push([i + 1, i, i + n + 1]);\n }\n }\n\n sideCells = [].concat(cells);\n\n if (options.closed) {\n var top = faces;\n var bottom = top.map(function(p) { return p.map(function(v) { return v + n; }); });\n bottom = bottom.map(function(p) { return [p[0], p[2], p[1]]; });\n cells = cells.concat(top).concat(bottom);\n\n topCells = top;\n bottomCells = bottom;\n }\n }\n\n return {\n positions: positions,\n faces: cells,\n top: topCells,\n bottom: bottomCells,\n sides: sideCells\n };\n};\n\nexport default extrudePolygon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/extrudePolygon.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Provide alternative output using tubes and splines / curves\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\n// TODO: Allow _setBufferAttributes to use a custom function passed in to\n// generate a custom mesh\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolylineLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n onBufferAttributes: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of lines so it's easy to support\n // MultiLineString features (a single line would be a MultiLineString with a\n // single line in the array)\n this._coordinates = (PolylineLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Polyline features are always flat (for now at least)\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polyline as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n getCenter() {\n return this._coordinates[0][0];\n }\n\n // Return line bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var attributes;\n\n // Only use this if you know what you're doing\n if (typeof this._options.onBufferAttributes === 'function') {\n // TODO: Probably want to pass something less general as arguments,\n // though passing the instance will do for now (it's everything)\n attributes = this._options.onBufferAttributes(this);\n } else {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.lineHeight) {\n height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.lineColor);\n\n // For each line\n attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n var _vertices = [];\n var _colours = [];\n\n // Connect coordinate with the next to make a pair\n //\n // LineSegments requires pairs of vertices so repeat the last point if\n // there's an odd number of vertices\n var nextCoord;\n _projectedCoordinates.forEach((coordinate, index) => {\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([coordinate.x, height, coordinate.y]);\n\n nextCoord = (_projectedCoordinates[index + 1]) ? _projectedCoordinates[index + 1] : coordinate;\n\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([nextCoord.x, height, nextCoord.y]);\n });\n\n var line = {\n vertices: _vertices,\n colours: _colours,\n verticesCount: _vertices.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n line.pickingId = this._pickingId;\n }\n\n // Convert line representation to proper attribute arrays\n return this._toAttributes(line);\n });\n }\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var style = this._options.style;\n var material;\n\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else {\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n }\n\n var mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n this._options.onMesh(mesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiLineString GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolylineLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolylineLayer(coordinates, options);\n};\n\nexport {noNew as polylineLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolylineLayer.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Point features may be using custom models / meshes and so an approach\n// needs to be found to allow these to be brokwn down into buffer attributes for\n// merging\n//\n// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n// and pull out the attributes\n\n// TODO: Support sprite objects using textures\n\n// TODO: Provide option to billboard geometry so it always faces the camera\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PointLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // THREE.Geometry or THREE.BufferGeometry to use for point output\n geometry: null,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n pointColor: '#ff0000'\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of points so it's easy to support\n // MultiPoint features (a single point would be a MultiPoint with a\n // single point in the array)\n this._coordinates = (PointLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Point features are always flat (for now at least)\n //\n // This won't always be the case once custom point objects / meshes are\n // added\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of point as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n getCenter() {\n return this._coordinates;\n }\n\n // Return point bounds in geographic coordinates\n //\n // While not useful for single points, it could be useful for MultiPoint\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.pointHeight) {\n height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.pointColor);\n\n var geometry;\n\n // Use default geometry if none has been provided or the provided geometry\n // isn't valid\n if (!this._options.geometry || (!this._options.geometry instanceof THREE.Geometry || !this._options.geometry instanceof THREE.BufferGeometry)) {\n // Debug geometry for points is a thin bar\n //\n // TODO: Allow point geometry to be customised / overridden\n var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n var _geometry = new THREE.BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\n // Shift geometry up so it sits on the ground\n _geometry.translate(0, geometryHeight * 0.5, 0);\n\n // Pull attributes out of debug geometry\n geometry = new THREE.BufferGeometry().fromGeometry(_geometry);\n } else {\n if (this._options.geometry instanceof THREE.BufferGeometry) {\n geometry = this._options.geometry;\n } else {\n geometry = new THREE.BufferGeometry().fromGeometry(this._options.geometry);\n }\n }\n\n // For each point\n var attributes = this._projectedCoordinates.map(coordinate => {\n var _vertices = [];\n var _normals = [];\n var _colours = [];\n\n var _geometry = geometry.clone();\n\n _geometry.translate(coordinate.x, height, coordinate.y);\n\n var _vertices = _geometry.attributes.position.clone().array;\n var _normals = _geometry.attributes.normal.clone().array;\n var _colours = _geometry.attributes.color.clone().array;\n\n for (var i = 0; i < _colours.length; i += 3) {\n _colours[i] = colour.r;\n _colours[i + 1] = colour.g;\n _colours[i + 2] = colour.b;\n }\n\n var _point = {\n vertices: _vertices,\n normals: _normals,\n colours: _colours\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n // point.pickingId = this._pickingId;\n _point.pickingIds = new Float32Array(_vertices.length / 3);\n for (var i = 0; i < _point.pickingIds.length; i++) {\n _point.pickingIds[i] = this._pickingId;\n }\n }\n\n // Convert point representation to proper attribute arrays\n // return this._toAttributes(_point);\n return _point;\n });\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n this._options.onMesh(mesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var _point;\n return this._coordinates.map(latlon => {\n _point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * _point.x;\n this._offset.y = -1 * _point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return _point;\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPoint GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PointLayer;\n\nvar noNew = function(coordinates, options) {\n return new PointLayer(coordinates, options);\n};\n\nexport {noNew as pointLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PointLayer.js\n **/","import GeoJSONLayer from './GeoJSONLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONLayer extends GeoJSONLayer {\n constructor(topojson, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(topojson, options);\n }\n}\n\nexport default TopoJSONLayer;\n\nvar noNew = function(topojson, options) {\n return new TopoJSONLayer(topojson, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as topoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/TopoJSONLayer.js\n **/"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/src/layer/GeoJSONLayer.js b/src/layer/GeoJSONLayer.js index 83b7f62..96f8e43 100644 --- a/src/layer/GeoJSONLayer.js +++ b/src/layer/GeoJSONLayer.js @@ -19,7 +19,15 @@ class GeoJSONLayer extends LayerGroup { topojson: false, filter: null, onEachFeature: null, + polygonMaterial: null, + onPolygonMesh: null, + onPolygonBufferAttributes: null, + polylineMaterial: null, + onPolylineMesh: null, + onPolylineBufferAttributes: null, pointGeometry: null, + pointMaterial: null, + onPointMesh: null, style: GeoJSON.defaultStyle }; @@ -198,7 +206,9 @@ class GeoJSONLayer extends LayerGroup { geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new THREE.MeshPhongMaterial({ vertexColors: THREE.VertexColors, side: THREE.BackSide @@ -232,6 +242,11 @@ class GeoJSONLayer extends LayerGroup { this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onPolygonMesh === 'function') { + this._options.onPolygonMesh(mesh); + } + this._polygonMesh = mesh; } @@ -252,13 +267,18 @@ class GeoJSONLayer extends LayerGroup { var style = (typeof this._options.style === 'function') ? this._options.style(this._geojson.features[0]) : this._options.style; style = extend({}, GeoJSON.defaultStyle, style); - var material = new THREE.LineBasicMaterial({ - vertexColors: THREE.VertexColors, - linewidth: style.lineWidth, - transparent: style.lineTransparent, - opacity: style.lineOpacity, - blending: style.lineBlending - }); + var material; + if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) { + material = this._options.material; + } else { + material = new THREE.LineBasicMaterial({ + vertexColors: THREE.VertexColors, + linewidth: style.lineWidth, + transparent: style.lineTransparent, + opacity: style.lineOpacity, + blending: style.lineBlending + }); + } var mesh = new THREE.LineSegments(geometry, material); @@ -281,6 +301,11 @@ class GeoJSONLayer extends LayerGroup { this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onPolylineMesh === 'function') { + this._options.onPolylineMesh(mesh); + } + this._polylineMesh = mesh; } @@ -299,7 +324,9 @@ class GeoJSONLayer extends LayerGroup { geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new THREE.MeshPhongMaterial({ vertexColors: THREE.VertexColors // side: THREE.BackSide @@ -328,6 +355,11 @@ class GeoJSONLayer extends LayerGroup { this._pickingMesh.add(pickingMesh); } + // Pass mesh callback, if defined + if (typeof this._options.onPointMesh === 'function') { + this._options.onPointMesh(mesh); + } + this._pointMesh = mesh; } @@ -341,10 +373,38 @@ class GeoJSONLayer extends LayerGroup { } if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') { + // Get material instance to use for polygon, if provided + if (typeof this._options.polygonMaterial === 'function') { + options.geometry = this._options.polygonMaterial(feature); + } + + if (typeof this._options.onPolygonMesh === 'function') { + options.onMesh = this._options.onPolygonMesh; + } + + // Pass onBufferAttributes callback, if defined + if (typeof this._options.onPolygonBufferAttributes === 'function') { + options.onBufferAttributes = this._options.onPolygonBufferAttributes; + } + return new PolygonLayer(coordinates, options); } if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') { + // Get material instance to use for line, if provided + if (typeof this._options.lineMaterial === 'function') { + options.geometry = this._options.lineMaterial(feature); + } + + if (typeof this._options.onPolylineMesh === 'function') { + options.onMesh = this._options.onPolylineMesh; + } + + // Pass onBufferAttributes callback, if defined + if (typeof this._options.onPolylineBufferAttributes === 'function') { + options.onBufferAttributes = this._options.onPolylineBufferAttributes; + } + return new PolylineLayer(coordinates, options); } @@ -354,6 +414,15 @@ class GeoJSONLayer extends LayerGroup { options.geometry = this._options.pointGeometry(feature); } + // Get material instance to use for point, if provided + if (typeof this._options.pointMaterial === 'function') { + options.geometry = this._options.pointMaterial(feature); + } + + if (typeof this._options.onPointMesh === 'function') { + options.onMesh = this._options.onPointMesh; + } + return new PointLayer(coordinates, options); } } diff --git a/src/layer/geometry/PointLayer.js b/src/layer/geometry/PointLayer.js index 07fa80a..0ba1bb9 100644 --- a/src/layer/geometry/PointLayer.js +++ b/src/layer/geometry/PointLayer.js @@ -36,9 +36,12 @@ class PointLayer extends Layer { output: true, interactive: false, // THREE.Geometry or THREE.BufferGeometry to use for point output - // - // TODO: Make this customisable per point via a callback (like style) geometry: null, + // Custom material override + // + // TODO: Should this be in the style object? + material: null, + onMesh: null, // This default style is separate to Util.GeoJSON.defaultStyle style: { pointColor: '#ff0000' @@ -220,7 +223,10 @@ class PointLayer extends Layer { geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + + if (this._options.material && this._options.material instanceof THREE.Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new THREE.MeshBasicMaterial({ vertexColors: THREE.VertexColors // side: THREE.BackSide @@ -249,6 +255,11 @@ class PointLayer extends Layer { this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onMesh === 'function') { + this._options.onMesh(mesh); + } + this._mesh = mesh; } diff --git a/src/layer/geometry/PolygonLayer.js b/src/layer/geometry/PolygonLayer.js index 06d8af6..e358521 100644 --- a/src/layer/geometry/PolygonLayer.js +++ b/src/layer/geometry/PolygonLayer.js @@ -11,6 +11,9 @@ // How much control should this layer support? Perhaps a different or custom // layer would be better suited for animation, for example. +// TODO: Allow _setBufferAttributes to use a custom function passed in to +// generate a custom mesh + import Layer from '../Layer'; import extend from 'lodash.assign'; import THREE from 'three'; @@ -26,6 +29,12 @@ class PolygonLayer extends Layer { var defaults = { output: true, interactive: false, + // Custom material override + // + // TODO: Should this be in the style object? + material: null, + onMesh: null, + onBufferAttributes: null, // This default style is separate to Util.GeoJSON.defaultStyle style: { color: '#ffffff', @@ -103,102 +112,111 @@ class PolygonLayer extends Layer { // Create and store reference to THREE.BufferAttribute data for this layer _setBufferAttributes() { - var height = 0; + var attributes; - // Convert height into world units - if (this._options.style.height && this._options.style.height !== 0) { - height = this._world.metresToWorld(this._options.style.height, this._pointScale); - } + // Only use this if you know what you're doing + if (typeof this._options.onBufferAttributes === 'function') { + // TODO: Probably want to pass something less general as arguments, + // though passing the instance will do for now (it's everything) + attributes = this._options.onBufferAttributes(this); + } else { + var height = 0; - var colour = new THREE.Color(); - colour.set(this._options.style.color); - - // Light and dark colours used for poor-mans AO gradient on object sides - var light = new THREE.Color(0xffffff); - var shadow = new THREE.Color(0x666666); - - // For each polygon - var attributes = this._projectedCoordinates.map(_projectedCoordinates => { - // Convert coordinates to earcut format - var _earcut = this._toEarcut(_projectedCoordinates); - - // Triangulate faces using earcut - var faces = this._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions); - - var groupedVertices = []; - for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) { - groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions)); + // Convert height into world units + if (this._options.style.height && this._options.style.height !== 0) { + height = this._world.metresToWorld(this._options.style.height, this._pointScale); } - var extruded = extrudePolygon(groupedVertices, faces, { - bottom: 0, - top: height - }); + var colour = new THREE.Color(); + colour.set(this._options.style.color); - var topColor = colour.clone().multiply(light); - var bottomColor = colour.clone().multiply(shadow); + // Light and dark colours used for poor-mans AO gradient on object sides + var light = new THREE.Color(0xffffff); + var shadow = new THREE.Color(0x666666); - var _vertices = extruded.positions; - var _faces = []; - var _colours = []; + // For each polygon + attributes = this._projectedCoordinates.map(_projectedCoordinates => { + // Convert coordinates to earcut format + var _earcut = this._toEarcut(_projectedCoordinates); - var _colour; - extruded.top.forEach((face, fi) => { - _colour = []; + // Triangulate faces using earcut + var faces = this._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions); - _colour.push([colour.r, colour.g, colour.b]); - _colour.push([colour.r, colour.g, colour.b]); - _colour.push([colour.r, colour.g, colour.b]); + var groupedVertices = []; + for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) { + groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions)); + } - _faces.push(face); - _colours.push(_colour); - }); + var extruded = extrudePolygon(groupedVertices, faces, { + bottom: 0, + top: height + }); - this._flat = true; + var topColor = colour.clone().multiply(light); + var bottomColor = colour.clone().multiply(shadow); - if (extruded.sides) { - this._flat = false; + var _vertices = extruded.positions; + var _faces = []; + var _colours = []; - // Set up colours for every vertex with poor-mans AO on the sides - extruded.sides.forEach((face, fi) => { + var _colour; + extruded.top.forEach((face, fi) => { _colour = []; - // First face is always bottom-bottom-top - if (fi % 2 === 0) { - _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); - _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); - _colour.push([topColor.r, topColor.g, topColor.b]); - // Reverse winding for the second face - // top-top-bottom - } else { - _colour.push([topColor.r, topColor.g, topColor.b]); - _colour.push([topColor.r, topColor.g, topColor.b]); - _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); - } + _colour.push([colour.r, colour.g, colour.b]); + _colour.push([colour.r, colour.g, colour.b]); + _colour.push([colour.r, colour.g, colour.b]); _faces.push(face); _colours.push(_colour); }); - } - // Skip bottom as there's no point rendering it - // allFaces.push(extruded.faces); + this._flat = true; - var polygon = { - vertices: _vertices, - faces: _faces, - colours: _colours, - facesCount: _faces.length - }; + if (extruded.sides) { + this._flat = false; - if (this._options.interactive && this._pickingId) { - // Inject picking ID - polygon.pickingId = this._pickingId; - } + // Set up colours for every vertex with poor-mans AO on the sides + extruded.sides.forEach((face, fi) => { + _colour = []; - // Convert polygon representation to proper attribute arrays - return this._toAttributes(polygon); - }); + // First face is always bottom-bottom-top + if (fi % 2 === 0) { + _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); + _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); + _colour.push([topColor.r, topColor.g, topColor.b]); + // Reverse winding for the second face + // top-top-bottom + } else { + _colour.push([topColor.r, topColor.g, topColor.b]); + _colour.push([topColor.r, topColor.g, topColor.b]); + _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]); + } + + _faces.push(face); + _colours.push(_colour); + }); + } + + // Skip bottom as there's no point rendering it + // allFaces.push(extruded.faces); + + var polygon = { + vertices: _vertices, + faces: _faces, + colours: _colours, + facesCount: _faces.length + }; + + if (this._options.interactive && this._pickingId) { + // Inject picking ID + polygon.pickingId = this._pickingId; + } + + // Convert polygon representation to proper attribute arrays + return this._toAttributes(polygon); + }); + } this._bufferAttributes = Buffer.mergeAttributes(attributes); } @@ -225,7 +243,9 @@ class PolygonLayer extends Layer { geometry.computeBoundingBox(); var material; - if (!this._world._environment._skybox) { + if (this._options.material && this._options.material instanceof THREE.Material) { + material = this._options.material; + } else if (!this._world._environment._skybox) { material = new THREE.MeshPhongMaterial({ vertexColors: THREE.VertexColors, side: THREE.BackSide @@ -259,6 +279,11 @@ class PolygonLayer extends Layer { this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onMesh === 'function') { + this._options.onMesh(mesh); + } + this._mesh = mesh; } diff --git a/src/layer/geometry/PolylineLayer.js b/src/layer/geometry/PolylineLayer.js index 9a9a63b..c159cee 100644 --- a/src/layer/geometry/PolylineLayer.js +++ b/src/layer/geometry/PolylineLayer.js @@ -13,6 +13,9 @@ // How much control should this layer support? Perhaps a different or custom // layer would be better suited for animation, for example. +// TODO: Allow _setBufferAttributes to use a custom function passed in to +// generate a custom mesh + import Layer from '../Layer'; import extend from 'lodash.assign'; import THREE from 'three'; @@ -26,6 +29,12 @@ class PolylineLayer extends Layer { var defaults = { output: true, interactive: false, + // Custom material override + // + // TODO: Should this be in the style object? + material: null, + onMesh: null, + onBufferAttributes: null, // This default style is separate to Util.GeoJSON.defaultStyle style: { lineOpacity: 1, @@ -109,50 +118,59 @@ class PolylineLayer extends Layer { // Create and store reference to THREE.BufferAttribute data for this layer _setBufferAttributes() { - var height = 0; + var attributes; - // Convert height into world units - if (this._options.style.lineHeight) { - height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale); - } + // Only use this if you know what you're doing + if (typeof this._options.onBufferAttributes === 'function') { + // TODO: Probably want to pass something less general as arguments, + // though passing the instance will do for now (it's everything) + attributes = this._options.onBufferAttributes(this); + } else { + var height = 0; - var colour = new THREE.Color(); - colour.set(this._options.style.lineColor); - - // For each line - var attributes = this._projectedCoordinates.map(_projectedCoordinates => { - var _vertices = []; - var _colours = []; - - // Connect coordinate with the next to make a pair - // - // LineSegments requires pairs of vertices so repeat the last point if - // there's an odd number of vertices - var nextCoord; - _projectedCoordinates.forEach((coordinate, index) => { - _colours.push([colour.r, colour.g, colour.b]); - _vertices.push([coordinate.x, height, coordinate.y]); - - nextCoord = (_projectedCoordinates[index + 1]) ? _projectedCoordinates[index + 1] : coordinate; - - _colours.push([colour.r, colour.g, colour.b]); - _vertices.push([nextCoord.x, height, nextCoord.y]); - }); - - var line = { - vertices: _vertices, - colours: _colours, - verticesCount: _vertices.length - }; - - if (this._options.interactive && this._pickingId) { - // Inject picking ID - line.pickingId = this._pickingId; + // Convert height into world units + if (this._options.style.lineHeight) { + height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale); } - // Convert line representation to proper attribute arrays - return this._toAttributes(line); - }); + var colour = new THREE.Color(); + colour.set(this._options.style.lineColor); + + // For each line + attributes = this._projectedCoordinates.map(_projectedCoordinates => { + var _vertices = []; + var _colours = []; + + // Connect coordinate with the next to make a pair + // + // LineSegments requires pairs of vertices so repeat the last point if + // there's an odd number of vertices + var nextCoord; + _projectedCoordinates.forEach((coordinate, index) => { + _colours.push([colour.r, colour.g, colour.b]); + _vertices.push([coordinate.x, height, coordinate.y]); + + nextCoord = (_projectedCoordinates[index + 1]) ? _projectedCoordinates[index + 1] : coordinate; + + _colours.push([colour.r, colour.g, colour.b]); + _vertices.push([nextCoord.x, height, nextCoord.y]); + }); + + var line = { + vertices: _vertices, + colours: _colours, + verticesCount: _vertices.length + }; + + if (this._options.interactive && this._pickingId) { + // Inject picking ID + line.pickingId = this._pickingId; + } + + // Convert line representation to proper attribute arrays + return this._toAttributes(line); + }); + } this._bufferAttributes = Buffer.mergeAttributes(attributes); } @@ -178,13 +196,19 @@ class PolylineLayer extends Layer { geometry.computeBoundingBox(); var style = this._options.style; - var material = new THREE.LineBasicMaterial({ - vertexColors: THREE.VertexColors, - linewidth: style.lineWidth, - transparent: style.lineTransparent, - opacity: style.lineOpacity, - blending: style.lineBlending - }); + var material; + + if (this._options.material && this._options.material instanceof THREE.Material) { + material = this._options.material; + } else { + material = new THREE.LineBasicMaterial({ + vertexColors: THREE.VertexColors, + linewidth: style.lineWidth, + transparent: style.lineTransparent, + opacity: style.lineOpacity, + blending: style.lineBlending + }); + } var mesh = new THREE.LineSegments(geometry, material); @@ -207,6 +231,11 @@ class PolylineLayer extends Layer { this._pickingMesh.add(pickingMesh); } + // Pass mesh through callback, if defined + if (typeof this._options.onMesh === 'function') { + this._options.onMesh(mesh); + } + this._mesh = mesh; }