Basic viewer for vector tiles based on mapbox-gl-js v0.15.0

This commit is contained in:
Petr Sloup committed 2016-03-11 08:57:06 +01:00
1 parent 4c40700bac
commit d4fa224d04
3 files changed
+640

No files matched your search

+244
View File
@@ -0,0 +1,244 @@
.mapboxgl-map {
font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
overflow: hidden;
position: relative;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.mapboxgl-canvas-container.mapboxgl-interactive,
.mapboxgl-ctrl-nav-compass {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.mapboxgl-canvas-container.mapboxgl-interactive:active,
.mapboxgl-ctrl-nav-compass:active {
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
.mapboxgl-ctrl-top-left,
.mapboxgl-ctrl-top-right,
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right { position:absolute; }
.mapboxgl-ctrl-top-left { top:0; left:0; }
.mapboxgl-ctrl-top-right { top:0; right:0; }
.mapboxgl-ctrl-bottom-left { bottom:0; left:0; }
.mapboxgl-ctrl-bottom-right { right:0; bottom:0; }
.mapboxgl-ctrl { clear:both; }
.mapboxgl-ctrl-top-left .mapboxgl-ctrl { margin:10px 0 0 10px; float:left; }
.mapboxgl-ctrl-top-right .mapboxgl-ctrl{ margin:10px 10px 0 0; float:right; }
.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl { margin:0 0 10px 10px; float:left; }
.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl { margin:0 10px 10px 0; float:right; }
.mapboxgl-ctrl-group {
border-radius: 4px;
-moz-box-shadow: 0px 0px 2px rgba(0,0,0,0.1);
-webkit-box-shadow: 0px 0px 2px rgba(0,0,0,0.1);
box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.1);
overflow: hidden;
background: #fff;
}
.mapboxgl-ctrl-group > button {
width: 30px;
height: 30px;
display: block;
padding: 0;
outline: none;
border: none;
border-bottom: 1px solid #ddd;
box-sizing: border-box;
background-color: rgba(0,0,0,0);
cursor: pointer;
}
/* https://bugzilla.mozilla.org/show_bug.cgi?id=140562 */
.mapboxgl-ctrl > button::-moz-focus-inner {
border: 0;
padding: 0;
}
.mapboxgl-ctrl > button:last-child {
border-bottom: 0;
}
.mapboxgl-ctrl > button:hover {
background-color: rgba(0,0,0,0.05);
}
.mapboxgl-ctrl-icon,
.mapboxgl-ctrl-icon > div.arrow {
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-out {
padding: 5px;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%23333333%3B%27%20d%3D%27m%207%2C9%20c%20-0.554%2C0%20-1%2C0.446%20-1%2C1%200%2C0.554%200.446%2C1%201%2C1%20l%206%2C0%20c%200.554%2C0%201%2C-0.446%201%2C-1%200%2C-0.554%20-0.446%2C-1%20-1%2C-1%20z%27%20%2F%3E%0A%3C%2Fsvg%3E%0A");
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-in {
padding: 5px;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%23333333%3B%27%20d%3D%27M%2010%206%20C%209.446%206%209%206.4459904%209%207%20L%209%209%20L%207%209%20C%206.446%209%206%209.446%206%2010%20C%206%2010.554%206.446%2011%207%2011%20L%209%2011%20L%209%2013%20C%209%2013.55401%209.446%2014%2010%2014%20C%2010.554%2014%2011%2013.55401%2011%2013%20L%2011%2011%20L%2013%2011%20C%2013.554%2011%2014%2010.554%2014%2010%20C%2014%209.446%2013.554%209%2013%209%20L%2011%209%20L%2011%207%20C%2011%206.4459904%2010.554%206%2010%206%20z%27%20%2F%3E%0A%3C%2Fsvg%3E%0A");
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-compass > div.arrow {
width: 20px;
height: 20px;
margin: 5px;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%0A%09%3Cpolygon%20fill%3D%27%23333333%27%20points%3D%276%2C9%2010%2C1%2014%2C9%27%2F%3E%0A%09%3Cpolygon%20fill%3D%27%23CCCCCC%27%20points%3D%276%2C11%2010%2C19%2014%2C11%20%27%2F%3E%0A%3C%2Fsvg%3E");
background-repeat: no-repeat;
}
.mapboxgl-ctrl.mapboxgl-ctrl-attrib {
padding: 0 5px;
background-color: rgba(255,255,255,0.5);
margin: 0;
}
.mapboxgl-ctrl-attrib a {
color: rgba(0,0,0,0.75);
text-decoration: none;
}
.mapboxgl-ctrl-attrib a:hover {
color: inherit;
text-decoration: underline;
}
.mapboxgl-ctrl-attrib .mapbox-improve-map {
font-weight: bold;
margin-left: 2px;
}
.mapboxgl-popup {
position: absolute;
display: -webkit-flex;
display: flex;
will-change: transform;
pointer-events: none;
}
.mapboxgl-popup-anchor-top,
.mapboxgl-popup-anchor-top-left,
.mapboxgl-popup-anchor-top-right {
-webkit-flex-direction: column;
flex-direction: column;
}
.mapboxgl-popup-anchor-bottom,
.mapboxgl-popup-anchor-bottom-left,
.mapboxgl-popup-anchor-bottom-right {
-webkit-flex-direction: column-reverse;
flex-direction: column-reverse;
}
.mapboxgl-popup-anchor-left {
-webkit-flex-direction: row;
flex-direction: row;
}
.mapboxgl-popup-anchor-right {
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
}
.mapboxgl-popup-tip {
width: 0;
height: 0;
border: 10px solid transparent;
z-index: 1;
}
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-top: none;
border-bottom-color: #fff;
}
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip {
-webkit-align-self: flex-start;
align-self: flex-start;
border-top: none;
border-left: none;
border-bottom-color: #fff;
}
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip {
-webkit-align-self: flex-end;
align-self: flex-end;
border-top: none;
border-right: none;
border-bottom-color: #fff;
}
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-bottom: none;
border-top-color: #fff;
}
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip {
-webkit-align-self: flex-start;
align-self: flex-start;
border-bottom: none;
border-left: none;
border-top-color: #fff;
}
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip {
-webkit-align-self: flex-end;
align-self: flex-end;
border-bottom: none;
border-right: none;
border-top-color: #fff;
}
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-left: none;
border-right-color: #fff;
}
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
-webkit-align-self: center;
align-self: center;
border-right: none;
border-left-color: #fff;
}
.mapboxgl-popup-close-button {
position: absolute;
right: 0;
top: 0;
border: none;
border-radius: 0 3px 0 0;
cursor: pointer;
background-color: rgba(0,0,0,0);
}
.mapboxgl-popup-close-button:hover {
background-color: rgba(0,0,0,0.05);
}
.mapboxgl-popup-content {
position: relative;
background: #fff;
border-radius: 3px;
box-shadow: 0 1px 2px rgba(0,0,0,0.10);
padding: 10px 10px 15px;
pointer-events: auto;
}
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content {
border-top-left-radius: 0;
}
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content {
border-top-right-radius: 0;
}
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content {
border-bottom-left-radius: 0;
}
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content {
border-bottom-right-radius: 0;
}
.mapboxgl-crosshair,
.mapboxgl-crosshair .mapboxgl-interactive,
.mapboxgl-crosshair .mapboxgl-interactive:active {
cursor: crosshair;
}
.mapboxgl-boxzoom {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
background: #fff;
border: 2px dotted #202020;
opacity: 0.5;
}
@media print {
.mapbox-improve-map {
display:none;
}
}
+58
View File
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="mapbox-gl.css" />
<script src="mapbox-gl.js"></script>
<title>Offline vector tiles</title>
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
#dropdown { position: absolute; top: 10px; left:10px; }
</style>
<body>
<div id='map'></div>
<select id='dropdown'></select>
<script>
var styles;
var request = new XMLHttpRequest();
request.responseType = 'json';
request.open('GET', '/styles.json', true);
request.onload = function(e) {
if (request.readyState != 4) return;
if (request.status === 200) {
styles = request.response;
}
var map = new mapboxgl.Map({
container: 'map',
style: 'styles/' + styles[0].id + '.json',
center: [0, 0],
zoom: 0,
hash: true
});
map.addControl(new mapboxgl.Navigation());
var select = document.getElementById('dropdown');
for (var i in styles) {
var style = styles[i];
var el = document.createElement('option');
el.textContent = style.name + ' (' + style.id + '.json)';
el.value = style.id;
select.appendChild(el);
};
select.onchange = function() {
mapboxgl.util.getJSON(
'styles/' + document.getElementById('dropdown').value + '.json',
function (err, style) {
if (err) throw err;
map.setStyle(style);
});
}
};
request.send(null);
</script>
</body>
</html>
+338
View File
@@ -0,0 +1,338 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mapboxgl = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";function Bucket(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layer=e.layer,this.layers=[this.layer.id],this.type=this.layer.type,this.features=[],this.id=this.layer.id,this["source-layer"]=this.layer["source-layer"],this.interactive=this.layer.interactive,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,e.elementGroups&&(this.elementGroups=e.elementGroups,this.buffers=util.mapObject(e.buffers,function(e){return new Buffer(e)}))}function createVertexAddMethod(e,t,r){for(var i=[],u=0;u<t.attributes.length;u++)i=i.concat(t.attributes[u].value);var s="return this.buffers."+r+".push("+i.join(", ")+");";return createVertexAddMethodCache[s]||(createVertexAddMethodCache[s]=new Function(t.attributeArgs,s)),createVertexAddMethodCache[s]}function createElementAddMethod(e){return function(t,r,i){return e.push(t,r,i)}}function createElementBuffer(e){return new Buffer({type:Buffer.BufferType.ELEMENT,attributes:[{name:"vertices",components:e||3,type:Buffer.ELEMENT_ATTRIBUTE_TYPE}]})}function capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ElementGroup(e,t,r){this.vertexStartIndex=e,this.elementStartIndex=t,this.secondElementStartIndex=r,this.elementLength=0,this.vertexLength=0,this.secondElementLength=0}var featureFilter=require("feature-filter"),Buffer=require("./buffer"),StyleLayer=require("../style/style_layer"),util=require("../util/util");module.exports=Bucket,Bucket.create=function(e){var t={fill:require("./bucket/fill_bucket"),line:require("./bucket/line_bucket"),circle:require("./bucket/circle_bucket"),symbol:require("./bucket/symbol_bucket")};return new t[e.layer.type](e)},Bucket.AttributeType=Buffer.AttributeType,Bucket.EXTENT=8192,Bucket.prototype.populateBuffers=function(){this.createStyleLayer(),this.createBuffers();for(var e=0;e<this.features.length;e++)this.addFeature(this.features[e]);this.trimBuffers()},Bucket.prototype.makeRoomFor=function(e,t){var r=this.elementGroups[e],i=r.length&&r[r.length-1];if(!i||i.vertexLength+t>65535){var u=this.buffers[this.getBufferName(e,"vertex")],s=this.buffers[this.getBufferName(e,"element")],f=this.buffers[this.getBufferName(e,"secondElement")];i=new ElementGroup(u.length,s&&s.length,f&&f.length),r.push(i)}return i},Bucket.prototype.createBuffers=function(){var e=this.elementGroups={},t=this.buffers={};for(var r in this.shaderInterfaces){var i=this.shaderInterfaces[r];if(i.vertexBuffer){var u=this.getBufferName(r,"vertex"),s=this.getAddMethodName(r,"vertex");t[u]=new Buffer({type:Buffer.BufferType.VERTEX,attributes:i.attributes}),this[s]=this[s]||createVertexAddMethod(r,i,this.getBufferName(r,"vertex"))}if(i.elementBuffer){var f=this.getBufferName(r,"element");t[f]=createElementBuffer(i.elementBufferComponents),this[this.getAddMethodName(r,"element")]=createElementAddMethod(this.buffers[f])}if(i.secondElementBuffer){var n=this.getBufferName(r,"secondElement");t[n]=createElementBuffer(i.secondElementBufferComponents),this[this.getAddMethodName(r,"secondElement")]=createElementAddMethod(this.buffers[n])}e[r]=[]}},Bucket.prototype.destroy=function(e){for(var t in this.buffers)this.buffers[t].destroy(e)},Bucket.prototype.trimBuffers=function(){for(var e in this.buffers)this.buffers[e].trim()},Bucket.prototype.getAddMethodName=function(e,t){return"add"+capitalize(e)+capitalize(t)},Bucket.prototype.getBufferName=function(e,t){return e+capitalize(t)},Bucket.prototype.serialize=function(){return{layer:{id:this.layer.id,type:this.layer.type},zoom:this.zoom,elementGroups:this.elementGroups,buffers:util.mapObject(this.buffers,function(e){return e.serialize()})}},Bucket.prototype.createStyleLayer=function(){this.layer instanceof StyleLayer||(this.layer=StyleLayer.create(this.layer),this.layer.recalculate(this.zoom,{lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0}))},Bucket.prototype.createFilter=function(){this.filter||(this.filter=featureFilter(this.layer.filter))};var createVertexAddMethodCache={};
},{"../style/style_layer":46,"../util/util":98,"./bucket/circle_bucket":2,"./bucket/fill_bucket":3,"./bucket/line_bucket":4,"./bucket/symbol_bucket":5,"./buffer":6,"feature-filter":105}],2:[function(require,module,exports){
"use strict";function CircleBucket(){Bucket.apply(this,arguments)}var Bucket=require("../bucket"),util=require("../../util/util"),loadGeometry=require("../load_geometry"),EXTENT=Bucket.EXTENT;module.exports=CircleBucket,CircleBucket.prototype=util.inherit(Bucket,{}),CircleBucket.prototype.shaderInterfaces={circle:{vertexBuffer:!0,elementBuffer:!0,attributeArgs:["x","y","extrudeX","extrudeY"],attributes:[{name:"pos",components:2,type:Bucket.AttributeType.SHORT,value:["(x * 2) + ((extrudeX + 1) / 2)","(y * 2) + ((extrudeY + 1) / 2)"]}]}},CircleBucket.prototype.addFeature=function(e){for(var t=loadGeometry(e),r=0;r<t.length;r++)for(var i=t[r],u=0;u<i.length;u++){var c=this.makeRoomFor("circle",4),l=i[u].x,a=i[u].y;if(!(0>l||l>=EXTENT||0>a||a>=EXTENT)){var d=this.addCircleVertex(l,a,-1,-1)-c.vertexStartIndex;this.addCircleVertex(l,a,1,-1),this.addCircleVertex(l,a,1,1),this.addCircleVertex(l,a,-1,1),c.vertexLength+=4,this.addCircleElement(d,d+1,d+2),this.addCircleElement(d,d+3,d+2),c.elementLength+=2}}};
},{"../../util/util":98,"../bucket":1,"../load_geometry":8}],3:[function(require,module,exports){
"use strict";function FillBucket(){Bucket.apply(this,arguments)}var Bucket=require("../bucket"),util=require("../../util/util"),loadGeometry=require("../load_geometry");module.exports=FillBucket,FillBucket.prototype=util.inherit(Bucket,{}),FillBucket.prototype.shaderInterfaces={fill:{vertexBuffer:!0,elementBuffer:!0,secondElementBuffer:!0,secondElementBufferComponents:2,attributeArgs:["x","y"],attributes:[{name:"pos",components:2,type:Bucket.AttributeType.SHORT,value:["x","y"]}]}},FillBucket.prototype.addFeature=function(e){for(var t=loadGeometry(e),l=0;l<t.length;l++)this.addFill(t[l])},FillBucket.prototype.addFill=function(e){if(!(e.length<3))for(var t,l,r=e.length,i=this.makeRoomFor("fill",r+1),o=0;o<e.length;o++){var n=e[o],u=this.addFillVertex(n.x,n.y)-i.vertexStartIndex;i.vertexLength++,0===o&&(t=u),o>=2&&(n.x!==e[0].x||n.y!==e[0].y)&&(this.addFillElement(t,l,u),i.elementLength++),o>=1&&(this.addFillSecondElement(l,u),i.secondElementLength++),l=u}};
},{"../../util/util":98,"../bucket":1,"../load_geometry":8}],4:[function(require,module,exports){
"use strict";function LineBucket(){Bucket.apply(this,arguments)}var Bucket=require("../bucket"),util=require("../../util/util"),loadGeometry=require("../load_geometry"),EXTENT=Bucket.EXTENT,EXTRUDE_SCALE=63,COS_HALF_SHARP_CORNER=Math.cos(37.5*(Math.PI/180)),SHARP_CORNER_OFFSET=15,LINE_DISTANCE_BUFFER_BITS=14,LINE_DISTANCE_SCALE=.5,MAX_LINE_DISTANCE=Math.pow(2,LINE_DISTANCE_BUFFER_BITS)/LINE_DISTANCE_SCALE;module.exports=LineBucket,LineBucket.prototype=util.inherit(Bucket,{}),LineBucket.prototype.shaderInterfaces={line:{vertexBuffer:!0,elementBuffer:!0,attributeArgs:["point","extrude","tx","ty","dir","linesofar"],attributes:[{name:"pos",components:2,type:Bucket.AttributeType.SHORT,value:["(point.x << 1) | tx","(point.y << 1) | ty"]},{name:"data",components:4,type:Bucket.AttributeType.UNSIGNED_BYTE,value:["Math.round("+EXTRUDE_SCALE+" * extrude.x) + 128","Math.round("+EXTRUDE_SCALE+" * extrude.y) + 128","((dir === 0 ? 0 : (dir < 0 ? -1 : 1)) + 1) | (((linesofar * "+LINE_DISTANCE_SCALE+") & 0x3F) << 2)","(linesofar * "+LINE_DISTANCE_SCALE+") >> 6"]}]}},LineBucket.prototype.addFeature=function(e){for(var t=loadGeometry(e),i=0;i<t.length;i++)this.addLine(t[i],this.layer.layout["line-join"],this.layer.layout["line-cap"],this.layer.layout["line-miter-limit"],this.layer.layout["line-round-limit"])},LineBucket.prototype.addLine=function(e,t,i,s,r){for(var n=e.length;n>2&&e[n-1].equals(e[n-2]);)n--;if(!(e.length<2)){"bevel"===t&&(s=1.05);var a=SHARP_CORNER_OFFSET*(EXTENT/(512*this.overscaling)),d=e[0],h=e[n-1],u=d.equals(h);if(this.makeRoomFor("line",10*n),2!==n||!u){this.distance=0;var l,o,c,_,x,E,m,p=i,C=u?"butt":i,L=!0;this.e1=this.e2=this.e3=-1,u&&(l=e[n-2],x=d.sub(l)._unit()._perp());for(var f=0;n>f;f++)if(c=u&&f===n-1?e[1]:e[f+1],!c||!e[f].equals(c)){x&&(_=x),l&&(o=l),l=e[f],x=c?c.sub(l)._unit()._perp():_,_=_||x;var v=_.add(x)._unit(),S=v.x*x.x+v.y*x.y,y=1/S,A=COS_HALF_SHARP_CORNER>S&&o&&c;if(A&&f>0){var N=l.dist(o);if(N>2*a){var T=l.sub(l.sub(o)._mult(a/N)._round());this.distance+=T.dist(o),this.addCurrentVertex(T,this.distance,_.mult(1),0,0,!1),o=T}}var I=o&&c,V=I?t:c?p:C;if(I&&"round"===V&&(r>y?V="miter":2>=y&&(V="fakeround")),"miter"===V&&y>s&&(V="bevel"),"bevel"===V&&(y>2&&(V="flipbevel"),s>y&&(V="miter")),o&&(this.distance+=l.dist(o)),"miter"===V)v._mult(y),this.addCurrentVertex(l,this.distance,v,0,0,!1);else if("flipbevel"===V){if(y>100)v=x.clone();else{var b=_.x*x.y-_.y*x.x>0?-1:1,B=y*_.add(x).mag()/_.sub(x).mag();v._perp()._mult(B*b)}this.addCurrentVertex(l,this.distance,v,0,0,!1),this.addCurrentVertex(l,this.distance,v.mult(-1),0,0,!1)}else if("bevel"===V||"fakeround"===V){var k=_.x*x.y-_.y*x.x>0,R=-Math.sqrt(y*y-1);if(k?(m=0,E=R):(E=0,m=R),L||this.addCurrentVertex(l,this.distance,_,E,m,!1),"fakeround"===V){for(var g,F=Math.floor(8*(.5-(S-.5))),D=0;F>D;D++)g=x.mult((D+1)/(F+1))._add(_)._unit(),this.addPieSliceVertex(l,this.distance,g,k);this.addPieSliceVertex(l,this.distance,v,k);for(var M=F-1;M>=0;M--)g=_.mult((M+1)/(F+1))._add(x)._unit(),this.addPieSliceVertex(l,this.distance,g,k)}c&&this.addCurrentVertex(l,this.distance,x,-E,-m,!1)}else"butt"===V?(L||this.addCurrentVertex(l,this.distance,_,0,0,!1),c&&this.addCurrentVertex(l,this.distance,x,0,0,!1)):"square"===V?(L||(this.addCurrentVertex(l,this.distance,_,1,1,!1),this.e1=this.e2=-1),c&&this.addCurrentVertex(l,this.distance,x,-1,-1,!1)):"round"===V&&(L||(this.addCurrentVertex(l,this.distance,_,0,0,!1),this.addCurrentVertex(l,this.distance,_,1,1,!0),this.e1=this.e2=-1),c&&(this.addCurrentVertex(l,this.distance,x,-1,-1,!0),this.addCurrentVertex(l,this.distance,x,0,0,!1)));if(A&&n-1>f){var O=l.dist(c);if(O>2*a){var P=l.add(c.sub(l)._mult(a/O)._round());this.distance+=P.dist(l),this.addCurrentVertex(P,this.distance,x.mult(1),0,0,!1),l=P}}L=!1}}}},LineBucket.prototype.addCurrentVertex=function(e,t,i,s,r,n){var a,d=n?1:0,h=this.elementGroups.line[this.elementGroups.line.length-1];h.vertexLength+=2,a=i.clone(),s&&a._sub(i.perp()._mult(s)),this.e3=this.addLineVertex(e,a,d,0,s,t)-h.vertexStartIndex,this.e1>=0&&this.e2>=0&&(this.addLineElement(this.e1,this.e2,this.e3),h.elementLength++),this.e1=this.e2,this.e2=this.e3,a=i.mult(-1),r&&a._sub(i.perp()._mult(r)),this.e3=this.addLineVertex(e,a,d,1,-r,t)-h.vertexStartIndex,this.e1>=0&&this.e2>=0&&(this.addLineElement(this.e1,this.e2,this.e3),h.elementLength++),this.e1=this.e2,this.e2=this.e3,t>MAX_LINE_DISTANCE/2&&(this.distance=0,this.addCurrentVertex(e,this.distance,i,s,r,n))},LineBucket.prototype.addPieSliceVertex=function(e,t,i,s){var r=s?1:0;i=i.mult(s?-1:1);var n=this.elementGroups.line[this.elementGroups.line.length-1];this.e3=this.addLineVertex(e,i,0,r,0,t)-n.vertexStartIndex,n.vertexLength++,this.e1>=0&&this.e2>=0&&(this.addLineElement(this.e1,this.e2,this.e3),n.elementLength++),s?this.e2=this.e3:this.e1=this.e3};
},{"../../util/util":98,"../bucket":1,"../load_geometry":8}],5:[function(require,module,exports){
"use strict";function SymbolBucket(e){Bucket.apply(this,arguments),this.collisionDebug=e.collisionDebug,this.overscaling=e.overscaling}function SymbolInstance(e,t,o,i,a,s,n,l,r,h,u,c,m){this.x=e.x,this.y=e.y,this.index=n,this.hasText=!!o,this.hasIcon=!!i,this.hasText&&(this.glyphQuads=s?getGlyphQuads(e,o,l,t,a,h):[],this.textCollisionFeature=new CollisionFeature(t,e,o,l,r,h,!1)),this.hasIcon&&(this.iconQuads=s?getIconQuads(e,i,u,t,a,m):[],this.iconCollisionFeature=new CollisionFeature(t,e,i,u,c,m,!0))}var Point=require("point-geometry"),Bucket=require("../bucket"),Anchor=require("../../symbol/anchor"),getAnchors=require("../../symbol/get_anchors"),resolveTokens=require("../../util/token"),Quads=require("../../symbol/quads"),Shaping=require("../../symbol/shaping"),resolveText=require("../../symbol/resolve_text"),mergeLines=require("../../symbol/mergelines"),clipLine=require("../../symbol/clip_line"),util=require("../../util/util"),loadGeometry=require("../load_geometry"),CollisionFeature=require("../../symbol/collision_feature"),shapeText=Shaping.shapeText,shapeIcon=Shaping.shapeIcon,getGlyphQuads=Quads.getGlyphQuads,getIconQuads=Quads.getIconQuads,EXTENT=Bucket.EXTENT;module.exports=SymbolBucket,SymbolBucket.prototype=util.inherit(Bucket,{});var shaderAttributeArgs=["x","y","ox","oy","tx","ty","minzoom","maxzoom","labelminzoom"],shaderAttributes=[{name:"pos",components:2,type:Bucket.AttributeType.SHORT,value:["x","y"]},{name:"offset",components:2,type:Bucket.AttributeType.SHORT,value:["Math.round(ox * 64)","Math.round(oy * 64)"]},{name:"data1",components:4,type:Bucket.AttributeType.UNSIGNED_BYTE,value:["tx / 4","ty / 4","(labelminzoom || 0) * 10","0"]},{name:"data2",components:2,type:Bucket.AttributeType.UNSIGNED_BYTE,value:["(minzoom || 0) * 10","Math.min(maxzoom || 25, 25) * 10"]}];SymbolBucket.prototype.shaderInterfaces={glyph:{vertexBuffer:!0,elementBuffer:!0,attributeArgs:shaderAttributeArgs,attributes:shaderAttributes},icon:{vertexBuffer:!0,elementBuffer:!0,attributeArgs:shaderAttributeArgs,attributes:shaderAttributes},collisionBox:{vertexBuffer:!0,attributeArgs:["point","extrude","maxZoom","placementZoom"],attributes:[{name:"pos",components:2,type:Bucket.AttributeType.SHORT,value:["point.x","point.y"]},{name:"extrude",components:2,type:Bucket.AttributeType.SHORT,value:["Math.round(extrude.x)","Math.round(extrude.y)"]},{name:"data",components:2,type:Bucket.AttributeType.UNSIGNED_BYTE,value:["maxZoom * 10","placementZoom * 10"]}]}},SymbolBucket.prototype.populateBuffers=function(e,t,o){this.createStyleLayer(),this.createBuffers();var i={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",18,i),this.adjustedTextSize=this.layer.getLayoutValue("text-size",this.zoom+1,i),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",18,i),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",this.zoom+1,i);var a=512*this.overscaling;this.tilePixelRatio=EXTENT/a,this.compareText={},this.symbolInstances=[],this.iconsNeedLinear=!1;var s=this.layer.layout,n=this.features,l=this.textFeatures,r=.5,h=.5;switch(s["text-anchor"]){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(s["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":h=1;break;case"top":case"top-right":case"top-left":h=0}for(var u="right"===s["text-justify"]?1:"left"===s["text-justify"]?0:.5,c=24,m=s["text-line-height"]*c,x="line"!==s["symbol-placement"]?s["text-max-width"]*c:0,y=s["text-letter-spacing"]*c,p=[s["text-offset"][0]*c,s["text-offset"][1]*c],d=s["text-font"].join(","),g=[],f=0;f<n.length;f++)g.push(loadGeometry(n[f]));if("line"===s["symbol-placement"]){var b=mergeLines(n,l,g);g=b.geometries,n=b.features,l=b.textFeatures}for(var v,S,T=0;T<n.length;T++)if(g[T]){if(v=l[T]?shapeText(l[T],t[d],x,m,r,h,u,y,p):null,s["icon-image"]){var B=resolveTokens(n[T].properties,s["icon-image"]),I=o[B];S=shapeIcon(I,s),I&&(void 0===this.sdfIcons?this.sdfIcons=I.sdf:this.sdfIcons!==I.sdf&&console.warn("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),1!==I.pixelRatio&&(this.iconsNeedLinear=!0))}else S=null;(v||S)&&this.addFeature(g[T],v,S)}this.placeFeatures(e,this.collisionDebug),this.trimBuffers()},SymbolBucket.prototype.addFeature=function(e,t,o){var i=this.layer.layout,a=24,s=this.adjustedTextSize/a,n=void 0!==this.adjustedTextMaxSize?this.adjustedTextMaxSize:this.adjustedTextSize,l=this.tilePixelRatio*s,r=this.tilePixelRatio*n/a,h=this.tilePixelRatio*this.adjustedIconSize,u=this.tilePixelRatio*i["symbol-spacing"],c=i["symbol-avoid-edges"],m=i["text-padding"]*this.tilePixelRatio,x=i["icon-padding"]*this.tilePixelRatio,y=i["text-max-angle"]/180*Math.PI,p="map"===i["text-rotation-alignment"]&&"line"===i["symbol-placement"],d="map"===i["icon-rotation-alignment"]&&"line"===i["symbol-placement"],g=i["text-allow-overlap"]||i["icon-allow-overlap"]||i["text-ignore-placement"]||i["icon-ignore-placLine truncated
},{"../../symbol/anchor":56,"../../symbol/clip_line":58,"../../symbol/collision_feature":60,"../../symbol/get_anchors":62,"../../symbol/mergelines":65,"../../symbol/quads":66,"../../symbol/resolve_text":67,"../../symbol/shaping":68,"../../util/token":97,"../../util/util":98,"../bucket":1,"../load_geometry":8,"point-geometry":151}],6:[function(require,module,exports){
"use strict";function Buffer(t){if(this.type=t.type,t.arrayBuffer)this.capacity=t.capacity,this.arrayBuffer=t.arrayBuffer,this.attributes=t.attributes,this.itemSize=t.itemSize,this.length=t.length;else{this.capacity=align(Buffer.CAPACITY_DEFAULT,Buffer.CAPACITY_ALIGNMENT),this.arrayBuffer=new ArrayBuffer(this.capacity),this.attributes=[],this.itemSize=0,this.length=0;var e=this.type===Buffer.BufferType.VERTEX?Buffer.VERTEX_ATTRIBUTE_ALIGNMENT:1;this.attributes=t.attributes.map(function(t){var r={};return r.name=t.name,r.components=t.components||1,r.type=t.type||Buffer.AttributeType.UNSIGNED_BYTE,r.size=r.type.size*r.components,r.offset=this.itemSize,this.itemSize=align(r.offset+r.size,e),r},this),this._createPushMethod(),this._refreshViews()}}function align(t,e){e=e||1;var r=t%e;return 1!==e&&0!==r&&(t+=e-r),t}Buffer.prototype.serialize=function(){return{type:this.type,capacity:this.capacity,arrayBuffer:this.arrayBuffer,attributes:this.attributes,itemSize:this.itemSize,length:this.length}},Buffer.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)},Buffer.prototype.destroy=function(t){this.buffer&&t.deleteBuffer(this.buffer)},Buffer.prototype.setAttribPointers=function(t,e,r){for(var i=0;i<this.attributes.length;i++){var f=this.attributes[i];t.vertexAttribPointer(e["a_"+f.name],f.components,t[f.type.name],!1,this.itemSize,r+f.offset)}},Buffer.prototype.trim=function(){this.capacity=align(this.itemSize*this.length,Buffer.CAPACITY_ALIGNMENT),this.arrayBuffer=this.arrayBuffer.slice(0,this.capacity),this._refreshViews()},Buffer.prototype.get=function(t){this._refreshViews();for(var e={},r=t*this.itemSize,i=0;i<this.attributes.length;i++)for(var f=this.attributes[i],s=e[f.name]=[],a=0;a<f.components;a++){var h=(r+f.offset)/f.type.size+a;s.push(this.views[f.type.name][h])}return e},Buffer.prototype.validate=function(t){for(var e=0;e<this.attributes.length;e++)for(var r=0;r<this.attributes[e].components;r++);},Buffer.prototype._resize=function(t){var e=this.views.UNSIGNED_BYTE;this.capacity=align(t,Buffer.CAPACITY_ALIGNMENT),this.arrayBuffer=new ArrayBuffer(this.capacity),this._refreshViews(),this.views.UNSIGNED_BYTE.set(e)},Buffer.prototype._refreshViews=function(){this.views={UNSIGNED_BYTE:new Uint8Array(this.arrayBuffer),BYTE:new Int8Array(this.arrayBuffer),UNSIGNED_SHORT:new Uint16Array(this.arrayBuffer),SHORT:new Int16Array(this.arrayBuffer)}};var createPushMethodCache={};Buffer.prototype._createPushMethod=function(){var t="",e=[];t+="var i = this.length++;\n",t+="var o = i * "+this.itemSize+";\n",t+="if (o + "+this.itemSize+" > this.capacity) { this._resize(this.capacity * "+Buffer.CAPACITY_RESIZE_MULTIPLIER+"); }\n";for(var r=0;r<this.attributes.length;r++){var i=this.attributes[r],f="o"+r;t+="\nvar "+f+" = (o + "+i.offset+") / "+i.type.size+";\n";for(var s=0;s<i.components;s++){var a="v"+e.length,h="this.views."+i.type.name+"["+f+" + "+s+"]";t+=h+" = "+a+";\n",e.push(a)}}t+="\nreturn i;\n",createPushMethodCache[t]||(createPushMethodCache[t]=new Function(e,t)),this.push=createPushMethodCache[t]},Buffer.BufferType={VERTEX:"ARRAY_BUFFER",ELEMENT:"ELEMENT_ARRAY_BUFFER"},Buffer.AttributeType={BYTE:{size:1,name:"BYTE"},UNSIGNED_BYTE:{size:1,name:"UNSIGNED_BYTE"},SHORT:{size:2,name:"SHORT"},UNSIGNED_SHORT:{size:2,name:"UNSIGNED_SHORT"}},Buffer.ELEMENT_ATTRIBUTE_TYPE=Buffer.AttributeType.UNSIGNED_SHORT,Buffer.CAPACITY_DEFAULT=1024,Buffer.CAPACITY_RESIZE_MULTIPLIER=5,Buffer.CAPACITY_ALIGNMENT=2,Buffer.VERTEX_ATTRIBUTE_ALIGNMENT=4,module.exports=Buffer;
},{}],7:[function(require,module,exports){
"use strict";function FeatureTree(t,e){this.x=t.x,this.y=t.y,this.z=t.z-Math.log(e)/Math.LN2,this.rtree=rbush(9),this.toBeInserted=[]}function geometryIntersectsBox(t,e,n){return"Point"===e?pointIntersectsBox(t,n):"LineString"===e?lineIntersectsBox(t,n):"Polygon"===e?polyIntersectsBox(t,n)||lineIntersectsBox(t,n):!1}function polyIntersectsBox(t,e){return polyContainsPoint(t,new Point(e[0],e[1]))||polyContainsPoint(t,new Point(e[0],e[3]))||polyContainsPoint(t,new Point(e[2],e[1]))||polyContainsPoint(t,new Point(e[2],e[3]))?!0:lineIntersectsBox(t,e)}function lineIntersectsBox(t,e){for(var n=0;n<t.length;n++)for(var r=t[n],o=0,i=r.length-1;o<r.length;i=o++){var s=r[o],a=r[i],u=new Point(s.y,s.x),l=new Point(a.y,a.x);if(segmentCrossesHorizontal(s,a,e[0],e[2],e[1])||segmentCrossesHorizontal(s,a,e[0],e[2],e[3])||segmentCrossesHorizontal(u,l,e[1],e[3],e[0])||segmentCrossesHorizontal(u,l,e[1],e[3],e[2]))return!0}return pointIntersectsBox(t,e)}function segmentCrossesHorizontal(t,e,n,r,o){if(e.y===t.y)return e.y===o&&Math.min(t.x,e.x)<=r&&Math.max(t.x,e.x)>=n;var i=(o-t.y)/(e.y-t.y),s=t.x+i*(e.x-t.x);return s>=n&&r>=s&&1>=i&&i>=0}function pointIntersectsBox(t,e){for(var n=0;n<t.length;n++)for(var r=t[n],o=0;o<r.length;o++)if(r[o].x>=e[0]&&r[o].y>=e[1]&&r[o].x<=e[2]&&r[o].y<=e[3])return!0;return!1}function geometryContainsPoint(t,e,n,r){return"Point"===e?pointContainsPoint(t,n,r):"LineString"===e?lineContainsPoint(t,n,r):"Polygon"===e?polyContainsPoint(t,n)||lineContainsPoint(t,n,r):!1}function distToSegmentSquared(t,e,n){var r=e.distSqr(n);if(0===r)return t.distSqr(e);var o=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return 0>o?t.distSqr(e):o>1?t.distSqr(n):t.distSqr(n.sub(e)._mult(o)._add(e))}function lineContainsPoint(t,e,n){for(var r=n*n,o=0;o<t.length;o++)for(var i=t[o],s=1;s<i.length;s++){var a=i[s-1],u=i[s];if(distToSegmentSquared(e,a,u)<r)return!0}return!1}function polyContainsPoint(t,e){for(var n,r,o,i=!1,s=0;s<t.length;s++){n=t[s];for(var a=0,u=n.length-1;a<n.length;u=a++)r=n[a],o=n[u],r.y>e.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(i=!i)}return i}function pointContainsPoint(t,e,n){for(var r=n*n,o=0;o<t.length;o++)for(var i=t[o],s=0;s<i.length;s++)if(i[s].distSqr(e)<=r)return!0;return!1}var rbush=require("rbush"),Point=require("point-geometry"),vt=require("vector-tile"),util=require("../util/util"),loadGeometry=require("./load_geometry"),EXTENT=require("./bucket").EXTENT;module.exports=FeatureTree,FeatureTree.prototype.insert=function(t,e,n){var r=EXTENT/n.extent;t[0]*=r,t[1]*=r,t[2]*=r,t[3]*=r,t.layers=e,t.feature=n,this.toBeInserted.push(t)},FeatureTree.prototype._load=function(){this.rtree.load(this.toBeInserted),this.toBeInserted=[]},FeatureTree.prototype.query=function(t,e){this.toBeInserted.length&&this._load();var n,r,o=t.params||{},i=t.x,s=t.y,a=[];"undefined"!=typeof i&&"undefined"!=typeof s?(n=(o.radius||0)*EXTENT/t.tileSize/t.scale,r=[i-n,s-n,i+n,s+n]):r=[t.minX,t.minY,t.maxX,t.maxY];for(var u=this.rtree.search(r),l=0;l<u.length;l++){var y=u[l].feature,x=u[l].layers,f=vt.VectorTileFeature.types[y.type];if((!o.$type||f===o.$type)&&(!n||geometryContainsPoint(loadGeometry(y),f,new Point(i,s),n))&&geometryIntersectsBox(loadGeometry(y),f,r)){var h=y.toGeoJSON(this.x,this.y,this.z);o.includeGeometry||(h.geometry=null);for(var d=0;d<x.length;d++){var g=x[d];o.layerIds&&o.layerIds.indexOf(g)<0||a.push(util.extend({layer:g},h))}}}e(null,a)};
},{"../util/util":98,"./bucket":1,"./load_geometry":8,"point-geometry":151,"rbush":152,"vector-tile":157}],8:[function(require,module,exports){
"use strict";var EXTENT=require("./bucket").EXTENT;module.exports=function(r){for(var e=EXTENT/r.extent,t=r.loadGeometry(),o=0;o<t.length;o++)for(var n=t[o],u=0;u<n.length;u++){var a=n[u];a.x=Math.round(a.x*e),a.y=Math.round(a.y*e)}return t};
},{"./bucket":1}],9:[function(require,module,exports){
"use strict";function Coordinate(o,t,n){this.column=o,this.row=t,this.zoom=n}module.exports=Coordinate,Coordinate.prototype={clone:function(){return new Coordinate(this.column,this.row,this.zoom)},zoomTo:function(o){return this.clone()._zoomTo(o)},sub:function(o){return this.clone()._sub(o)},_zoomTo:function(o){var t=Math.pow(2,o-this.zoom);return this.column*=t,this.row*=t,this.zoom=o,this},_sub:function(o){return o=o.zoomTo(this.zoom),this.column-=o.column,this.row-=o.row,this}};
},{}],10:[function(require,module,exports){
"use strict";function LngLat(t,n){if(isNaN(t)||isNaN(n))throw new Error("Invalid LngLat object: ("+t+", "+n+")");if(this.lng=+t,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}module.exports=LngLat;var wrap=require("../util/util").wrap;LngLat.prototype.wrap=function(){return new LngLat(wrap(this.lng,-180,180),this.lat)},LngLat.prototype.toArray=function(){return[this.lng,this.lat]},LngLat.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},LngLat.convert=function(t){return t instanceof LngLat?t:Array.isArray(t)?new LngLat(t[0],t[1]):t};
},{"../util/util":98}],11:[function(require,module,exports){
"use strict";function LngLatBounds(t,n){t&&(n?this.extend(t).extend(n):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}module.exports=LngLatBounds;var LngLat=require("./lng_lat");LngLatBounds.prototype={extend:function(t){var n,e,s=this._sw,i=this._ne;if(t instanceof LngLat)n=t,e=t;else{if(!(t instanceof LngLatBounds))return t?this.extend(LngLat.convert(t)||LngLatBounds.convert(t)):this;if(n=t._sw,e=t._ne,!n||!e)return this}return s||i?(s.lng=Math.min(n.lng,s.lng),s.lat=Math.min(n.lat,s.lat),i.lng=Math.max(e.lng,i.lng),i.lat=Math.max(e.lat,i.lat)):(this._sw=new LngLat(n.lng,n.lat),this._ne=new LngLat(e.lng,e.lat)),this},getCenter:function(){return new LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new LngLat(this.getWest(),this.getNorth())},getSouthEast:function(){return new LngLat(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},LngLatBounds.convert=function(t){return!t||t instanceof LngLatBounds?t:new LngLatBounds(t)};
},{"./lng_lat":10}],12:[function(require,module,exports){
"use strict";function Transform(t,i){this.tileSize=512,this._minZoom=t||0,this._maxZoom=i||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new LngLat(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var LngLat=require("./lng_lat"),Point=require("point-geometry"),Coordinate=require("./coordinate"),wrap=require("../util/util").wrap,interp=require("../util/interpolate"),glmatrix=require("gl-matrix"),vec4=glmatrix.vec4,mat4=glmatrix.mat4,mat2=glmatrix.mat2;module.exports=Transform,Transform.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new Point(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var i=-wrap(t,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcProjMatrix(),this.rotationMatrix=mat2.create(),mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var i=Math.min(60,t)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcProjMatrix())},get altitude(){return this._altitude},set altitude(t){var i=Math.max(.75,t);this._altitude!==i&&(this._unmodified=!1,this._altitude=i,this._calcProjMatrix())},get zoom(){return this._zoom},set zoom(t){var i=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom,this._calcProjMatrix(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcProjMatrix(),this._constrain())},resize:function(t,i){this.width=t,this.height=i,this.exMatrix=mat4.create(),mat4.ortho(this.exMatrix,0,t,i,0,0,-1),this._calcProjMatrix(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,i){return new Point(this.lngX(t.lng,i),this.latY(t.lat,i))},unproject:function(t,i){return new LngLat(this.xLng(t.x,i),this.yLat(t.y,i))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new Point(this.x,this.y)},lngX:function(t,i){return(180+t)*(i||this.worldSize)/360},latY:function(t,i){var n=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-n)*(i||this.worldSize)/360},xLng:function(t,i){return 360*t/(i||this.worldSize)-180},yLat:function(t,i){var n=180-360*t/(i||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90},panBy:function(t){var i=this.centerPoint._add(t);this.center=this.pointLocation(i)},setLocationAtPoint:function(t,i){var n=this.locationCoordinate(t),o=this.pointCoordinate(i),e=this.pointCoordinate(this.centerPoint),a=o._sub(n);this._unmodified=!1,this.center=this.coordinateLocation(e._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var i=this.zoomScale(this.tileZoom)/this.worldSize,n=LngLat.convert(t);return new Coordinate(this.lngX(n.lng)*i,this.latY(n.lat)*i,this.tileZoom)},coordinateLocation:function(t){var i=this.zoomScale(t.zoom);return new LngLat(this.xLng(t.column,i),this.yLat(t.row,i))},pointCoordinate:function(t,i){void 0===i&&(i=0);var n=this.coordinatePointMatrix(this.tileZoom);if(mat4.invert(n,n),!n)throw new Error("failed to invert matrix");var o=[t.x,t.y,0,1],e=[t.x,t.y,1,1];vec4.transformMat4(o,o,n),vec4.transformMat4(e,e,n);var a=o[3],r=e[3],h=o[0]/a,s=e[0]/r,c=o[1]/a,u=e[1]/r,l=o[2]/a,m=e[2]/r,g=l===m?0:(i-l)/(m-l);return new Coordinate(interp(h,s,g),interp(c,u,g),this.tileZoom)},coordinatePoint:function(t){var i=this.coordinatePointMatrix(t.zoom),n=[t.column,t.row,0,1];return vec4.transformMat4(n,n,i),new Point(n[0]/n[3],n[1]/n[3])},coordinatePointMatrix:function(t){var i=mat4.copy(new Float64Array(16),this.projMatrix),n=this.worldSize/this.zoomScale(t);return mat4.scale(i,i,[n,n,1]),mat4.multiply(i,this.getPixelMatrix(),i),i},getPixelMatrix:function(){var t=mat4.create();return mat4.scale(t,t,[this.width/2,-this.height/2,1]),mat4.translate(t,t,[1,-1,0]),t},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,i,n,o,e,a,r,h,s=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),i=this.latY(this.latRange[0]),e=i-t<s.y?s.y/(i-t):0),this.lngRange&&(n=this.lngX(this.lngRange[0]),o=this.lngX(this.lngRange[1]),a=o-n<s.x?s.x/(o-n):0);var u=Math.max(a||0,e||0);if(u)return this.ceLine truncated
},{"../util/interpolate":94,"../util/util":98,"./coordinate":9,"./lng_lat":10,"gl-matrix":113,"point-geometry":151}],13:[function(require,module,exports){
"use strict";var simplexFont={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4Line truncated
},{}],14:[function(require,module,exports){
"use strict";var mapboxgl=module.exports={};mapboxgl.Map=require("./ui/map"),mapboxgl.Control=require("./ui/control/control"),mapboxgl.Navigation=require("./ui/control/navigation"),mapboxgl.Attribution=require("./ui/control/attribution"),mapboxgl.Popup=require("./ui/popup"),mapboxgl.GeoJSONSource=require("./source/geojson_source"),mapboxgl.VideoSource=require("./source/video_source"),mapboxgl.ImageSource=require("./source/image_source"),mapboxgl.Style=require("./style/style"),mapboxgl.LngLat=require("./geo/lng_lat"),mapboxgl.LngLatBounds=require("./geo/lng_lat_bounds"),mapboxgl.Point=require("point-geometry"),mapboxgl.Evented=require("./util/evented"),mapboxgl.util=require("./util/util"),mapboxgl.supported=require("./util/browser").supported;var ajax=require("./util/ajax");mapboxgl.util.getJSON=ajax.getJSON,mapboxgl.util.getArrayBuffer=ajax.getArrayBuffer;var config=require("./util/config");mapboxgl.config=config,Object.defineProperty(mapboxgl,"accessToken",{get:function(){return config.ACCESS_TOKEN},set:function(e){config.ACCESS_TOKEN=e}});
},{"./geo/lng_lat":10,"./geo/lng_lat_bounds":11,"./source/geojson_source":28,"./source/image_source":30,"./source/video_source":37,"./style/style":43,"./ui/control/attribution":71,"./ui/control/control":72,"./ui/control/navigation":73,"./ui/map":83,"./ui/popup":84,"./util/ajax":86,"./util/browser":87,"./util/config":91,"./util/evented":92,"./util/util":98,"point-geometry":151}],15:[function(require,module,exports){
"use strict";function drawBackground(t,r,e){var i,a=t.gl,u=t.transform,n=util.premultiply(e.paint["background-color"],e.paint["background-opacity"]),l=e.paint["background-pattern"],o=e.paint["background-opacity"],s=l?t.spriteAtlas.getPosition(l.from,!0):null,f=l?t.spriteAtlas.getPosition(l.to,!0):null;if(t.setDepthSublayer(0),s&&f){if(t.isOpaquePass)return;i=t.patternShader,a.switchShader(i),a.uniform1i(i.u_image,0),a.uniform2fv(i.u_pattern_tl_a,s.tl),a.uniform2fv(i.u_pattern_br_a,s.br),a.uniform2fv(i.u_pattern_tl_b,f.tl),a.uniform2fv(i.u_pattern_br_b,f.br),a.uniform1f(i.u_opacity,o),a.uniform1f(i.u_mix,l.t);var c=EXTENT/u.tileSize/Math.pow(2,0);a.uniform2fv(i.u_patternscale_a,[1/(s.size[0]*c*l.fromScale),1/(s.size[1]*c*l.fromScale)]),a.uniform2fv(i.u_patternscale_b,[1/(f.size[0]*c*l.toScale),1/(f.size[1]*c*l.toScale)]),t.spriteAtlas.bind(a,!0)}else{if(t.isOpaquePass!==(1===n[3]))return;i=t.fillShader,a.switchShader(i),a.uniform4fv(i.u_color,n)}a.disable(a.STENCIL_TEST),a.bindBuffer(a.ARRAY_BUFFER,t.tileExtentBuffer),a.vertexAttribPointer(i.a_pos,t.tileExtentBuffer.itemSize,a.SHORT,!1,0,0);for(var p=pyramid.coveringTiles(u),m=0;m<p.length;m++)a.setPosMatrix(t.calculatePosMatrix(p[m])),a.drawArrays(a.TRIANGLE_STRIP,0,t.tileExtentBuffer.itemCount);a.stencilMask(0),a.stencilFunc(a.EQUAL,128,128)}var TilePyramid=require("../source/tile_pyramid"),pyramid=new TilePyramid({tileSize:512}),util=require("../util/util"),EXTENT=require("../data/bucket").EXTENT;module.exports=drawBackground;
},{"../data/bucket":1,"../source/tile_pyramid":35,"../util/util":98}],16:[function(require,module,exports){
"use strict";function drawCircles(e,r,t,i){if(!e.isOpaquePass){var a=e.gl,l=e.circleShader;e.gl.switchShader(l),e.setDepthSublayer(0),e.depthMask(!1),a.disable(a.STENCIL_TEST);var c=1/browser.devicePixelRatio/t.paint["circle-radius"],s=util.premultiply(t.paint["circle-color"],t.paint["circle-opacity"]);a.uniform4fv(l.u_color,s),a.uniform1f(l.u_blur,Math.max(t.paint["circle-blur"],c)),a.uniform1f(l.u_size,t.paint["circle-radius"]);for(var n=0;n<i.length;n++){var u=i[n],o=r.getTile(u),f=o.getBucket(t);if(f){var m=f.elementGroups.circle;if(m){var d=f.buffers.circleVertex,p=f.buffers.circleElement;a.setPosMatrix(e.translatePosMatrix(e.calculatePosMatrix(u,r.maxzoom),o,t.paint["circle-translate"],t.paint["circle-translate-anchor"])),a.setExMatrix(e.transform.exMatrix);for(var x=0;x<m.length;x++){var v=m[x],b=v.vertexStartIndex*d.itemSize;d.bind(a),d.setAttribPointers(a,l,b),p.bind(a);var S=3*v.elementLength,h=v.elementStartIndex*p.itemSize;a.drawElements(a.TRIANGLES,S,a.UNSIGNED_SHORT,h)}}}}}}var browser=require("../util/browser"),util=require("../util/util");module.exports=drawCircles;
},{"../util/browser":87,"../util/util":98}],17:[function(require,module,exports){
"use strict";function drawCollisionDebug(o,e,r,t){var i=o.gl,a=o.collisionBoxShader;i.enable(i.STENCIL_TEST),i.switchShader(a);for(var l=0;l<t.length;l++){var n=t[l],s=e.getTile(n),f=s.getBucket(r);if(f){var u=f.elementGroups.collisionBox;if(u&&f.buffers&&0!==u[0].vertexLength){var m=f.buffers.collisionBoxVertex;m.bind(i),m.setAttribPointers(i,a,0);var x=o.calculatePosMatrix(n,e.maxzoom);i.setPosMatrix(x),o.enableTileClippingMask(n),i.lineWidth(1),i.uniform1f(a.u_scale,Math.pow(2,o.transform.zoom-s.coord.z)),i.uniform1f(a.u_zoom,10*o.transform.zoom),i.uniform1f(a.u_maxzoom,10*(s.coord.z+1)),i.drawArrays(i.LINES,u[0].vertexStartIndex,u[0].vertexLength)}}}}module.exports=drawCollisionDebug;
},{}],18:[function(require,module,exports){
"use strict";function drawDebug(e,r,t){if(!e.isOpaquePass&&e.options.debug)for(var i=0;i<t.length;i++)drawDebugTile(e,r,t[i])}function drawDebugTile(e,r,t){var i=e.gl;i.disable(i.STENCIL_TEST),i.lineWidth(1*browser.devicePixelRatio);var a=e.calculatePosMatrix(t,r.maxzoom),u=e.debugShader;i.switchShader(u,a),i.bindBuffer(i.ARRAY_BUFFER,e.debugBuffer),i.vertexAttribPointer(u.a_pos,e.debugBuffer.itemSize,i.SHORT,!1,0,0),i.uniform4f(u.u_color,1,0,0,1),i.drawArrays(i.LINE_STRIP,0,e.debugBuffer.itemCount);var o=textVertices(t.toString(),50,200,5);i.bindBuffer(i.ARRAY_BUFFER,e.debugTextBuffer),i.bufferData(i.ARRAY_BUFFER,new Int16Array(o),i.STREAM_DRAW),i.vertexAttribPointer(u.a_pos,e.debugTextBuffer.itemSize,i.SHORT,!1,0,0),i.uniform4f(u.u_color,1,1,1,1);for(var f=r.getTile(t).tileSize,d=EXTENT/(Math.pow(2,e.transform.zoom-t.z)*f),s=[[-1,-1],[-1,1],[1,-1],[1,1]],b=0;b<s.length;b++){var n=s[b];i.setPosMatrix(mat4.translate([],a,[d*n[0],d*n[1],0])),i.drawArrays(i.LINES,0,o.length/e.debugTextBuffer.itemSize)}i.uniform4f(u.u_color,0,0,0,1),i.setPosMatrix(a),i.drawArrays(i.LINES,0,o.length/e.debugTextBuffer.itemSize)}var textVertices=require("../lib/debugtext"),browser=require("../util/browser"),mat4=require("gl-matrix").mat4,EXTENT=require("../data/bucket").EXTENT;module.exports=drawDebug;
},{"../data/bucket":1,"../lib/debugtext":13,"../util/browser":87,"gl-matrix":113}],19:[function(require,module,exports){
"use strict";function draw(e,t,i,r){var l=e.gl;l.enable(l.STENCIL_TEST);var a=util.premultiply(i.paint["fill-color"],i.paint["fill-opacity"]),n=i.paint["fill-pattern"],o=util.premultiply(i.paint["fill-outline-color"],i.paint["fill-opacity"]);if(n?!e.isOpaquePass:e.isOpaquePass===(1===a[3]))for(var f=0;f<r.length;f++)drawFill(e,t,i,r[f]);if(!e.isOpaquePass&&i.paint["fill-antialias"]&&(!i.paint["fill-pattern"]||o)){l.switchShader(e.outlineShader),l.lineWidth(2*browser.devicePixelRatio*10),o?e.setDepthSublayer(2):e.setDepthSublayer(0),l.uniform2f(e.outlineShader.u_world,l.drawingBufferWidth,l.drawingBufferHeight),l.uniform4fv(e.outlineShader.u_color,o?o:a);for(var s=0;s<r.length;s++)drawStroke(e,t,i,r[s])}}function drawFill(e,t,i,r){var l=t.getTile(r),a=l.getBucket(i);if(a){var n=a.elementGroups.fill;if(n){var o=e.gl,f=util.premultiply(i.paint["fill-color"],i.paint["fill-opacity"]),s=i.paint["fill-pattern"],u=i.paint["fill-opacity"],p=e.calculatePosMatrix(r,t.maxzoom),c=e.translatePosMatrix(p,l,i.paint["fill-translate"],i.paint["fill-translate-anchor"]);e.setDepthSublayer(1),o.stencilMask(7),o.clear(o.STENCIL_BUFFER_BIT),e.enableTileClippingMask(r),o.stencilOpSeparate(o.FRONT,o.KEEP,o.KEEP,o.INCR_WRAP),o.stencilOpSeparate(o.BACK,o.KEEP,o.KEEP,o.DECR_WRAP),o.colorMask(!1,!1,!1,!1),e.depthMask(!1),o.switchShader(e.fillShader,c);var m=a.buffers.fillVertex;m.bind(o);var d=a.buffers.fillElement;d.bind(o);for(var S=0;S<n.length;S++){var v=n[S],_=v.vertexStartIndex*m.itemSize;m.setAttribPointers(o,e.fillShader,_);var h=3*v.elementLength,E=v.elementStartIndex*d.itemSize;o.drawElements(o.TRIANGLES,h,o.UNSIGNED_SHORT,E)}o.colorMask(!0,!0,!0,!0),e.depthMask(!0),o.stencilOp(o.KEEP,o.KEEP,o.KEEP),o.stencilMask(0);var b;if(s){var x=e.spriteAtlas.getPosition(s.from,!0),T=e.spriteAtlas.getPosition(s.to,!0);if(!x||!T)return;b=e.patternShader,o.switchShader(b,p),o.uniform1i(b.u_image,0),o.uniform2fv(b.u_pattern_tl_a,x.tl),o.uniform2fv(b.u_pattern_br_a,x.br),o.uniform2fv(b.u_pattern_tl_b,T.tl),o.uniform2fv(b.u_pattern_br_b,T.br),o.uniform1f(b.u_opacity,u),o.uniform1f(b.u_mix,s.t);var w=[x.size[0]*s.fromScale,x.size[1]*s.fromScale],P=[T.size[0]*s.toScale,T.size[1]*s.toScale];o.uniform2fv(b.u_patternscale_a,[1/l.pixelsToTileUnits(w[0],e.transform.tileZoom),1/l.pixelsToTileUnits(w[1],e.transform.tileZoom)]),o.uniform2fv(b.u_patternscale_b,[1/l.pixelsToTileUnits(P[0],e.transform.tileZoom),1/l.pixelsToTileUnits(P[1],e.transform.tileZoom)]);var g=l.tileSize*Math.pow(2,e.transform.tileZoom-l.coord.z),M=g/w[0]%1*(l.coord.x+r.w*Math.pow(2,l.coord.z)),R=g/w[1]%1*l.coord.y,z=g/P[0]%1*(l.coord.x+r.w*Math.pow(2,l.coord.z)),A=g/P[1]%1*l.coord.y;o.uniform2fv(b.u_offset_a,[M,R]),o.uniform2fv(b.u_offset_b,[z,A]),e.spriteAtlas.bind(o,!0)}else b=e.fillShader,o.switchShader(b,p),o.uniform4fv(b.u_color,f);o.stencilFunc(o.NOTEQUAL,0,7),o.bindBuffer(o.ARRAY_BUFFER,e.tileExtentBuffer),o.vertexAttribPointer(b.a_pos,e.tileExtentBuffer.itemSize,o.SHORT,!1,0,0),o.drawArrays(o.TRIANGLE_STRIP,0,e.tileExtentBuffer.itemCount),o.stencilMask(0)}}}function drawStroke(e,t,i,r){var l=t.getTile(r),a=l.getBucket(i);if(a){var n=e.gl,o=a.elementGroups.fill;n.setPosMatrix(e.translatePosMatrix(e.calculatePosMatrix(r,t.maxzoom),l,i.paint["fill-translate"],i.paint["fill-translate-anchor"]));var f=a.buffers.fillVertex,s=a.buffers.fillSecondElement;f.bind(n),s.bind(n),e.enableTileClippingMask(r);for(var u=0;u<o.length;u++){var p=o[u],c=p.vertexStartIndex*f.itemSize;f.setAttribPointers(n,e.outlineShader,c);var m=2*p.secondElementLength,d=p.secondElementStartIndex*s.itemSize;n.drawElements(n.LINES,m,n.UNSIGNED_SHORT,d)}}}var browser=require("../util/browser"),util=require("../util/util");module.exports=draw;
},{"../util/browser":87,"../util/util":98}],20:[function(require,module,exports){
"use strict";var browser=require("../util/browser"),mat2=require("gl-matrix").mat2,util=require("../util/util");module.exports=function(i,t,e,r){if(!i.isOpaquePass){i.setDepthSublayer(0),i.depthMask(!1);var a=r.some(function(i){var r=t.getTile(i).getBucket(e);return r&&r.elementGroups.line});if(a){var n=i.gl;if(n.enable(n.STENCIL_TEST),!(e.paint["line-width"]<=0)){var o=1/browser.devicePixelRatio,l=e.paint["line-blur"]+o,f=e.paint["line-width"]/2,u=-1,s=0,m=0;e.paint["line-gap-width"]>0&&(u=e.paint["line-gap-width"]/2+.5*o,f=e.paint["line-width"],s=u-o/2);var _=s+f+o/2+m,p=util.premultiply(e.paint["line-color"],e.paint["line-opacity"]),h=i.transform,v=mat2.create();mat2.scale(v,v,[1,Math.cos(h._pitch)]),mat2.rotate(v,v,i.transform.angle);var d,x,c,b,g,S=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),T=h.height/2*Math.tan(h._pitch),w=(S+T)/S-1,M=e.paint["line-dasharray"],y=e.paint["line-pattern"];if(M)d=i.linesdfpatternShader,n.switchShader(d),n.uniform2fv(d.u_linewidth,[_,u]),n.uniform1f(d.u_blur,l),n.uniform4fv(d.u_color,p),x=i.lineAtlas.getDash(M.from,"round"===e.layout["line-cap"]),c=i.lineAtlas.getDash(M.to,"round"===e.layout["line-cap"]),i.lineAtlas.bind(n),n.uniform1f(d.u_tex_y_a,x.y),n.uniform1f(d.u_tex_y_b,c.y),n.uniform1i(d.u_image,0),n.uniform1f(d.u_mix,M.t),n.uniform1f(d.u_extra,w),n.uniform1f(d.u_offset,-e.paint["line-offset"]),n.uniformMatrix2fv(d.u_antialiasingmatrix,!1,v);else if(y){if(b=i.spriteAtlas.getPosition(y.from,!0),g=i.spriteAtlas.getPosition(y.to,!0),!b||!g)return;i.spriteAtlas.bind(n,!0),d=i.linepatternShader,n.switchShader(d),n.uniform2fv(d.u_linewidth,[_,u]),n.uniform1f(d.u_blur,l),n.uniform2fv(d.u_pattern_tl_a,b.tl),n.uniform2fv(d.u_pattern_br_a,b.br),n.uniform2fv(d.u_pattern_tl_b,g.tl),n.uniform2fv(d.u_pattern_br_b,g.br),n.uniform1f(d.u_fade,y.t),n.uniform1f(d.u_opacity,e.paint["line-opacity"]),n.uniform1f(d.u_extra,w),n.uniform1f(d.u_offset,-e.paint["line-offset"]),n.uniformMatrix2fv(d.u_antialiasingmatrix,!1,v)}else d=i.lineShader,n.switchShader(d),n.uniform2fv(d.u_linewidth,[_,u]),n.uniform1f(d.u_blur,l),n.uniform1f(d.u_extra,w),n.uniform1f(d.u_offset,-e.paint["line-offset"]),n.uniformMatrix2fv(d.u_antialiasingmatrix,!1,v),n.uniform4fv(d.u_color,p);for(var z=0;z<r.length;z++){var A=r[z],P=t.getTile(A),E=P.getBucket(e);if(E){var U=E.elementGroups.line;if(U){i.enableTileClippingMask(A);var I=i.translatePosMatrix(i.calculatePosMatrix(A,t.maxzoom),P,e.paint["line-translate"],e.paint["line-translate-anchor"]);n.setPosMatrix(I),n.setExMatrix(i.transform.exMatrix);var N=1/P.pixelsToTileUnits(1,i.transform.zoom);if(M){var q=x.width*M.fromScale,D=c.width*M.toScale,G=[1/P.pixelsToTileUnits(q,i.transform.tileZoom),-x.height/2],R=[1/P.pixelsToTileUnits(D,i.transform.tileZoom),-c.height/2],k=i.lineAtlas.width/(256*Math.min(q,D)*browser.devicePixelRatio)/2;n.uniform1f(d.u_ratio,N),n.uniform2fv(d.u_patternscale_a,G),n.uniform2fv(d.u_patternscale_b,R),n.uniform1f(d.u_sdfgamma,k)}else y?(n.uniform1f(d.u_ratio,N),n.uniform2fv(d.u_pattern_size_a,[P.pixelsToTileUnits(b.size[0]*y.fromScale,i.transform.tileZoom),g.size[1]]),n.uniform2fv(d.u_pattern_size_b,[P.pixelsToTileUnits(g.size[0]*y.toScale,i.transform.tileZoom),g.size[1]])):n.uniform1f(d.u_ratio,N);var Z=E.buffers.lineVertex;Z.bind(n);var B=E.buffers.lineElement;B.bind(n);for(var L=0;L<U.length;L++){var O=U[L],C=O.vertexStartIndex*Z.itemSize;n.vertexAttribPointer(d.a_pos,2,n.SHORT,!1,8,C+0),n.vertexAttribPointer(d.a_data,4,n.UNSIGNED_BYTE,!1,8,C+4);var H=3*O.elementLength,V=O.elementStartIndex*B.itemSize;n.drawElements(n.TRIANGLES,H,n.UNSIGNED_SHORT,V)}}}}}}}};
},{"../util/browser":87,"../util/util":98,"gl-matrix":113}],21:[function(require,module,exports){
"use strict";function drawRaster(t,r,e,a){if(!t.isOpaquePass){var i=t.gl;i.depthFunc(i.LESS);for(var o=0;o<a.length;o++)drawRasterTile(t,r,e,a[o]);i.depthFunc(i.LEQUAL)}}function drawRasterTile(t,r,e,a){t.setDepthSublayer(0);var i=t.gl;i.disable(i.STENCIL_TEST);var o=r.getTile(a),n=t.calculatePosMatrix(a,r.maxzoom),u=t.rasterShader;i.switchShader(u,n),i.uniform1f(u.u_brightness_low,e.paint["raster-brightness-min"]),i.uniform1f(u.u_brightness_high,e.paint["raster-brightness-max"]),i.uniform1f(u.u_saturation_factor,saturationFactor(e.paint["raster-saturation"])),i.uniform1f(u.u_contrast_factor,contrastFactor(e.paint["raster-contrast"])),i.uniform3fv(u.u_spin_weights,spinWeights(e.paint["raster-hue-rotate"]));var s,c,f=o.source&&o.source._pyramid.findLoadedParent(a,0,{}),d=getOpacities(o,f,e,t.transform);i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.texture),f?(i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,f.texture),s=Math.pow(2,f.coord.z-o.coord.z),c=[o.coord.x*s%1,o.coord.y*s%1]):d[1]=0,i.uniform2fv(u.u_tl_parent,c||[0,0]),i.uniform1f(u.u_scale_parent,s||1),i.uniform1f(u.u_buffer_scale,1),i.uniform1f(u.u_opacity0,d[0]),i.uniform1f(u.u_opacity1,d[1]),i.uniform1i(u.u_image0,0),i.uniform1i(u.u_image1,1),i.bindBuffer(i.ARRAY_BUFFER,o.boundsBuffer||t.tileExtentBuffer),i.vertexAttribPointer(u.a_pos,2,i.SHORT,!1,8,0),i.vertexAttribPointer(u.a_texture_pos,2,i.SHORT,!1,8,4),i.drawArrays(i.TRIANGLE_STRIP,0,4)}function spinWeights(t){t*=Math.PI/180;var r=Math.sin(t),e=Math.cos(t);return[(2*e+1)/3,(-Math.sqrt(3)*r-e+1)/3,(Math.sqrt(3)*r-e+1)/3]}function contrastFactor(t){return t>0?1/(1-t):1+t}function saturationFactor(t){return t>0?1-1/(1.001-t):-t}function getOpacities(t,r,e,a){var i=[1,0],o=e.paint["raster-fade-duration"];if(t.source&&o>0){var n=(new Date).getTime(),u=(n-t.timeAdded)/o,s=r?(n-r.timeAdded)/o:-1,c=t.source._pyramid.coveringZoomLevel(a),f=r?Math.abs(r.coord.z-c)>Math.abs(t.coord.z-c):!1;!r||f?(i[0]=util.clamp(u,0,1),i[1]=1-i[0]):(i[0]=util.clamp(1-s,0,1),i[1]=1-i[0])}var d=e.paint["raster-opacity"];return i[0]*=d,i[1]*=d,i}var util=require("../util/util");module.exports=drawRaster;
},{"../util/util":98}],22:[function(require,module,exports){
"use strict";function drawSymbols(e,t,a,i){if(!e.isOpaquePass){var r=!(a.layout["text-allow-overlap"]||a.layout["icon-allow-overlap"]||a.layout["text-ignore-placement"]||a.layout["icon-ignore-placement"]),o=e.gl;r?o.disable(o.STENCIL_TEST):o.enable(o.STENCIL_TEST),e.setDepthSublayer(0),e.depthMask(!1),o.disable(o.DEPTH_TEST);for(var l,n,s,u,m=0;m<i.length;m++)l=t.getTile(i[m]),s=l.getBucket(a),s&&(n=s.elementGroups,n.icon.length&&(u=e.calculatePosMatrix(i[m],t.maxzoom),e.enableTileClippingMask(i[m]),drawSymbol(e,a,u,l,s,n.icon,"icon",n.sdfIcons,n.iconsNeedLinear)));for(var f=0;f<i.length;f++)l=t.getTile(i[f]),s=l.getBucket(a),s&&(n=s.elementGroups,n.glyph.length&&(u=e.calculatePosMatrix(i[f],t.maxzoom),e.enableTileClippingMask(i[f]),drawSymbol(e,a,u,l,s,n.glyph,"text",!0,!1)));o.enable(o.DEPTH_TEST),drawCollisionDebug(e,t,a,i)}}function drawSymbol(e,t,a,i,r,o,l,n,s){var u=e.gl;a=e.translatePosMatrix(a,i,t.paint[l+"-translate"],t.paint[l+"-translate-anchor"]);var m,f,d,p=e.transform,h="map"===t.layout[l+"-rotation-alignment"],c=h;c?(m=mat4.create(),f=i.pixelsToTileUnits(1,e.transform.zoom),d=1/Math.cos(p._pitch)):(m=mat4.clone(e.transform.exMatrix),f=e.transform.altitude,d=1),mat4.scale(m,m,[f,f,1]);var g=t.layout[l+"-size"],S=g/defaultSizes[l];mat4.scale(m,m,[S,S,1]);var x,b,v,T,_=Math.sqrt(p.height*p.height/4*(1+p.altitude*p.altitude)),y=p.height/2*Math.tan(p._pitch),z=(_+y)/_-1,w="text"===l;if(w||e.style.sprite.loaded()){if(u.activeTexture(u.TEXTURE0),x=n?e.sdfShader:e.iconShader,w){var E=o.fontstack,I=E&&e.glyphSource.getGlyphAtlas(E);if(!I)return;I.updateTexture(u),b=r.buffers.glyphVertex,v=r.buffers.glyphElement,T=[I.width/4,I.height/4]}else{var M=e.options.rotating||e.options.zooming,N=1!==S||browser.devicePixelRatio!==e.spriteAtlas.pixelRatio||s,P=h||e.transform.pitch;e.spriteAtlas.bind(u,n||M||N||P),b=r.buffers.iconVertex,v=r.buffers.iconElement,T=[e.spriteAtlas.width/4,e.spriteAtlas.height/4]}u.switchShader(x,a,m),u.uniform1i(x.u_texture,0),u.uniform2fv(x.u_texsize,T),u.uniform1i(x.u_skewed,c),u.uniform1f(x.u_extra,z);var A=Math.log(g/o.adjustedSize)/Math.LN2||0;u.uniform1f(x.u_zoom,10*(e.transform.zoom-A));var L=e.frameHistory.getFadeProperties(300);u.uniform1f(x.u_fadedist,10*L.fadedist),u.uniform1f(x.u_minfadezoom,Math.floor(10*L.minfadezoom)),u.uniform1f(x.u_maxfadezoom,Math.floor(10*L.maxfadezoom)),u.uniform1f(x.u_fadezoom,10*(e.transform.zoom+L.bump));var R,G,D,k;if(v.bind(u),n){var q=8,C=1.19,H=6,U=.105*defaultSizes[l]/g/browser.devicePixelRatio;if(t.paint[l+"-halo-width"]){var O=util.premultiply(t.paint[l+"-halo-color"],t.paint[l+"-opacity"]);u.uniform1f(x.u_gamma,(t.paint[l+"-halo-blur"]*C/S/q+U)*d),u.uniform4fv(x.u_color,O),u.uniform1f(x.u_buffer,(H-t.paint[l+"-halo-width"]/S)/q);for(var B=0;B<o.length;B++)R=o[B],G=R.vertexStartIndex*b.itemSize,b.bind(u),b.setAttribPointers(u,x,G),D=3*R.elementLength,k=R.elementStartIndex*v.itemSize,u.drawElements(u.TRIANGLES,D,u.UNSIGNED_SHORT,k)}var V=util.premultiply(t.paint[l+"-color"],t.paint[l+"-opacity"]);u.uniform1f(x.u_gamma,U*d),u.uniform4fv(x.u_color,V),u.uniform1f(x.u_buffer,.75);for(var j=0;j<o.length;j++)R=o[j],G=R.vertexStartIndex*b.itemSize,b.bind(u),b.setAttribPointers(u,x,G),D=3*R.elementLength,k=R.elementStartIndex*v.itemSize,u.drawElements(u.TRIANGLES,D,u.UNSIGNED_SHORT,k)}else{u.uniform1f(x.u_opacity,t.paint["icon-opacity"]);for(var F=0;F<o.length;F++)R=o[F],G=R.vertexStartIndex*b.itemSize,b.bind(u),b.setAttribPointers(u,x,G),D=3*R.elementLength,k=R.elementStartIndex*v.itemSize,u.drawElements(u.TRIANGLES,D,u.UNSIGNED_SHORT,k)}}}var mat4=require("gl-matrix").mat4,browser=require("../util/browser"),drawCollisionDebug=require("./draw_collision_debug"),util=require("../util/util");module.exports=drawSymbols;var defaultSizes={icon:1,text:24};
},{"../util/browser":87,"../util/util":98,"./draw_collision_debug":17,"gl-matrix":113}],23:[function(require,module,exports){
"use strict";function FrameHistory(){this.frameHistory=[]}module.exports=FrameHistory,FrameHistory.prototype.getFadeProperties=function(t){void 0===t&&(t=300);for(var e=(new Date).getTime();this.frameHistory.length>3&&this.frameHistory[1].time+t<e;)this.frameHistory.shift();this.frameHistory[1].time+t<e&&(this.frameHistory[0].z=this.frameHistory[1].z);var r=this.frameHistory.length;3>r&&console.warn("there should never be less than three frames in the history");var i=this.frameHistory[0].z,s=this.frameHistory[r-1],o=s.z,a=Math.min(i,o),m=Math.max(i,o),h=s.z-this.frameHistory[1].z,f=s.time-this.frameHistory[1].time,y=h/(f/t);isNaN(y)&&console.warn("fadedist should never be NaN");var n=(e-s.time)/t*y;return{fadedist:y,minfadezoom:a,maxfadezoom:m,bump:n}},FrameHistory.prototype.record=function(t){var e=(new Date).getTime();this.frameHistory.length||this.frameHistory.push({time:0,z:t},{time:0,z:t}),2!==this.frameHistory.length&&this.frameHistory[this.frameHistory.length-1].z===t||this.frameHistory.push({time:e,z:t})};
},{}],24:[function(require,module,exports){
"use strict";var shaders=require("./shaders"),util=require("../util/util");exports.extend=function(r){var t=r.lineWidth,e=r.getParameter(r.ALIASED_LINE_WIDTH_RANGE);return r.lineWidth=function(i){t.call(r,util.clamp(i,e[0],e[1]))},r.getShader=function(r,t){var e=t===this.FRAGMENT_SHADER?"fragment":"vertex";if(!shaders[r]||!shaders[r][e])throw new Error("Could not find shader "+r);var i=this.createShader(t),a=shaders[r][e];if(this.shaderSource(i,a),this.compileShader(i),!this.getShaderParameter(i,this.COMPILE_STATUS))throw new Error(r+" "+e+this.getShaderInfoLog(i));return i},r.initializeShader=function(r,t,e){var i={program:this.createProgram(),fragment:this.getShader(r,this.FRAGMENT_SHADER),vertex:this.getShader(r,this.VERTEX_SHADER),attributes:[]};if(this.attachShader(i.program,i.vertex),this.attachShader(i.program,i.fragment),this.linkProgram(i.program),this.getProgramParameter(i.program,this.LINK_STATUS)){for(var a=0;a<t.length;a++)i[t[a]]=this.getAttribLocation(i.program,t[a]),i.attributes.push(i[t[a]]);for(var h=0;h<e.length;h++)i[e[h]]=this.getUniformLocation(i.program,e[h])}else console.error(r+" ERROR: "+this.getProgramInfoLog(i.program));return i},r.switchShader=function(t,e,i){if(this.currentShader!==t){this.useProgram(t.program);for(var a=this.currentShader?this.currentShader.attributes:[],h=t.attributes,s=0;s<a.length;s++)h.indexOf(a[s])<0&&this.disableVertexAttribArray(a[s]);for(var o=0;o<h.length;o++)a.indexOf(h[o])<0&&this.enableVertexAttribArray(h[o]);this.currentShader=t}void 0!==e&&r.setPosMatrix(e),void 0!==i&&r.setExMatrix(i)},r.setPosMatrix=function(r){var t=this.currentShader;t.posMatrix!==r&&(this.uniformMatrix4fv(t.u_matrix,!1,r),t.posMatrix=r)},r.setExMatrix=function(r){var t=this.currentShader;r&&t.exMatrix!==r&&t.u_exmatrix&&(this.uniformMatrix4fv(t.u_exmatrix,!1,r),t.exMatrix=r)},r.vertexAttrib2fv=function(t,e){r.vertexAttrib2f(t,e[0],e[1])},r.vertexAttrib3fv=function(t,e){r.vertexAttrib3f(t,e[0],e[1],e[2])},r.vertexAttrib4fv=function(t,e){r.vertexAttrib4f(t,e[0],e[1],e[2],e[3])},r};
},{"../util/util":98,"./shaders":27}],25:[function(require,module,exports){
"use strict";function LineAtlas(t,i){this.width=t,this.height=i,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}module.exports=LineAtlas,LineAtlas.prototype.setSprite=function(t){this.sprite=t},LineAtlas.prototype.getDash=function(t,i){var e=t.join(",")+i;return this.positions[e]||(this.positions[e]=this.addDash(t,i)),this.positions[e]},LineAtlas.prototype.addDash=function(t,i){var e=i?7:0,h=2*e+1,s=128;if(this.nextRow+h>this.height)return console.warn("LineAtlas out of space"),null;for(var a=0,r=0;r<t.length;r++)a+=t[r];for(var n=this.width/a,o=n/2,d=t.length%2===1,E=-e;e>=E;E++)for(var T=this.nextRow+e+E,l=this.width*T,R=d?-t[t.length-1]:0,u=t[0],g=1,p=0;p<this.width;p++){for(;p/n>u;)R=u,u+=t[g],d&&g===t.length-1&&(u+=t[0]),g++;var x,f=Math.abs(p-R*n),A=Math.abs(p-u*n),w=Math.min(f,A),_=g%2===1;if(i){var y=e?E/e*(o+1):0;if(_){var D=o-Math.abs(y);x=Math.sqrt(w*w+D*D)}else x=o-Math.sqrt(w*w+y*y)}else x=(_?1:-1)*w;this.data[3+4*(l+p)]=Math.max(0,Math.min(255,x+s))}var c={y:(this.nextRow+e+.5)/this.height,height:2*e/this.height,width:a};return this.nextRow+=h,this.dirty=!0,c},LineAtlas.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))},LineAtlas.prototype.debug=function(){var t=document.createElement("canvas");document.body.appendChild(t),t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.background="#ff0",t.width=this.width,t.height=this.height;for(var i=t.getContext("2d"),e=i.getImageData(0,0,this.width,this.height),h=0;h<this.data.length;h++)if(this.sdf){var s=4*h;e.data[s]=e.data[s+1]=e.data[s+2]=0,e.data[s+3]=this.data[h]}else e.data[h]=this.data[h];i.putImageData(e,0,0)};
},{}],26:[function(require,module,exports){
"use strict";function Painter(e,t){this.gl=glutil.extend(e),this.transform=t,this.reusableTextures={},this.preFbos={},this.frameHistory=new FrameHistory,this.setup(),this.numSublayers=3,this.depthEpsilon=1/Math.pow(2,16)}var glutil=require("./gl_util"),browser=require("../util/browser"),mat4=require("gl-matrix").mat4,FrameHistory=require("./frame_history"),TileCoord=require("../source/tile_coord"),EXTENT=require("../data/bucket").EXTENT;module.exports=Painter,Painter.prototype.resize=function(e,t){var i=this.gl;this.width=e*browser.devicePixelRatio,this.height=t*browser.devicePixelRatio,i.viewport(0,0,this.width,this.height)},Painter.prototype.setup=function(){var e=this.gl;e.verbose=!0,e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.enable(e.STENCIL_TEST),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),this._depthMask=!1,e.depthMask(!1),this.debugShader=e.initializeShader("debug",["a_pos"],["u_matrix","u_color"]),this.rasterShader=e.initializeShader("raster",["a_pos","a_texture_pos"],["u_matrix","u_brightness_low","u_brightness_high","u_saturation_factor","u_spin_weights","u_contrast_factor","u_opacity0","u_opacity1","u_image0","u_image1","u_tl_parent","u_scale_parent","u_buffer_scale"]),this.circleShader=e.initializeShader("circle",["a_pos"],["u_matrix","u_exmatrix","u_blur","u_size","u_color"]),this.lineShader=e.initializeShader("line",["a_pos","a_data"],["u_matrix","u_linewidth","u_color","u_ratio","u_blur","u_extra","u_antialiasingmatrix","u_offset","u_exmatrix"]),this.linepatternShader=e.initializeShader("linepattern",["a_pos","a_data"],["u_matrix","u_linewidth","u_ratio","u_pattern_size_a","u_pattern_size_b","u_pattern_tl_a","u_pattern_br_a","u_pattern_tl_b","u_pattern_br_b","u_blur","u_fade","u_opacity","u_extra","u_antialiasingmatrix","u_offset"]),this.linesdfpatternShader=e.initializeShader("linesdfpattern",["a_pos","a_data"],["u_matrix","u_linewidth","u_color","u_ratio","u_blur","u_patternscale_a","u_tex_y_a","u_patternscale_b","u_tex_y_b","u_image","u_sdfgamma","u_mix","u_extra","u_antialiasingmatrix","u_offset"]),this.sdfShader=e.initializeShader("sdf",["a_pos","a_offset","a_data1","a_data2"],["u_matrix","u_exmatrix","u_texture","u_texsize","u_color","u_gamma","u_buffer","u_zoom","u_fadedist","u_minfadezoom","u_maxfadezoom","u_fadezoom","u_skewed","u_extra"]),this.iconShader=e.initializeShader("icon",["a_pos","a_offset","a_data1","a_data2"],["u_matrix","u_exmatrix","u_texture","u_texsize","u_zoom","u_fadedist","u_minfadezoom","u_maxfadezoom","u_fadezoom","u_opacity","u_skewed","u_extra"]),this.outlineShader=e.initializeShader("outline",["a_pos"],["u_matrix","u_color","u_world"]),this.patternShader=e.initializeShader("pattern",["a_pos"],["u_matrix","u_pattern_tl_a","u_pattern_br_a","u_pattern_tl_b","u_pattern_br_b","u_mix","u_patternscale_a","u_patternscale_b","u_opacity","u_image","u_offset_a","u_offset_b"]),this.fillShader=e.initializeShader("fill",["a_pos"],["u_matrix","u_color"]),this.collisionBoxShader=e.initializeShader("collisionbox",["a_pos","a_extrude","a_data"],["u_matrix","u_scale","u_zoom","u_maxzoom"]),this.identityMatrix=mat4.create(),this.backgroundBuffer=e.createBuffer(),this.backgroundBuffer.itemSize=2,this.backgroundBuffer.itemCount=4,e.bindBuffer(e.ARRAY_BUFFER,this.backgroundBuffer),e.bufferData(e.ARRAY_BUFFER,new Int16Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW),this.tileExtentBuffer=e.createBuffer(),this.tileExtentBuffer.itemSize=4,this.tileExtentBuffer.itemCount=4,e.bindBuffer(e.ARRAY_BUFFER,this.tileExtentBuffer),e.bufferData(e.ARRAY_BUFFER,new Int16Array([0,0,0,0,EXTENT,0,32767,0,0,EXTENT,0,32767,EXTENT,EXTENT,32767,32767]),e.STATIC_DRAW),this.debugBuffer=e.createBuffer(),this.debugBuffer.itemSize=2,this.debugBuffer.itemCount=5,e.bindBuffer(e.ARRAY_BUFFER,this.debugBuffer),e.bufferData(e.ARRAY_BUFFER,new Int16Array([0,0,EXTENT,0,EXTENT,EXTENT,0,EXTENT,0,0]),e.STATIC_DRAW),this.debugTextBuffer=e.createBuffer(),this.debugTextBuffer.itemSize=2},Painter.prototype.clearColor=function(){var e=this.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},Painter.prototype.clearStencil=function(){var e=this.gl;e.clearStencil(0),e.stencilMask(255),e.clear(e.STENCIL_BUFFER_BIT)},Painter.prototype.clearDepth=function(){var e=this.gl;e.clearDepth(1),this.depthMask(!0),e.clear(e.DEPTH_BUFFER_BIT)},Painter.prototype._renderTileClippingMasks=function(e,t){var i=this.gl;i.colorMask(!1,!1,!1,!1),this.depthMask(!1),i.disable(i.DEPTH_TEST),i.enable(i.STENCIL_TEST),i.stencilMask(248),i.stencilOp(i.KEEP,i.KEEP,i.REPLACE);var r=1;this._tileClippingMaskIDs={};for(var a=0;a<e.length;a++){var s=e[a],u=this._tileClippingMaskIDs[s.id]=r++<<3;i.stencilFunc(i.ALWAYS,u,248),i.switchShader(this.fillShader,this.calculatePosMatrix(s,t)),i.bindBuffer(i.ARRAY_BUFFER,this.tileExtentBuffer),i.vertexAttribPointer(this.fillShader.a_pos,this.tileExtentBuffer.itemSize,i.SHORT,!1,8,0),i.drawArrays(i.TRIANGLE_STRIP,0,this.tileExtentBuffer.itemCount)}i.stencilMask(0),i.colorMask(!0,!0,!0,!0),this.depthMask(Line truncated
},{"../data/bucket":1,"../source/tile_coord":34,"../util/browser":87,"./draw_background":15,"./draw_circle":16,"./draw_debug":18,"./draw_fill":19,"./draw_line":20,"./draw_raster":21,"./draw_symbol":22,"./frame_history":23,"./gl_util":24,"gl-matrix":113}],27:[function(require,module,exports){
"use strict";var path=require("path");module.exports={debug:{fragment:"precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertex:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragment:"precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertex:"precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},circle:{fragment:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_blur;\n\nvarying vec2 v_extrude;\n\nvoid main() {\n float t = smoothstep(1.0 - u_blur, 1.0, length(v_extrude));\n gl_FragColor = u_color * (1.0 - t);\n}\n",vertex:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform mat4 u_exmatrix;\nuniform mediump float u_size;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_extrude;\n\nvoid main(void) {\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec4 extrude = u_exmatrix * vec4(v_extrude * u_size, 0, 0);\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n // gl_Position is divided by gl_Position.w after this shader runs.\n // Multiply the extrude by it so that it isn't affected by it.\n gl_Position += extrude * gl_Position.w;\n}\n"},line:{fragment:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * alpha;\n}\n",vertex:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragment:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniforLine truncated
},{"path":100}],28:[function(require,module,exports){
"use strict";function GeoJSONSource(e){e=e||{},this._data=e.data,void 0!==e.maxzoom&&(this.maxzoom=e.maxzoom);var i=EXTENT/this.tileSize;this.geojsonVtOptions={buffer:(void 0!==e.buffer?e.buffer:128)*i,tolerance:(void 0!==e.tolerance?e.tolerance:.375)*i,extent:EXTENT,maxZoom:this.maxzoom},this.cluster=e.cluster||!1,this.superclusterOptions={maxZoom:Math.max(e.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:EXTENT,radius:(e.clusterRadius||50)*i,log:!1},this._pyramid=new TilePyramid({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!0,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement.bind(this)})}var util=require("../util/util"),Evented=require("../util/evented"),TilePyramid=require("./tile_pyramid"),Source=require("./source"),urlResolve=require("resolve-url"),EXTENT=require("../data/bucket").EXTENT;module.exports=GeoJSONSource,GeoJSONSource.prototype=util.inherit(Evented,{minzoom:0,maxzoom:14,tileSize:512,_dirty:!0,isTileClipped:!0,setData:function(e){return this._data=e,this._dirty=!0,this.fire("change"),this.map&&this.update(this.map.transform),this},onAdd:function(e){this.map=e},loaded:function(){return this._loaded&&this._pyramid.loaded()},update:function(e){this._dirty&&this._updateData(),this._loaded&&this._pyramid.update(this.used,e)},reload:function(){this._loaded&&this._pyramid.reload()},serialize:function(){return{type:"geojson",data:this._data}},getVisibleCoordinates:Source._getVisibleCoordinates,getTile:Source._getTile,featuresAt:Source._vectorFeaturesAt,featuresIn:Source._vectorFeaturesIn,_updateData:function(){this._dirty=!1;var e=this._data;"string"==typeof e&&"undefined"!=typeof window&&(e=urlResolve(window.location.href,e)),this.workerID=this.dispatcher.send("parse geojson",{data:e,tileSize:this.tileSize,source:this.id,geojsonVtOptions:this.geojsonVtOptions,cluster:this.cluster,superclusterOptions:this.superclusterOptions},function(e){this._loaded=!0,e?this.fire("error",{error:e}):(this._pyramid.reload(),this.fire("change"))}.bind(this))},_loadTile:function(e){var i=e.coord.z>this.maxzoom?Math.pow(2,e.coord.z-this.maxzoom):1,t={uid:e.uid,coord:e.coord,zoom:e.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:i,angle:this.map.transform.angle,pitch:this.map.transform.pitch,collisionDebug:this.map.collisionDebug};e.workerID=this.dispatcher.send("load geojson tile",t,function(i,t){if(e.unloadVectorData(this.map.painter),!e.aborted){if(i)return void this.fire("tile.error",{tile:e});e.loadVectorData(t),e.redoWhenDone&&(e.redoWhenDone=!1,e.redoPlacement(this)),this.fire("tile.load",{tile:e})}}.bind(this),this.workerID)},_abortTile:function(e){e.aborted=!0},_addTile:function(e){this.fire("tile.add",{tile:e})},_removeTile:function(e){this.fire("tile.remove",{tile:e})},_unloadTile:function(e){e.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:e.uid,source:this.id},null,e.workerID)},redoPlacement:Source.redoPlacement,_redoTilePlacement:function(e){e.redoPlacement(this)}});
},{"../data/bucket":1,"../util/evented":92,"../util/util":98,"./source":32,"./tile_pyramid":35,"resolve-url":153}],29:[function(require,module,exports){
"use strict";function GeoJSONWrapper(e){this.features=e,this.length=e.length}function FeatureWrapper(e){this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=EXTENT}var Point=require("point-geometry"),VectorTileFeature=require("vector-tile").VectorTileFeature,EXTENT=require("../data/bucket").EXTENT;module.exports=GeoJSONWrapper,GeoJSONWrapper.prototype.feature=function(e){return new FeatureWrapper(this.features[e])},FeatureWrapper.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var r=e[t],o=[],a=0;a<r.length;a++)o.push(new Point(r[a][0],r[a][1]));this.geometry.push(o)}return this.geometry},FeatureWrapper.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,r=-(1/0),o=1/0,a=-(1/0),p=0;p<e.length;p++)for(var i=e[p],n=0;n<i.length;n++){var u=i[n];t=Math.min(t,u.x),r=Math.max(r,u.x),o=Math.min(o,u.y),a=Math.max(a,u.y)}return[t,o,r,a]},FeatureWrapper.prototype.toGeoJSON=VectorTileFeature.prototype.toGeoJSON;
},{"../data/bucket":1,"point-geometry":151,"vector-tile":157}],30:[function(require,module,exports){
"use strict";function ImageSource(e){this.urls=e.urls,this.coordinates=e.coordinates,ajax.getImage(e.url,function(t,i){t||(this.image=i,this.image.addEventListener("load",function(){this.map._rerender()}.bind(this)),this._loaded=!0,this.map&&this.setCoordinates(e.coordinates))}.bind(this))}var util=require("../util/util"),Tile=require("./tile"),LngLat=require("../geo/lng_lat"),Point=require("point-geometry"),Evented=require("../util/evented"),ajax=require("../util/ajax"),EXTENT=require("../data/bucket").EXTENT;module.exports=ImageSource,ImageSource.prototype=util.inherit(Evented,{onAdd:function(e){this.map=e,this.image&&this.setCoordinates(this.coordinates)},setCoordinates:function(e){this.coordinates=e;var t=this.map,i=e.map(function(e){return t.transform.locationCoordinate(LngLat.convert(e)).zoomTo(0)}),r=this.centerCoord=util.getCoordinatesCenter(i),n=i.map(function(e){var t=e.zoomTo(r.zoom);return new Point(Math.round((t.column-r.column)*EXTENT),Math.round((t.row-r.row)*EXTENT))}),o=t.painter.gl,a=32767,u=new Int16Array([n[0].x,n[0].y,0,0,n[1].x,n[1].y,a,0,n[3].x,n[3].y,0,a,n[2].x,n[2].y,a,a]);return this.tile=new Tile,this.tile.buckets={},this.tile.boundsBuffer=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,this.tile.boundsBuffer),o.bufferData(o.ARRAY_BUFFER,u,o.STATIC_DRAW),this.fire("change"),this},loaded:function(){return this.image&&this.image.complete},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&this.loaded()){var e=this.map.painter,t=e.gl;this.tile.texture?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.image)):(this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.image))}},getVisibleCoordinates:function(){return this.centerCoord?[this.centerCoord]:[]},getTile:function(){return this.tile},featuresAt:function(e,t,i){return i(null,[])},featuresIn:function(e,t,i){return i(null,[])},serialize:function(){return{type:"image",urls:this.urls,coordinates:this.coordinates}}});
},{"../data/bucket":1,"../geo/lng_lat":10,"../util/ajax":86,"../util/evented":92,"../util/util":98,"./tile":33,"point-geometry":151}],31:[function(require,module,exports){
"use strict";function RasterTileSource(e){util.extend(this,util.pick(e,["url","tileSize"])),Source._loadTileJSON.call(this,e)}var util=require("../util/util"),ajax=require("../util/ajax"),Evented=require("../util/evented"),Source=require("./source"),normalizeURL=require("../util/mapbox").normalizeTileURL;module.exports=RasterTileSource,RasterTileSource.prototype=util.inherit(Evented,{minzoom:0,maxzoom:22,roundZoom:!0,tileSize:512,_loaded:!1,onAdd:function(e){this.map=e},loaded:function(){return this._pyramid&&this._pyramid.loaded()},update:function(e){this._pyramid&&this._pyramid.update(this.used,e,this.map.style.rasterFadeDuration)},reload:function(){},serialize:function(){return{type:"raster",url:this.url,tileSize:this.tileSize}},getVisibleCoordinates:Source._getVisibleCoordinates,getTile:Source._getTile,_loadTile:function(e){function t(t,i){if(delete e.request,!e.aborted){if(t)return e.errored=!0,void this.fire("tile.error",{tile:e,error:t});var r=this.map.painter.gl;e.texture=this.map.painter.getTexture(i.width),e.texture?(r.bindTexture(r.TEXTURE_2D,e.texture),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,i)):(e.texture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,e.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),e.texture.size=i.width),r.generateMipmap(r.TEXTURE_2D),e.timeAdded=(new Date).getTime(),this.map.animationLoop.set(this.style.rasterFadeDuration),e.source=this,e.loaded=!0,this.fire("tile.load",{tile:e})}}var i=normalizeURL(e.coord.url(this.tiles),this.url,this.tileSize);e.request=ajax.getImage(i,t.bind(this))},_abortTile:function(e){e.aborted=!0,e.request&&(e.request.abort(),delete e.request)},_addTile:function(e){this.fire("tile.add",{tile:e})},_removeTile:function(e){this.fire("tile.remove",{tile:e})},_unloadTile:function(e){e.texture&&this.map.painter.saveTexture(e.texture)},featuresAt:function(e,t,i){i(null,[])},featuresIn:function(e,t,i){i(null,[])}});
},{"../util/ajax":86,"../util/evented":92,"../util/mapbox":96,"../util/util":98,"./source":32}],32:[function(require,module,exports){
"use strict";var util=require("../util/util"),ajax=require("../util/ajax"),browser=require("../util/browser"),TilePyramid=require("./tile_pyramid"),normalizeURL=require("../util/mapbox").normalizeSourceURL,TileCoord=require("./tile_coord");exports._loadTileJSON=function(e){var r=function(e,r){return e?void this.fire("error",{error:e}):(util.extend(this,util.pick(r,["tiles","minzoom","maxzoom","attribution"])),r.vector_layers&&(this.vectorLayers=r.vector_layers,this.vectorLayerIds=this.vectorLayers.map(function(e){return e.id})),this._pyramid=new TilePyramid({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom,reparseOverscaled:this.reparseOverscaled,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement?this._redoTilePlacement.bind(this):void 0}),void this.fire("load"))}.bind(this);e.url?ajax.getJSON(normalizeURL(e.url),r):browser.frame(r.bind(this,null,e))},exports.redoPlacement=function(){if(this._pyramid)for(var e=this._pyramid.orderedIDs(),r=0;r<e.length;r++){var i=this._pyramid.getTile(e[r]);this._redoTilePlacement(i)}},exports._getTile=function(e){return this._pyramid.getTile(e.id)},exports._getVisibleCoordinates=function(){return this._pyramid?this._pyramid.renderedIDs().map(TileCoord.fromID):[]},exports._vectorFeaturesAt=function(e,r,i){if(!this._pyramid)return i(null,[]);var t=this._pyramid.tileAt(e);return t?void this.dispatcher.send("query features",{uid:t.tile.uid,x:t.x,y:t.y,scale:t.scale,tileSize:t.tileSize,source:this.id,params:r},i,t.tile.workerID):i(null,[])},exports._vectorFeaturesIn=function(e,r,i){if(!this._pyramid)return i(null,[]);var t=this._pyramid.tilesIn(e);return t?void util.asyncAll(t,function(e,i){this.dispatcher.send("query features",{uid:e.tile.uid,source:this.id,minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY,params:r},i,e.tile.workerID)}.bind(this),function(e,r){i(e,Array.prototype.concat.apply([],r))}):i(null,[])},exports.create=function(e){var r={vector:require("./vector_tile_source"),raster:require("./raster_tile_source"),geojson:require("./geojson_source"),video:require("./video_source"),image:require("./image_source")};return exports.is(e)?e:new r[e.type](e)},exports.is=function(e){var r={vector:require("./vector_tile_source"),raster:require("./raster_tile_source"),geojson:require("./geojson_source"),video:require("./video_source"),image:require("./image_source")};for(var i in r)if(e instanceof r[i])return!0;return!1};
},{"../util/ajax":86,"../util/browser":87,"../util/mapbox":96,"../util/util":98,"./geojson_source":28,"./image_source":30,"./raster_tile_source":31,"./tile_coord":34,"./tile_pyramid":35,"./vector_tile_source":36,"./video_source":37}],33:[function(require,module,exports){
"use strict";function Tile(t,e,i){this.coord=t,this.uid=util.uniqueId(),this.loaded=!1,this.isUnloaded=!1,this.uses=0,this.tileSize=e,this.sourceMaxZoom=i,this.buckets={}}function unserializeBuckets(t){for(var e={},i=0;i<t.length;i++){var o=Bucket.create(t[i]);e[o.id]=o}return e}var util=require("../util/util"),Bucket=require("../data/bucket");module.exports=Tile,Tile.prototype={pixelsToTileUnits:function(t,e){return t*(Bucket.EXTENT/(this.tileSize*Math.pow(2,e-this.coord.z)))},positionAt:function(t){var e=t.zoomTo(Math.min(this.coord.z,this.sourceMaxZoom));return{x:(e.column-this.coord.x)*Bucket.EXTENT,y:(e.row-this.coord.y)*Bucket.EXTENT}},loadVectorData:function(t){this.loaded=!0,t&&(this.buckets=unserializeBuckets(t.buckets))},reloadSymbolData:function(t,e){if(!this.isUnloaded){var i=unserializeBuckets(t.buckets);for(var o in i){var s=i[o],r=this.buckets[o];r.destroy(e.gl),this.buckets[o]=s}}},unloadVectorData:function(t){for(var e in this.buckets){var i=this.buckets[e];i.destroy(t.gl)}this.buckets=null,this.loaded=!1,this.isUnloaded=!0},redoPlacement:function(t){function e(e,i){this.reloadSymbolData(i,t.map.painter),t.fire("tile.load",{tile:this}),this.redoingPlacement=!1,this.redoWhenDone&&(this.redoPlacement(t),this.redoWhenDone=!1)}return!this.loaded||this.redoingPlacement?void(this.redoWhenDone=!0):(this.redoingPlacement=!0,void t.dispatcher.send("redo placement",{uid:this.uid,source:t.id,angle:t.map.transform.angle,pitch:t.map.transform.pitch,collisionDebug:t.map.collisionDebug},e.bind(this),this.workerID))},getBucket:function(t){return this.buckets&&this.buckets[t.ref||t.id]}};
},{"../data/bucket":1,"../util/util":98}],34:[function(require,module,exports){
"use strict";function TileCoord(t,i,o,r){isNaN(r)&&(r=0),this.z=+t,this.x=+i,this.y=+o,this.w=+r,r*=2,0>r&&(r=-1*r-1);var e=1<<this.z;this.id=32*(e*e*r+e*this.y+this.x)+this.z}function edge(t,i){if(t.row>i.row){var o=t;t=i,i=o}return{x0:t.column,y0:t.row,x1:i.column,y1:i.row,dx:i.column-t.column,dy:i.row-t.row}}function scanSpans(t,i,o,r,e){var n=Math.max(o,Math.floor(i.y0)),h=Math.min(r,Math.ceil(i.y1));if(t.x0===i.x0&&t.y0===i.y0?t.x0+i.dy/t.dy*t.dx<i.x1:t.x1-i.dy/t.dy*t.dx<i.x0){var s=t;t=i,i=s}for(var d=t.dx/t.dy,a=i.dx/i.dy,l=t.dx>0,y=i.dx<0,c=n;h>c;c++){var x=d*Math.max(0,Math.min(t.dy,c+l-t.y0))+t.x0,u=a*Math.max(0,Math.min(i.dy,c+y-i.y0))+i.x0;e(Math.floor(u),Math.ceil(x),c)}}function scanTriangle(t,i,o,r,e,n){var h,s=edge(t,i),d=edge(i,o),a=edge(o,t);s.dy>d.dy&&(h=s,s=d,d=h),s.dy>a.dy&&(h=s,s=a,a=h),d.dy>a.dy&&(h=d,d=a,a=h),s.dy&&scanSpans(a,s,r,e,n),d.dy&&scanSpans(a,d,r,e,n)}var Coordinate=require("../geo/coordinate");module.exports=TileCoord,TileCoord.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},TileCoord.prototype.toCoordinate=function(){var t=this.z,i=Math.pow(2,t),o=this.y,r=this.x+i*this.w;return new Coordinate(r,o,t)},TileCoord.fromID=function(t){var i=t%32,o=1<<i,r=(t-i)/32,e=r%o,n=(r-e)/o%o,h=Math.floor(r/(o*o));return h%2!==0&&(h=-1*h-1),h/=2,new TileCoord(i,e,n,h)},TileCoord.prototype.url=function(t,i){return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",Math.min(this.z,i||this.z)).replace("{x}",this.x).replace("{y}",this.y)},TileCoord.prototype.parent=function(t){return 0===this.z?null:this.z>t?new TileCoord(this.z-1,this.x,this.y,this.w):new TileCoord(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},TileCoord.prototype.wrapped=function(){return new TileCoord(this.z,this.x,this.y,0)},TileCoord.prototype.children=function(t){if(this.z>=t)return[new TileCoord(this.z+1,this.x,this.y,this.w)];var i=this.z+1,o=2*this.x,r=2*this.y;return[new TileCoord(i,o,r,this.w),new TileCoord(i,o+1,r,this.w),new TileCoord(i,o,r+1,this.w),new TileCoord(i,o+1,r+1,this.w)]},TileCoord.cover=function(t,i,o){function r(t,i,r){var h,s,d;if(r>=0&&e>=r)for(h=t;i>h;h++)s=(h%e+e)%e,d=new TileCoord(o,s,r,Math.floor(h/e)),n[d.id]=d}var e=1<<t,n={};return scanTriangle(i[0],i[1],i[2],0,e,r),scanTriangle(i[2],i[3],i[0],0,e,r),Object.keys(n).map(function(t){return n[t]})};
},{"../geo/coordinate":9}],35:[function(require,module,exports){
"use strict";function TilePyramid(e){this.tileSize=e.tileSize,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this.roundZoom=e.roundZoom,this.reparseOverscaled=e.reparseOverscaled,this._load=e.load,this._abort=e.abort,this._unload=e.unload,this._add=e.add,this._remove=e.remove,this._redoPlacement=e.redoPlacement,this._tiles={},this._cache=new Cache(0,function(e){return this._unload(e)}.bind(this)),this._filterRendered=this._filterRendered.bind(this)}function compareKeyZoom(e,i){return e%32-i%32}var Tile=require("./tile"),TileCoord=require("./tile_coord"),Point=require("point-geometry"),Cache=require("../util/lru_cache"),util=require("../util/util"),EXTENT=require("../data/bucket").EXTENT;module.exports=TilePyramid,TilePyramid.prototype={loaded:function(){for(var e in this._tiles)if(!this._tiles[e].loaded&&!this._tiles[e].errored)return!1;return!0},orderedIDs:function(){return Object.keys(this._tiles).map(Number).sort(compareKeyZoom)},renderedIDs:function(){return this.orderedIDs().filter(this._filterRendered)},_filterRendered:function(e){return this._tiles[e].loaded&&!this._coveredTiles[e]},reload:function(){this._cache.reset();for(var e in this._tiles)this._load(this._tiles[e])},getTile:function(e){return this._tiles[e]},getZoom:function(e){return e.zoom+Math.log(e.tileSize/this.tileSize)/Math.LN2},coveringZoomLevel:function(e){return(this.roundZoom?Math.round:Math.floor)(this.getZoom(e))},coveringTiles:function(e){var i=this.coveringZoomLevel(e),t=i;if(i<this.minzoom)return[];i>this.maxzoom&&(i=this.maxzoom);var o=e,r=o.locationCoordinate(o.center)._zoomTo(i),s=new Point(r.column-.5,r.row-.5);return TileCoord.cover(i,[o.pointCoordinate(new Point(0,0))._zoomTo(i),o.pointCoordinate(new Point(o.width,0))._zoomTo(i),o.pointCoordinate(new Point(o.width,o.height))._zoomTo(i),o.pointCoordinate(new Point(0,o.height))._zoomTo(i)],this.reparseOverscaled?t:i).sort(function(e,i){return s.dist(e)-s.dist(i)})},findLoadedChildren:function(e,i,t){var o=!1;for(var r in this._tiles){var s=this._tiles[r];if(!(t[r]||!s.loaded||s.coord.z<=e.z||s.coord.z>i)){var n=Math.pow(2,Math.min(s.coord.z,this.maxzoom)-Math.min(e.z,this.maxzoom));if(Math.floor(s.coord.x/n)===e.x&&Math.floor(s.coord.y/n)===e.y)for(t[r]=!0,o=!0;s&&s.coord.z-1>e.z;){var a=s.coord.parent(this.maxzoom).id;s=this._tiles[a],s&&s.loaded&&(delete t[r],t[a]=!0)}}}return o},findLoadedParent:function(e,i,t){for(var o=e.z-1;o>=i;o--){e=e.parent(this.maxzoom);var r=this._tiles[e.id];if(r&&r.loaded)return t[e.id]=!0,r;if(this._cache.has(e.id))return this.addTile(e),t[e.id]=!0,this._tiles[e.id]}},updateCacheSize:function(e){var i=Math.ceil(e.width/e.tileSize)+1,t=Math.ceil(e.height/e.tileSize)+1,o=i*t,r=5;this._cache.setMaxSize(Math.floor(o*r))},update:function(e,i,t){var o,r,s;this.updateCacheSize(i);var n=(this.roundZoom?Math.round:Math.floor)(this.getZoom(i)),a=Math.max(n-10,this.minzoom),d=Math.max(n+3,this.minzoom),h={},l=(new Date).getTime();this._coveredTiles={};var m=e?this.coveringTiles(i):[];for(o=0;o<m.length;o++)r=m[o],s=this.addTile(r),h[r.id]=!0,s.loaded||this.findLoadedChildren(r,d,h)||this.findLoadedParent(r,a,h);for(var c={},u=Object.keys(h),f=0;f<u.length;f++){var _=u[f];r=TileCoord.fromID(_),s=this._tiles[_],s&&s.timeAdded>l-(t||0)&&(this.findLoadedChildren(r,d,h)&&(h[_]=!0),this.findLoadedParent(r,a,c))}var v;for(v in c)h[v]||(this._coveredTiles[v]=!0);for(v in c)h[v]=!0;var z=util.keysDifference(this._tiles,h);for(o=0;o<z.length;o++)this.removeTile(+z[o]);this.transform=i},addTile:function(e){var i=this._tiles[e.id];if(i)return i;var t=e.wrapped();if(i=this._tiles[t.id],i||(i=this._cache.get(t.id),i&&this._redoPlacement&&this._redoPlacement(i)),!i){var o=e.z,r=o>this.maxzoom?Math.pow(2,o-this.maxzoom):1;i=new Tile(t,this.tileSize*r,this.maxzoom),this._load(i)}return i.uses++,this._tiles[e.id]=i,this._add(i,e),i},removeTile:function(e){var i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._remove(i),i.uses>0||(i.loaded?this._cache.add(i.coord.wrapped().id,i):(this._abort(i),this._unload(i))))},clearTiles:function(){for(var e in this._tiles)this.removeTile(e);this._cache.reset()},tileAt:function(e){for(var i=this.orderedIDs(),t=0;t<i.length;t++){var o=this._tiles[i[t]],r=o.positionAt(e);if(r&&r.x>=0&&r.x<EXTENT&&r.y>=0&&r.y<EXTENT)return{tile:o,x:r.x,y:r.y,scale:Math.pow(2,this.transform.zoom-o.coord.z),tileSize:o.tileSize}}},tilesIn:function(e){for(var i=[],t=this.orderedIDs(),o=0;o<t.length;o++){var r=this._tiles[t[o]],s=[r.positionAt(e[0]),r.positionAt(e[1])];s[0].x<EXTENT&&s[0].y<EXTENT&&s[1].x>=0&&s[1].y>=0&&i.push({tile:r,minX:s[0].x,maxX:s[1].x,minY:s[0].y,maxY:s[1].y})}return i}};
},{"../data/bucket":1,"../util/lru_cache":95,"../util/util":98,"./tile":33,"./tile_coord":34,"point-geometry":151}],36:[function(require,module,exports){
"use strict";function VectorTileSource(e){if(util.extend(this,util.pick(e,["url","tileSize"])),this._options=util.extend({type:"vector"},e),512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");Source._loadTileJSON.call(this,e)}var util=require("../util/util"),Evented=require("../util/evented"),Source=require("./source"),normalizeURL=require("../util/mapbox").normalizeTileURL;module.exports=VectorTileSource,VectorTileSource.prototype=util.inherit(Evented,{minzoom:0,maxzoom:22,tileSize:512,reparseOverscaled:!0,_loaded:!1,isTileClipped:!0,onAdd:function(e){this.map=e},loaded:function(){return this._pyramid&&this._pyramid.loaded()},update:function(e){this._pyramid&&this._pyramid.update(this.used,e)},reload:function(){this._pyramid&&this._pyramid.reload()},serialize:function(){return util.extend({},this._options)},getVisibleCoordinates:Source._getVisibleCoordinates,getTile:Source._getTile,featuresAt:Source._vectorFeaturesAt,featuresIn:Source._vectorFeaturesIn,_loadTile:function(e){var i=e.coord.z>this.maxzoom?Math.pow(2,e.coord.z-this.maxzoom):1,t={url:normalizeURL(e.coord.url(this.tiles,this.maxzoom),this.url),uid:e.uid,coord:e.coord,zoom:e.coord.z,tileSize:this.tileSize*i,source:this.id,overscaling:i,angle:this.map.transform.angle,pitch:this.map.transform.pitch,collisionDebug:this.map.collisionDebug};e.workerID?this.dispatcher.send("reload tile",t,this._tileLoaded.bind(this,e),e.workerID):e.workerID=this.dispatcher.send("load tile",t,this._tileLoaded.bind(this,e))},_tileLoaded:function(e,i,t){if(!e.aborted){if(i)return e.errored=!0,void this.fire("tile.error",{tile:e,error:i});e.loadVectorData(t),e.redoWhenDone&&(e.redoWhenDone=!1,e.redoPlacement(this)),this.fire("tile.load",{tile:e}),this.fire("tile.stats",t.bucketStats)}},_abortTile:function(e){e.aborted=!0,this.dispatcher.send("abort tile",{uid:e.uid,source:this.id},null,e.workerID)},_addTile:function(e){this.fire("tile.add",{tile:e})},_removeTile:function(e){this.fire("tile.remove",{tile:e})},_unloadTile:function(e){e.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:e.uid,source:this.id},null,e.workerID)},redoPlacement:Source.redoPlacement,_redoTilePlacement:function(e){e.redoPlacement(this)}});
},{"../util/evented":92,"../util/mapbox":96,"../util/util":98,"./source":32}],37:[function(require,module,exports){
"use strict";function VideoSource(e){this.urls=e.urls,this.coordinates=e.coordinates,ajax.getVideo(e.urls,function(t,i){if(!t){this.video=i,this.video.loop=!0;var r;this.video.addEventListener("playing",function(){r=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(r)}.bind(this)),this._loaded=!0,this.map&&(this.video.play(),this.setCoordinates(e.coordinates))}}.bind(this))}var util=require("../util/util"),Tile=require("./tile"),LngLat=require("../geo/lng_lat"),Point=require("point-geometry"),Evented=require("../util/evented"),ajax=require("../util/ajax"),EXTENT=require("../data/bucket").EXTENT;module.exports=VideoSource,VideoSource.prototype=util.inherit(Evented,{roundZoom:!0,getVideo:function(){return this.video},onAdd:function(e){this.map=e,this.video&&(this.video.play(),this.setCoordinates(this.coordinates))},setCoordinates:function(e){this.coordinates=e;var t=this.map,i=e.map(function(e){return t.transform.locationCoordinate(LngLat.convert(e)).zoomTo(0)}),r=this.centerCoord=util.getCoordinatesCenter(i),o=i.map(function(e){var t=e.zoomTo(r.zoom);return new Point(Math.round((t.column-r.column)*EXTENT),Math.round((t.row-r.row)*EXTENT))}),n=t.painter.gl,s=32767,a=new Int16Array([o[0].x,o[0].y,0,0,o[1].x,o[1].y,s,0,o[3].x,o[3].y,0,s,o[2].x,o[2].y,s,s]);return this.tile=new Tile,this.tile.buckets={},this.tile.boundsBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this.tile.boundsBuffer),n.bufferData(n.ARRAY_BUFFER,a,n.STATIC_DRAW),this.fire("change"),this},loaded:function(){return this.video&&this.video.readyState>=2},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&!(this.video.readyState<2)){var e=this.map.painter.gl;this.tile.texture?(e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.video)):(this.tile.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},getVisibleCoordinates:function(){return this.centerCoord?[this.centerCoord]:[]},getTile:function(){return this.tile},featuresAt:function(e,t,i){return i(null,[])},featuresIn:function(e,t,i){return i(null,[])},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}});
},{"../data/bucket":1,"../geo/lng_lat":10,"../util/ajax":86,"../util/evented":92,"../util/util":98,"./tile":33,"point-geometry":151}],38:[function(require,module,exports){
"use strict";function Worker(e){this.self=e,this.actor=new Actor(e,this),this.loading={},this.loaded={},this.layers=[],this.geoJSONIndexes={}}var Actor=require("../util/actor"),WorkerTile=require("./worker_tile"),util=require("../util/util"),ajax=require("../util/ajax"),vt=require("vector-tile"),Protobuf=require("pbf"),supercluster=require("supercluster"),geojsonvt=require("geojson-vt"),GeoJSONWrapper=require("./geojson_wrapper");module.exports=function(e){return new Worker(e)},util.extend(Worker.prototype,{"set layers":function(e){this.layers=e},"update layers":function(e){var r,t={};for(r=0;r<e.length;r++)t[e[r].id]=e[r];for(r=0;r<this.layers.length;r++)this.layers[r]=t[this.layers[r].id]||this.layers[r]},"load tile":function(e,r){function t(e,t){return delete this.loading[i][o],e?r(e):(a.data=new vt.VectorTile(new Protobuf(new Uint8Array(t))),a.parse(a.data,this.layers,this.actor,r),this.loaded[i]=this.loaded[i]||{},void(this.loaded[i][o]=a))}var i=e.source,o=e.uid;this.loading[i]||(this.loading[i]={});var a=this.loading[i][o]=new WorkerTile(e);a.xhr=ajax.getArrayBuffer(e.url,t.bind(this))},"reload tile":function(e,r){var t=this.loaded[e.source],i=e.uid;if(t&&t[i]){var o=t[i];o.parse(o.data,this.layers,this.actor,r)}},"abort tile":function(e){var r=this.loading[e.source],t=e.uid;r&&r[t]&&(r[t].xhr.abort(),delete r[t])},"remove tile":function(e){var r=this.loaded[e.source],t=e.uid;r&&r[t]&&delete r[t]},"redo placement":function(e,r){var t=this.loaded[e.source],i=this.loading[e.source],o=e.uid;if(t&&t[o]){var a=t[o],s=a.redoPlacement(e.angle,e.pitch,e.collisionDebug);s.result&&r(null,s.result,s.transferables)}else i&&i[o]&&(i[o].angle=e.angle)},"parse geojson":function(e,r){var t=function(t,i){if(t)return r(t);if("object"!=typeof i)return r(new Error("Input data is not a valid GeoJSON object."));try{this.geoJSONIndexes[e.source]=e.cluster?supercluster(e.superclusterOptions).load(i.features):geojsonvt(i,e.geojsonVtOptions)}catch(t){return r(t)}r(null)}.bind(this);"string"==typeof e.data?ajax.getJSON(e.data,t):t(null,e.data)},"load geojson tile":function(e,r){var t=e.source,i=e.coord;if(!this.geoJSONIndexes[t])return r(null,null);var o=this.geoJSONIndexes[t].getTile(Math.min(i.z,e.maxZoom),i.x,i.y);if(!o)return r(null,null);var a=new WorkerTile(e);a.parse(new GeoJSONWrapper(o.features),this.layers,this.actor,r),this.loaded[t]=this.loaded[t]||{},this.loaded[t][e.uid]=a},"query features":function(e,r){var t=this.loaded[e.source]&&this.loaded[e.source][e.uid];t?t.featureTree.query(e,r):r(null,[])}});
},{"../util/actor":85,"../util/ajax":86,"../util/util":98,"./geojson_wrapper":29,"./worker_tile":39,"geojson-vt":108,"pbf":149,"supercluster":155,"vector-tile":157}],39:[function(require,module,exports){
"use strict";function WorkerTile(e){this.coord=e.coord,this.uid=e.uid,this.zoom=e.zoom,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=e.overscaling,this.angle=e.angle,this.pitch=e.pitch,this.collisionDebug=e.collisionDebug}function filterEmptyBuckets(e){return e.filter(function(e){for(var t in e.buffers)if(e.buffers[t].length>0)return!0;return!1})}function getTransferables(e){var t=[];for(var r in e)for(var i in e.buffers)t.push(e[r].buffers[i].arrayBuffer);return t}var FeatureTree=require("../data/feature_tree"),CollisionTile=require("../symbol/collision_tile"),Bucket=require("../data/bucket");module.exports=WorkerTile,WorkerTile.prototype.parse=function(e,t,r,i){function o(e,t){for(var r=0;r<e.length;r++){var i=e.feature(r);for(var o in t)t[o].filter(i)&&t[o].features.push(i)}}function s(e){if(e)return i(e);if(B++,2===B){for(var t=v.length-1;t>=0;t--)n(g,v[t]);a()}}function n(e,t){var r=Date.now();t.populateBuffers(y,T,z);var i=Date.now()-r;if(t.interactive)for(var o=0;o<t.features.length;o++){var s=t.features[o];e.featureTree.insert(s.bbox(),t.layers,s)}t.features=null,h._total+=i,h[t.id]=(h[t.id]||0)+i}function a(){g.status="done",g.redoPlacementAfterDone&&(g.redoPlacement(g.angle,g.pitch,null),g.redoPlacementAfterDone=!1),d=filterEmptyBuckets(d),i(null,{buckets:d.map(function(e){return e.serialize()}),bucketStats:h},getTransferables(d))}this.status="parsing",this.featureTree=new FeatureTree(this.coord,this.overscaling);var l,u,f,c,h={_total:0},g=this,m={},p={};for(l=0;l<t.length;l++)u=t[l],u.source===this.source&&(u.ref||u.minzoom&&this.zoom<u.minzoom||u.maxzoom&&this.zoom>=u.maxzoom||u.layout&&"none"===u.layout.visibility||(c=Bucket.create({layer:u,zoom:this.zoom,overscaling:this.overscaling,collisionDebug:this.collisionDebug}),c.createFilter(),m[u.id]=c,e.layers&&(f=u["source-layer"],p[f]=p[f]||{},p[f][u.id]=c)));for(l=0;l<t.length;l++)u=t[l],u.source===this.source&&u.ref&&m[u.ref]&&m[u.ref].layers.push(u.id);if(e.layers)for(f in p)u=e.layers[f],u&&o(u,p[f]);else o(e,m);var d=[],v=this.symbolBuckets=[],b=[],y=new CollisionTile(this.angle,this.pitch);for(var k in m)c=m[k],0!==c.features.length&&(d.push(c),"symbol"===c.type?v.push(c):b.push(c));var z={},T={},B=0;if(v.length>0){for(l=v.length-1;l>=0;l--)v[l].updateIcons(z),v[l].updateFont(T);for(var D in T)T[D]=Object.keys(T[D]).map(Number);z=Object.keys(z),r.send("get glyphs",{uid:this.uid,stacks:T},function(e,t){T=t,s(e)}),z.length?r.send("get icons",{icons:z},function(e,t){z=t,s(e)}):s()}for(l=b.length-1;l>=0;l--)n(this,b[l]);return 0===v.length?a():void 0},WorkerTile.prototype.redoPlacement=function(e,t,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=e,{};for(var i=new CollisionTile(e,t),o=this.symbolBuckets,s=o.length-1;s>=0;s--)o[s].placeFeatures(i,r);return o=filterEmptyBuckets(o),{result:{buckets:o.map(function(e){return e.serialize()})},transferables:getTransferables(o)}};
},{"../data/bucket":1,"../data/feature_tree":7,"../symbol/collision_tile":61}],40:[function(require,module,exports){
"use strict";function AnimationLoop(){this.n=0,this.times=[]}module.exports=AnimationLoop,AnimationLoop.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},AnimationLoop.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},AnimationLoop.prototype.cancel=function(t){this.times=this.times.filter(function(i){return i.id!==t})};
},{}],41:[function(require,module,exports){
"use strict";function ImageSprite(t){this.base=t,this.retina=browser.devicePixelRatio>1;var i=this.retina?"@2x":"";ajax.getJSON(normalizeURL(t,i,".json"),function(t,i){return t?void this.fire("error",{error:t}):(this.data=i,void(this.img&&this.fire("load")))}.bind(this)),ajax.getImage(normalizeURL(t,i,".png"),function(t,i){if(t)return void this.fire("error",{error:t});for(var e=i.getData(),r=i.data=new Uint8Array(e.length),a=0;a<e.length;a+=4){var o=e[a+3]/255;r[a+0]=e[a+0]*o,r[a+1]=e[a+1]*o,r[a+2]=e[a+2]*o,r[a+3]=e[a+3]}this.img=i,this.data&&this.fire("load")}.bind(this))}function SpritePosition(){}var Evented=require("../util/evented"),ajax=require("../util/ajax"),browser=require("../util/browser"),normalizeURL=require("../util/mapbox").normalizeSpriteURL;module.exports=ImageSprite,ImageSprite.prototype=Object.create(Evented),ImageSprite.prototype.toJSON=function(){return this.base},ImageSprite.prototype.loaded=function(){return!(!this.data||!this.img)},ImageSprite.prototype.resize=function(){if(browser.devicePixelRatio>1!==this.retina){var t=new ImageSprite(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},SpritePosition.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},ImageSprite.prototype.getSpritePosition=function(t){if(!this.loaded())return new SpritePosition;var i=this.data&&this.data[t];return i&&this.img?i:new SpritePosition};
},{"../util/ajax":86,"../util/browser":87,"../util/evented":92,"../util/mapbox":96}],42:[function(require,module,exports){
"use strict";function parseColor(r){if(colorCache[r])return colorCache[r];if(Array.isArray(r))return r;if(r&&r.stops)return util.extend({},r,{stops:r.stops.map(parseFunctionStopColor)});if("string"==typeof r){var o=parseCSSColor(r);if(!o)throw new Error("Invalid color "+r);var e=colorDowngrade(o);return colorCache[r]=e,e}throw new Error("Invalid color "+r)}function parseFunctionStopColor(r){return[r[0],parseColor(r[1])]}function colorDowngrade(r){return[r[0]/255,r[1]/255,r[2]/255,r[3]/1]}var parseCSSColor=require("csscolorparser").parseCSSColor,util=require("../util/util"),colorCache={};module.exports=parseColor;
},{"../util/util":98,"csscolorparser":104}],43:[function(require,module,exports){
"use strict";function Style(e,t){this.animationLoop=t||new AnimationLoop,this.dispatcher=new Dispatcher(Math.max(browser.hardwareConcurrency-1,1),this),this.spriteAtlas=new SpriteAtlas(512,512),this.lineAtlas=new LineAtlas(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},util.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this);var r=function(e,t){if(e)return void this.fire("error",{error:e});if(!validateStyle.emitErrors(this,validateStyle(t))){this._loaded=!0,this.stylesheet=t;var r=t.sources;for(var i in r)this.addSource(i,r[i]);t.sprite&&(this.sprite=new ImageSprite(t.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new GlyphSource(t.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof e?ajax.getJSON(normalizeURL(e),r):browser.frame(r.bind(this,null,e)),this.on("source.load",function(e){var t=e.source;if(t&&t.vectorLayerIds)for(var r in this._layers){var i=this._layers[r];i.source===t.id&&this._validateLayer(i)}})}var Evented=require("../util/evented"),styleBatch=require("./style_batch"),StyleLayer=require("./style_layer"),ImageSprite=require("./image_sprite"),GlyphSource=require("../symbol/glyph_source"),SpriteAtlas=require("../symbol/sprite_atlas"),LineAtlas=require("../render/line_atlas"),util=require("../util/util"),ajax=require("../util/ajax"),normalizeURL=require("../util/mapbox").normalizeStyleURL,browser=require("../util/browser"),Dispatcher=require("../util/dispatcher"),AnimationLoop=require("./animation_loop"),validateStyle=require("./validate_style");module.exports=Style,Style.prototype=util.inherit(Evented,{_loaded:!1,_validateLayer:function(e){var t=this.sources[e.source];e.sourceLayer&&t&&t.vectorLayerIds&&-1===t.vectorLayerIds.indexOf(e.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+e.sourceLayer+'" does not exist on source "'+t.id+'" as specified by style layer "'+e.id+'"')})},loaded:function(){if(!this._loaded)return!1;for(var e in this.sources)if(!this.sources[e].loaded())return!1;return!this.sprite||this.sprite.loaded()},_resolve:function(){var e,t;this._layers={},this._order=this.stylesheet.layers.map(function(e){return e.id});for(var r=0;r<this.stylesheet.layers.length;r++)t=this.stylesheet.layers[r],t.ref||(e=StyleLayer.create(t),this._layers[e.id]=e,e.on("error",this._forwardLayerEvent));for(var i=0;i<this.stylesheet.layers.length;i++)if(t=this.stylesheet.layers[i],t.ref){var s=this.getLayer(t.ref);e=StyleLayer.create(t,s),this._layers[e.id]=e,e.on("error",this._forwardLayerEvent)}this._groupLayers(),this._broadcastLayers()},_groupLayers:function(){var e;this._groups=[];for(var t=0;t<this._order.length;++t){var r=this._layers[this._order[t]];e&&r.source===e.source||(e=[],e.source=r.source,this._groups.push(e)),e.push(r)}},_broadcastLayers:function(e){this.dispatcher.broadcast(e?"update layers":"set layers",this._serializeLayers(e))},_serializeLayers:function(e){e=e||this._order;for(var t=[],r={includeRefProperties:!0},i=0;i<e.length;i++)t.push(this._layers[e[i]].serialize(r));return t},_cascade:function(e,t){if(this._loaded){t=t||{transition:!0};for(var r in this._layers)this._layers[r].cascade(e,t,this.stylesheet.transition||{},this.animationLoop);this.fire("change")}},_recalculate:function(e){for(var t in this.sources)this.sources[t].used=!1;this._updateZoomHistory(e),this.rasterFadeDuration=300;for(var r in this._layers){var i=this._layers[r];i.recalculate(e,this.zoomHistory),!i.isHidden(e)&&i.source&&(this.sources[i.source].used=!0)}var s=300;Math.floor(this.z)!==Math.floor(e)&&this.animationLoop.set(s),this.z=e,this.fire("zoom")},_updateZoomHistory:function(e){var t=this.zoomHistory;void 0===t.lastIntegerZoom&&(t.lastIntegerZoom=Math.floor(e),t.lastIntegerZoomTime=0,t.lastZoom=e),Math.floor(t.lastZoom)<Math.floor(e)?(t.lastIntegerZoom=Math.floor(e),t.lastIntegerZoomTime=Date.now()):Math.floor(t.lastZoom)>Math.floor(e)&&(t.lastIntegerZoom=Math.floor(e+1),t.lastIntegerZoomTime=Date.now()),t.lastZoom=e},batch:function(e){styleBatch(this,e)},addSource:function(e,t){return this.batch(function(r){r.addSource(e,t)}),this},removeSource:function(e){return this.batch(function(t){t.removeSource(e)}),this},getSource:function(e){return this.sources[e]},addLayer:function(e,t){return this.batch(function(r){r.addLayer(e,t)}),this},removeLayer:function(e){return this.batch(function(t){t.removeLayer(e)}),this},getLayer:function(e){return this._layers[e]},getReferentLayer:function(e){var t=this.getLayer(e);return t.ref&&(t=this.getLayer(t.ref)),t},setFilter:function(e,t){return this.batch(function(r){r.setFilter(e,t)}),this},setLayerZoomRange:function(e,t,r){return this.batch(function(i){i.setLayerZoomRange(e,t,r)}),this},getFilter:function(e){return this.getReferentLayer(e).filter},getLayoutProperty:function(e,t){return this.getReferentLayer(e).getLayoutProperty(t)},getPaintProperty:function(e,t,r){return this.getLayer(e).getPaintProperty(t,rLine truncated
},{"../render/line_atlas":25,"../symbol/glyph_source":64,"../symbol/sprite_atlas":69,"../util/ajax":86,"../util/browser":87,"../util/dispatcher":89,"../util/evented":92,"../util/mapbox":96,"../util/util":98,"./animation_loop":40,"./image_sprite":41,"./style_batch":44,"./style_layer":46,"./validate_style":55}],44:[function(require,module,exports){
"use strict";function styleBatch(e,t){if(!e._loaded)throw new Error("Style is not done loading");var r=Object.create(styleBatch.prototype);if(r._style=e,r._groupLayers=!1,r._updateAllLayers=!1,r._updatedLayers={},r._updatedSources={},r._events=[],r._change=!1,t(r),r._groupLayers&&r._style._groupLayers(),r._updateAllLayers)r._style._broadcastLayers();else{var s=Object.keys(r._updatedLayers);s.length&&r._style._broadcastLayers(s)}Object.keys(r._updatedSources).forEach(function(e){r._style._reloadSource(e)}),r._events.forEach(function(e){r._style.fire.apply(r._style,e)}),r._change&&r._style.fire("change")}var Source=require("../source/source"),StyleLayer=require("./style_layer"),validateStyle=require("./validate_style"),styleSpec=require("./style_spec"),util=require("../util/util");styleBatch.prototype={addLayer:function(e,t){if(!(e instanceof StyleLayer)){if(validateStyle.emitErrors(this._style,validateStyle.layer({key:"layers."+e.id,value:e,style:this._style.serialize(),styleSpec:styleSpec,arrayIndex:-1})))return this;var r=e.ref&&this._style.getLayer(e.ref);e=StyleLayer.create(e,r)}return this._style._validateLayer(e),e.on("error",this._style._forwardLayerEvent),this._style._layers[e.id]=e,this._style._order.splice(t?this._style._order.indexOf(t):1/0,0,e.id),this._groupLayers=!0,this._updateAllLayers=!0,e.source&&(this._updatedSources[e.source]=!0),this._events.push(["layer.add",{layer:e}]),this._change=!0,this},removeLayer:function(e){var t=this._style._layers[e];if(void 0===t)throw new Error("There is no layer with this ID");for(var r in this._style._layers)this._style._layers[r].ref===e&&this.removeLayer(r);return t.off("error",this._style._forwardLayerEvent),delete this._style._layers[e],this._style._order.splice(this._style._order.indexOf(e),1),this._groupLayers=!0,this._updateAllLayers=!0,this._events.push(["layer.remove",{layer:t}]),this._change=!0,this},setPaintProperty:function(e,t,r,s){return this._style.getLayer(e).setPaintProperty(t,r,s),this._change=!0,this},setLayoutProperty:function(e,t,r){var s=this._style.getReferentLayer(e);return s.getLayoutProperty(t)===r?this:(s.setLayoutProperty(t,r),this._updatedLayers[e]=!0,s.source&&(this._updatedSources[s.source]=!0),this._change=!0,this)},setFilter:function(e,t){if(validateStyle.emitErrors(this._style,validateStyle.filter({key:"layers."+e+".filter",value:t,style:this._style.serialize(),styleSpec:styleSpec})))return this;var r=this._style.getReferentLayer(e);return util.deepEqual(r.filter,t)?this:(r.filter=t,this._updatedLayers[e]=!0,r.source&&(this._updatedSources[r.source]=!0),this._change=!0,this)},setLayerZoomRange:function(e,t,r){var s=this._style.getReferentLayer(e);return s.minzoom===t&&s.maxzoom===r?this:(null!=t&&(s.minzoom=t),null!=r&&(s.maxzoom=r),this._updatedLayers[e]=!0,s.source&&(this._updatedSources[s.source]=!0),this._change=!0,this)},addSource:function(e,t){if(!this._style._loaded)throw new Error("Style is not done loading");if(void 0!==this._style.sources[e])throw new Error("There is already a source with this ID");return!Source.is(t)&&validateStyle.emitErrors(this._style,validateStyle.source({key:"sources."+e,style:this._style.serialize(),value:t,styleSpec:styleSpec}))?this:(t=Source.create(t),this._style.sources[e]=t,t.id=e,t.style=this._style,t.dispatcher=this._style.dispatcher,t.on("load",this._style._forwardSourceEvent).on("error",this._style._forwardSourceEvent).on("change",this._style._forwardSourceEvent).on("tile.add",this._style._forwardTileEvent).on("tile.load",this._style._forwardTileEvent).on("tile.error",this._style._forwardTileEvent).on("tile.remove",this._style._forwardTileEvent).on("tile.stats",this._style._forwardTileEvent),this._events.push(["source.add",{source:t}]),this._change=!0,this)},removeSource:function(e){if(void 0===this._style.sources[e])throw new Error("There is no source with this ID");var t=this._style.sources[e];return delete this._style.sources[e],t.off("load",this._style._forwardSourceEvent).off("error",this._style._forwardSourceEvent).off("change",this._style._forwardSourceEvent).off("tile.add",this._style._forwardTileEvent).off("tile.load",this._style._forwardTileEvent).off("tile.error",this._style._forwardTileEvent).off("tile.remove",this._style._forwardTileEvent).off("tile.stats",this._style._forwardTileEvent),this._events.push(["source.remove",{source:t}]),this._change=!0,this}},module.exports=styleBatch;
},{"../source/source":32,"../util/util":98,"./style_layer":46,"./style_spec":53,"./validate_style":55}],45:[function(require,module,exports){
"use strict";function StyleDeclaration(t,e){this.type=t.type,this.transitionable=t.transition,this.value=e,this.json=JSON.stringify(this.value);var i="color"===this.type?parseColor(this.value):e;"interpolated"===t["function"]?this.calculate=MapboxGLFunction.interpolated(i):(this.calculate=MapboxGLFunction["piecewise-constant"](i),t.transition&&(this.calculate=transitioned(this.calculate)))}function transitioned(t){return function(e,i,o){var a,n,r,l=e%1,s=Math.min((Date.now()-i.lastIntegerZoomTime)/o,1),c=1,u=1;return e>i.lastIntegerZoom?(a=l+(1-l)*s,c*=2,n=t(e-1),r=t(e)):(a=1-(1-s)*l,r=t(e),n=t(e+1),c/=2),{from:n,fromScale:c,to:r,toScale:u,t:a}}}var MapboxGLFunction=require("mapbox-gl-function"),parseColor=require("./parse_color");module.exports=StyleDeclaration;
},{"./parse_color":42,"mapbox-gl-function":123}],46:[function(require,module,exports){
"use strict";function StyleLayer(t,i){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(i||t).type,this.source=(i||t).source,this.sourceLayer=(i||t)["source-layer"],this.minzoom=(i||t).minzoom,this.maxzoom=(i||t).maxzoom,this.filter=(i||t).filter,this.interactive=(i||t).interactive,this._paintSpecifications=styleSpec["paint_"+this.type],this._layoutSpecifications=styleSpec["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={};for(var e in t){var a=e.match(/^paint(?:\.(.*))?$/);if(a){var r=a[1]||"";for(var n in t[e])this.setPaintProperty(n,t[e][n],r)}}if(this.ref)this._layoutDeclarations=i._layoutDeclarations;else for(var s in t.layout)this.setLayoutProperty(s,t.layout[s])}function getDeclarationValue(t){return t.value}var util=require("../util/util"),StyleTransition=require("./style_transition"),StyleDeclaration=require("./style_declaration"),styleSpec=require("./style_spec"),validateStyle=require("./validate_style"),parseColor=require("./parse_color"),Evented=require("../util/evented");module.exports=StyleLayer;var TRANSITION_SUFFIX="-transition";StyleLayer.create=function(t,i){var e={background:require("./style_layer/background_style_layer"),circle:require("./style_layer/circle_style_layer"),fill:require("./style_layer/fill_style_layer"),line:require("./style_layer/line_style_layer"),raster:require("./style_layer/raster_style_layer"),symbol:require("./style_layer/symbol_style_layer")};return new e[(i||t).type](t,i)},StyleLayer.prototype=util.inherit(Evented,{setLayoutProperty:function(t,i){if(null==i)delete this._layoutDeclarations[t];else{if(validateStyle.emitErrors(this,validateStyle.layoutProperty({key:"layers."+this.id+".layout."+t,layerType:this.type,objectKey:t,value:i,styleSpec:styleSpec})))return;this._layoutDeclarations[t]=new StyleDeclaration(this._layoutSpecifications[t],i)}},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,i,e){var a=this._layoutSpecifications[t],r=this._layoutDeclarations[t];return r?r.calculate(i,e):a["default"]},setPaintProperty:function(t,i,e){var a="layers."+this.id+(e?'["paint.'+e+'"].':".paint.")+t;if(util.endsWith(t,TRANSITION_SUFFIX))if(this._paintTransitionOptions[e||""]||(this._paintTransitionOptions[e||""]={}),null===i||void 0===i)delete this._paintTransitionOptions[e||""][t];else{if(validateStyle.emitErrors(this,validateStyle.paintProperty({key:a,layerType:this.type,objectKey:t,value:i,styleSpec:styleSpec})))return;this._paintTransitionOptions[e||""][t]=i}else if(this._paintDeclarations[e||""]||(this._paintDeclarations[e||""]={}),null===i||void 0===i)delete this._paintDeclarations[e||""][t];else{if(validateStyle.emitErrors(this,validateStyle.paintProperty({key:a,layerType:this.type,objectKey:t,value:i,styleSpec:styleSpec})))return;this._paintDeclarations[e||""][t]=new StyleDeclaration(this._paintSpecifications[t],i)}},getPaintProperty:function(t,i){return i=i||"",util.endsWith(t,TRANSITION_SUFFIX)?this._paintTransitionOptions[i]&&this._paintTransitionOptions[i][t]:this._paintDeclarations[i]&&this._paintDeclarations[i][t]&&this._paintDeclarations[i][t].value},getPaintValue:function(t,i,e){var a=this._paintSpecifications[t],r=this._paintTransitions[t];return r?r.at(i,e):"color"===a.type&&a["default"]?parseColor(a["default"]):a["default"]},isHidden:function(t){if(this.minzoom&&t<this.minzoom)return!0;if(this.maxzoom&&t>=this.maxzoom)return!0;if("none"===this.getLayoutValue("visibility"))return!0;var i=this.type+"-opacity";return!(!this._paintSpecifications[i]||0!==this.getPaintValue(i))},cascade:function(t,i,e,a){function r(t,r){var o=i.transition?n[t]:void 0;if(o&&o.declaration.json===r.json)s[t]=o;else{var y=new StyleTransition(r,o,util.extend({duration:300,delay:0},e,l.getPaintProperty(t+TRANSITION_SUFFIX)));y.instant()||(y.loopID=a.set(y.endTime-(new Date).getTime())),o&&a.cancel(o.loopID),s[t]=y}}var n=this._paintTransitions,s=this._paintTransitions={},l=this;for(var o in this._paintDeclarations)if(""===o||t[o])for(var y in this._paintDeclarations[o])r(y,this._paintDeclarations[o][y]);for(var u=util.keysDifference(n,s),c=0;c<u.length;c++){var p=this._paintSpecifications[u[c]];r(u[c],new StyleDeclaration(p,p["default"]))}},recalculate:function(t,i){this.paint={};for(var e in this._paintSpecifications)this.paint[e]=this.getPaintValue(e,t,i);this.layout={};for(var a in this._layoutSpecifications)this.layout[a]=this.getLayoutValue(a,t,i)},serialize:function(t){var i={id:this.id,ref:this.ref,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,interactive:this.interactive};for(var e in this._paintDeclarations){var a=""===e?"paint":"paint."+e;i[a]=util.mapObject(this._paintDeclarations[e],getDeclarationValue)}return(!this.ref||t&&t.includeRefProperties)&&util.extend(i,{type:this.type,source:this.source,"source-layer":this.sourceLayer,filter:this.filter,layout:util.mapObject(this._layoutLine truncated
},{"../util/evented":92,"../util/util":98,"./parse_color":42,"./style_declaration":45,"./style_layer/background_style_layer":47,"./style_layer/circle_style_layer":48,"./style_layer/fill_style_layer":49,"./style_layer/line_style_layer":50,"./style_layer/raster_style_layer":51,"./style_layer/symbol_style_layer":52,"./style_spec":53,"./style_transition":54,"./validate_style":55}],47:[function(require,module,exports){
"use strict";function BackgroundStyleLayer(){StyleLayer.apply(this,arguments)}var util=require("../../util/util"),StyleLayer=require("../style_layer");module.exports=BackgroundStyleLayer,BackgroundStyleLayer.prototype=util.inherit(StyleLayer,{});
},{"../../util/util":98,"../style_layer":46}],48:[function(require,module,exports){
"use strict";function CircleStyleLayer(){StyleLayer.apply(this,arguments)}var util=require("../../util/util"),StyleLayer=require("../style_layer");module.exports=CircleStyleLayer,CircleStyleLayer.prototype=util.inherit(StyleLayer,{});
},{"../../util/util":98,"../style_layer":46}],49:[function(require,module,exports){
"use strict";function FillStyleLayer(){StyleLayer.apply(this,arguments)}var util=require("../../util/util"),StyleLayer=require("../style_layer");module.exports=FillStyleLayer,FillStyleLayer.prototype=util.inherit(StyleLayer,{});
},{"../../util/util":98,"../style_layer":46}],50:[function(require,module,exports){
"use strict";function LineStyleLayer(){StyleLayer.apply(this,arguments)}var util=require("../../util/util"),StyleLayer=require("../style_layer");module.exports=LineStyleLayer,LineStyleLayer.prototype=util.inherit(StyleLayer,{getPaintValue:function(e,t){var r=StyleLayer.prototype.getPaintValue.apply(this,arguments);if(r&&"line-dasharray"===e){var a=this.getPaintValue("line-width",Math.floor(t),1/0);r.fromScale*=a,r.toScale*=a}return r}});
},{"../../util/util":98,"../style_layer":46}],51:[function(require,module,exports){
"use strict";function RasterStyleLayer(){StyleLayer.apply(this,arguments)}var util=require("../../util/util"),StyleLayer=require("../style_layer");module.exports=RasterStyleLayer,RasterStyleLayer.prototype=util.inherit(StyleLayer,{});
},{"../../util/util":98,"../style_layer":46}],52:[function(require,module,exports){
"use strict";function SymbolStyleLayer(){StyleLayer.apply(this,arguments)}var util=require("../../util/util"),StyleLayer=require("../style_layer");module.exports=SymbolStyleLayer,SymbolStyleLayer.prototype=util.inherit(StyleLayer,{isHidden:function(){if(StyleLayer.prototype.isHidden.apply(this,arguments))return!0;var t=0===this.paint["text-opacity"]||!this.layout["text-field"],e=0===this.paint["icon-opacity"]||!this.layout["icon-image"];return!(!t||!e)},getLayoutValue:function(t,e,i){return("text-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,i)||this.getLayoutProperty("text-rotation-alignment"))&&("icon-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,i)||this.getLayoutProperty("icon-rotation-alignment"))?StyleLayer.prototype.getLayoutValue.apply(this,arguments):"map"}});
},{"../../util/util":98,"../style_layer":46}],53:[function(require,module,exports){
"use strict";module.exports=require("mapbox-gl-style-spec/reference/latest");
},{"mapbox-gl-style-spec/reference/latest":144}],54:[function(require,module,exports){
"use strict";function StyleTransition(t,i,e){this.declaration=t,this.startTime=this.endTime=(new Date).getTime();var n=t.type;"string"!==n&&"array"!==n||!t.transitionable?this.interp=interpolate[n]:this.interp=interpZoomTransitioned,this.oldTransition=i,this.duration=e.duration||0,this.delay=e.delay||0,this.instant()||(this.endTime=this.startTime+this.duration+this.delay,this.ease=util.easeCubicInOut),i&&i.endTime<=this.startTime&&delete i.oldTransition}function interpZoomTransitioned(t,i,e){return{from:t.to,fromScale:t.toScale,to:i.to,toScale:i.toScale,t:e}}var util=require("../util/util"),interpolate=require("../util/interpolate");module.exports=StyleTransition,StyleTransition.prototype.instant=function(){return!this.oldTransition||!this.interp||0===this.duration&&0===this.delay},StyleTransition.prototype.at=function(t,i,e){var n=this.declaration.calculate(t,i,this.duration);if(this.instant())return n;if(e=e||Date.now(),e<this.endTime){var r=this.oldTransition.at(t,i,this.startTime),a=this.ease((e-this.startTime-this.delay)/this.duration);n=this.interp(r,n,a)}return n};
},{"../util/interpolate":94,"../util/util":98}],55:[function(require,module,exports){
"use strict";module.exports=require("mapbox-gl-style-spec/lib/validate_style.min"),module.exports.emitErrors=function(r,e){if(e&&e.length){for(var t=0;t<e.length;t++)r.fire("error",{error:new Error(e[t].message)});return!0}return!1};
},{"mapbox-gl-style-spec/lib/validate_style.min":143}],56:[function(require,module,exports){
"use strict";function Anchor(t,e,o,n){this.x=t,this.y=e,this.angle=o,void 0!==n&&(this.segment=n)}var Point=require("point-geometry");module.exports=Anchor,Anchor.prototype=Object.create(Point.prototype),Anchor.prototype.clone=function(){return new Anchor(this.x,this.y,this.angle,this.segment)};
},{"point-geometry":151}],57:[function(require,module,exports){
"use strict";function checkMaxAngle(e,t,a,r,n){if(void 0===t.segment)return!0;for(var i=t,s=t.segment+1,f=0;f>-a/2;){if(s--,0>s)return!1;f-=e[s].dist(i),i=e[s]}f+=e[s].dist(e[s+1]),s++;for(var l=[],o=0;a/2>f;){var u=e[s-1],c=e[s],g=e[s+1];if(!g)return!1;var h=u.angleTo(c)-c.angleTo(g);for(h=Math.abs((h+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:f,angleDelta:h}),o+=h;f-l[0].distance>r;)o-=l.shift().angleDelta;if(o>n)return!1;s++,f+=c.dist(g)}return!0}module.exports=checkMaxAngle;
},{}],58:[function(require,module,exports){
"use strict";function clipLine(n,x,y,o,e){for(var r=[],t=0;t<n.length;t++)for(var i,u=n[t],d=0;d<u.length-1;d++){var P=u[d],w=u[d+1];P.x<x&&w.x<x||(P.x<x?P=new Point(x,P.y+(w.y-P.y)*((x-P.x)/(w.x-P.x)))._round():w.x<x&&(w=new Point(x,P.y+(w.y-P.y)*((x-P.x)/(w.x-P.x)))._round()),P.y<y&&w.y<y||(P.y<y?P=new Point(P.x+(w.x-P.x)*((y-P.y)/(w.y-P.y)),y)._round():w.y<y&&(w=new Point(P.x+(w.x-P.x)*((y-P.y)/(w.y-P.y)),y)._round()),P.x>=o&&w.x>=o||(P.x>=o?P=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round():w.x>=o&&(w=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round()),P.y>=e&&w.y>=e||(P.y>=e?P=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round():w.y>=e&&(w=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round()),i&&P.equals(i[i.length-1])||(i=[P],r.push(i)),i.push(w)))))}return r}var Point=require("point-geometry");module.exports=clipLine;
},{"point-geometry":151}],59:[function(require,module,exports){
"use strict";function CollisionBox(i,t,s,h,o,l){this.anchorPoint=i,this.x1=t,this.y1=s,this.x2=h,this.y2=o,this.maxScale=l,this.placementScale=0,this[0]=this[1]=this[2]=this[3]=0}module.exports=CollisionBox;
},{}],60:[function(require,module,exports){
"use strict";function CollisionFeature(i,o,e,t,s,n,r){var l=e.top*t-s,a=e.bottom*t+s,u=e.left*t-s,d=e.right*t+s;if(this.boxes=[],n){var h=a-l,x=d-u;if(0>=h)return;if(h=Math.max(10*t,h),r){var f=i[o.segment+1].sub(i[o.segment])._unit()._mult(x),m=[o.sub(f),o.add(f)];this._addLineCollisionBoxes(m,o,0,x,h)}else this._addLineCollisionBoxes(i,o,o.segment,x,h)}else this.boxes.push(new CollisionBox(new Point(o.x,o.y),u,l,d,a,1/0))}var CollisionBox=require("./collision_box"),Point=require("point-geometry");module.exports=CollisionFeature,CollisionFeature.prototype._addLineCollisionBoxes=function(i,o,e,t,s){var n=s/2,r=Math.floor(t/n),l=-s/2,a=this.boxes,u=o,d=e+1,h=l;do{if(d--,0>d)return a;h-=i[d].dist(u),u=i[d]}while(h>-t/2);for(var x=i[d].dist(i[d+1]),f=0;r>f;f++){for(var m=-t/2+f*n;m>h+x;){if(h+=x,d++,d+1>=i.length)return a;x=i[d].dist(i[d+1])}var b=m-h,C=i[d],_=i[d+1],v=_.sub(C)._unit()._mult(b)._add(C),p=Math.max(Math.abs(m-l)-n/2,0),g=t/2/p;a.push(new CollisionBox(v,-s/2,-s/2,s/2,s/2,g))}return a};
},{"./collision_box":59,"point-geometry":151}],61:[function(require,module,exports){
"use strict";function CollisionTile(t,e){this.tree=rbush(),this.angle=t;var i=Math.sin(t),o=Math.cos(t);this.rotationMatrix=[o,-i,i,o],this.reverseRotationMatrix=[o,i,-i,o],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.edges=[new CollisionBox(new Point(0,0),0,-(1/0),0,1/0,1/0),new CollisionBox(new Point(EXTENT,0),0,-(1/0),0,1/0,1/0),new CollisionBox(new Point(0,0),-(1/0),0,1/0,0,1/0),new CollisionBox(new Point(0,EXTENT),-(1/0),0,1/0,0,1/0)]}var rbush=require("rbush"),CollisionBox=require("./collision_box"),Point=require("point-geometry"),EXTENT=require("../data/bucket").EXTENT;module.exports=CollisionTile,CollisionTile.prototype.minScale=.25,CollisionTile.prototype.maxScale=2,CollisionTile.prototype.placeCollisionFeature=function(t,e,i){for(var o=this.minScale,a=this.rotationMatrix,n=this.yStretch,l=0;l<t.boxes.length;l++){var r=t.boxes[l];if(!e){var s=r.anchorPoint.matMult(a),x=s.x,h=s.y;r[0]=x+r.x1,r[1]=h+r.y1*n,r[2]=x+r.x2,r[3]=h+r.y2*n;for(var c=this.tree.search(r),m=0;m<c.length;m++){var y=c[m],u=y.anchorPoint.matMult(a);if(o=this.getPlacementScale(o,s,r,u,y),o>=this.maxScale)return o}}if(i)for(var M=this.reverseRotationMatrix,S=new Point(r.x1,r.y1).matMult(M),P=new Point(r.x2,r.y1).matMult(M),p=new Point(r.x1,r.y2).matMult(M),C=new Point(r.x2,r.y2).matMult(M),T=new CollisionBox(r.anchorPoint,Math.min(S.x,P.x,p.x,C.x),Math.min(S.y,P.x,p.x,C.x),Math.max(S.x,P.x,p.x,C.x),Math.max(S.y,P.x,p.x,C.x),r.maxScale),v=0;v<this.edges.length;v++){var w=this.edges[v];if(o=this.getPlacementScale(o,r.anchorPoint,T,w.anchorPoint,w),o>=this.maxScale)return o}}return o},CollisionTile.prototype.getPlacementScale=function(t,e,i,o,a){var n=(a.x1-i.x2)/(e.x-o.x),l=(a.x2-i.x1)/(e.x-o.x),r=(a.y1-i.y2)*this.yStretch/(e.y-o.y),s=(a.y2-i.y1)*this.yStretch/(e.y-o.y);(isNaN(n)||isNaN(l))&&(n=l=1),(isNaN(r)||isNaN(s))&&(r=s=1);var x=Math.min(Math.max(n,l),Math.max(r,s));return x>a.maxScale&&(x=a.maxScale),x>i.maxScale&&(x=i.maxScale),x>t&&x>=a.placementScale&&(t=x),t},CollisionTile.prototype.insertCollisionFeature=function(t,e){for(var i=t.boxes,o=0;o<i.length;o++)i[o].placementScale=e;e<this.maxScale&&this.tree.load(i)};
},{"../data/bucket":1,"./collision_box":59,"point-geometry":151,"rbush":152}],62:[function(require,module,exports){
"use strict";function getAnchors(e,r,t,n,a,l,o,i,h){var c=n?.6*l*o:0,s=Math.max(n?n.right-n.left:0,a?a.right-a.left:0),u=0===e[0].x||e[0].x===h||0===e[0].y||e[0].y===h;r/4>r-s*o&&(r=s*o+r/4);var g=2*l,p=u?r/2*i%r:(s/2+g)*o*i%r;return resample(e,p,r,c,t,s*o,u,!1,h)}function resample(e,r,t,n,a,l,o,i,h){for(var c=l/2,s=0,u=0;u<e.length-1;u++)s+=e[u].dist(e[u+1]);for(var g=0,p=r-t,x=[],f=0;f<e.length-1;f++){for(var v=e[f],m=e[f+1],A=v.dist(m),y=m.angleTo(v);g+A>p+t;){p+=t;var d=(p-g)/A,k=interpolate(v.x,m.x,d),q=interpolate(v.y,m.y,d);if(k>=0&&h>k&&q>=0&&h>q&&p-c>=0&&s>=p+c){var M=new Anchor(k,q,y,f)._round();n&&!checkMaxAngle(e,M,l,n,a)||x.push(M)}}g+=A}return i||x.length||o||(x=resample(e,g/2,t,n,a,l,o,!0,h)),x}var interpolate=require("../util/interpolate"),Anchor=require("../symbol/anchor"),checkMaxAngle=require("./check_max_angle");module.exports=getAnchors;
},{"../symbol/anchor":56,"../util/interpolate":94,"./check_max_angle":57}],63:[function(require,module,exports){
"use strict";function GlyphAtlas(t,i){this.width=t,this.height=i,this.bin=new ShelfPack(t,i),this.index={},this.ids={},this.data=new Uint8Array(t*i)}var ShelfPack=require("shelf-pack");module.exports=GlyphAtlas,GlyphAtlas.prototype={get debug(){return"canvas"in this},set debug(t){t&&!this.canvas?(this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,document.body.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")):!t&&this.canvas&&(this.canvas.parentNode.removeChild(this.canvas),delete this.ctx,delete this.canvas)}},GlyphAtlas.prototype.getGlyphs=function(){var t,i,e,h={};for(var s in this.ids)t=s.split("#"),i=t[0],e=t[1],h[i]||(h[i]=[]),h[i].push(e);return h},GlyphAtlas.prototype.getRects=function(){var t,i,e,h={};for(var s in this.ids)t=s.split("#"),i=t[0],e=t[1],h[i]||(h[i]={}),h[i][e]=this.index[s];return h},GlyphAtlas.prototype.addGlyph=function(t,i,e,h){if(!e)return null;var s=i+"#"+e.id;if(this.index[s])return this.ids[s].indexOf(t)<0&&this.ids[s].push(t),this.index[s];if(!e.bitmap)return null;var a=e.width+2*h,r=e.height+2*h,n=1,d=a+2*n,l=r+2*n;d+=4-d%4,l+=4-l%4;var o=this.bin.allocate(d,l);if(o.x<0&&(this.resize(),o=this.bin.allocate(d,l)),o.x<0)return console.warn("glyph bitmap overflow"),{glyph:e,rect:null};this.index[s]=o,this.ids[s]=[t];for(var c=this.data,u=e.bitmap,p=0;r>p;p++)for(var x=this.width*(o.y+p+n)+o.x+n,E=a*p,T=0;a>T;T++)c[x+T]=u[E+T];return this.dirty=!0,o},GlyphAtlas.prototype.resize=function(){var t=this.width,i=this.height;if(!(t>512||i>512)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=2,this.height*=2,this.bin.resize(this.width,this.height);for(var e,h,s=new ArrayBuffer(this.width*this.height),a=0;i>a;a++)e=new Uint8Array(this.data.buffer,i*a,t),h=new Uint8Array(s,i*a*2,t),h.set(e);this.data=new Uint8Array(s)}},GlyphAtlas.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},GlyphAtlas.prototype.updateTexture=function(t){if(this.bind(t),this.dirty){if(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.ctx){for(var i=this.ctx.getImageData(0,0,this.width,this.height),e=0,h=0;e<this.data.length;e++,h+=4)i.data[h]=this.data[e],i.data[h+1]=this.data[e],i.data[h+2]=this.data[e],i.data[h+3]=255;this.ctx.putImageData(i,0,0),this.ctx.strokeStyle="red";for(var s=0;s<this.bin.free.length;s++){var a=this.bin.free[s];this.ctx.strokeRect(a.x,a.y,a.w,a.h)}}this.dirty=!1}};
},{"shelf-pack":154}],64:[function(require,module,exports){
"use strict";function GlyphSource(t){this.url=t&&normalizeURL(t),this.atlases={},this.stacks={},this.loading={}}function SimpleGlyph(t,e,l){var r=1;this.advance=t.advance,this.left=t.left-l-r,this.top=t.top+l+r,this.rect=e}function glyphUrl(t,e,l,r){return r=r||"abc",l.replace("{s}",r[t.length%r.length]).replace("{fontstack}",t).replace("{range}",e)}var normalizeURL=require("../util/mapbox").normalizeGlyphsURL,getArrayBuffer=require("../util/ajax").getArrayBuffer,Glyphs=require("../util/glyphs"),GlyphAtlas=require("../symbol/glyph_atlas"),Protobuf=require("pbf");module.exports=GlyphSource,GlyphSource.prototype.getSimpleGlyphs=function(t,e,l,r){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new GlyphAtlas(128,128));for(var s,a={},i=this.stacks[t],h=this.atlases[t],o=3,n={},p=0,u=0;u<e.length;u++){var y=e[u];if(s=Math.floor(y/256),i[s]){var f=i[s].glyphs[y],c=h.addGlyph(l,t,f,o);f&&(a[y]=new SimpleGlyph(f,c,o))}else void 0===n[s]&&(n[s]=[],p++),n[s].push(y)}p||r(void 0,a,t);var g=function(e,s,i){if(!e)for(var u=this.stacks[t][s]=i.stacks[0],y=0;y<n[s].length;y++){var f=n[s][y],c=u.glyphs[f],g=h.addGlyph(l,t,c,o);c&&(a[f]=new SimpleGlyph(c,g,o))}p--,p||r(void 0,a,t)}.bind(this);for(var d in n)this.loadRange(t,d,g)},GlyphSource.prototype.loadRange=function(t,e,l){if(256*e>65535)return l("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var r=this.loading[t];if(r[e])r[e].push(l);else{r[e]=[l];var s=256*e+"-"+(256*e+255),a=glyphUrl(t,s,this.url);getArrayBuffer(a,function(t,l){for(var s=!t&&new Glyphs(new Protobuf(new Uint8Array(l))),a=0;a<r[e].length;a++)r[e][a](t,e,s);delete r[e]})}},GlyphSource.prototype.getGlyphAtlas=function(t){return this.atlases[t]};
},{"../symbol/glyph_atlas":63,"../util/ajax":86,"../util/glyphs":93,"../util/mapbox":96,"pbf":149}],65:[function(require,module,exports){
"use strict";module.exports=function(e,t,n){function r(r){c.push(e[r]),f.push(n[r]),v.push(t[r]),h++}function u(e,t,n){var r=l[e];return delete l[e],l[t]=r,f[r][0].pop(),f[r][0]=f[r][0].concat(n[0]),r}function i(e,t,n){var r=a[t];return delete a[t],a[e]=r,f[r][0].shift(),f[r][0]=n[0].concat(f[r][0]),r}function o(e,t,n){var r=n?t[0][t[0].length-1]:t[0][0];return e+":"+r.x+":"+r.y}var s,a={},l={},c=[],f=[],v=[],h=0;for(s=0;s<e.length;s++){var p=n[s],d=t[s];if(d){var g=o(d,p),x=o(d,p,!0);if(g in l&&x in a&&l[g]!==a[x]){var m=i(g,x,p),y=u(g,x,f[m]);delete a[g],delete l[x],l[o(d,f[y],!0)]=y,f[m]=null}else g in l?u(g,x,p):x in a?i(g,x,p):(r(s),a[g]=h-1,l[x]=h-1)}else r(s)}return{features:c,textFeatures:v,geometries:f}};
},{}],66:[function(require,module,exports){
"use strict";function SymbolQuad(t,a,e,n,i,o,l,h,r){this.anchorPoint=t,this.tl=a,this.tr=e,this.bl=n,this.br=i,this.tex=o,this.angle=l,this.minScale=h,this.maxScale=r}function getIconQuads(t,a,e,n,i,o){var l=a.image.rect,h=1,r=a.left-h,s=r+l.w/a.image.pixelRatio,m=a.top-h,u=m+l.h/a.image.pixelRatio,c=new Point(r,m),g=new Point(s,m),M=new Point(s,u),P=new Point(r,u),x=i["icon-rotate"]*Math.PI/180;if(o){var y=n[t.segment];if(t.y===y.y&&t.x===y.x&&t.segment+1<n.length){var f=n[t.segment+1];x+=Math.atan2(t.y-f.y,t.x-f.x)+Math.PI}else x+=Math.atan2(t.y-y.y,t.x-y.x)}if(x){var p=Math.sin(x),v=Math.cos(x),S=[v,-p,p,v];c=c.matMult(S),g=g.matMult(S),P=P.matMult(S),M=M.matMult(S)}return[new SymbolQuad(new Point(t.x,t.y),c,g,P,M,a.image.rect,0,minScale,1/0)]}function getGlyphQuads(t,a,e,n,i,o){for(var l=i["text-rotate"]*Math.PI/180,h=i["text-keep-upright"],r=a.positionedGlyphs,s=[],m=0;m<r.length;m++){var u=r[m],c=u.glyph,g=c.rect;if(g){var M,P=(u.x+c.advance/2)*e,x=minScale;o?(M=[],x=getSegmentGlyphs(M,t,P,n,t.segment,!0),h&&(x=Math.min(x,getSegmentGlyphs(M,t,P,n,t.segment,!1)))):M=[{anchorPoint:new Point(t.x,t.y),offset:0,angle:0,maxScale:1/0,minScale:minScale}];for(var y=u.x+c.left,f=u.y-c.top,p=y+g.w,v=f+g.h,S=new Point(y,f),w=new Point(p,f),d=new Point(y,v),I=new Point(p,v),b=0;b<M.length;b++){var Q=M[b],G=S,k=w,q=d,R=I,_=Q.angle+l;if(_){var j=Math.sin(_),z=Math.cos(_),A=[z,-j,j,z];G=G.matMult(A),k=k.matMult(A),q=q.matMult(A),R=R.matMult(A)}var B=Math.max(Q.minScale,x),C=(t.angle+l+Q.offset+2*Math.PI)%(2*Math.PI);s.push(new SymbolQuad(Q.anchorPoint,G,k,q,R,g,C,B,Q.maxScale))}}}return s}function getSegmentGlyphs(t,a,e,n,i,o){var l=!o;0>e&&(o=!o),o&&i++;var h=new Point(a.x,a.y),r=n[i],s=1/0;e=Math.abs(e);for(var m=minScale;;){var u=h.dist(r),c=e/u,g=Math.atan2(r.y-h.y,r.x-h.x);if(o||(g+=Math.PI),l&&(g+=Math.PI),t.push({anchorPoint:h,offset:l?Math.PI:0,minScale:c,maxScale:s,angle:(g+2*Math.PI)%(2*Math.PI)}),m>=c)break;for(h=r;h.equals(r);)if(i+=o?1:-1,r=n[i],!r)return c;var M=r.sub(h)._unit();h=h.sub(M._mult(u)),s=c}return m}var Point=require("point-geometry");module.exports={getIconQuads:getIconQuads,getGlyphQuads:getGlyphQuads};var minScale=.5;
},{"point-geometry":151}],67:[function(require,module,exports){
"use strict";function resolveText(e,r,o){for(var t=[],s=0,l=e.length;l>s;s++){var a=resolveTokens(e[s].properties,r["text-field"]);if(a){a=a.toString();var n=r["text-transform"];"uppercase"===n?a=a.toLocaleUpperCase():"lowercase"===n&&(a=a.toLocaleLowerCase());for(var v=0;v<a.length;v++)o[a.charCodeAt(v)]=!0;t[s]=a}else t[s]=null}return t}var resolveTokens=require("../util/token");module.exports=resolveText;
},{"../util/token":97}],68:[function(require,module,exports){
"use strict";function PositionedGlyph(t,i,n,e){this.codePoint=t,this.x=i,this.y=n,this.glyph=e}function Shaping(t,i,n,e,o,h){this.positionedGlyphs=t,this.text=i,this.top=n,this.bottom=e,this.left=o,this.right=h}function shapeText(t,i,n,e,o,h,a,s,r){for(var l=[],f=new Shaping(l,t,r[1],r[1],r[0],r[0]),c=-17,p=0,u=c,v=0;v<t.length;v++){var d=t.charCodeAt(v),g=i[d];g&&(l.push(new PositionedGlyph(d,p,u,g)),p+=g.advance+s)}return l.length?(linewrap(f,i,e,n,o,h,a,r),f):!1}function linewrap(t,i,n,e,o,h,a,s){var r=null,l=0,f=0,c=0,p=0,u=t.positionedGlyphs;if(e)for(var v=0;v<u.length;v++){var d=u[v];if(d.x-=l,d.y+=n*c,d.x>e&&null!==r){var g=u[r+1].x;p=Math.max(g,p);for(var x=r+1;v>=x;x++)u[x].y+=n,u[x].x-=g;if(a){var y=r;invisible[u[r].codePoint]&&y--,justifyLine(u,i,f,y,a)}f=r+1,r=null,l+=g,c++}breakable[d.codePoint]&&(r=v)}var b=u[u.length-1],P=b.x+i[b.codePoint].advance;p=Math.max(p,P);var m=(c+1)*n;justifyLine(u,i,f,u.length-1,a),align(u,a,o,h,p,n,c,s),t.top+=-h*m,t.bottom=t.top+m,t.left+=-o*p,t.right=t.left+p}function justifyLine(t,i,n,e,o){for(var h=i[t[e].codePoint].advance,a=(t[e].x+h)*o,s=n;e>=s;s++)t[s].x-=a}function align(t,i,n,e,o,h,a,s){for(var r=(i-n)*o+s[0],l=(-e*(a+1)+.5)*h+s[1],f=0;f<t.length;f++)t[f].x+=r,t[f].y+=l}function shapeIcon(t,i){if(!t||!t.rect)return null;var n=i["icon-offset"][0],e=i["icon-offset"][1],o=n-t.width/2,h=o+t.width,a=e-t.height/2,s=a+t.height;return new PositionedIcon(t,a,s,o,h)}function PositionedIcon(t,i,n,e,o){this.image=t,this.top=i,this.bottom=n,this.left=e,this.right=o}module.exports={shapeText:shapeText,shapeIcon:shapeIcon};var invisible={32:!0,8203:!0},breakable={32:!0,38:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0};
},{}],69:[function(require,module,exports){
"use strict";function SpriteAtlas(t,i){this.width=t,this.height=i,this.bin=new ShelfPack(t,i),this.images={},this.data=!1,this.texture=0,this.filter=0,this.pixelRatio=1,this.dirty=!0}function copyBitmap(t,i,e,h,a,s,r,o,l,n,p){var c,x,d=h*i+e,R=o*s+r;if(p)for(R-=s,x=-1;n>=x;x++,d=((x+n)%n+h)*i+e,R+=s)for(c=-1;l>=c;c++)a[R+c]=t[d+(c+l)%l];else for(x=0;n>x;x++,d+=i,R+=s)for(c=0;l>c;c++)a[R+c]=t[d+c]}function AtlasImage(t,i,e,h,a){this.rect=t,this.width=i,this.height=e,this.sdf=h,this.pixelRatio=a}var ShelfPack=require("shelf-pack"),browser=require("../util/browser");module.exports=SpriteAtlas,SpriteAtlas.prototype={get debug(){return"canvas"in this},set debug(t){t&&!this.canvas?(this.canvas=document.createElement("canvas"),this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio,this.canvas.style.width=this.width+"px",this.canvas.style.width=this.width+"px",document.body.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")):!t&&this.canvas&&(this.canvas.parentNode.removeChild(this.canvas),delete this.ctx,delete this.canvas)}},SpriteAtlas.prototype.allocateImage=function(t,i){t/=this.pixelRatio,i/=this.pixelRatio;var e=2,h=t+e+(4-(t+e)%4),a=i+e+(4-(i+e)%4),s=this.bin.allocate(h,a);return s.x<0?(console.warn("SpriteAtlas out of space."),s):s},SpriteAtlas.prototype.getImage=function(t,i){if(this.images[t])return this.images[t];if(!this.sprite)return null;var e=this.sprite.getSpritePosition(t);if(!e.width||!e.height)return null;var h=this.allocateImage(e.width,e.height);if(h.x<0)return h;var a=new AtlasImage(h,e.width/e.pixelRatio,e.height/e.pixelRatio,e.sdf,e.pixelRatio/this.pixelRatio);return this.images[t]=a,this.copy(h,e,i),a},SpriteAtlas.prototype.getPosition=function(t,i){var e=this.getImage(t,i),h=e&&e.rect;if(!h)return null;var a=e.width*e.pixelRatio,s=e.height*e.pixelRatio,r=1;return{size:[e.width,e.height],tl:[(h.x+r)/this.width,(h.y+r)/this.height],br:[(h.x+r+a)/this.width,(h.y+r+s)/this.height]}},SpriteAtlas.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),i=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*i);for(var e=0;e<this.data.length;e++)this.data[e]=0}},SpriteAtlas.prototype.copy=function(t,i,e){if(this.sprite.img.data){var h=new Uint32Array(this.sprite.img.data.buffer);this.allocate();var a=this.data,s=1;copyBitmap(h,this.sprite.img.width,i.x,i.y,a,this.width*this.pixelRatio,(t.x+s)*this.pixelRatio,(t.y+s)*this.pixelRatio,i.width,i.height,e),this.dirty=!0}},SpriteAtlas.prototype.setSprite=function(t){t&&(this.pixelRatio=browser.devicePixelRatio>1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},SpriteAtlas.prototype.addIcons=function(t,i){for(var e=0;e<t.length;e++)this.getImage(t[e]);i(null,this.images)},SpriteAtlas.prototype.bind=function(t,i){var e=!1;this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e=!0);var h=i?t.LINEAR:t.NEAREST;if(h!==this.filter&&(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,h),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,h),this.filter=h),this.dirty&&(this.allocate(),e?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width*this.pixelRatio,this.height*this.pixelRatio,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)):t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width*this.pixelRatio,this.height*this.pixelRatio,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)),this.dirty=!1,this.ctx)){var a=this.ctx.getImageData(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio);a.data.set(new Uint8ClampedArray(this.data.buffer)),this.ctx.putImageData(a,0,0),this.ctx.strokeStyle="red";for(var s=0;s<this.bin.free.length;s++){var r=this.bin.free[s];this.ctx.strokeRect(r.x*this.pixelRatio,r.y*this.pixelRatio,r.w*this.pixelRatio,r.h*this.pixelRatio)}}};
},{"../util/browser":87,"shelf-pack":154}],70:[function(require,module,exports){
"use strict";var util=require("../util/util"),interpolate=require("../util/interpolate"),browser=require("../util/browser"),LngLat=require("../geo/lng_lat"),LngLatBounds=require("../geo/lng_lat_bounds"),Point=require("point-geometry"),Camera=module.exports=function(){};util.extend(Camera.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,i){return this.jumpTo({center:t},i),this},panBy:function(t,i,e){return this.panTo(this.transform.center,util.extend({offset:Point.convert(t).mult(-1)},i),e),this},panTo:function(t,i,e){return this.easeTo(util.extend({center:t},i),e)},getZoom:function(){return this.transform.zoom},setZoom:function(t,i){return this.jumpTo({zoom:t},i),this},zoomTo:function(t,i,e){return this.easeTo(util.extend({zoom:t},i),e)},zoomIn:function(t,i){return this.zoomTo(this.getZoom()+1,t,i),this},zoomOut:function(t,i){return this.zoomTo(this.getZoom()-1,t,i),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,i){return this.jumpTo({bearing:t},i),this},rotateTo:function(t,i,e){return this.easeTo(util.extend({bearing:t},i),e)},resetNorth:function(t,i){return this.rotateTo(0,util.extend({duration:1e3},t),i),this},snapToNorth:function(t,i){return Math.abs(this.getBearing())<this.options.bearingSnap?this.resetNorth(t,i):this},getPitch:function(){return this.transform.pitch},setPitch:function(t,i){return this.jumpTo({pitch:t},i),this},fitBounds:function(t,i,e){i=util.extend({padding:0,offset:[0,0],maxZoom:1/0},i),t=LngLatBounds.convert(t);var n=Point.convert(i.offset),o=this.transform,r=o.project(t.getNorthWest()),s=o.project(t.getSouthEast()),a=s.sub(r),h=(o.width-2*i.padding-2*Math.abs(n.x))/a.x,u=(o.height-2*i.padding-2*Math.abs(n.y))/a.y;return i.center=o.unproject(r.add(s).div(2)),i.zoom=Math.min(o.scaleZoom(o.scale*Math.min(h,u)),i.maxZoom),i.bearing=0,i.linear?this.easeTo(i,e):this.flyTo(i,e)},jumpTo:function(t,i){this.stop();var e=this.transform,n=!1,o=!1,r=!1;return"zoom"in t&&e.zoom!==+t.zoom&&(n=!0,e.zoom=+t.zoom),"center"in t&&(e.center=LngLat.convert(t.center)),"bearing"in t&&e.bearing!==+t.bearing&&(o=!0,e.bearing=+t.bearing),"pitch"in t&&e.pitch!==+t.pitch&&(r=!0,e.pitch=+t.pitch),this.fire("movestart",i).fire("move",i),n&&this.fire("zoomstart",i).fire("zoom",i).fire("zoomend",i),o&&this.fire("rotate",i),r&&this.fire("pitch",i),this.fire("moveend",i)},easeTo:function(t,i){this.stop(),t=util.extend({offset:[0,0],duration:500,easing:util.ease},t);var e,n,o=this.transform,r=Point.convert(t.offset),s=this.getZoom(),a=this.getBearing(),h=this.getPitch(),u="zoom"in t?+t.zoom:s,c="bearing"in t?this._normalizeBearing(t.bearing,a):a,m="pitch"in t?+t.pitch:h;"center"in t?(e=LngLat.convert(t.center),n=o.centerPoint.add(r)):"around"in t?(e=LngLat.convert(t.around),n=o.locationPoint(e)):(n=o.centerPoint.add(r),e=o.pointLocation(n));var f=o.locationPoint(e);return t.animate===!1&&(t.duration=0),this.zooming=u!==s,this.rotating=a!==c,this.pitching=m!==h,t.noMoveStart||this.fire("movestart",i),this.zooming&&this.fire("zoomstart",i),clearTimeout(this._onEaseEnd),this._ease(function(t){this.zooming&&(o.zoom=interpolate(s,u,t)),this.rotating&&(o.bearing=interpolate(a,c,t)),this.pitching&&(o.pitch=interpolate(h,m,t)),o.setLocationAtPoint(e,f.add(n.sub(f)._mult(t))),this.fire("move",i),this.zooming&&this.fire("zoom",i),this.rotating&&this.fire("rotate",i),this.pitching&&this.fire("pitch",i)},function(){t.delayEndEvents?this._onEaseEnd=setTimeout(this._easeToEnd.bind(this,i),t.delayEndEvents):this._easeToEnd(i)}.bind(this),t),this},_easeToEnd:function(t){this.zooming&&this.fire("zoomend",t),this.fire("moveend",t),this.zooming=!1,this.rotating=!1,this.pitching=!1},flyTo:function(t,i){function e(t){var i=(T*T-M*M+(t?-1:1)*L*L*_*_)/(2*(t?T:M)*L*_);return Math.log(Math.sqrt(i*i+1)-i)}function n(t){return(Math.exp(t)-Math.exp(-t))/2}function o(t){return(Math.exp(t)+Math.exp(-t))/2}function r(t){return n(t)/o(t)}this.stop(),t=util.extend({offset:[0,0],speed:1.2,curve:1.42,easing:util.ease},t);var s=this.transform,a=Point.convert(t.offset),h=this.getZoom(),u=this.getBearing(),c=this.getPitch(),m="center"in t?LngLat.convert(t.center):this.getCenter(),f="zoom"in t?+t.zoom:h,g="bearing"in t?this._normalizeBearing(t.bearing,u):u,p="pitch"in t?+t.pitch:c;Math.abs(s.center.lng)+Math.abs(m.lng)>180&&(s.center.lng>0&&m.lng<0?m.lng+=360:s.center.lng<0&&m.lng>0&&(m.lng-=360));var l=s.zoomScale(f-h),d=s.point,b="center"in t?s.project(m).sub(a.div(l)):d,z=s.worldSize,v=t.curve,M=Math.max(s.width,s.height),T=M/l,_=b.sub(d).mag();if("minZoom"in t){var x=util.clamp(Math.min(t.minZoom,h,f),s.minZoom,s.maxZoom),E=M/s.zoomScale(x-h);v=Math.sqrt(E/_*2)}var L=v*v,P=e(0),Z=function(t){return o(P)/o(P+v*t)},B=function(t){return M*((o(P)*r(P+v*t)-n(P))/L)/_},j=(e(1)-P)/v;if(Math.abs(_)<1e-6){if(Math.abs(M-T)<1e-6)return this.easeTo(t);var q=M>T?-1:1;j=Math.abs(Math.log(T/M))/v,B=function(){return 0},Z=function(t){return Math.exp(q*v*t)}}if("duration"in t)t.duration=+t.duration;eLine truncated
},{"../geo/lng_lat":10,"../geo/lng_lat_bounds":11,"../util/browser":87,"../util/interpolate":94,"../util/util":98,"point-geometry":151}],71:[function(require,module,exports){
"use strict";function Attribution(t){util.setOptions(this,t)}var Control=require("./control"),DOM=require("../../util/dom"),util=require("../../util/util");module.exports=Attribution,Attribution.prototype=util.inherit(Control,{options:{position:"bottom-right"},onAdd:function(t){var i="mapboxgl-ctrl-attrib",e=this._container=DOM.create("div",i,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),e},_update:function(){var t=[];if(this._map.style)for(var i in this._map.style.sources){var e=this._map.style.sources[i];e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}this._container.innerHTML=t.join(" | "),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}});
},{"../../util/dom":90,"../../util/util":98,"./control":72}],72:[function(require,module,exports){
"use strict";function Control(){}module.exports=Control,Control.prototype={addTo:function(o){this._map=o;var t=this._container=this.onAdd(o);if(this.options&&this.options.position){var i=this.options.position,n=o._controlCorners[i];t.className+=" mapboxgl-ctrl",-1!==i.indexOf("bottom")?n.insertBefore(t,n.firstChild):n.appendChild(t)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}};
},{}],73:[function(require,module,exports){
"use strict";function Navigation(t){util.setOptions(this,t)}function copyMouseEvent(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var Control=require("./control"),DOM=require("../../util/dom"),util=require("../../util/util");module.exports=Navigation,Navigation.prototype=util.inherit(Control,{options:{position:"top-right"},onAdd:function(t){var o="mapboxgl-ctrl",e=this._container=DOM.create("div",o+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(o+"-icon "+o+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(o+"-icon "+o+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(o+"-icon "+o+"-compass",t.resetNorth.bind(t)),this._compassArrow=DOM.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),e},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(DOM.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),DOM.enableDrag(),this._el.dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},_createButton:function(t,o){var e=DOM.create("button",t,this._container);return e.addEventListener("click",function(){o()}),e},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}});
},{"../../util/dom":90,"../../util/util":98,"./control":72}],74:[function(require,module,exports){
"use strict";function BoxZoomHandler(e){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),LngLatBounds=require("../../geo/lng_lat_bounds"),util=require("../../util/util");module.exports=BoxZoomHandler,BoxZoomHandler.prototype={enable:function(){this.disable(),this._el.addEventListener("mousedown",this._onMouseDown,!1)},disable:function(){this._el.removeEventListener("mousedown",this._onMouseDown)},_onMouseDown:function(e){e.shiftKey&&0===e.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),DOM.disableDrag(),this._startPos=DOM.mousePos(this._el,e),this.active=!0)},_onMouseMove:function(e){var o=this._startPos,t=DOM.mousePos(this._el,e);this._box||(this._box=DOM.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));var n=Math.min(o.x,t.x),i=Math.max(o.x,t.x),s=Math.min(o.y,t.y),a=Math.max(o.y,t.y);DOM.setTransform(this._box,"translate("+n+"px,"+s+"px)"),this._box.style.width=i-n+"px",this._box.style.height=a-s+"px"},_onMouseUp:function(e){if(0===e.button){var o=this._startPos,t=DOM.mousePos(this._el,e),n=new LngLatBounds(this._map.unproject(o),this._map.unproject(t));this._finish(),o.x===t.x&&o.y===t.y?this._fireEvent("boxzoomcancel",e):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:e,boxZoomBounds:n})}},_onKeyDown:function(e){27===e.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",e))},_finish:function(){this.active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),DOM.enableDrag()},_fireEvent:function(e,o){return this._map.fire(e,{originalEvent:o})}};
},{"../../geo/lng_lat_bounds":11,"../../util/dom":90,"../../util/util":98}],75:[function(require,module,exports){
"use strict";function DoubleClickZoomHandler(i){this._map=i,this._onDblClick=this._onDblClick.bind(this)}module.exports=DoubleClickZoomHandler,DoubleClickZoomHandler.prototype={enable:function(){this.disable(),this._map.on("dblclick",this._onDblClick)},disable:function(){this._map.off("dblclick",this._onDblClick)},_onDblClick:function(i){this._map.zoomTo(this._map.getZoom()+(i.originalEvent.shiftKey?-1:1),{around:i.lngLat})}};
},{}],76:[function(require,module,exports){
"use strict";function DragPanHandler(t){this._map=t,this._el=t.getCanvasContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),util=require("../../util/util");module.exports=DragPanHandler;var inertiaLinearity=.3,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=1400,inertiaDeceleration=2500;DragPanHandler.prototype={enable:function(){this.disable(),this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown)},disable:function(){this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown)},_onDown:function(t){this._ignoreEvent(t)||this.active||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this.active=!1,this._startPos=this._pos=DOM.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.active||(this.active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=DOM.mousePos(this._el,t),i=this._map;i.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),i.transform.setLocationAtPoint(i.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.active){this.active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),i=this._inertia;if(i.length<2)return void e();var n=i[i.length-1],o=i[0],r=n[1].sub(o[1]),s=(n[0]-o[0])/1e3;if(0===s||n[1].equals(o[1]))return void e();var a=r.mult(inertiaLinearity/s),u=a.mag();u>inertiaMaxSpeed&&(u=inertiaMaxSpeed,a._unit()._mult(u));var h=u/(inertiaDeceleration*inertiaLinearity),v=a.mult(-h/2);this._map.panBy(v,{duration:1e3*h,easing:inertiaEasing,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.active)return!0;if(e.dragRotate&&e.dragRotate.active)return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var i=1,n=0;return"mousemove"===t.type?t.buttons&0===i:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),i=160;t.length>0&&e-t[0][0]>i;)t.shift()}};
},{"../../util/dom":90,"../../util/util":98}],77:[function(require,module,exports){
"use strict";function DragRotateHandler(t){this._map=t,this._el=t.getCanvasContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),Point=require("point-geometry"),util=require("../../util/util");module.exports=DragRotateHandler;var inertiaLinearity=.25,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=180,inertiaDeceleration=720;DragRotateHandler.prototype={enable:function(){this.disable(),this._el.addEventListener("mousedown",this._onDown)},disable:function(){this._el.removeEventListener("mousedown",this._onDown)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.active){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this.active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=DOM.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),i=e.mag();200>i&&(this._center=this._startPos.add(new Point(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.active||(this.active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var i=this._pos,n=DOM.mousePos(this._el,t),r=this._center,a=i.sub(r).angleWith(n.sub(r))/Math.PI*180,o=e.getBearing()-a,s=this._inertia,h=s[s.length-1];this._drainInertiaBuffer(),s.push([Date.now(),e._normalizeBearing(o,h[1])]),e.transform.bearing=o,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.active)){this.active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,i=e.getBearing(),n=this._inertia,r=function(){Math.abs(i)<e.options.bearingSnap?e.resetNorth({noMoveStart:!0},{originalEvent:t}):this._fireEvent("moveend",t)}.bind(this);if(n.length<2)return void r();var a=n[0],o=n[n.length-1],s=n[n.length-2],h=e._normalizeBearing(i,s[1]),v=o[1]-a[1],u=0>v?-1:1,_=(o[0]-a[0])/1e3;if(0===v||0===_)return void r();var m=Math.abs(v*(inertiaLinearity/_));m>inertiaMaxSpeed&&(m=inertiaMaxSpeed);var g=m/(inertiaDeceleration*inertiaLinearity),l=u*m*(g/2);h+=l,Math.abs(e._normalizeBearing(h,0))<e.options.bearingSnap&&(h=e._normalizeBearing(0,h)),e.rotateTo(h,{duration:1e3*g,easing:inertiaEasing,noMoveStart:!0},{originalEvent:t})}},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.active)return!0;if(e.dragPan&&e.dragPan.active)return!0;if(t.touches)return t.touches.length>1;var i=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===i:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),i=160;t.length>0&&e-t[0][0]>i;)t.shift()}};
},{"../../util/dom":90,"../../util/util":98,"point-geometry":151}],78:[function(require,module,exports){
"use strict";function KeyboardHandler(e){this._map=e,this._el=e.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}module.exports=KeyboardHandler;var panDelta=80,rotateDelta=2,pitchDelta=5;KeyboardHandler.prototype={enable:function(){this.disable(),this._el.addEventListener("keydown",this._onKeyDown,!1)},disable:function(){this._el.removeEventListener("keydown",this._onKeyDown)},_onKeyDown:function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var a=this._map,t={originalEvent:e};switch(e.keyCode){case 61:case 107:case 171:case 187:a.zoomTo(Math.round(a.getZoom())+(e.shiftKey?2:1),t);break;case 189:case 109:case 173:a.zoomTo(Math.round(a.getZoom())-(e.shiftKey?2:1),t);break;case 37:e.shiftKey?a.easeTo({bearing:a.getBearing()-rotateDelta},t):a.panBy([-panDelta,0],t);break;case 39:e.shiftKey?a.easeTo({bearing:a.getBearing()+rotateDelta},t):a.panBy([panDelta,0],t);break;case 38:e.shiftKey?a.easeTo({pitch:a.getPitch()+pitchDelta},t):a.panBy([0,-panDelta],t);break;case 40:e.shiftKey?a.easeTo({pitch:Math.max(a.getPitch()-pitchDelta,0)},t):a.panBy([0,panDelta],t)}}}};
},{}],79:[function(require,module,exports){
"use strict";function ScrollZoomHandler(e){this._map=e,this._el=e.getCanvasContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),browser=require("../../util/browser"),util=require("../../util/util");module.exports=ScrollZoomHandler;var ua="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",firefox=-1!==ua.indexOf("firefox"),safari=-1!==ua.indexOf("safari")&&-1===ua.indexOf("chrom");ScrollZoomHandler.prototype={enable:function(){this.disable(),this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1)},disable:function(){this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel)},_onWheel:function(e){var t;"wheel"===e.type?(t=e.deltaY,firefox&&e.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(t/=browser.devicePixelRatio),e.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(t*=40)):"mousewheel"===e.type&&(t=-e.wheelDeltaY,safari&&(t/=3));var i=browser.now(),o=i-(this._time||0);this._pos=DOM.mousePos(this._el,e),this._time=i,0!==t&&t%4.000244140625===0?(this._type="wheel",t=Math.floor(t/4)):0!==t&&Math.abs(t)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(o*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&this._zoom(-t,e),e.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(e,t){if(0!==e){var i=this._map,o=2/(1+Math.exp(-Math.abs(e/100)));0>e&&0!==o&&(o=1/o);var s=i.ease?i.ease.to:i.transform.scale,a=i.transform.scaleZoom(s*o);i.zoomTo(a,{duration:0,around:i.unproject(this._pos),delayEndEvents:200},{originalEvent:t})}}};
},{"../../util/browser":87,"../../util/dom":90,"../../util/util":98}],80:[function(require,module,exports){
"use strict";function TouchZoomRotateHandler(t){this._map=t,this._el=t.getCanvasContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),util=require("../../util/util");module.exports=TouchZoomRotateHandler;var inertiaLinearity=.15,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaDeceleration=12,inertiaMaxSpeed=2.5,significantScaleThreshold=.15,significantRotateThreshold=4;TouchZoomRotateHandler.prototype={enable:function(){this.disable(),this._el.addEventListener("touchstart",this._onStart,!1)},disable:function(){this._el.removeEventListener("touchstart",this._onStart)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),i=DOM.mousePos(this._el,t.touches[1]);this._startVec=e.sub(i),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),i=DOM.mousePos(this._el,t.touches[1]),n=e.add(i).div(2),a=e.sub(i),s=a.mag()/this._startVec.mag(),r=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,o=this._map;if(this._gestureIntent){var h={duration:0,around:o.unproject(n)};"rotate"===this._gestureIntent&&(h.bearing=this._startBearing+r),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(h.zoom=o.transform.scaleZoom(this._startScale*s)),o.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),s,n]),o.easeTo(h,{originalEvent:t})}else{var u=Math.abs(1-s)>significantScaleThreshold,l=Math.abs(r)>significantRotateThreshold;l?this._gestureIntent="rotate":u&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=o.transform.scale,this._startBearing=o.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,i=this._map;if(e.length<2)return void i.snapToNorth({},{originalEvent:t});var n=e[e.length-1],a=e[0],s=i.transform.scaleZoom(this._startScale*n[1]),r=i.transform.scaleZoom(this._startScale*a[1]),o=s-r,h=(n[0]-a[0])/1e3,u=n[2];if(0===h||s===r)return void i.snapToNorth({},{originalEvent:t});var l=o*inertiaLinearity/h;Math.abs(l)>inertiaMaxSpeed&&(l=l>0?inertiaMaxSpeed:-inertiaMaxSpeed);var c=1e3*Math.abs(l/(inertiaDeceleration*inertiaLinearity)),_=s+l*c/2e3;0>_&&(_=0),i.easeTo({zoom:_,duration:c,easing:inertiaEasing,around:i.unproject(u)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),i=160;t.length>2&&e-t[0][0]>i;)t.shift()}};
},{"../../util/dom":90,"../../util/util":98}],81:[function(require,module,exports){
"use strict";function Hash(){util.bindAll(["_onHashChange","_updateHash"],this)}module.exports=Hash;var util=require("../util/util");Hash.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),a=this._map.getBearing(),h=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),n="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(h)+"/"+t.lng.toFixed(h)+(a?"/"+Math.round(10*a)/10:"");window.history.replaceState("","",n)}};
},{"../util/util":98}],82:[function(require,module,exports){
"use strict";function Interaction(e){this._map=e,this._el=e.getCanvasContainer();for(var t in handlers)e[t]=new handlers[t](e);util.bindHandlers(this)}var handlers={scrollZoom:require("./handler/scroll_zoom"),boxZoom:require("./handler/box_zoom"),dragRotate:require("./handler/drag_rotate"),dragPan:require("./handler/drag_pan"),keyboard:require("./handler/keyboard"),doubleClickZoom:require("./handler/dblclick_zoom"),touchZoomRotate:require("./handler/touch_zoom_rotate")},DOM=require("../util/dom"),util=require("../util/util");module.exports=Interaction,Interaction.prototype={enable:function(){var e=this._map.options,t=this._el;for(var n in handlers)e[n]&&this._map[n].enable();t.addEventListener("mousedown",this._onMouseDown,!1),t.addEventListener("mouseup",this._onMouseUp,!1),t.addEventListener("touchstart",this._onTouchStart,!1),t.addEventListener("click",this._onClick,!1),t.addEventListener("mousemove",this._onMouseMove,!1),t.addEventListener("dblclick",this._onDblClick,!1),t.addEventListener("contextmenu",this._onContextMenu,!1)},disable:function(){var e=this._map.options,t=this._el;for(var n in handlers)e[n]&&this._map[n].disable();t.removeEventListener("mousedown",this._onMouseDown),t.removeEventListener("mouseup",this._onMouseUp),t.removeEventListener("touchstart",this._onTouchStart),t.removeEventListener("click",this._onClick),t.removeEventListener("mousemove",this._onMouseMove),t.removeEventListener("dblclick",this._onDblClick),t.removeEventListener("contextmenu",this._onContextMenu)},_onMouseDown:function(e){this._map.stop(),this._startPos=DOM.mousePos(this._el,e),this._fireEvent("mousedown",e)},_onMouseUp:function(e){var t=this._map,n=t.dragRotate&&t.dragRotate.active;this._contextMenuEvent&&!n&&this._fireEvent("contextmenu",this._contextMenuEvent),this._contextMenuEvent=null,this._fireEvent("mouseup",e)},_onTouchStart:function(e){!e.touches||e.touches.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._fireEvent("dblclick",e)):this._tapped=setTimeout(this._onTimeout,300))},_onTimeout:function(){this._tapped=null},_onMouseMove:function(e){var t=this._map,n=this._el;if(!(t.dragPan&&t.dragPan.active||t.dragRotate&&t.dragRotate.active)){for(var o=e.toElement||e.target;o&&o!==n;)o=o.parentNode;o===n&&this._fireEvent("mousemove",e)}},_onClick:function(e){var t=DOM.mousePos(this._el,e);t.equals(this._startPos)&&this._fireEvent("click",e)},_onDblClick:function(e){this._fireEvent("dblclick",e),e.preventDefault()},_onContextMenu:function(e){this._contextMenuEvent=e,e.preventDefault()},_fireEvent:function(e,t){var n=DOM.mousePos(this._el,t);return this._map.fire(e,{lngLat:this._map.unproject(n),point:n,originalEvent:t})}};
},{"../util/dom":90,"../util/util":98,"./handler/box_zoom":74,"./handler/dblclick_zoom":75,"./handler/drag_pan":76,"./handler/drag_rotate":77,"./handler/keyboard":78,"./handler/scroll_zoom":79,"./handler/touch_zoom_rotate":80}],83:[function(require,module,exports){
"use strict";function removeNode(t){t.parentNode&&t.parentNode.removeChild(t)}var Canvas=require("../util/canvas"),util=require("../util/util"),browser=require("../util/browser"),Evented=require("../util/evented"),DOM=require("../util/dom"),Style=require("../style/style"),AnimationLoop=require("../style/animation_loop"),Painter=require("../render/painter"),Transform=require("../geo/transform"),Hash=require("./hash"),Interaction=require("./interaction"),Camera=require("./camera"),LngLat=require("../geo/lng_lat"),LngLatBounds=require("../geo/lng_lat_bounds"),Point=require("point-geometry"),Attribution=require("./control/attribution"),Map=module.exports=function(t){if(t=this.options=util.inherit(this.options,t),this.animationLoop=new AnimationLoop,this.transform=new Transform(t.minZoom,t.maxZoom),t.maxBounds){var e=LngLatBounds.convert(t.maxBounds);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()]}util.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowResize","onError","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof window&&window.addEventListener("resize",this._onWindowResize,!1),this.interaction=new Interaction(this),t.interactive&&this.interaction.enable(),this._hash=t.hash&&(new Hash).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo(t),this.sources={},this.stacks={},this._classes={},this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new Attribution(t.attributionControl)),this.on("style.error",this.onError),this.on("source.error",this.onError),this.on("tile.error",this.onError),this.on("layer.error",this.onError)};util.extend(Map.prototype,Evented),util.extend(Map.prototype,Camera.prototype),util.extend(Map.prototype,{options:{center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:20,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1},addControl:function(t){return t.addTo(this),this},addClass:function(t,e){this._classes[t]||(this._classes[t]=!0,this.style&&this.style._cascade(this._classes,e))},removeClass:function(t,e){this._classes[t]&&(delete this._classes[t],this.style&&this.style._cascade(this._classes,e))},setClasses:function(t,e){this._classes={};for(var i=0;i<t.length;i++)this._classes[t[i]]=!0;this.style&&this.style._cascade(this._classes,e)},hasClass:function(t){return!!this._classes[t]},getClasses:function(){return Object.keys(this._classes)},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new LngLatBounds(this.transform.pointLocation(new Point(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new Point(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new Point(0,this.transform.size.y)))),t},project:function(t){return this.transform.locationPoint(LngLat.convert(t))},unproject:function(t){return this.transform.pointLocation(Point.convert(t))},featuresAt:function(t,e,i){var r=this.unproject(t).wrap(),o=this.transform.locationCoordinate(r);return this.style.featuresAt(o,e,i),this},featuresIn:function(t,e,i){return"undefined"==typeof i&&(i=e,e=t,t=[Point.convert([0,0]),Point.convert([this.transform.width,this.transform.height])]),t=t.map(Point.convert.bind(Point)),t=[new Point(Math.min(t[0].x,t[1].x),Math.min(t[0].y,t[1].y)),new Point(Math.max(t[0].x,t[1].x),Math.max(t[0].y,t[1].y))].map(this.transform.pointCoordinate.bind(this.transform)),this.style.featuresIn(t,e,i),this},batch:function(t){this.style.batch(t),this.style._cascade(this._classes),this._update(!0)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tileLine truncated
},{"../geo/lng_lat":10,"../geo/lng_lat_bounds":11,"../geo/transform":12,"../render/painter":26,"../style/animation_loop":40,"../style/style":43,"../util/browser":87,"../util/canvas":88,"../util/dom":90,"../util/evented":92,"../util/util":98,"./camera":70,"./control/attribution":71,"./hash":81,"./interaction":82,"point-geometry":151}],84:[function(require,module,exports){
"use strict";function Popup(t){util.setOptions(this,t),util.bindAll(["_update","_onClickClose"],this)}module.exports=Popup;var util=require("../util/util"),Evented=require("../util/evented"),DOM=require("../util/dom"),LngLat=require("../geo/lng_lat");Popup.prototype=util.inherit(Evented,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=LngLat.convert(t),this._update(),this},setText:function(t){return this._createContent(),this._content.appendChild(document.createTextNode(t)),this._update(),this},setHTML:function(t){this._createContent();var e,n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;this._content.appendChild(e)}return this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=DOM.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=DOM.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=DOM.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=DOM.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var n=this._container.offsetWidth,i=this._container.offsetHeight;e=t.y<i?["top"]:t.y>this._map.transform.height-i?["bottom"]:[],t.x<n/2?e.push("left"):t.x>this._map.transform.width-n/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var o={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},s=this._container.classList;for(var a in o)s.remove("mapboxgl-popup-anchor-"+a);s.add("mapboxgl-popup-anchor-"+e),DOM.setTransform(this._container,o[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}});
},{"../geo/lng_lat":10,"../util/dom":90,"../util/evented":92,"../util/util":98}],85:[function(require,module,exports){
"use strict";function Actor(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}module.exports=Actor,Actor.prototype.receive=function(t){var e,s=t.data;if("<response>"===s.type)e=this.callbacks[s.id],delete this.callbacks[s.id],e(s.error||null,s.data);else if("undefined"!=typeof s.id){var i=s.id;this.parent[s.type](s.data,function(t,e,s){this.postMessage({type:"<response>",id:String(i),error:t?String(t):null,data:e},s)}.bind(this))}else this.parent[s.type](s.data)},Actor.prototype.send=function(t,e,s,i){var a=null;s&&(this.callbacks[a=this.callbackID++]=s),this.postMessage({type:t,id:String(a),data:e},i)},Actor.prototype.postMessage=function(t,e){try{this.target.postMessage(t,e)}catch(s){this.target.postMessage(t)}};
},{}],86:[function(require,module,exports){
"use strict";function sameOrigin(e){var t=document.createElement("a");return t.href=e,t.protocol===document.location.protocol&&t.host===document.location.host}exports.getJSON=function(e,t){var n=new XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","application/json"),n.onerror=function(e){t(e)},n.onload=function(){if(n.status>=200&&n.status<300&&n.response){var e;try{e=JSON.parse(n.response)}catch(r){return t(r)}t(null,e)}else t(new Error(n.statusText))},n.send(),n},exports.getArrayBuffer=function(e,t){var n=new XMLHttpRequest;return n.open("GET",e,!0),n.responseType="arraybuffer",n.onerror=function(e){t(e)},n.onload=function(){n.status>=200&&n.status<300&&n.response?t(null,n.response):t(new Error(n.statusText))},n.send(),n},exports.getImage=function(e,t){return exports.getArrayBuffer(e,function(e,n){if(e)return t(e);var r=new Image;r.onload=function(){t(null,r),(window.URL||window.webkitURL).revokeObjectURL(r.src)};var o=new Blob([new Uint8Array(n)],{type:"image/png"});return r.src=(window.URL||window.webkitURL).createObjectURL(o),r.getData=function(){var e=document.createElement("canvas"),t=e.getContext("2d");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height).data},r})},exports.getVideo=function(e,t){var n=document.createElement("video");n.onloadstart=function(){t(null,n)};for(var r=0;r<e.length;r++){var o=document.createElement("source");sameOrigin(e[r])||(n.crossOrigin="Anonymous"),o.src=e[r],n.appendChild(o)}return n.getData=function(){return n},n};
},{}],87:[function(require,module,exports){
"use strict";var Canvas=require("./canvas");module.exports.now=function(){return window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now.bind(Date)}();var frame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;exports.frame=function(e){return frame(e)};var cancel=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame;exports.cancelFrame=function(e){cancel(e)},exports.timed=function(e,r,t){function n(a){o||(a=module.exports.now(),a>=i+r?e.call(t,1):(e.call(t,(a-i)/r),exports.frame(n)))}if(!r)return e.call(t,1),null;var o=!1,i=module.exports.now();return exports.frame(n),function(){o=!0}},exports.supportsWebGL={},exports.supported=function(e){for(var r=([function(){return"undefined"!=typeof window},function(){return"undefined"!=typeof document},function(){return!!(Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray)},function(){return!(!Function.prototype||!Function.prototype.bind||!(Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions))},function(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON},function(){var r=e&&e.failIfMajorPerformanceCaveat||!1,t="fimpc_"+String(r);if(void 0===exports.supportsWebGL[t]){var n=new Canvas;exports.supportsWebGL[t]=n.supportsWebGLContext(r)}return exports.supportsWebGL[t]},function(){return"Worker"in window}]),t=0;t<r.length;t++)if(!r[t]())return!1;return!0},exports.hardwareConcurrency=navigator.hardwareConcurrency||8,Object.defineProperty(exports,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),exports.supportsWebp=!1;var webpImgTest=document.createElement("img");webpImgTest.onload=function(){exports.supportsWebp=!0},webpImgTest.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=";
},{"./canvas":88}],88:[function(require,module,exports){
"use strict";function Canvas(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var util=require("../util");module.exports=Canvas,Canvas.prototype.resize=function(t,e){var a=window.devicePixelRatio||1;this.canvas.width=a*t,this.canvas.height=a*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"};var requiredContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};Canvas.prototype.getWebGLContext=function(t){return t=util.extend({},t,requiredContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},Canvas.prototype.supportsWebGLContext=function(t){var e=util.extend({failIfMajorPerformanceCaveat:t},requiredContextAttributes);return"probablySupportsContext"in this.canvas?this.canvas.probablySupportsContext("webgl",e)||this.canvas.probablySupportsContext("experimental-webgl",e):"supportsContext"in this.canvas?this.canvas.supportsContext("webgl",e)||this.canvas.supportsContext("experimental-webgl",e):!!window.WebGLRenderingContext&&!!this.getWebGLContext(t)},Canvas.prototype.getElement=function(){return this.canvas};
},{"../util":98}],89:[function(require,module,exports){
"use strict";function Dispatcher(r,t){this.actors=[],this.currentActor=0;for(var e=0;r>e;e++){var o=new WebWorkify(require("../../source/worker")),s=new Actor(o,t);s.name="Worker "+e,this.actors.push(s)}}var Actor=require("../actor"),WebWorkify=require("webworkify");module.exports=Dispatcher,Dispatcher.prototype={broadcast:function(r,t){for(var e=0;e<this.actors.length;e++)this.actors[e].send(r,t)},send:function(r,t,e,o,s){return("number"!=typeof o||isNaN(o))&&(o=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[o].send(r,t,e,s),o},remove:function(){for(var r=0;r<this.actors.length;r++)this.actors[r].target.terminate();this.actors=[]}};
},{"../../source/worker":38,"../actor":85,"webworkify":162}],90:[function(require,module,exports){
"use strict";function testProp(e){for(var t=0;t<e.length;t++)if(e[t]in docStyle)return e[t]}function suppressClick(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",suppressClick,!0)}var Point=require("point-geometry");exports.create=function(e,t,r){var o=document.createElement(e);return t&&(o.className=t),r&&r.appendChild(o),o};var docStyle=document.documentElement.style,selectProp=testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),userSelect;exports.disableDrag=function(){selectProp&&(userSelect=docStyle[selectProp],docStyle[selectProp]="none")},exports.enableDrag=function(){selectProp&&(docStyle[selectProp]=userSelect)};var transformProp=testProp(["transform","WebkitTransform"]);exports.setTransform=function(e,t){e.style[transformProp]=t},exports.suppressClick=function(){window.addEventListener("click",suppressClick,!0),window.setTimeout(function(){window.removeEventListener("click",suppressClick,!0)},0)},exports.mousePos=function(e,t){var r=e.getBoundingClientRect();return t=t.touches?t.touches[0]:t,new Point(t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop)};
},{"point-geometry":151}],91:[function(require,module,exports){
"use strict";module.exports={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0};
},{}],92:[function(require,module,exports){
"use strict";var util=require("./util"),Evented={on:function(t,e){return this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(e),this},off:function(t,e){if(!t)return delete this._events,this;if(!this.listens(t))return this;if(e){var s=this._events[t].indexOf(e);s>=0&&this._events[t].splice(s,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var s=function(i){this.off(t,s),e.call(this,i)}.bind(this);return this.on(t,s),this},fire:function(t,e){if(!this.listens(t))return this;e=util.extend({},e),util.extend(e,{type:t,target:this});for(var s=this._events[t].slice(),i=0;i<s.length;i++)s[i].call(this,e);return this},listens:function(t){return!(!this._events||!this._events[t])}};module.exports=Evented;
},{"./util":98}],93:[function(require,module,exports){
"use strict";function Glyphs(a,e){this.stacks=a.readFields(readFontstacks,[],e)}function readFontstacks(a,e,r){if(1===a){var t=r.readMessage(readFontstack,{glyphs:{}});e.push(t)}}function readFontstack(a,e,r){if(1===a)e.name=r.readString();else if(2===a)e.range=r.readString();else if(3===a){var t=r.readMessage(readGlyph,{});e.glyphs[t.id]=t}}function readGlyph(a,e,r){1===a?e.id=r.readVarint():2===a?e.bitmap=r.readBytes():3===a?e.width=r.readVarint():4===a?e.height=r.readVarint():5===a?e.left=r.readSVarint():6===a?e.top=r.readSVarint():7===a&&(e.advance=r.readVarint())}module.exports=Glyphs;
},{}],94:[function(require,module,exports){
"use strict";function interpolate(t,e,n){return t*(1-n)+e*n}module.exports=interpolate,interpolate.number=interpolate,interpolate.vec2=function(t,e,n){return[interpolate(t[0],e[0],n),interpolate(t[1],e[1],n)]},interpolate.color=function(t,e,n){return[interpolate(t[0],e[0],n),interpolate(t[1],e[1],n),interpolate(t[2],e[2],n),interpolate(t[3],e[3],n)]},interpolate.array=function(t,e,n){return t.map(function(t,r){return interpolate(t,e[r],n)})};
},{}],95:[function(require,module,exports){
"use strict";function LRUCache(t,e){this.max=t,this.onRemove=e,this.reset()}module.exports=LRUCache,LRUCache.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},LRUCache.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var i=this.get(this.order[0]);i&&this.onRemove(i)}return this},LRUCache.prototype.has=function(t){return t in this.data},LRUCache.prototype.keys=function(){return this.order},LRUCache.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},LRUCache.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this};
},{}],96:[function(require,module,exports){
"use strict";function normalizeURL(e,r,o){if(o=o||config.ACCESS_TOKEN,!o&&config.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(e=e.replace(/^mapbox:\/\//,config.API_URL+r),e+=-1!==e.indexOf("?")?"&access_token=":"?access_token=",config.REQUIRE_ACCESS_TOKEN){if("s"===o[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");e+=o}return e}var config=require("./config"),browser=require("./browser");module.exports.normalizeStyleURL=function(e,r){if(!e.match(/^mapbox:\/\/styles\//))return e;var o=e.split("/"),t=o[3],s=o[4],n=o[5]?"/draft":"";return normalizeURL("mapbox://"+t+"/"+s+n,"/styles/v1/",r)},module.exports.normalizeSourceURL=function(e,r){return e.match(/^mapbox:\/\//)?normalizeURL(e+".json","/v4/",r)+"&secure":e},module.exports.normalizeGlyphsURL=function(e,r){if(!e.match(/^mapbox:\/\//))return e;var o=e.split("/")[3];return normalizeURL("mapbox://"+o+"/{fontstack}/{range}.pbf","/fonts/v1/",r)},module.exports.normalizeSpriteURL=function(e,r,o,t){if(!e.match(/^mapbox:\/\/sprites\//))return e+r+o;var s=e.split("/"),n=s[3],a=s[4],i=s[5]?"/draft":"";return normalizeURL("mapbox://"+n+"/"+a+i+"/sprite"+r+o,"/styles/v1/",t)},module.exports.normalizeTileURL=function(e,r,o){if(!r||!r.match(/^mapbox:\/\//))return e;e=e.replace(/([?&]access_token=)tk\.[^&]+/,"$1"+config.ACCESS_TOKEN);var t=browser.supportsWebp?"webp":"$1";return e.replace(/\.((?:png|jpg)\d*)(?=$|\?)/,browser.devicePixelRatio>=2||512===o?"@2x."+t:"."+t)};
},{"./browser":87,"./config":91}],97:[function(require,module,exports){
"use strict";function resolveTokens(e,n){return n.replace(/{([^{}()\[\]<>$=:;.,^]+)}/g,function(n,r){return r in e?e[r]:""})}module.exports=resolveTokens;
},{}],98:[function(require,module,exports){
"use strict";var UnitBezier=require("unitbezier"),Coordinate=require("../geo/coordinate");exports.easeCubicInOut=function(r){if(0>=r)return 0;if(r>=1)return 1;var t=r*r,n=t*r;return 4*(.5>r?n:3*(r-t)+n-.75)},exports.bezier=function(r,t,n,e){var o=new UnitBezier(r,t,n,e);return function(r){return o.solve(r)}},exports.ease=exports.bezier(.25,.1,.25,1),exports.premultiply=function(r,t){if(!r)return null;var n=r[3]*t;return[r[0]*n,r[1]*n,r[2]*n,n]},exports.clamp=function(r,t,n){return Math.min(n,Math.max(t,r))},exports.wrap=function(r,t,n){var e=n-t,o=((r-t)%e+e)%e+t;return o===t?n:o},exports.coalesce=function(){for(var r=0;r<arguments.length;r++){var t=arguments[r];if(null!==t&&void 0!==t)return t}},exports.asyncAll=function(r,t,n){if(!r.length)return n(null,[]);var e=r.length,o=new Array(r.length),i=null;r.forEach(function(r,u){t(r,function(r,t){r&&(i=r),o[u]=t,0===--e&&n(i,o)})})},exports.keysDifference=function(r,t){var n=[];for(var e in r)e in t||n.push(e);return n},exports.extend=function(r){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var e in n)r[e]=n[e]}return r},exports.extendAll=function(r,t){for(var n in t)Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n));return r},exports.inherit=function(r,t){var n="function"==typeof r?r.prototype:r,e=Object.create(n);return exports.extendAll(e,t),e},exports.pick=function(r,t){for(var n={},e=0;e<t.length;e++){var o=t[e];o in r&&(n[o]=r[o])}return n};var id=1;exports.uniqueId=function(){return id++},exports.throttle=function(r,t,n){var e,o,i,u;return u=function(){e=!1,o&&(i.apply(n,o),o=!1)},i=function(){e?o=arguments:(r.apply(n,arguments),setTimeout(u,t),e=!0)}},exports.debounce=function(r,t){var n,e;return function(){e=arguments,clearTimeout(n),n=setTimeout(function(){r.apply(null,e)},t)}},exports.bindAll=function(r,t){r.forEach(function(r){t[r]=t[r].bind(t)})},exports.bindHandlers=function(r){for(var t in r)"function"==typeof r[t]&&0===t.indexOf("_on")&&(r[t]=r[t].bind(r))},exports.setOptions=function(r,t){r.hasOwnProperty("options")||(r.options=r.options?Object.create(r.options):{});for(var n in t)r.options[n]=t[n];return r.options},exports.getCoordinatesCenter=function(r){for(var t=1/0,n=1/0,e=-(1/0),o=-(1/0),i=0;i<r.length;i++)t=Math.min(t,r[i].column),n=Math.min(n,r[i].row),e=Math.max(e,r[i].column),o=Math.max(o,r[i].row);var u=e-t,a=o-n,f=Math.max(u,a);return new Coordinate((t+e)/2,(n+o)/2,0).zoomTo(Math.floor(-Math.log(f)/Math.LN2))},exports.endsWith=function(r,t){return-1!==r.indexOf(t,r.length-t.length)},exports.startsWith=function(r,t){return 0===r.indexOf(t)},exports.mapObject=function(r,t,n){var e={};for(var o in r)e[o]=t.call(n||this,r[o],o,r);return e},exports.filterObject=function(r,t,n){var e={};for(var o in r)t.call(n||this,r[o],o,r)&&(e[o]=r[o]);return e},exports.deepEqual=function r(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(var e=0;e<t.length;e++)if(!r(t[e],n[e]))return!1;return!0}if("object"==typeof t){if("object"!=typeof n)return!1;var o=Object.keys(t);if(o.length!==Object.keys(n).length)return!1;for(var i in t)if(!r(t[i],n[i]))return!1;return!0}return t===n};
},{"../geo/coordinate":9,"unitbezier":156}],99:[function(require,module,exports){
"function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t};
},{}],100:[function(require,module,exports){
(function (process){
function normalizeArray(r,t){for(var e=0,n=r.length-1;n>=0;n--){var s=r[n];"."===s?r.splice(n,1):".."===s?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function filter(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,splitPath=function(r){return splitPathRe.exec(r).slice(1)};exports.resolve=function(){for(var r="",t=!1,e=arguments.length-1;e>=-1&&!t;e--){var n=e>=0?arguments[e]:process.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(r=n+"/"+r,t="/"===n.charAt(0))}return r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"),(t?"/":"")+r||"."},exports.normalize=function(r){var t=exports.isAbsolute(r),e="/"===substr(r,-1);return r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"),r||t||(r="."),r&&e&&(r+="/"),(t?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(r,function(r,t){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),s=e(t.split("/")),i=Math.min(n.length,s.length),o=i,u=0;i>u;u++)if(n[u]!==s[u]){o=u;break}for(var l=[],u=o;u<n.length;u++)l.push("..");return l=l.concat(s.slice(o)),l.join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){var t=splitPath(r),e=t[0],n=t[1];return e||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},exports.basename=function(r,t){var e=splitPath(r)[2];return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},exports.extname=function(r){return splitPath(r)[3]};var substr="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return 0>t&&(t=r.length+t),r.substr(t,e)};
}).call(this,require('_process'))
},{"_process":101}],101:[function(require,module,exports){
function cleanUpNextTick(){draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue()}function drainQueue(){if(!draining){var e=setTimeout(cleanUpNextTick);draining=!0;for(var n=queue.length;n;){for(currentQueue=queue,queue=[];++queueIndex<n;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,n=queue.length}currentQueue=null,draining=!1,clearTimeout(e)}}function Item(e,n){this.fun=e,this.array=n}function noop(){}var process=module.exports={},queue=[],draining=!1,currentQueue,queueIndex=-1;process.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)n[r-1]=arguments[r];queue.push(new Item(e,n)),1!==queue.length||draining||setTimeout(drainQueue,0)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};
},{}],102:[function(require,module,exports){
module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8};
},{}],103:[function(require,module,exports){
(function (process,global){
function inspect(e,r){var t={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),isBoolean(r)?t.showHidden=r:r&&exports._extend(t,r),isUndefined(t.showHidden)&&(t.showHidden=!1),isUndefined(t.depth)&&(t.depth=2),isUndefined(t.colors)&&(t.colors=!1),isUndefined(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=stylizeWithColor),formatValue(t,e,t.depth)}function stylizeWithColor(e,r){var t=inspect.styles[r];return t?"["+inspect.colors[t][0]+"m"+e+"["+inspect.colors[t][1]+"m":e}function stylizeNoColor(e,r){return e}function arrayToHash(e){var r={};return e.forEach(function(e,t){r[e]=!0}),r}function formatValue(e,r,t){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==exports.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(t,e);return isString(n)||(n=formatValue(e,n,t)),n}var i=formatPrimitive(e,r);if(i)return i;var o=Object.keys(r),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),isError(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(r);if(0===o.length){if(isFunction(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var c="",a=!1,l=["{","}"];if(isArray(r)&&(a=!0,l=["[","]"]),isFunction(r)){var p=r.name?": "+r.name:"";c=" [Function"+p+"]"}if(isRegExp(r)&&(c=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(c=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(c=" "+formatError(r)),0===o.length&&(!a||0==r.length))return l[0]+c+l[1];if(0>t)return isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var f;return f=a?formatArray(e,r,t,s,o):o.map(function(n){return formatProperty(e,r,t,s,n,a)}),e.seen.pop(),reduceToSingleString(f,c,l)}function formatPrimitive(e,r){if(isUndefined(r))return e.stylize("undefined","undefined");if(isString(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return isNumber(r)?e.stylize(""+r,"number"):isBoolean(r)?e.stylize(""+r,"boolean"):isNull(r)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,r,t,n,i){for(var o=[],s=0,u=r.length;u>s;++s)hasOwnProperty(r,String(s))?o.push(formatProperty(e,r,t,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(formatProperty(e,r,t,n,i,!0))}),o}function formatProperty(e,r,t,n,i,o){var s,u,c;if(c=Object.getOwnPropertyDescriptor(r,i)||{value:r[i]},c.get?u=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(u=e.stylize("[Setter]","special")),hasOwnProperty(n,i)||(s="["+i+"]"),u||(e.seen.indexOf(c.value)<0?(u=isNull(t)?formatValue(e,c.value,null):formatValue(e,c.value,t-1),u.indexOf("\n")>-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return u;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function reduceToSingleString(e,r,t){var n=0,i=e.reduce(function(e,r){return n++,r.indexOf("\n")>=0&&n++,e+r.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?t[0]+(""===r?"":r+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return 10>e?"0"+e.toString(10):e.toString(10)}function timestamp(){var e=new Date,r=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],r].join(" ")}function hasOwnProperty(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var formatRegExp=/%[sdj%]/g;exports.formaLine truncated
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./support/isBuffer":102,"_process":101,"inherits":99}],104:[function(require,module,exports){
function clamp_css_byte(e){return e=Math.round(e),0>e?0:e>255?255:e}function clamp_css_float(e){return 0>e?0:e>1?1:e}function parse_css_int(e){return clamp_css_byte("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function parse_css_float(e){return clamp_css_float("%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))}function css_hue_to_rgb(e,r,l){return 0>l?l+=1:l>1&&(l-=1),1>6*l?e+(r-e)*l*6:1>2*l?r:2>3*l?e+(r-e)*(2/3-l)*6:e}function parseCSSColor(e){var r=e.replace(/ /g,"").toLowerCase();if(r in kCSSColorTable)return kCSSColorTable[r].slice();if("#"===r[0]){if(4===r.length){var l=parseInt(r.substr(1),16);return l>=0&&4095>=l?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null}if(7===r.length){var l=parseInt(r.substr(1),16);return l>=0&&16777215>=l?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null}return null}var a=r.indexOf("("),t=r.indexOf(")");if(-1!==a&&t+1===r.length){var n=r.substr(0,a),s=r.substr(a+1,t-(a+1)).split(","),o=1;switch(n){case"rgba":if(4!==s.length)return null;o=parse_css_float(s.pop());case"rgb":return 3!==s.length?null:[parse_css_int(s[0]),parse_css_int(s[1]),parse_css_int(s[2]),o];case"hsla":if(4!==s.length)return null;o=parse_css_float(s.pop());case"hsl":if(3!==s.length)return null;var i=(parseFloat(s[0])%360+360)%360/360,u=parse_css_float(s[1]),g=parse_css_float(s[2]),d=.5>=g?g*(u+1):g+u-g*u,c=2*g-d;return[clamp_css_byte(255*css_hue_to_rgb(c,d,i+1/3)),clamp_css_byte(255*css_hue_to_rgb(c,d,i)),clamp_css_byte(255*css_hue_to_rgb(c,d,i-1/3)),o];default:return null}}return null}var kCSSColorTable={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,18Line truncated
},{}],105:[function(require,module,exports){
"use strict";function createFilter(e){return new Function("f","return "+compile(e))}function compile(e){if(!e)return"true";var n=e[0];if(e.length<=1)return"any"===n?"false":"true";var r="=="===n?compare(e[1],e[2],"===",!1):"!="===n?compare(e[1],e[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?compare(e[1],e[2],n,!0):"any"===n?e.slice(1).map(compile).join("||"):"all"===n?e.slice(1).map(compile).join("&&"):"none"===n?"!("+e.slice(1).map(compile).join("||")+")":"in"===n?compileIn(e[1],e.slice(2)):"!in"===n?"!("+compileIn(e[1],e.slice(2))+")":"true";return"("+r+")"}function valueExpr(e){return"$type"===e?"f.type":"(f.properties || {})["+JSON.stringify(e)+"]"}function compare(e,n,r,i){var t=valueExpr(e),o="$type"===e?types.indexOf(n):JSON.stringify(n);return(i?"typeof "+t+"=== typeof "+o+"&&":"")+t+r+o}function compileIn(e,n){"$type"===e&&(n=n.map(function(e){return types.indexOf(e)}));var r=JSON.stringify(n.sort(compareFn)),i=valueExpr(e);return n.length<=200?r+".indexOf("+i+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+i+", "+r+",0,"+(n.length-1)+")"}function compareFn(e,n){return n>e?-1:e>n?1:0}module.exports=createFilter;var types=["Unknown","Point","LineString","Polygon"];
},{}],106:[function(require,module,exports){
"use strict";function clip(e,n,t,r,l,u,i,s){if(t/=n,r/=n,i>=t&&r>=s)return e;if(i>r||t>s)return null;for(var p=[],h=0;h<e.length;h++){var c,a,o=e[h],f=o.geometry,g=o.type;if(c=o.min[l],a=o.max[l],c>=t&&r>=a)p.push(o);else if(!(c>r||t>a)){var m=1===g?clipPoints(f,t,r,l):clipGeometry(f,t,r,l,u,3===g);m.length&&p.push({geometry:m,type:g,tags:e[h].tags||null,min:o.min,max:o.max})}}return p.length?p:null}function clipPoints(e,n,t,r){for(var l=[],u=0;u<e.length;u++){var i=e[u],s=i[r];s>=n&&t>=s&&l.push(i)}return l}function clipGeometry(e,n,t,r,l,u){for(var i=[],s=0;s<e.length;s++){var p,h,c,a=0,o=0,f=null,g=e[s],m=g.area,v=g.dist,w=g.length,y=[];for(h=0;w-1>h;h++)p=f||g[h],f=g[h+1],a=o||p[r],o=f[r],n>a?o>t?(y.push(l(p,f,n),l(p,f,t)),u||(y=newSlice(i,y,m,v))):o>=n&&y.push(l(p,f,n)):a>t?n>o?(y.push(l(p,f,t),l(p,f,n)),u||(y=newSlice(i,y,m,v))):t>=o&&y.push(l(p,f,t)):(y.push(p),n>o?(y.push(l(p,f,n)),u||(y=newSlice(i,y,m,v))):o>t&&(y.push(l(p,f,t)),u||(y=newSlice(i,y,m,v))));p=g[w-1],a=p[r],a>=n&&t>=a&&y.push(p),c=y[y.length-1],u&&c&&(y[0][0]!==c[0]||y[0][1]!==c[1])&&y.push(y[0]),newSlice(i,y,m,v)}return i}function newSlice(e,n,t,r){return n.length&&(n.area=t,n.dist=r,e.push(n)),[]}module.exports=clip;
},{}],107:[function(require,module,exports){
"use strict";function convert(e,t){var r=[];if("FeatureCollection"===e.type)for(var o=0;o<e.features.length;o++)convertFeature(r,e.features[o],t);else"Feature"===e.type?convertFeature(r,e,t):convertFeature(r,{geometry:e},t);return r}function convertFeature(e,t,r){var o,n,a,i=t.geometry,c=i.type,l=i.coordinates,u=t.properties;if("Point"===c)e.push(create(u,1,[projectPoint(l)]));else if("MultiPoint"===c)e.push(create(u,1,project(l)));else if("LineString"===c)e.push(create(u,2,[project(l,r)]));else if("MultiLineString"===c||"Polygon"===c){for(a=[],o=0;o<l.length;o++)a.push(project(l[o],r));e.push(create(u,"Polygon"===c?3:2,a))}else if("MultiPolygon"===c){for(a=[],o=0;o<l.length;o++)for(n=0;n<l[o].length;n++)a.push(project(l[o][n],r));e.push(create(u,3,a))}else{if("GeometryCollection"!==c)throw new Error("Input data is not a valid GeoJSON object.");for(o=0;o<i.geometries.length;o++)convertFeature(e,{geometry:i.geometries[o],properties:u},r)}}function create(e,t,r){var o={geometry:r,type:t,tags:e||null,min:[2,1],max:[-1,0]};return calcBBox(o),o}function project(e,t){for(var r=[],o=0;o<e.length;o++)r.push(projectPoint(e[o]));return t&&(simplify(r,t),calcSize(r)),r}function projectPoint(e){var t=Math.sin(e[1]*Math.PI/180),r=e[0]/360+.5,o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o=-1>o?-1:o>1?1:o,[r,o,0]}function calcSize(e){for(var t,r,o=0,n=0,a=0;a<e.length-1;a++)t=r||e[a],r=e[a+1],o+=t[0]*r[1]-r[0]*t[1],n+=Math.abs(r[0]-t[0])+Math.abs(r[1]-t[1]);e.area=Math.abs(o/2),e.dist=n}function calcBBox(e){var t=e.geometry,r=e.min,o=e.max;if(1===e.type)calcRingBBox(r,o,t);else for(var n=0;n<t.length;n++)calcRingBBox(r,o,t[n]);return e}function calcRingBBox(e,t,r){for(var o,n=0;n<r.length;n++)o=r[n],e[0]=Math.min(o[0],e[0]),t[0]=Math.max(o[0],t[0]),e[1]=Math.min(o[1],e[1]),t[1]=Math.max(o[1],t[1])}module.exports=convert;var simplify=require("./simplify");
},{"./simplify":109}],108:[function(require,module,exports){
"use strict";function geojsonvt(e,t){return new GeoJSONVT(e,t)}function GeoJSONVT(e,t){t=this.options=extend(Object.create(this.options),t);var i=t.debug;i&&console.time("preprocess data");var o=1<<t.maxZoom,n=convert(e,t.tolerance/(o*t.extent));this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=wrap(n,t.buffer/t.extent,intersectX),n.length&&this.splitTile(n,0,0,0),i&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function toID(e,t,i){return 32*((1<<e)*i+t)+e}function intersectX(e,t,i){return[i,(i-e[0])*(t[1]-e[1])/(t[0]-e[0])+e[1],1]}function intersectY(e,t,i){return[(i-e[1])*(t[0]-e[0])/(t[1]-e[1])+e[0],i,1]}function extend(e,t){for(var i in t)e[i]=t[i];return e}function isClippedSquare(e,t,i){var o=e.source;if(1!==o.length)return!1;var n=o[0];if(3!==n.type||n.geometry.length>1)return!1;var r=n.geometry[0].length;if(5!==r)return!1;for(var s=0;r>s;s++){var l=transform.point(n.geometry[0][s],t,e.z2,e.x,e.y);if(l[0]!==-i&&l[0]!==t+i||l[1]!==-i&&l[1]!==t+i)return!1}return!0}module.exports=geojsonvt;var convert=require("./convert"),transform=require("./transform"),clip=require("./clip"),wrap=require("./wrap"),createTile=require("./tile");GeoJSONVT.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},GeoJSONVT.prototype.splitTile=function(e,t,i,o,n,r,s){for(var l=[e,t,i,o],a=this.options,u=a.debug,c=null;l.length;){o=l.pop(),i=l.pop(),t=l.pop(),e=l.pop();var p=1<<t,d=toID(t,i,o),m=this.tiles[d],f=t===a.maxZoom?0:a.tolerance/(p*a.extent);if(!m&&(u>1&&console.time("creation"),m=this.tiles[d]=createTile(e,p,i,o,f,t===a.maxZoom),this.tileCoords.push({z:t,x:i,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,o,m.numFeatures,m.numPoints,m.numSimplified),console.timeEnd("creation"));var h="z"+t;this.stats[h]=(this.stats[h]||0)+1,this.total++}if(m.source=e,n){if(t===a.maxZoom||t===n)continue;var x=1<<n-t;if(i!==Math.floor(r/x)||o!==Math.floor(s/x))continue}else if(t===a.indexMaxZoom||m.numPoints<=a.indexMaxPoints)continue;if(a.solidChildren||!isClippedSquare(m,a.extent,a.buffer)){m.source=null,u>1&&console.time("clipping");var g,v,M,T,b,y,S=.5*a.buffer/a.extent,Z=.5-S,q=.5+S,w=1+S;g=v=M=T=null,b=clip(e,p,i-S,i+q,0,intersectX,m.min[0],m.max[0]),y=clip(e,p,i+Z,i+w,0,intersectX,m.min[0],m.max[0]),b&&(g=clip(b,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),v=clip(b,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),y&&(M=clip(y,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),T=clip(y,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),u>1&&console.timeEnd("clipping"),g&&l.push(g,t+1,2*i,2*o),v&&l.push(v,t+1,2*i,2*o+1),M&&l.push(M,t+1,2*i+1,2*o),T&&l.push(T,t+1,2*i+1,2*o+1)}else n&&(c=t)}return c},GeoJSONVT.prototype.getTile=function(e,t,i){var o=this.options,n=o.extent,r=o.debug,s=1<<e;t=(t%s+s)%s;var l=toID(e,t,i);if(this.tiles[l])return transform.tile(this.tiles[l],n);r>1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var a,u=e,c=t,p=i;!a&&u>0;)u--,c=Math.floor(c/2),p=Math.floor(p/2),a=this.tiles[toID(u,c,p)];if(!a||!a.source)return null;if(r>1&&console.log("found parent tile z%d-%d-%d",u,c,p),isClippedSquare(a,n,o.buffer))return transform.tile(a,n);r>1&&console.time("drilling down");var d=this.splitTile(a.source,u,c,p,e,t,i);if(r>1&&console.timeEnd("drilling down"),null!==d){var m=1<<e-d;l=toID(d,Math.floor(t/m),Math.floor(i/m))}return this.tiles[l]?transform.tile(this.tiles[l],n):null};
},{"./clip":106,"./convert":107,"./tile":110,"./transform":111,"./wrap":112}],109:[function(require,module,exports){
"use strict";function simplify(t,i){var e,p,r,s,o=i*i,f=t.length,u=0,n=f-1,g=[];for(t[u][2]=1,t[n][2]=1;n;){for(p=0,e=u+1;n>e;e++)r=getSqSegDist(t[e],t[u],t[n]),r>p&&(s=e,p=r);p>o?(t[s][2]=p,g.push(u),g.push(s),u=s):(n=g.pop(),u=g.pop())}}function getSqSegDist(t,i,e){var p=i[0],r=i[1],s=e[0],o=e[1],f=t[0],u=t[1],n=s-p,g=o-r;if(0!==n||0!==g){var l=((f-p)*n+(u-r)*g)/(n*n+g*g);l>1?(p=s,r=o):l>0&&(p+=n*l,r+=g*l)}return n=f-p,g=u-r,n*n+g*g}module.exports=simplify;
},{}],110:[function(require,module,exports){
"use strict";function createTile(e,n,t,m,i,u){for(var r={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:t,y:m,z2:n,transformed:!1,min:[2,1],max:[-1,0]},a=0;a<e.length;a++){r.numFeatures++,addFeature(r,e[a],i,u);var s=e[a].min,l=e[a].max;s[0]<r.min[0]&&(r.min[0]=s[0]),s[1]<r.min[1]&&(r.min[1]=s[1]),l[0]>r.max[0]&&(r.max[0]=l[0]),l[1]>r.max[1]&&(r.max[1]=l[1])}return r}function addFeature(e,n,t,m){var i,u,r,a,s=n.geometry,l=n.type,o=[],f=t*t;if(1===l)for(i=0;i<s.length;i++)o.push(s[i]),e.numPoints++,e.numSimplified++;else for(i=0;i<s.length;i++)if(r=s[i],m||!(2===l&&r.dist<t||3===l&&r.area<f)){var d=[];for(u=0;u<r.length;u++)a=r[u],(m||a[2]>f)&&(d.push(a),e.numSimplified++),e.numPoints++;o.push(d)}else e.numPoints+=r.length;o.length&&e.features.push({geometry:o,type:l,tags:n.tags||null})}module.exports=createTile;
},{}],111:[function(require,module,exports){
"use strict";function transformTile(r,t){if(r.transformed)return r;var n,e,o,f=r.z2,a=r.x,s=r.y;for(n=0;n<r.features.length;n++){var i=r.features[n],u=i.geometry,m=i.type;if(1===m)for(e=0;e<u.length;e++)u[e]=transformPoint(u[e],t,f,a,s);else for(e=0;e<u.length;e++){var l=u[e];for(o=0;o<l.length;o++)l[o]=transformPoint(l[o],t,f,a,s)}}return r.transformed=!0,r}function transformPoint(r,t,n,e,o){var f=Math.round(t*(r[0]*n-e)),a=Math.round(t*(r[1]*n-o));return[f,a]}exports.tile=transformTile,exports.point=transformPoint;
},{}],112:[function(require,module,exports){
"use strict";function wrap(r,t,e){var o=r,a=clip(r,1,-1-t,t,0,e,-1,2),s=clip(r,1,1-t,2+t,0,e,-1,2);return(a||s)&&(o=clip(r,1,-t,1+t,0,e,-1,2),a&&(o=shiftFeatureCoords(a,1).concat(o)),s&&(o=o.concat(shiftFeatureCoords(s,-1)))),o}function shiftFeatureCoords(r,t){for(var e=[],o=0;o<r.length;o++){var a,s=r[o],i=s.type;if(1===i)a=shiftCoords(s.geometry,t);else{a=[];for(var n=0;n<s.geometry.length;n++)a.push(shiftCoords(s.geometry[n],t))}e.push({geometry:a,type:i,tags:s.tags,min:[s.min[0]+t,s.min[1]],max:[s.max[0]+t,s.max[1]]})}return e}function shiftCoords(r,t){var e=[];e.area=r.area,e.dist=r.dist;for(var o=0;o<r.length;o++)e.push([r[o][0]+t,r[o][1],r[o][2]]);return e}var clip=require("./clip");module.exports=wrap;
},{"./clip":106}],113:[function(require,module,exports){
exports.glMatrix=require("./gl-matrix/common.js"),exports.mat2=require("./gl-matrix/mat2.js"),exports.mat2d=require("./gl-matrix/mat2d.js"),exports.mat3=require("./gl-matrix/mat3.js"),exports.mat4=require("./gl-matrix/mat4.js"),exports.quat=require("./gl-matrix/quat.js"),exports.vec2=require("./gl-matrix/vec2.js"),exports.vec3=require("./gl-matrix/vec3.js"),exports.vec4=require("./gl-matrix/vec4.js");
},{"./gl-matrix/common.js":114,"./gl-matrix/mat2.js":115,"./gl-matrix/mat2d.js":116,"./gl-matrix/mat3.js":117,"./gl-matrix/mat4.js":118,"./gl-matrix/quat.js":119,"./gl-matrix/vec2.js":120,"./gl-matrix/vec3.js":121,"./gl-matrix/vec4.js":122}],114:[function(require,module,exports){
var glMatrix={};glMatrix.EPSILON=1e-6,glMatrix.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,glMatrix.RANDOM=Math.random,glMatrix.ENABLE_SIMD=!1,glMatrix.SIMD_AVAILABLE=glMatrix.ARRAY_TYPE===Float32Array&&"SIMD"in this,glMatrix.USE_SIMD=glMatrix.ENABLE_SIMD&&glMatrix.SIMD_AVAILABLE,glMatrix.setMatrixArrayType=function(a){glMatrix.ARRAY_TYPE=a};var degree=Math.PI/180;glMatrix.toRadian=function(a){return a*degree},glMatrix.equals=function(a,r){return Math.abs(a-r)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(r))},module.exports=glMatrix;
},{}],115:[function(require,module,exports){
var glMatrix=require("./common.js"),mat2={};mat2.create=function(){var t=new glMatrix.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},mat2.clone=function(t){var a=new glMatrix.ARRAY_TYPE(4);return a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=t[3],a},mat2.copy=function(t,a){return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t},mat2.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},mat2.fromValues=function(t,a,n,r){var u=new glMatrix.ARRAY_TYPE(4);return u[0]=t,u[1]=a,u[2]=n,u[3]=r,u},mat2.set=function(t,a,n,r,u){return t[0]=a,t[1]=n,t[2]=r,t[3]=u,t},mat2.transpose=function(t,a){if(t===a){var n=a[1];t[1]=a[2],t[2]=n}else t[0]=a[0],t[1]=a[2],t[2]=a[1],t[3]=a[3];return t},mat2.invert=function(t,a){var n=a[0],r=a[1],u=a[2],e=a[3],i=n*e-u*r;return i?(i=1/i,t[0]=e*i,t[1]=-r*i,t[2]=-u*i,t[3]=n*i,t):null},mat2.adjoint=function(t,a){var n=a[0];return t[0]=a[3],t[1]=-a[1],t[2]=-a[2],t[3]=n,t},mat2.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},mat2.multiply=function(t,a,n){var r=a[0],u=a[1],e=a[2],i=a[3],m=n[0],o=n[1],c=n[2],M=n[3];return t[0]=r*m+e*o,t[1]=u*m+i*o,t[2]=r*c+e*M,t[3]=u*c+i*M,t},mat2.mul=mat2.multiply,mat2.rotate=function(t,a,n){var r=a[0],u=a[1],e=a[2],i=a[3],m=Math.sin(n),o=Math.cos(n);return t[0]=r*o+e*m,t[1]=u*o+i*m,t[2]=r*-m+e*o,t[3]=u*-m+i*o,t},mat2.scale=function(t,a,n){var r=a[0],u=a[1],e=a[2],i=a[3],m=n[0],o=n[1];return t[0]=r*m,t[1]=u*m,t[2]=e*o,t[3]=i*o,t},mat2.fromRotation=function(t,a){var n=Math.sin(a),r=Math.cos(a);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},mat2.fromScaling=function(t,a){return t[0]=a[0],t[1]=0,t[2]=0,t[3]=a[1],t},mat2.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},mat2.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},mat2.LDU=function(t,a,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,a,n]},mat2.add=function(t,a,n){return t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t[3]=a[3]+n[3],t},mat2.subtract=function(t,a,n){return t[0]=a[0]-n[0],t[1]=a[1]-n[1],t[2]=a[2]-n[2],t[3]=a[3]-n[3],t},mat2.sub=mat2.subtract,mat2.exactEquals=function(t,a){return t[0]===a[0]&&t[1]===a[1]&&t[2]===a[2]&&t[3]===a[3]},mat2.equals=function(t,a){var n=t[0],r=t[1],u=t[2],e=t[3],i=a[0],m=a[1],o=a[2],c=a[3];return Math.abs(n-i)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-m)<=glMatrix.EPSILON*Math.max(1,Math.abs(r),Math.abs(m))&&Math.abs(u-o)<=glMatrix.EPSILON*Math.max(1,Math.abs(u),Math.abs(o))&&Math.abs(e-c)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(c))},mat2.multiplyScalar=function(t,a,n){return t[0]=a[0]*n,t[1]=a[1]*n,t[2]=a[2]*n,t[3]=a[3]*n,t},mat2.multiplyScalarAndAdd=function(t,a,n,r){return t[0]=a[0]+n[0]*r,t[1]=a[1]+n[1]*r,t[2]=a[2]+n[2]*r,t[3]=a[3]+n[3]*r,t},module.exports=mat2;
},{"./common.js":114}],116:[function(require,module,exports){
var glMatrix=require("./common.js"),mat2d={};mat2d.create=function(){var t=new glMatrix.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},mat2d.clone=function(t){var a=new glMatrix.ARRAY_TYPE(6);return a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=t[4],a[5]=t[5],a},mat2d.copy=function(t,a){return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t[4]=a[4],t[5]=a[5],t},mat2d.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},mat2d.fromValues=function(t,a,n,r,u,m){var i=new glMatrix.ARRAY_TYPE(6);return i[0]=t,i[1]=a,i[2]=n,i[3]=r,i[4]=u,i[5]=m,i},mat2d.set=function(t,a,n,r,u,m,i){return t[0]=a,t[1]=n,t[2]=r,t[3]=u,t[4]=m,t[5]=i,t},mat2d.invert=function(t,a){var n=a[0],r=a[1],u=a[2],m=a[3],i=a[4],o=a[5],M=n*m-r*u;return M?(M=1/M,t[0]=m*M,t[1]=-r*M,t[2]=-u*M,t[3]=n*M,t[4]=(u*o-m*i)*M,t[5]=(r*i-n*o)*M,t):null},mat2d.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},mat2d.multiply=function(t,a,n){var r=a[0],u=a[1],m=a[2],i=a[3],o=a[4],M=a[5],e=n[0],d=n[1],c=n[2],s=n[3],h=n[4],l=n[5];return t[0]=r*e+m*d,t[1]=u*e+i*d,t[2]=r*c+m*s,t[3]=u*c+i*s,t[4]=r*h+m*l+o,t[5]=u*h+i*l+M,t},mat2d.mul=mat2d.multiply,mat2d.rotate=function(t,a,n){var r=a[0],u=a[1],m=a[2],i=a[3],o=a[4],M=a[5],e=Math.sin(n),d=Math.cos(n);return t[0]=r*d+m*e,t[1]=u*d+i*e,t[2]=r*-e+m*d,t[3]=u*-e+i*d,t[4]=o,t[5]=M,t},mat2d.scale=function(t,a,n){var r=a[0],u=a[1],m=a[2],i=a[3],o=a[4],M=a[5],e=n[0],d=n[1];return t[0]=r*e,t[1]=u*e,t[2]=m*d,t[3]=i*d,t[4]=o,t[5]=M,t},mat2d.translate=function(t,a,n){var r=a[0],u=a[1],m=a[2],i=a[3],o=a[4],M=a[5],e=n[0],d=n[1];return t[0]=r,t[1]=u,t[2]=m,t[3]=i,t[4]=r*e+m*d+o,t[5]=u*e+i*d+M,t},mat2d.fromRotation=function(t,a){var n=Math.sin(a),r=Math.cos(a);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},mat2d.fromScaling=function(t,a){return t[0]=a[0],t[1]=0,t[2]=0,t[3]=a[1],t[4]=0,t[5]=0,t},mat2d.fromTranslation=function(t,a){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=a[0],t[5]=a[1],t},mat2d.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},mat2d.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},mat2d.add=function(t,a,n){return t[0]=a[0]+n[0],t[1]=a[1]+n[1],t[2]=a[2]+n[2],t[3]=a[3]+n[3],t[4]=a[4]+n[4],t[5]=a[5]+n[5],t},mat2d.subtract=function(t,a,n){return t[0]=a[0]-n[0],t[1]=a[1]-n[1],t[2]=a[2]-n[2],t[3]=a[3]-n[3],t[4]=a[4]-n[4],t[5]=a[5]-n[5],t},mat2d.sub=mat2d.subtract,mat2d.multiplyScalar=function(t,a,n){return t[0]=a[0]*n,t[1]=a[1]*n,t[2]=a[2]*n,t[3]=a[3]*n,t[4]=a[4]*n,t[5]=a[5]*n,t},mat2d.multiplyScalarAndAdd=function(t,a,n,r){return t[0]=a[0]+n[0]*r,t[1]=a[1]+n[1]*r,t[2]=a[2]+n[2]*r,t[3]=a[3]+n[3]*r,t[4]=a[4]+n[4]*r,t[5]=a[5]+n[5]*r,t},mat2d.exactEquals=function(t,a){return t[0]===a[0]&&t[1]===a[1]&&t[2]===a[2]&&t[3]===a[3]&&t[4]===a[4]&&t[5]===a[5]},mat2d.equals=function(t,a){var n=t[0],r=t[1],u=t[2],m=t[3],i=t[4],o=t[5],M=a[0],e=a[1],d=a[2],c=a[3],s=a[4],h=a[5];return Math.abs(n-M)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(M))&&Math.abs(r-e)<=glMatrix.EPSILON*Math.max(1,Math.abs(r),Math.abs(e))&&Math.abs(u-d)<=glMatrix.EPSILON*Math.max(1,Math.abs(u),Math.abs(d))&&Math.abs(m-c)<=glMatrix.EPSILON*Math.max(1,Math.abs(m),Math.abs(c))&&Math.abs(i-s)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-h)<=glMatrix.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))},module.exports=mat2d;
},{"./common.js":114}],117:[function(require,module,exports){
var glMatrix=require("./common.js"),mat3={};mat3.create=function(){var t=new glMatrix.ARRAY_TYPE(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},mat3.fromMat4=function(t,a){return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[4],t[4]=a[5],t[5]=a[6],t[6]=a[8],t[7]=a[9],t[8]=a[10],t},mat3.clone=function(t){var a=new glMatrix.ARRAY_TYPE(9);return a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=t[4],a[5]=t[5],a[6]=t[6],a[7]=t[7],a[8]=t[8],a},mat3.copy=function(t,a){return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t[4]=a[4],t[5]=a[5],t[6]=a[6],t[7]=a[7],t[8]=a[8],t},mat3.fromValues=function(t,a,r,n,u,M,m,o,i){var e=new glMatrix.ARRAY_TYPE(9);return e[0]=t,e[1]=a,e[2]=r,e[3]=n,e[4]=u,e[5]=M,e[6]=m,e[7]=o,e[8]=i,e},mat3.set=function(t,a,r,n,u,M,m,o,i,e){return t[0]=a,t[1]=r,t[2]=n,t[3]=u,t[4]=M,t[5]=m,t[6]=o,t[7]=i,t[8]=e,t},mat3.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},mat3.transpose=function(t,a){if(t===a){var r=a[1],n=a[2],u=a[5];t[1]=a[3],t[2]=a[6],t[3]=r,t[5]=a[7],t[6]=n,t[7]=u}else t[0]=a[0],t[1]=a[3],t[2]=a[6],t[3]=a[1],t[4]=a[4],t[5]=a[7],t[6]=a[2],t[7]=a[5],t[8]=a[8];return t},mat3.invert=function(t,a){var r=a[0],n=a[1],u=a[2],M=a[3],m=a[4],o=a[5],i=a[6],e=a[7],h=a[8],s=h*m-o*e,c=-h*M+o*i,l=e*M-m*i,f=r*s+n*c+u*l;return f?(f=1/f,t[0]=s*f,t[1]=(-h*n+u*e)*f,t[2]=(o*n-u*m)*f,t[3]=c*f,t[4]=(h*r-u*i)*f,t[5]=(-o*r+u*M)*f,t[6]=l*f,t[7]=(-e*r+n*i)*f,t[8]=(m*r-n*M)*f,t):null},mat3.adjoint=function(t,a){var r=a[0],n=a[1],u=a[2],M=a[3],m=a[4],o=a[5],i=a[6],e=a[7],h=a[8];return t[0]=m*h-o*e,t[1]=u*e-n*h,t[2]=n*o-u*m,t[3]=o*i-M*h,t[4]=r*h-u*i,t[5]=u*M-r*o,t[6]=M*e-m*i,t[7]=n*i-r*e,t[8]=r*m-n*M,t},mat3.determinant=function(t){var a=t[0],r=t[1],n=t[2],u=t[3],M=t[4],m=t[5],o=t[6],i=t[7],e=t[8];return a*(e*M-m*i)+r*(-e*u+m*o)+n*(i*u-M*o)},mat3.multiply=function(t,a,r){var n=a[0],u=a[1],M=a[2],m=a[3],o=a[4],i=a[5],e=a[6],h=a[7],s=a[8],c=r[0],l=r[1],f=r[2],b=r[3],x=r[4],v=r[5],p=r[6],g=r[7],E=r[8];return t[0]=c*n+l*m+f*e,t[1]=c*u+l*o+f*h,t[2]=c*M+l*i+f*s,t[3]=b*n+x*m+v*e,t[4]=b*u+x*o+v*h,t[5]=b*M+x*i+v*s,t[6]=p*n+g*m+E*e,t[7]=p*u+g*o+E*h,t[8]=p*M+g*i+E*s,t},mat3.mul=mat3.multiply,mat3.translate=function(t,a,r){var n=a[0],u=a[1],M=a[2],m=a[3],o=a[4],i=a[5],e=a[6],h=a[7],s=a[8],c=r[0],l=r[1];return t[0]=n,t[1]=u,t[2]=M,t[3]=m,t[4]=o,t[5]=i,t[6]=c*n+l*m+e,t[7]=c*u+l*o+h,t[8]=c*M+l*i+s,t},mat3.rotate=function(t,a,r){var n=a[0],u=a[1],M=a[2],m=a[3],o=a[4],i=a[5],e=a[6],h=a[7],s=a[8],c=Math.sin(r),l=Math.cos(r);return t[0]=l*n+c*m,t[1]=l*u+c*o,t[2]=l*M+c*i,t[3]=l*m-c*n,t[4]=l*o-c*u,t[5]=l*i-c*M,t[6]=e,t[7]=h,t[8]=s,t},mat3.scale=function(t,a,r){var n=r[0],u=r[1];return t[0]=n*a[0],t[1]=n*a[1],t[2]=n*a[2],t[3]=u*a[3],t[4]=u*a[4],t[5]=u*a[5],t[6]=a[6],t[7]=a[7],t[8]=a[8],t},mat3.fromTranslation=function(t,a){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=a[0],t[7]=a[1],t[8]=1,t},mat3.fromRotation=function(t,a){var r=Math.sin(a),n=Math.cos(a);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},mat3.fromScaling=function(t,a){return t[0]=a[0],t[1]=0,t[2]=0,t[3]=0,t[4]=a[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},mat3.fromMat2d=function(t,a){return t[0]=a[0],t[1]=a[1],t[2]=0,t[3]=a[2],t[4]=a[3],t[5]=0,t[6]=a[4],t[7]=a[5],t[8]=1,t},mat3.fromQuat=function(t,a){var r=a[0],n=a[1],u=a[2],M=a[3],m=r+r,o=n+n,i=u+u,e=r*m,h=n*m,s=n*o,c=u*m,l=u*o,f=u*i,b=M*m,x=M*o,v=M*i;return t[0]=1-s-f,t[3]=h-v,t[6]=c+x,t[1]=h+v,t[4]=1-e-f,t[7]=l-b,t[2]=c-x,t[5]=l+b,t[8]=1-e-s,t},mat3.normalFromMat4=function(t,a){var r=a[0],n=a[1],u=a[2],M=a[3],m=a[4],o=a[5],i=a[6],e=a[7],h=a[8],s=a[9],c=a[10],l=a[11],f=a[12],b=a[13],x=a[14],v=a[15],p=r*o-n*m,g=r*i-u*m,E=r*e-M*m,w=n*i-u*o,P=n*e-M*o,S=u*e-M*i,d=h*b-s*f,I=h*x-c*f,L=h*v-l*f,N=s*x-c*b,O=s*v-l*b,A=c*v-l*x,R=p*A-g*O+E*N+w*L-P*I+S*d;return R?(R=1/R,t[0]=(o*A-i*O+e*N)*R,t[1]=(i*L-m*A-e*I)*R,t[2]=(m*O-o*L+e*d)*R,t[3]=(u*O-n*A-M*N)*R,t[4]=(r*A-u*L+M*I)*R,t[5]=(n*L-r*O-M*d)*R,t[6]=(b*S-x*P+v*w)*R,t[7]=(x*E-f*S-v*g)*R,t[8]=(f*P-b*E+v*p)*R,t):null},mat3.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},mat3.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},mat3.add=function(t,a,r){return t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t[3]=a[3]+r[3],t[4]=a[4]+r[4],t[5]=a[5]+r[5],t[6]=a[6]+r[6],t[7]=a[7]+r[7],t[8]=a[8]+r[8],t},mat3.subtract=function(t,a,r){return t[0]=a[0]-r[0],t[1]=a[1]-r[1],t[2]=a[2]-r[2],t[3]=a[3]-r[3],t[4]=a[4]-r[4],t[5]=a[5]-r[5],t[6]=a[6]-r[6],t[7]=a[7]-r[7],t[8]=a[8]-r[8],t},mat3.sub=mat3.subtract,mat3.multiplyScalar=function(t,a,r){return t[0]=a[0]*r,t[1]=a[1]*r,t[2]=a[2]*r,t[3]=a[3]*r,t[4]=a[4]*r,t[5]=a[5]*r,t[6]=a[6]*r,t[7]=a[7]*r,t[8]=a[8]*r,t},mat3.multiplyScalarAndAdd=function(t,a,r,n){return t[0]=a[0]+r[0]*n,t[1]=a[1]+r[1]*n,t[2]=a[2]+r[2]*n,t[3]=a[3]+r[3]*n,t[4]=a[4]+r[4]*n,t[5]=a[5]+r[5]*n,t[6]=a[6]+r[6]Line truncated
},{"./common.js":114}],118:[function(require,module,exports){
var glMatrix=require("./common.js"),mat4={scalar:{},SIMD:{}};mat4.create=function(){var a=new glMatrix.ARRAY_TYPE(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.clone=function(a){var t=new glMatrix.ARRAY_TYPE(16);return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t[4]=a[4],t[5]=a[5],t[6]=a[6],t[7]=a[7],t[8]=a[8],t[9]=a[9],t[10]=a[10],t[11]=a[11],t[12]=a[12],t[13]=a[13],t[14]=a[14],t[15]=a[15],t},mat4.copy=function(a,t){return a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=t[4],a[5]=t[5],a[6]=t[6],a[7]=t[7],a[8]=t[8],a[9]=t[9],a[10]=t[10],a[11]=t[11],a[12]=t[12],a[13]=t[13],a[14]=t[14],a[15]=t[15],a},mat4.fromValues=function(a,t,l,o,M,S,x,I,D,F,r,s,u,e,m,n){var i=new glMatrix.ARRAY_TYPE(16);return i[0]=a,i[1]=t,i[2]=l,i[3]=o,i[4]=M,i[5]=S,i[6]=x,i[7]=I,i[8]=D,i[9]=F,i[10]=r,i[11]=s,i[12]=u,i[13]=e,i[14]=m,i[15]=n,i},mat4.set=function(a,t,l,o,M,S,x,I,D,F,r,s,u,e,m,n,i){return a[0]=t,a[1]=l,a[2]=o,a[3]=M,a[4]=S,a[5]=x,a[6]=I,a[7]=D,a[8]=F,a[9]=r,a[10]=s,a[11]=u,a[12]=e,a[13]=m,a[14]=n,a[15]=i,a},mat4.identity=function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.scalar.transpose=function(a,t){if(a===t){var l=t[1],o=t[2],M=t[3],S=t[6],x=t[7],I=t[11];a[1]=t[4],a[2]=t[8],a[3]=t[12],a[4]=l,a[6]=t[9],a[7]=t[13],a[8]=o,a[9]=S,a[11]=t[14],a[12]=M,a[13]=x,a[14]=I}else a[0]=t[0],a[1]=t[4],a[2]=t[8],a[3]=t[12],a[4]=t[1],a[5]=t[5],a[6]=t[9],a[7]=t[13],a[8]=t[2],a[9]=t[6],a[10]=t[10],a[11]=t[14],a[12]=t[3],a[13]=t[7],a[14]=t[11],a[15]=t[15];return a},mat4.SIMD.transpose=function(a,t){var l,o,M,S,x,I,D,F,r,s;return l=SIMD.Float32x4.load(t,0),o=SIMD.Float32x4.load(t,4),M=SIMD.Float32x4.load(t,8),S=SIMD.Float32x4.load(t,12),x=SIMD.Float32x4.shuffle(l,o,0,1,4,5),I=SIMD.Float32x4.shuffle(M,S,0,1,4,5),D=SIMD.Float32x4.shuffle(x,I,0,2,4,6),F=SIMD.Float32x4.shuffle(x,I,1,3,5,7),SIMD.Float32x4.store(a,0,D),SIMD.Float32x4.store(a,4,F),x=SIMD.Float32x4.shuffle(l,o,2,3,6,7),I=SIMD.Float32x4.shuffle(M,S,2,3,6,7),r=SIMD.Float32x4.shuffle(x,I,0,2,4,6),s=SIMD.Float32x4.shuffle(x,I,1,3,5,7),SIMD.Float32x4.store(a,8,r),SIMD.Float32x4.store(a,12,s),a},mat4.transpose=glMatrix.USE_SIMD?mat4.SIMD.transpose:mat4.scalar.transpose,mat4.scalar.invert=function(a,t){var l=t[0],o=t[1],M=t[2],S=t[3],x=t[4],I=t[5],D=t[6],F=t[7],r=t[8],s=t[9],u=t[10],e=t[11],m=t[12],n=t[13],i=t[14],h=t[15],d=l*I-o*x,z=l*D-M*x,f=l*F-S*x,c=o*D-M*I,b=o*F-S*I,w=M*F-S*D,v=r*n-s*m,p=r*i-u*m,g=r*h-e*m,E=s*i-u*n,P=s*h-e*n,O=u*h-e*i,L=d*O-z*P+f*E+c*g-b*p+w*v;return L?(L=1/L,a[0]=(I*O-D*P+F*E)*L,a[1]=(M*P-o*O-S*E)*L,a[2]=(n*w-i*b+h*c)*L,a[3]=(u*b-s*w-e*c)*L,a[4]=(D*g-x*O-F*p)*L,a[5]=(l*O-M*g+S*p)*L,a[6]=(i*f-m*w-h*z)*L,a[7]=(r*w-u*f+e*z)*L,a[8]=(x*P-I*g+F*v)*L,a[9]=(o*g-l*P-S*v)*L,a[10]=(m*b-n*f+h*d)*L,a[11]=(s*f-r*b-e*d)*L,a[12]=(I*p-x*E-D*v)*L,a[13]=(l*E-o*p+M*v)*L,a[14]=(n*z-m*c-i*d)*L,a[15]=(r*c-s*z+u*d)*L,a):null},mat4.SIMD.invert=function(a,t){var l,o,M,S,x,I,D,F,r,s,u=SIMD.Float32x4.load(t,0),e=SIMD.Float32x4.load(t,4),m=SIMD.Float32x4.load(t,8),n=SIMD.Float32x4.load(t,12);return x=SIMD.Float32x4.shuffle(u,e,0,1,4,5),o=SIMD.Float32x4.shuffle(m,n,0,1,4,5),l=SIMD.Float32x4.shuffle(x,o,0,2,4,6),o=SIMD.Float32x4.shuffle(o,x,1,3,5,7),x=SIMD.Float32x4.shuffle(u,e,2,3,6,7),S=SIMD.Float32x4.shuffle(m,n,2,3,6,7),M=SIMD.Float32x4.shuffle(x,S,0,2,4,6),S=SIMD.Float32x4.shuffle(S,x,1,3,5,7),x=SIMD.Float32x4.mul(M,S),x=SIMD.Float32x4.swizzle(x,1,0,3,2),I=SIMD.Float32x4.mul(o,x),D=SIMD.Float32x4.mul(l,x),x=SIMD.Float32x4.swizzle(x,2,3,0,1),I=SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,x),I),D=SIMD.Float32x4.sub(SIMD.Float32x4.mul(l,x),D),D=SIMD.Float32x4.swizzle(D,2,3,0,1),x=SIMD.Float32x4.mul(o,M),x=SIMD.Float32x4.swizzle(x,1,0,3,2),I=SIMD.Float32x4.add(SIMD.Float32x4.mul(S,x),I),r=SIMD.Float32x4.mul(l,x),x=SIMD.Float32x4.swizzle(x,2,3,0,1),I=SIMD.Float32x4.sub(I,SIMD.Float32x4.mul(S,x)),r=SIMD.Float32x4.sub(SIMD.Float32x4.mul(l,x),r),r=SIMD.Float32x4.swizzle(r,2,3,0,1),x=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(o,2,3,0,1),S),x=SIMD.Float32x4.swizzle(x,1,0,3,2),M=SIMD.Float32x4.swizzle(M,2,3,0,1),I=SIMD.Float32x4.add(SIMD.Float32x4.mul(M,x),I),F=SIMD.Float32x4.mul(l,x),x=SIMD.Float32x4.swizzle(x,2,3,0,1),I=SIMD.Float32x4.sub(I,SIMD.Float32x4.mul(M,x)),F=SIMD.Float32x4.sub(SIMD.Float32x4.mul(l,x),F),F=SIMD.Float32x4.swizzle(F,2,3,0,1),x=SIMD.Float32x4.mul(l,o),x=SIMD.Float32x4.swizzle(x,1,0,3,2),F=SIMD.Float32x4.add(SIMD.Float32x4.mul(S,x),F),r=SIMD.Float32x4.sub(SIMD.Float32x4.mul(M,x),r),x=SIMD.Float32x4.swizzle(x,2,3,0,1),F=SIMD.Float32x4.sub(SIMD.Float32x4.mul(S,x),F),r=SIMD.Float32x4.sub(r,SIMD.Float32x4.mul(M,x)),x=SIMD.Float32x4.mul(l,S),x=SIMD.Float32x4.swizzle(x,1,0,3,2),D=SIMD.Float32x4.sub(D,SIMD.Float32x4.mul(M,x)),F=SIMD.Float32x4.add(SIMD.Float32x4.mul(o,x),F),x=SIMD.Float32x4.swizzle(x,2,3,0,1),D=SIMD.Float32x4.add(SIMD.Float32x4.mul(M,x),D),F=SIMD.Float32x4.sub(F,SIMD.Float32x4.mul(o,x)),x=SIMD.Float32Line truncated
},{"./common.js":114}],119:[function(require,module,exports){
var glMatrix=require("./common.js"),mat3=require("./mat3.js"),vec3=require("./vec3.js"),vec4=require("./vec4.js"),quat={};quat.create=function(){var t=new glMatrix.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},quat.rotationTo=function(){var t=vec3.create(),a=vec3.fromValues(1,0,0),e=vec3.fromValues(0,1,0);return function(u,r,n){var c=vec3.dot(r,n);return-.999999>c?(vec3.cross(t,a,r),vec3.length(t)<1e-6&&vec3.cross(t,e,r),vec3.normalize(t,t),quat.setAxisAngle(u,t,Math.PI),u):c>.999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(vec3.cross(t,r,n),u[0]=t[0],u[1]=t[1],u[2]=t[2],u[3]=1+c,quat.normalize(u,u))}}(),quat.setAxes=function(){var t=mat3.create();return function(a,e,u,r){return t[0]=u[0],t[3]=u[1],t[6]=u[2],t[1]=r[0],t[4]=r[1],t[7]=r[2],t[2]=-e[0],t[5]=-e[1],t[8]=-e[2],quat.normalize(a,quat.fromMat3(a,t))}}(),quat.clone=vec4.clone,quat.fromValues=vec4.fromValues,quat.copy=vec4.copy,quat.set=vec4.set,quat.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},quat.setAxisAngle=function(t,a,e){e=.5*e;var u=Math.sin(e);return t[0]=u*a[0],t[1]=u*a[1],t[2]=u*a[2],t[3]=Math.cos(e),t},quat.getAxisAngle=function(t,a){var e=2*Math.acos(a[3]),u=Math.sin(e/2);return 0!=u?(t[0]=a[0]/u,t[1]=a[1]/u,t[2]=a[2]/u):(t[0]=1,t[1]=0,t[2]=0),e},quat.add=vec4.add,quat.multiply=function(t,a,e){var u=a[0],r=a[1],n=a[2],c=a[3],q=e[0],s=e[1],o=e[2],i=e[3];return t[0]=u*i+c*q+r*o-n*s,t[1]=r*i+c*s+n*q-u*o,t[2]=n*i+c*o+u*s-r*q,t[3]=c*i-u*q-r*s-n*o,t},quat.mul=quat.multiply,quat.scale=vec4.scale,quat.rotateX=function(t,a,e){e*=.5;var u=a[0],r=a[1],n=a[2],c=a[3],q=Math.sin(e),s=Math.cos(e);return t[0]=u*s+c*q,t[1]=r*s+n*q,t[2]=n*s-r*q,t[3]=c*s-u*q,t},quat.rotateY=function(t,a,e){e*=.5;var u=a[0],r=a[1],n=a[2],c=a[3],q=Math.sin(e),s=Math.cos(e);return t[0]=u*s-n*q,t[1]=r*s+c*q,t[2]=n*s+u*q,t[3]=c*s-r*q,t},quat.rotateZ=function(t,a,e){e*=.5;var u=a[0],r=a[1],n=a[2],c=a[3],q=Math.sin(e),s=Math.cos(e);return t[0]=u*s+r*q,t[1]=r*s-u*q,t[2]=n*s+c*q,t[3]=c*s-n*q,t},quat.calculateW=function(t,a){var e=a[0],u=a[1],r=a[2];return t[0]=e,t[1]=u,t[2]=r,t[3]=Math.sqrt(Math.abs(1-e*e-u*u-r*r)),t},quat.dot=vec4.dot,quat.lerp=vec4.lerp,quat.slerp=function(t,a,e,u){var r,n,c,q,s,o=a[0],i=a[1],v=a[2],l=a[3],f=e[0],h=e[1],M=e[2],m=e[3];return n=o*f+i*h+v*M+l*m,0>n&&(n=-n,f=-f,h=-h,M=-M,m=-m),1-n>1e-6?(r=Math.acos(n),c=Math.sin(r),q=Math.sin((1-u)*r)/c,s=Math.sin(u*r)/c):(q=1-u,s=u),t[0]=q*o+s*f,t[1]=q*i+s*h,t[2]=q*v+s*M,t[3]=q*l+s*m,t},quat.sqlerp=function(){var t=quat.create(),a=quat.create();return function(e,u,r,n,c,q){return quat.slerp(t,u,c,q),quat.slerp(a,r,n,q),quat.slerp(e,t,a,2*q*(1-q)),e}}(),quat.invert=function(t,a){var e=a[0],u=a[1],r=a[2],n=a[3],c=e*e+u*u+r*r+n*n,q=c?1/c:0;return t[0]=-e*q,t[1]=-u*q,t[2]=-r*q,t[3]=n*q,t},quat.conjugate=function(t,a){return t[0]=-a[0],t[1]=-a[1],t[2]=-a[2],t[3]=a[3],t},quat.length=vec4.length,quat.len=quat.length,quat.squaredLength=vec4.squaredLength,quat.sqrLen=quat.squaredLength,quat.normalize=vec4.normalize,quat.fromMat3=function(t,a){var e,u=a[0]+a[4]+a[8];if(u>0)e=Math.sqrt(u+1),t[3]=.5*e,e=.5/e,t[0]=(a[5]-a[7])*e,t[1]=(a[6]-a[2])*e,t[2]=(a[1]-a[3])*e;else{var r=0;a[4]>a[0]&&(r=1),a[8]>a[3*r+r]&&(r=2);var n=(r+1)%3,c=(r+2)%3;e=Math.sqrt(a[3*r+r]-a[3*n+n]-a[3*c+c]+1),t[r]=.5*e,e=.5/e,t[3]=(a[3*n+c]-a[3*c+n])*e,t[n]=(a[3*n+r]+a[3*r+n])*e,t[c]=(a[3*c+r]+a[3*r+c])*e}return t},quat.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},quat.exactEquals=vec4.exactEquals,quat.equals=vec4.equals,module.exports=quat;
},{"./common.js":114,"./mat3.js":117,"./vec3.js":121,"./vec4.js":122}],120:[function(require,module,exports){
var glMatrix=require("./common.js"),vec2={};vec2.create=function(){var n=new glMatrix.ARRAY_TYPE(2);return n[0]=0,n[1]=0,n},vec2.clone=function(n){var t=new glMatrix.ARRAY_TYPE(2);return t[0]=n[0],t[1]=n[1],t},vec2.fromValues=function(n,t){var r=new glMatrix.ARRAY_TYPE(2);return r[0]=n,r[1]=t,r},vec2.copy=function(n,t){return n[0]=t[0],n[1]=t[1],n},vec2.set=function(n,t,r){return n[0]=t,n[1]=r,n},vec2.add=function(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n},vec2.subtract=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n},vec2.sub=vec2.subtract,vec2.multiply=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n},vec2.mul=vec2.multiply,vec2.divide=function(n,t,r){return n[0]=t[0]/r[0],n[1]=t[1]/r[1],n},vec2.div=vec2.divide,vec2.ceil=function(n,t){return n[0]=Math.ceil(t[0]),n[1]=Math.ceil(t[1]),n},vec2.floor=function(n,t){return n[0]=Math.floor(t[0]),n[1]=Math.floor(t[1]),n},vec2.min=function(n,t,r){return n[0]=Math.min(t[0],r[0]),n[1]=Math.min(t[1],r[1]),n},vec2.max=function(n,t,r){return n[0]=Math.max(t[0],r[0]),n[1]=Math.max(t[1],r[1]),n},vec2.round=function(n,t){return n[0]=Math.round(t[0]),n[1]=Math.round(t[1]),n},vec2.scale=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},vec2.scaleAndAdd=function(n,t,r,e){return n[0]=t[0]+r[0]*e,n[1]=t[1]+r[1]*e,n},vec2.distance=function(n,t){var r=t[0]-n[0],e=t[1]-n[1];return Math.sqrt(r*r+e*e)},vec2.dist=vec2.distance,vec2.squaredDistance=function(n,t){var r=t[0]-n[0],e=t[1]-n[1];return r*r+e*e},vec2.sqrDist=vec2.squaredDistance,vec2.length=function(n){var t=n[0],r=n[1];return Math.sqrt(t*t+r*r)},vec2.len=vec2.length,vec2.squaredLength=function(n){var t=n[0],r=n[1];return t*t+r*r},vec2.sqrLen=vec2.squaredLength,vec2.negate=function(n,t){return n[0]=-t[0],n[1]=-t[1],n},vec2.inverse=function(n,t){return n[0]=1/t[0],n[1]=1/t[1],n},vec2.normalize=function(n,t){var r=t[0],e=t[1],c=r*r+e*e;return c>0&&(c=1/Math.sqrt(c),n[0]=t[0]*c,n[1]=t[1]*c),n},vec2.dot=function(n,t){return n[0]*t[0]+n[1]*t[1]},vec2.cross=function(n,t,r){var e=t[0]*r[1]-t[1]*r[0];return n[0]=n[1]=0,n[2]=e,n},vec2.lerp=function(n,t,r,e){var c=t[0],a=t[1];return n[0]=c+e*(r[0]-c),n[1]=a+e*(r[1]-a),n},vec2.random=function(n,t){t=t||1;var r=2*glMatrix.RANDOM()*Math.PI;return n[0]=Math.cos(r)*t,n[1]=Math.sin(r)*t,n},vec2.transformMat2=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[2]*c,n[1]=r[1]*e+r[3]*c,n},vec2.transformMat2d=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[2]*c+r[4],n[1]=r[1]*e+r[3]*c+r[5],n},vec2.transformMat3=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[3]*c+r[6],n[1]=r[1]*e+r[4]*c+r[7],n},vec2.transformMat4=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[4]*c+r[12],n[1]=r[1]*e+r[5]*c+r[13],n},vec2.forEach=function(){var n=vec2.create();return function(t,r,e,c,a,u){var v,i;for(r||(r=2),e||(e=0),i=c?Math.min(c*r+e,t.length):t.length,v=e;i>v;v+=r)n[0]=t[v],n[1]=t[v+1],a(n,n,u),t[v]=n[0],t[v+1]=n[1];return t}}(),vec2.str=function(n){return"vec2("+n[0]+", "+n[1]+")"},vec2.exactEquals=function(n,t){return n[0]===t[0]&&n[1]===t[1]},vec2.equals=function(n,t){var r=n[0],e=n[1],c=t[0],a=t[1];return Math.abs(r-c)<=glMatrix.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(e-a)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(a))},module.exports=vec2;
},{"./common.js":114}],121:[function(require,module,exports){
var glMatrix=require("./common.js"),vec3={};vec3.create=function(){var t=new glMatrix.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},vec3.clone=function(t){var n=new glMatrix.ARRAY_TYPE(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},vec3.fromValues=function(t,n,r){var e=new glMatrix.ARRAY_TYPE(3);return e[0]=t,e[1]=n,e[2]=r,e},vec3.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},vec3.set=function(t,n,r,e){return t[0]=n,t[1]=r,t[2]=e,t},vec3.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t},vec3.subtract=function(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t},vec3.sub=vec3.subtract,vec3.multiply=function(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t[2]=n[2]*r[2],t},vec3.mul=vec3.multiply,vec3.divide=function(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t[2]=n[2]/r[2],t},vec3.div=vec3.divide,vec3.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t},vec3.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t},vec3.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t[2]=Math.min(n[2],r[2]),t},vec3.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t[2]=Math.max(n[2],r[2]),t},vec3.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t},vec3.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t},vec3.scaleAndAdd=function(t,n,r,e){return t[0]=n[0]+r[0]*e,t[1]=n[1]+r[1]*e,t[2]=n[2]+r[2]*e,t},vec3.distance=function(t,n){var r=n[0]-t[0],e=n[1]-t[1],a=n[2]-t[2];return Math.sqrt(r*r+e*e+a*a)},vec3.dist=vec3.distance,vec3.squaredDistance=function(t,n){var r=n[0]-t[0],e=n[1]-t[1],a=n[2]-t[2];return r*r+e*e+a*a},vec3.sqrDist=vec3.squaredDistance,vec3.length=function(t){var n=t[0],r=t[1],e=t[2];return Math.sqrt(n*n+r*r+e*e)},vec3.len=vec3.length,vec3.squaredLength=function(t){var n=t[0],r=t[1],e=t[2];return n*n+r*r+e*e},vec3.sqrLen=vec3.squaredLength,vec3.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},vec3.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},vec3.normalize=function(t,n){var r=n[0],e=n[1],a=n[2],c=r*r+e*e+a*a;return c>0&&(c=1/Math.sqrt(c),t[0]=n[0]*c,t[1]=n[1]*c,t[2]=n[2]*c),t},vec3.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]},vec3.cross=function(t,n,r){var e=n[0],a=n[1],c=n[2],u=r[0],v=r[1],i=r[2];return t[0]=a*i-c*v,t[1]=c*u-e*i,t[2]=e*v-a*u,t},vec3.lerp=function(t,n,r,e){var a=n[0],c=n[1],u=n[2];return t[0]=a+e*(r[0]-a),t[1]=c+e*(r[1]-c),t[2]=u+e*(r[2]-u),t},vec3.hermite=function(t,n,r,e,a,c){var u=c*c,v=u*(2*c-3)+1,i=u*(c-2)+c,o=u*(c-1),M=u*(3-2*c);return t[0]=n[0]*v+r[0]*i+e[0]*o+a[0]*M,t[1]=n[1]*v+r[1]*i+e[1]*o+a[1]*M,t[2]=n[2]*v+r[2]*i+e[2]*o+a[2]*M,t},vec3.bezier=function(t,n,r,e,a,c){var u=1-c,v=u*u,i=c*c,o=v*u,M=3*c*v,s=3*i*u,h=i*c;return t[0]=n[0]*o+r[0]*M+e[0]*s+a[0]*h,t[1]=n[1]*o+r[1]*M+e[1]*s+a[1]*h,t[2]=n[2]*o+r[2]*M+e[2]*s+a[2]*h,t},vec3.random=function(t,n){n=n||1;var r=2*glMatrix.RANDOM()*Math.PI,e=2*glMatrix.RANDOM()-1,a=Math.sqrt(1-e*e)*n;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=e*n,t},vec3.transformMat4=function(t,n,r){var e=n[0],a=n[1],c=n[2],u=r[3]*e+r[7]*a+r[11]*c+r[15];return u=u||1,t[0]=(r[0]*e+r[4]*a+r[8]*c+r[12])/u,t[1]=(r[1]*e+r[5]*a+r[9]*c+r[13])/u,t[2]=(r[2]*e+r[6]*a+r[10]*c+r[14])/u,t},vec3.transformMat3=function(t,n,r){var e=n[0],a=n[1],c=n[2];return t[0]=e*r[0]+a*r[3]+c*r[6],t[1]=e*r[1]+a*r[4]+c*r[7],t[2]=e*r[2]+a*r[5]+c*r[8],t},vec3.transformQuat=function(t,n,r){var e=n[0],a=n[1],c=n[2],u=r[0],v=r[1],i=r[2],o=r[3],M=o*e+v*c-i*a,s=o*a+i*e-u*c,h=o*c+u*a-v*e,f=-u*e-v*a-i*c;return t[0]=M*o+f*-u+s*-i-h*-v,t[1]=s*o+f*-v+h*-u-M*-i,t[2]=h*o+f*-i+M*-v-s*-u,t},vec3.rotateX=function(t,n,r,e){var a=[],c=[];return a[0]=n[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],c[0]=a[0],c[1]=a[1]*Math.cos(e)-a[2]*Math.sin(e),c[2]=a[1]*Math.sin(e)+a[2]*Math.cos(e),t[0]=c[0]+r[0],t[1]=c[1]+r[1],t[2]=c[2]+r[2],t},vec3.rotateY=function(t,n,r,e){var a=[],c=[];return a[0]=n[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],c[0]=a[2]*Math.sin(e)+a[0]*Math.cos(e),c[1]=a[1],c[2]=a[2]*Math.cos(e)-a[0]*Math.sin(e),t[0]=c[0]+r[0],t[1]=c[1]+r[1],t[2]=c[2]+r[2],t},vec3.rotateZ=function(t,n,r,e){var a=[],c=[];return a[0]=n[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],c[0]=a[0]*Math.cos(e)-a[1]*Math.sin(e),c[1]=a[0]*Math.sin(e)+a[1]*Math.cos(e),c[2]=a[2],t[0]=c[0]+r[0],t[1]=c[1]+r[1],t[2]=c[2]+r[2],t},vec3.forEach=function(){var t=vec3.create();return function(n,r,e,a,c,u){var v,i;for(r||(r=3),e||(e=0),i=a?Math.min(a*r+e,n.length):n.length,v=e;i>v;v+=r)t[0]=n[v],t[1]=n[v+1],t[2]=n[v+2],c(t,t,u),n[v]=t[0],n[v+1]=t[1],n[v+2]=t[2];return n}}(),vec3.angle=function(t,n){var r=vec3.fromValues(t[0],t[1],t[2]),e=vec3.fromValues(n[0],n[1],n[2]);vec3.normalize(r,r),vec3.normalize(e,e);var a=vec3.dot(r,e);return a>1?0:Math.acos(a)},vec3.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},vec3.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]},veLine truncated
},{"./common.js":114}],122:[function(require,module,exports){
var glMatrix=require("./common.js"),vec4={};vec4.create=function(){var t=new glMatrix.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},vec4.clone=function(t){var n=new glMatrix.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},vec4.fromValues=function(t,n,e,r){var a=new glMatrix.ARRAY_TYPE(4);return a[0]=t,a[1]=n,a[2]=e,a[3]=r,a},vec4.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},vec4.set=function(t,n,e,r,a){return t[0]=n,t[1]=e,t[2]=r,t[3]=a,t},vec4.add=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},vec4.subtract=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t},vec4.sub=vec4.subtract,vec4.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t[3]=n[3]*e[3],t},vec4.mul=vec4.multiply,vec4.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t},vec4.div=vec4.divide,vec4.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t[3]=Math.ceil(n[3]),t},vec4.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t[3]=Math.floor(n[3]),t},vec4.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t[3]=Math.min(n[3],e[3]),t},vec4.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t[3]=Math.max(n[3],e[3]),t},vec4.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t[3]=Math.round(n[3]),t},vec4.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},vec4.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t},vec4.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],a=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(e*e+r*r+a*a+c*c)},vec4.dist=vec4.distance,vec4.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],a=n[2]-t[2],c=n[3]-t[3];return e*e+r*r+a*a+c*c},vec4.sqrDist=vec4.squaredDistance,vec4.length=function(t){var n=t[0],e=t[1],r=t[2],a=t[3];return Math.sqrt(n*n+e*e+r*r+a*a)},vec4.len=vec4.length,vec4.squaredLength=function(t){var n=t[0],e=t[1],r=t[2],a=t[3];return n*n+e*e+r*r+a*a},vec4.sqrLen=vec4.squaredLength,vec4.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},vec4.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},vec4.normalize=function(t,n){var e=n[0],r=n[1],a=n[2],c=n[3],u=e*e+r*r+a*a+c*c;return u>0&&(u=1/Math.sqrt(u),t[0]=e*u,t[1]=r*u,t[2]=a*u,t[3]=c*u),t},vec4.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},vec4.lerp=function(t,n,e,r){var a=n[0],c=n[1],u=n[2],i=n[3];return t[0]=a+r*(e[0]-a),t[1]=c+r*(e[1]-c),t[2]=u+r*(e[2]-u),t[3]=i+r*(e[3]-i),t},vec4.random=function(t,n){return n=n||1,t[0]=glMatrix.RANDOM(),t[1]=glMatrix.RANDOM(),t[2]=glMatrix.RANDOM(),t[3]=glMatrix.RANDOM(),vec4.normalize(t,t),vec4.scale(t,t,n),t},vec4.transformMat4=function(t,n,e){var r=n[0],a=n[1],c=n[2],u=n[3];return t[0]=e[0]*r+e[4]*a+e[8]*c+e[12]*u,t[1]=e[1]*r+e[5]*a+e[9]*c+e[13]*u,t[2]=e[2]*r+e[6]*a+e[10]*c+e[14]*u,t[3]=e[3]*r+e[7]*a+e[11]*c+e[15]*u,t},vec4.transformQuat=function(t,n,e){var r=n[0],a=n[1],c=n[2],u=e[0],i=e[1],v=e[2],o=e[3],M=o*r+i*c-v*a,h=o*a+v*r-u*c,f=o*c+u*a-i*r,l=-u*r-i*a-v*c;return t[0]=M*o+l*-u+h*-v-f*-i,t[1]=h*o+l*-i+f*-u-M*-v,t[2]=f*o+l*-v+M*-i-h*-u,t[3]=n[3],t},vec4.forEach=function(){var t=vec4.create();return function(n,e,r,a,c,u){var i,v;for(e||(e=4),r||(r=0),v=a?Math.min(a*e+r,n.length):n.length,i=r;v>i;i+=e)t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t[3]=n[i+3],c(t,t,u),n[i]=t[0],n[i+1]=t[1],n[i+2]=t[2],n[i+3]=t[3];return n}}(),vec4.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},vec4.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},vec4.equals=function(t,n){var e=t[0],r=t[1],a=t[2],c=t[3],u=n[0],i=n[1],v=n[2],o=n[3];return Math.abs(e-u)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(r-i)<=glMatrix.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(a-v)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(c-o)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(o))},module.exports=vec4;
},{"./common.js":114}],123:[function(require,module,exports){
"use strict";function constant(r){return function(){return r}}function interpolateNumber(r,t,n){return r*(1-n)+t*n}function interpolateArray(r,t,n){for(var e=[],o=0;o<r.length;o++)e[o]=interpolateNumber(r[o],t[o],n);return e}exports.interpolated=function(r){if(!r.stops)return constant(r);var t=r.stops,n=r.base||1,e=Array.isArray(t[0][1])?interpolateArray:interpolateNumber;return function(r){for(var o,a,i=0;i<t.length;i++){var u=t[i];if(u[0]<=r&&(o=u),u[0]>r){a=u;break}}if(o&&a){var s=a[0]-o[0],f=r-o[0],p=1===n?f/s:(Math.pow(n,f)-1)/(Math.pow(n,s)-1);return e(o[1],a[1],p)}return o?o[1]:a?a[1]:void 0}},exports["piecewise-constant"]=function(r){if(!r.stops)return constant(r);var t=r.stops;return function(r){for(var n=0;n<t.length;n++)if(t[n][0]>r)return t[0===n?0:n-1][1];return t[t.length-1][1]}};
},{}],124:[function(require,module,exports){
"use strict";function ValidationError(r,i){this.message=(r?r+": ":"")+format.apply(format,Array.prototype.slice.call(arguments,2)),null!==i&&void 0!==i&&i.__line__&&(this.line=i.__line__)}var format=require("util").format;module.exports=ValidationError;
},{"util":103}],125:[function(require,module,exports){
"use strict";module.exports=function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)r[n]=e[n]}return r};
},{}],126:[function(require,module,exports){
"use strict";module.exports=function(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":null===n?"null":typeof n};
},{}],127:[function(require,module,exports){
"use strict";module.exports=function(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n};
},{}],128:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),getType=require("../util/get_type"),extend=require("../util/extend");module.exports=function(e){var r=require("./validate_function"),t=require("./validate_object"),a={"*":function(){return[]},array:require("./validate_array"),"boolean":require("./validate_boolean"),number:require("./validate_number"),color:require("./validate_color"),constants:require("./validate_constants"),"enum":require("./validate_enum"),filter:require("./validate_filter"),"function":require("./validate_function"),layer:require("./validate_layer"),object:require("./validate_object"),source:require("./validate_source"),string:require("./validate_string")},i=e.value,n=e.valueSpec,u=e.key,o=e.styleSpec,l=e.style;if("string"===getType(i)&&"@"===i[0]){if(o.$version>7)return[new ValidationError(u,i,"constants have been deprecated as of v8")];if(!(i in l.constants))return[new ValidationError(u,i,'constant "%s" not found',i)];e=extend({},e,{value:l.constants[i]})}return n["function"]&&"object"===getType(i)?r(e):n.type&&a[n.type]?a[n.type](e):t(extend({},e,{valueSpec:n.type?o[n.type]:n}))};
},{"../error/validation_error":124,"../util/extend":125,"../util/get_type":126,"./validate_array":129,"./validate_boolean":130,"./validate_color":131,"./validate_constants":132,"./validate_enum":133,"./validate_filter":134,"./validate_function":135,"./validate_layer":136,"./validate_number":138,"./validate_object":139,"./validate_source":141,"./validate_string":142}],129:[function(require,module,exports){
"use strict";var getType=require("../util/get_type"),validate=require("./validate"),ValidationError=require("../error/validation_error");module.exports=function(e){var r=e.value,t=e.valueSpec,a=e.style,n=e.styleSpec,l=e.key,i=e.arrayElementValidator||validate;if("array"!==getType(r))return[new ValidationError(l,r,"array expected, %s found",getType(r))];if(t.length&&r.length!==t.length)return[new ValidationError(l,r,"array length %d expected, length %d found",t.length,r.length)];if(t["min-length"]&&r.length<t["min-length"])return[new ValidationError(l,r,"array length at least %d expected, length %d found",t["min-length"],r.length)];var o={type:t.value};n.$version<7&&(o["function"]=t["function"]),"object"===getType(t.value)&&(o=t.value);for(var u=[],d=0;d<r.length;d++)u=u.concat(i({array:r,arrayIndex:d,value:r[d],valueSpec:o,style:a,styleSpec:n,key:l+"["+d+"]"}));return u};
},{"../error/validation_error":124,"../util/get_type":126,"./validate":128}],130:[function(require,module,exports){
"use strict";var getType=require("../util/get_type"),ValidationError=require("../error/validation_error");module.exports=function(e){var r=e.value,o=e.key,t=getType(r);return"boolean"!==t?[new ValidationError(o,r,"boolean expected, %s found",t)]:[]};
},{"../error/validation_error":124,"../util/get_type":126}],131:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),getType=require("../util/get_type"),parseCSSColor=require("csscolorparser").parseCSSColor;module.exports=function(r){var e=r.key,o=r.value,t=getType(o);return"string"!==t?[new ValidationError(e,o,"color expected, %s found",t)]:null===parseCSSColor(o)?[new ValidationError(e,o,'color expected, "%s" found',o)]:[]};
},{"../error/validation_error":124,"../util/get_type":126,"csscolorparser":104}],132:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),getType=require("../util/get_type");module.exports=function(r){var e=r.key,t=r.value,a=r.styleSpec;if(a.$version>7)return t?[new ValidationError(e,t,"constants have been deprecated as of v8")]:[];var o=getType(t);if("object"!==o)return[new ValidationError(e,t,"object expected, %s found",o)];var n=[];for(var i in t)"@"!==i[0]&&n.push(new ValidationError(e+"."+i,t[i],'constants must start with "@"'));return n};
},{"../error/validation_error":124,"../util/get_type":126}],133:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),unbundle=require("../util/unbundle_jsonlint");module.exports=function(e){var r=e.key,n=e.value,u=e.valueSpec,o=[];return-1===u.values.indexOf(unbundle(n))&&o.push(new ValidationError(r,n,"expected one of [%s], %s found",u.values.join(", "),n)),o};
},{"../error/validation_error":124,"../util/unbundle_jsonlint":127}],134:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),validateEnum=require("./validate_enum"),getType=require("../util/get_type"),unbundle=require("../util/unbundle_jsonlint");module.exports=function e(t){var r,a=t.value,n=t.key,l=t.styleSpec,o=[];if("array"!==getType(a))return[new ValidationError(n,a,"array expected, %s found",getType(a))];if(a.length<1)return[new ValidationError(n,a,"filter array must have at least 1 element")];switch(o=o.concat(validateEnum({key:n+"[0]",value:a[0],valueSpec:l.filter_operator,style:t.style,styleSpec:t.styleSpec})),unbundle(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"==a[1]&&o.push(new ValidationError(n,a,'"$type" cannot be use with operator "%s"',a[0]));case"==":case"!=":3!=a.length&&o.push(new ValidationError(n,a,'filter array for operator "%s" must have 3 elements',a[0]));case"in":case"!in":a.length>=2&&(r=getType(a[1]),"string"!==r?o.push(new ValidationError(n+"[1]",a[1],"string expected, %s found",r)):"@"===a[1][0]&&o.push(new ValidationError(n+"[1]",a[1],"filter key cannot be a constant")));for(var s=2;s<a.length;s++)r=getType(a[s]),"$type"==a[1]?o=o.concat(validateEnum({key:n+"["+s+"]",value:a[s],valueSpec:l.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"===r&&"@"===a[s][0]?o.push(new ValidationError(n+"["+s+"]",a[s],"filter value cannot be a constant")):"string"!==r&&"number"!==r&&"boolean"!==r&&o.push(new ValidationError(n+"["+s+"]",a[s],"string, number, or boolean expected, %s found",r));break;case"any":case"all":case"none":for(s=1;s<a.length;s++)o=o.concat(e({key:n+"["+s+"]",value:a[s],style:t.style,styleSpec:t.styleSpec}))}return o};
},{"../error/validation_error":124,"../util/get_type":126,"../util/unbundle_jsonlint":127,"./validate_enum":133}],135:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),getType=require("../util/get_type"),validate=require("./validate"),validateObject=require("./validate_object"),validateArray=require("./validate_array");module.exports=function(e){function a(e){var a=[],r=e.value;return a=a.concat(validateArray({key:e.key,value:r,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:t})),"array"===getType(r)&&0===r.length&&a.push(new ValidationError(e.key,r,"array must have at least one stop")),a}function t(e){var a=[],t=e.value,l=e.key;return"array"!==getType(t)?[new ValidationError(l,t,"array expected, %s found",getType(t))]:2!==t.length?[new ValidationError(l,t,"array length %d expected, length %d found",2,t.length)]:(a=a.concat(validate({key:l+"[0]",value:t[0],valueSpec:{type:"number"},style:e.style,styleSpec:e.styleSpec})),a=a.concat(validate({key:l+"[1]",value:t[1],valueSpec:r,style:e.style,styleSpec:e.styleSpec})),"number"===getType(t[0])&&("piecewise-constant"===r["function"]&&t[0]%1!==0&&a.push(new ValidationError(l+"[0]",t[0],"zoom level for piecewise-constant functions must be an integer")),0!==e.arrayIndex&&t[0]<e.array[e.arrayIndex-1][0]&&a.push(new ValidationError(l+"[0]",t[0],"array stops must appear in ascending order"))),a)}var r=e.valueSpec;return validateObject({key:e.key,value:e.value,valueSpec:e.styleSpec["function"],style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:a}})};
},{"../error/validation_error":124,"../util/get_type":126,"./validate":128,"./validate_array":129,"./validate_object":139}],136:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),unbundle=require("../util/unbundle_jsonlint"),validateObject=require("./validate_object"),validateFilter=require("./validate_filter"),validatePaintProperty=require("./validate_paint_property"),validateLayoutProperty=require("./validate_layout_property"),extend=require("../util/extend");module.exports=function(e){var r=[],t=e.value,a=e.key,i=e.style,l=e.styleSpec;t.type||t.ref||r.push(new ValidationError(a,t,'either "type" or "ref" is required'));var o=unbundle(t.type),u=unbundle(t.ref);if(t.id)for(var n=0;n<e.arrayIndex;n++){var s=i.layers[n];unbundle(s.id)===unbundle(t.id)&&r.push(new ValidationError(a,t.id,'duplicate layer id "%s", previously used at line %d',t.id,s.id.__line__))}if("ref"in t){["type","source","source-layer","filter","layout"].forEach(function(e){e in t&&r.push(new ValidationError(a,t[e],'"%s" is prohibited for ref layers',e))});var d;i.layers.forEach(function(e){e.id==u&&(d=e)}),d?d.ref?r.push(new ValidationError(a,t.ref,"ref cannot reference another ref layer")):o=unbundle(d.type):r.push(new ValidationError(a,t.ref,'ref layer "%s" not found',u))}else if("background"!==o)if(t.source){var y=i.sources[t.source];y?"vector"==y.type&&"raster"==o?r.push(new ValidationError(a,t.source,'layer "%s" requires a raster source',t.id)):"raster"==y.type&&"raster"!=o?r.push(new ValidationError(a,t.source,'layer "%s" requires a vector source',t.id)):"vector"!=y.type||t["source-layer"]||r.push(new ValidationError(a,t,'layer "%s" must specify a "source-layer"',t.id)):r.push(new ValidationError(a,t.source,'source "%s" not found',t.source))}else r.push(new ValidationError(a,t,'missing required property "source"'));return r=r.concat(validateObject({key:a,value:t,valueSpec:l.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{filter:validateFilter,layout:function(e){return validateObject({layer:t,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return validateLayoutProperty(extend({layerType:o},e))}}})},paint:function(e){return validateObject({layer:t,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return validatePaintProperty(extend({layerType:o},e))}}})}}}))};
},{"../error/validation_error":124,"../util/extend":125,"../util/unbundle_jsonlint":127,"./validate_filter":134,"./validate_layout_property":137,"./validate_object":139,"./validate_paint_property":140}],137:[function(require,module,exports){
"use strict";var validate=require("./validate"),ValidationError=require("../error/validation_error");module.exports=function(e){var r=e.key,a=e.style,l=e.styleSpec,t=e.value,o=e.objectKey,i=l["layout_"+e.layerType];return e.valueSpec||i[o]?validate({key:e.key,value:t,valueSpec:e.valueSpec||i[o],style:a,styleSpec:l}):[new ValidationError(r,t,'unknown property "%s"',o)]};
},{"../error/validation_error":124,"./validate":128}],138:[function(require,module,exports){
"use strict";var getType=require("../util/get_type"),ValidationError=require("../error/validation_error");module.exports=function(e){var r=e.key,i=e.value,m=e.valueSpec,a=getType(i);return"number"!==a?[new ValidationError(r,i,"number expected, %s found",a)]:"minimum"in m&&i<m.minimum?[new ValidationError(r,i,"%s is less than the minimum value %s",i,m.minimum)]:"maximum"in m&&i>m.maximum?[new ValidationError(r,i,"%s is greater than the maximum value %s",i,m.maximum)]:[]};
},{"../error/validation_error":124,"../util/get_type":126}],139:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),getType=require("../util/get_type"),validate=require("./validate");module.exports=function(e){var r=e.key,t=e.value,i=e.valueSpec,o=e.objectElementValidators||{},a=e.style,l=e.styleSpec,n=[],u=getType(t);if("object"!==u)return[new ValidationError(r,t,"object expected, %s found",u)];for(var d in t){var p=d.split(".")[0],s=i&&(i[p]||i["*"]),c=o[p]||o["*"];s||c?n=n.concat((c||validate)({key:(r?r+".":r)+d,value:t[d],valueSpec:s,style:a,styleSpec:l,object:t,objectKey:d})):""!==r&&1!==r.split(".").length&&n.push(new ValidationError(r,t[d],'unknown property "%s"',d))}for(p in i)i[p].required&&void 0===i[p]["default"]&&void 0===t[p]&&n.push(new ValidationError(r,t,'missing required property "%s"',p));return n};
},{"../error/validation_error":124,"../util/get_type":126,"./validate":128}],140:[function(require,module,exports){
"use strict";var validate=require("./validate"),ValidationError=require("../error/validation_error");module.exports=function(e){var a=e.key,r=e.style,t=e.styleSpec,l=e.value,i=e.objectKey,n=t["paint_"+e.layerType],o=i.match(/^(.*)-transition$/);return o&&n[o[1]]&&n[o[1]].transition?validate({key:a,value:l,valueSpec:t.transition,style:r,styleSpec:t}):e.valueSpec||n[i]?validate({key:e.key,value:l,valueSpec:e.valueSpec||n[i],style:r,styleSpec:t}):[new ValidationError(a,l,'unknown property "%s"',i)]};
},{"../error/validation_error":124,"./validate":128}],141:[function(require,module,exports){
"use strict";var ValidationError=require("../error/validation_error"),unbundle=require("../util/unbundle_jsonlint"),validateObject=require("./validate_object"),validateEnum=require("./validate_enum");module.exports=function(e){var r=e.value,t=e.key,a=e.styleSpec,l=e.style;if(!r.type)return[new ValidationError(t,r,'"type" is required')];var u=unbundle(r.type);switch(u){case"vector":case"raster":var i=[];if(i=i.concat(validateObject({key:t,value:r,valueSpec:a.source_tile,style:e.style,styleSpec:a})),"url"in r)for(var s in r)["type","url","tileSize"].indexOf(s)<0&&i.push(new ValidationError(t+"."+s,r[s],'a source with a "url" property may not include a "%s" property',s));return i;case"geojson":return validateObject({key:t,value:r,valueSpec:a.source_geojson,style:l,styleSpec:a});case"video":return validateObject({key:t,value:r,valueSpec:a.source_video,style:l,styleSpec:a});case"image":return validateObject({key:t,value:r,valueSpec:a.source_image,style:l,styleSpec:a});default:return validateEnum({key:t+".type",value:r.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:a})}};
},{"../error/validation_error":124,"../util/unbundle_jsonlint":127,"./validate_enum":133,"./validate_object":139}],142:[function(require,module,exports){
"use strict";var getType=require("../util/get_type"),ValidationError=require("../error/validation_error");module.exports=function(r){var e=r.value,t=r.key,i=getType(e);return"string"!==i?[new ValidationError(t,e,"string expected, %s found",i)]:[]};
},{"../error/validation_error":124,"../util/get_type":126}],143:[function(require,module,exports){
"use strict";function validateStyleMin(e,t){t=t||latestStyleSpec;var a=[];return a=a.concat(validate({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e})),t.$version>7&&e.constants&&(a=a.concat(validateConstants({key:"constants",value:e.constants,style:e,styleSpec:t}))),sortErrors(a)}function sortErrors(e){return[].concat(e).sort(function(e,t){return e.line-t.line})}function wrapCleanErrors(e){return function(){return sortErrors(e.apply(this,arguments))}}var validateConstants=require("./validate/validate_constants"),validate=require("./validate/validate"),latestStyleSpec=require("../reference/latest.min");validateStyleMin.source=wrapCleanErrors(require("./validate/validate_source")),validateStyleMin.layer=wrapCleanErrors(require("./validate/validate_layer")),validateStyleMin.filter=wrapCleanErrors(require("./validate/validate_filter")),validateStyleMin.paintProperty=wrapCleanErrors(require("./validate/validate_paint_property")),validateStyleMin.layoutProperty=wrapCleanErrors(require("./validate/validate_layout_property")),module.exports=validateStyleMin;
},{"../reference/latest.min":145,"./validate/validate":128,"./validate/validate_constants":132,"./validate/validate_filter":134,"./validate/validate_layer":136,"./validate/validate_layout_property":137,"./validate/validate_paint_property":140,"./validate/validate_source":141}],144:[function(require,module,exports){
module.exports=require("./v8.json");
},{"./v8.json":146}],145:[function(require,module,exports){
module.exports=require("./v8.min.json");
},{"./v8.min.json":147}],146:[function(require,module,exports){
module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8],"doc":"Stylesheet version number. Must be 8.","example":8},"name":{"type":"string","doc":"A human-readable name for the style.","example":"Bright"},"metadata":{"type":"*","doc":"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},"center":{"type":"array","value":"number","doc":"Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).","example":[-73.9749,40.7736]},"zoom":{"type":"number","doc":"Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).","example":12.5},"bearing":{"type":"number","default":0,"period":360,"units":"degrees","doc":"Default bearing, in degrees. The style bearing will be used only if the map has not been positioned by other means (e.g. map options or user interaction).","example":29},"pitch":{"type":"number","default":0,"units":"degrees","doc":"Default pitch, in degrees. Zero is perpendicular to the surface. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).","example":50},"sources":{"required":true,"type":"sources","doc":"Data source specifications.","example":{"mapbox-streets":{"type":"vector","url":"mapbox://mapbox.mapbox-streets-v6"}}},"sprite":{"type":"string","doc":"A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended.","example":"mapbox://sprites/mapbox/bright-v8"},"glyphs":{"type":"string","doc":"A URL template for loading signed-distance-field glyph sets in PBF format. Valid tokens are {fontstack} and {range}.","example":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition","doc":"A global transition definition to use as a default across properties.","example":{"duration":300,"delay":0}},"layers":{"required":true,"type":"array","value":"layer","doc":"Layers will be drawn in the order of this array.","example":[{"id":"water","source":"mapbox-streets","source-layer":"water","type":"fill","paint":{"fill-color":"#00ffff"}}]}},"sources":{"*":{"type":"source","doc":"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For GeoJSON and video sources, a URL must be provided."}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"],"doc":"The data type of the tile source."},"url":{"type":"string","doc":"A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<mapid>`."},"tiles":{"type":"array","value":"string","doc":"An array of one or more tile source URLs, as in the TileJSON spec."},"minzoom":{"type":"number","default":0,"doc":"Minimum zoom level for which tiles are available, as in the TileJSON spec."},"maxzoom":{"type":"number","default":22,"doc":"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},"tileSize":{"type":"number","default":512,"units":"pixels","doc":"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},"*":{"type":"*","doc":"Other keys to configure the data source."}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"],"doc":"The data type of the GeoJSON source."},"data":{"type":"*","doc":"A URL to a GeoJSON file, or inline GeoJSON."},"maxzoom":{"type":"number","default":14,"doc":"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},"buffer":{"type":"number","default":64,"doc":"Tile buffer size on each side (higher means fewer rendering artifacts near tile edges but slower performance)."},"tolerance":{"type":"number","default":3,"doc":"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},"cluster":{"type":"boolean","default":false,"doc":"If the data is a collection of point features, setting this to true clusters the points by radius into groups."},"clusterRadius":{"type":"number","default":400,"doc":"Radius of each cluster when clustering points, relative to 4096 tile."},"clusterMaxZoom":{"type":"number","doc":"Max zoom to cluster points on. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered)."}},"source_video":{"type":{"required":true,"type":"enum","values":["video"],"doc":"The data type of the video source."},"urls":{"required":true,"type":"array","value":"string","doc":"URLs to video content in order of preferred format."},"coordinates":{"required":true,"doc":"Corners of viLine truncated
},{}],147:[function(require,module,exports){
module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":["vector","raster"]},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":["geojson"]},"data":{"type":"*"},"maxzoom":{"type":"number","default":14},"buffer":{"type":"number","default":64},"tolerance":{"type":"number","default":3},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":["fill","line","symbol","circle","raster","background"]},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","requires":["icon-image"]},"icon-image":{"type":"string","function":"piecewise-constant","tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","requires":["icon-image"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-consLine truncated
},{}],148:[function(require,module,exports){
"use strict";function Buffer(t){var e;t&&t.length&&(e=t,t=e.length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=BufferMethods.readUInt32LE,r.writeUInt32LE=BufferMethods.writeUInt32LE,r.readInt32LE=BufferMethods.readInt32LE,r.writeInt32LE=BufferMethods.writeInt32LE,r.readFloatLE=BufferMethods.readFloatLE,r.writeFloatLE=BufferMethods.writeFloatLE,r.readDoubleLE=BufferMethods.readDoubleLE,r.writeDoubleLE=BufferMethods.writeDoubleLE,r.toString=BufferMethods.toString,r.write=BufferMethods.write,r.slice=BufferMethods.slice,r.copy=BufferMethods.copy,r._isBuffer=!0,r}function encodeString(t){for(var e,r,n=t.length,i=[],o=0;n>o;o++){if(e=t.charCodeAt(o),e>55295&&57344>e){if(!r){e>56319||o+1===n?i.push(239,191,189):r=e;continue}if(56320>e){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);128>e?i.push(e):2048>e?i.push(e>>6|192,63&e|128):65536>e?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}module.exports=Buffer;var ieee754=require("ieee754"),BufferMethods,lastStr,lastStrEncoded;BufferMethods={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return ieee754.read(this,t,!0,23,4)},readDoubleLE:function(t){return ieee754.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return ieee754.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return ieee754.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var o=e;r>o;o++){var u=this[o];127>=u?(n+=decodeURIComponent(i)+String.fromCharCode(u),i=""):i+="%"+u.toString(16)}return n+=decodeURIComponent(i)},write:function(t,e){for(var r=t===lastStr?lastStrEncoded:encodeString(t),n=0;n<r.length;n++)this[e+n]=r[n]},slice:function(t,e){return this.subarray(t,e)},copy:function(t,e){e=e||0;for(var r=0;r<this.length;r++)t[e+r]=this[r]}},BufferMethods.writeInt32LE=BufferMethods.writeUInt32LE,Buffer.byteLength=function(t){return lastStr=t,lastStrEncoded=encodeString(t),lastStrEncoded.length},Buffer.isBuffer=function(t){return!(!t||!t._isBuffer)};
},{"ieee754":150}],149:[function(require,module,exports){
(function (global){
"use strict";function Pbf(t){this.buf=Buffer.isBuffer(t)?t:new Buffer(t||0),this.pos=0,this.length=this.buf.length}function writePackedVarint(t,i){for(var e=0;e<t.length;e++)i.writeVarint(t[e])}function writePackedSVarint(t,i){for(var e=0;e<t.length;e++)i.writeSVarint(t[e])}function writePackedFloat(t,i){for(var e=0;e<t.length;e++)i.writeFloat(t[e])}function writePackedDouble(t,i){for(var e=0;e<t.length;e++)i.writeDouble(t[e])}function writePackedBoolean(t,i){for(var e=0;e<t.length;e++)i.writeBoolean(t[e])}function writePackedFixed32(t,i){for(var e=0;e<t.length;e++)i.writeFixed32(t[e])}function writePackedSFixed32(t,i){for(var e=0;e<t.length;e++)i.writeSFixed32(t[e])}function writePackedFixed64(t,i){for(var e=0;e<t.length;e++)i.writeFixed64(t[e])}function writePackedSFixed64(t,i){for(var e=0;e<t.length;e++)i.writeSFixed64(t[e])}module.exports=Pbf;var Buffer=global.Buffer||require("./buffer");Pbf.Varint=0,Pbf.Fixed64=1,Pbf.Bytes=2,Pbf.Fixed32=5;var SHIFT_LEFT_32=4294967296,SHIFT_RIGHT_32=1/SHIFT_LEFT_32,POW_2_63=Math.pow(2,63);Pbf.prototype={destroy:function(){this.buf=null},readFields:function(t,i,e){for(e=e||this.length;this.pos<e;){var r=this.readVarint(),s=r>>3,n=this.pos;t(s,i,this),this.pos===n&&this.skip(r)}return i},readMessage:function(t,i){return this.readFields(t,i,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,i,e,r,s,n,o=this.buf;if(e=o[this.pos++],128>e)return e;if(e=127&e,r=o[this.pos++],128>r)return e|r<<7;if(r=(127&r)<<7,s=o[this.pos++],128>s)return e|r|s<<14;if(s=(127&s)<<14,n=o[this.pos++],128>n)return e|r|s|n<<21;if(t=e|r|s|(127&n)<<21,i=o[this.pos++],t+=268435456*(127&i),128>i)return t;if(i=o[this.pos++],t+=34359738368*(127&i),128>i)return t;if(i=o[this.pos++],t+=4398046511104*(127&i),128>i)return t;if(i=o[this.pos++],t+=562949953421312*(127&i),128>i)return t;if(i=o[this.pos++],t+=72057594037927940*(127&i),128>i)return t;if(i=o[this.pos++],t+=0x8000000000000000*(127&i),128>i)return t;throw new Error("Expected varint not more than 10 bytes")},readVarint64:function(){var t=this.pos,i=this.readVarint();if(POW_2_63>i)return i;for(var e=this.pos-2;255===this.buf[e];)e--;t>e&&(e=t),i=0;for(var r=0;e-t+1>r;r++){var s=127&~this.buf[t+r];i+=4>r?s<<7*r:s*Math.pow(2,7*r)}return-i-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,i=this.buf.toString("utf8",this.pos,t);return this.pos=t,i},readBytes:function(){var t=this.readVarint()+this.pos,i=this.buf.slice(this.pos,t);return this.pos=t,i},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readVarint());return i},readPackedSVarint:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(){for(var t=this.readVarint()+this.pos,i=[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(t){var i=7&t;if(i===Pbf.Varint)for(;this.buf[this.pos++]>127;);else if(i===Pbf.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Pbf.Fixed32)this.pos+=4;else{if(i!==Pbf.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(t,i){this.writeVarint(t<<3|i)},realloc:function(t){for(var i=this.length||16;i<this.pos+t;)i*=2;if(i!==this.length){var e=new Buffer(i);this.buf.copy(e),this.buf=e,this.length=i}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.slice(0,this.length)},writeFixed32:function(t){this.realloc(4),this.buf.writeUInt32LE(t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),this.buf.writeInt32LE(t,this.pos),this.pos+=4},writeFixed64:function(t)Line truncated
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./buffer":148}],150:[function(require,module,exports){
exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:(s?-1:1)*(1/0);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,N=i>>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=0>o||0===o&&0>1/o?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),o+=p+N>=1?n/f:n*Math.pow(2,1-N),o*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l};
},{}],151:[function(require,module,exports){
"use strict";function Point(t,n){this.x=t,this.y=n}module.exports=Point,Point.prototype={clone:function(){return new Point(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var n=Math.cos(t),i=Math.sin(t),s=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=s,this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Point.convert=function(t){return t instanceof Point?t:Array.isArray(t)?new Point(t[0],t[1]):t};
},{}],152:[function(require,module,exports){
!function(){"use strict";function t(i,n){return this instanceof t?(this._maxEntries=Math.max(4,i||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),n&&this._initFormat(n),void this.clear()):new t(i,n)}function i(t,i){t.bbox=n(t,0,t.children.length,i)}function n(t,i,n,r){for(var o,a=e(),s=i;n>s;s++)o=t.children[s],h(a,t.leaf?r(o):o.bbox);return a}function e(){return[1/0,1/0,-(1/0),-(1/0)]}function h(t,i){return t[0]=Math.min(t[0],i[0]),t[1]=Math.min(t[1],i[1]),t[2]=Math.max(t[2],i[2]),t[3]=Math.max(t[3],i[3]),t}function r(t,i){return t.bbox[0]-i.bbox[0]}function o(t,i){return t.bbox[1]-i.bbox[1]}function a(t){return(t[2]-t[0])*(t[3]-t[1])}function s(t){return t[2]-t[0]+(t[3]-t[1])}function l(t,i){return(Math.max(i[2],t[2])-Math.min(i[0],t[0]))*(Math.max(i[3],t[3])-Math.min(i[1],t[1]))}function u(t,i){var n=Math.max(t[0],i[0]),e=Math.max(t[1],i[1]),h=Math.min(t[2],i[2]),r=Math.min(t[3],i[3]);return Math.max(0,h-n)*Math.max(0,r-e)}function f(t,i){return t[0]<=i[0]&&t[1]<=i[1]&&i[2]<=t[2]&&i[3]<=t[3]}function c(t,i){return i[0]<=t[2]&&i[1]<=t[3]&&i[2]>=t[0]&&i[3]>=t[1]}function d(t,i,n,e,h){for(var r,o=[i,n];o.length;)n=o.pop(),i=o.pop(),e>=n-i||(r=i+Math.ceil((n-i)/e/2)*e,x(t,i,n,r,h),o.push(i,r,r,n))}function x(t,i,n,e,h){for(var r,o,a,s,l,u,f,c,d;n>i;){for(n-i>600&&(r=n-i+1,o=e-i+1,a=Math.log(r),s=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*s*(r-s)/r)*(0>o-r/2?-1:1),u=Math.max(i,Math.floor(e-o*s/r+l)),f=Math.min(n,Math.floor(e+(r-o)*s/r+l)),x(t,u,f,e,h)),c=t[e],o=i,d=n,p(t,i,e),h(t[n],c)>0&&p(t,i,n);d>o;){for(p(t,o,d),o++,d--;h(t[o],c)<0;)o++;for(;h(t[d],c)>0;)d--}0===h(t[i],c)?p(t,i,d):(d++,p(t,d,n)),e>=d&&(i=d+1),d>=e&&(n=d-1)}}function p(t,i,n){var e=t[i];t[i]=t[n],t[n]=e}t.prototype={all:function(){return this._all(this.data,[])},search:function(t){var i=this.data,n=[],e=this.toBBox;if(!c(t,i.bbox))return n;for(var h,r,o,a,s=[];i;){for(h=0,r=i.children.length;r>h;h++)o=i.children[h],a=i.leaf?e(o):o.bbox,c(t,a)&&(i.leaf?n.push(o):f(t,a)?this._all(o,n):s.push(o));i=s.pop()}return n},collides:function(t){var i=this.data,n=this.toBBox;if(!c(t,i.bbox))return!1;for(var e,h,r,o,a=[];i;){for(e=0,h=i.children.length;h>e;e++)if(r=i.children[e],o=i.leaf?n(r):r.bbox,c(t,o)){if(i.leaf||f(t,o))return!0;a.push(r)}i=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var i=0,n=t.length;n>i;i++)this.insert(t[i]);return this}var e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){var h=this.data;this.data=e,e=h}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data={children:[],height:1,bbox:e(),leaf:!0},this},remove:function(t){if(!t)return this;for(var i,n,e,h,r=this.data,o=this.toBBox(t),a=[],s=[];r||a.length;){if(r||(r=a.pop(),n=a[a.length-1],i=s.pop(),h=!0),r.leaf&&(e=r.children.indexOf(t),-1!==e))return r.children.splice(e,1),a.push(r),this._condense(a),this;h||r.leaf||!f(r.bbox,o)?n?(i++,r=n.children[i],h=!1):r=null:(a.push(r),s.push(i),i=0,n=r,r=r.children[0])}return this},toBBox:function(t){return t},compareMinX:function(t,i){return t[0]-i[0]},compareMinY:function(t,i){return t[1]-i[1]},toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,i){for(var n=[];t;)t.leaf?i.push.apply(i,t.children):n.push.apply(n,t.children),t=n.pop();return i},_build:function(t,n,e,h){var r,o=e-n+1,a=this._maxEntries;if(a>=o)return r={children:t.slice(n,e+1),height:1,bbox:null,leaf:!0},i(r,this.toBBox),r;h||(h=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,h-1))),r={children:[],height:h,bbox:null,leaf:!1};var s,l,u,f,c=Math.ceil(o/a),x=c*Math.ceil(Math.sqrt(a));for(d(t,n,e,x,this.compareMinX),s=n;e>=s;s+=x)for(u=Math.min(s+x-1,e),d(t,s,u,c,this.compareMinY),l=s;u>=l;l+=c)f=Math.min(l+c-1,u),r.children.push(this._build(t,l,f,h-1));return i(r,this.toBBox),r},_chooseSubtree:function(t,i,n,e){for(var h,r,o,s,u,f,c,d;;){if(e.push(i),i.leaf||e.length-1===n)break;for(c=d=1/0,h=0,r=i.children.length;r>h;h++)o=i.children[h],u=a(o.bbox),f=l(t,o.bbox)-u,d>f?(d=f,c=c>u?u:c,s=o):f===d&&c>u&&(c=u,s=o);i=s}return i},_insert:function(t,i,n){var e=this.toBBox,r=n?t.bbox:e(t),o=[],a=this._chooseSubtree(r,this.data,i,o);for(a.children.push(t),h(a.bbox,r);i>=0&&o[i].children.length>this._maxEntries;)this._split(o,i),i--;this._adjustParentBBoxes(r,o,i)},_split:function(t,n){var e=t[n],h=e.children.length,r=this._minEntries;this._chooseSplitAxis(e,r,h);var o=this._chooseSplitIndex(e,r,h),a={children:e.children.splice(o,e.children.length-o),height:e.height,bbox:null,leaf:!1};e.leaf&&(a.leaf=!0),i(e,this.toBBox),i(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(e,a)},_splitRoot:function(t,n){this.data={children:[t,n],height:t.height+1,bbox:null,leaf:!1},i(this.data,this.toBBox)},_chooseSplitIndex:function(t,i,Line truncated
},{}],153:[function(require,module,exports){
void function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():e.resolveUrl=r()}(this,function(){function e(){var e=arguments.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var r=document.createElement("base");if(r.href=arguments[0],1===e)return r.href;var t=document.getElementsByTagName("head")[0];t.insertBefore(r,t.firstChild);for(var n,o=document.createElement("a"),f=1;e>f;f++)o.href=arguments[f],n=o.href,r.href=n;return t.removeChild(r),n}return e});
},{}],154:[function(require,module,exports){
"use strict";function ShelfPack(t,h){this.width=t,this.height=h,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function Shelf(t,h,e){this.y=t,this.x=0,this.width=this.free=h,this.height=e}module.exports=ShelfPack,ShelfPack.prototype.allocate=function(t,h){for(var e,i,s=0,r={shelf:-1,waste:1/0},l=0;l<this.shelves.length;l++){if(e=this.shelves[l],s+=e.height,h===e.height&&t<=e.free)return this.count(h),e.alloc(t,h);h>e.height||t>e.free||h<e.height&&t<=e.free&&(i=e.height-h,i<r.waste&&(r.waste=i,r.shelf=l))}return-1!==r.shelf?(e=this.shelves[r.shelf],this.count(h),e.alloc(t,h)):h<=this.height-s&&t<=this.width?(e=new Shelf(s,this.width,h),this.shelves.push(e),this.count(h),e.alloc(t,h)):{x:-1,y:-1}},ShelfPack.prototype.resize=function(t,h){if(t<this.width||h<this.height)return!1;this.height=h,this.width=t;for(var e=0;e<this.shelves.length;e++)this.shelves[e].resize(t);return!0},Shelf.prototype={alloc:function(t,h){if(t>this.free||h>this.height)return{x:-1,y:-1};var e=this.x;return this.x+=t,this.free-=t,{x:e,y:this.y,w:t,h:h}},resize:function(t){return t<this.width?!1:(this.free+=t-this.width,this.width=t,!0)}};
},{}],155:[function(require,module,exports){
"use strict";function supercluster(t){return new SuperCluster(t)}function SuperCluster(t){this.options=extend(Object.create(this.options),t),this._initTrees()}function toBBox(t){return[t.x,t.y,t.x,t.y]}function compareMinX(t,e){return t.x-e.x}function compareMinY(t,e){return t.y-e.y}function createCluster(t,e){return{x:t,y:e,wx:t,wy:e,zoom:1/0,point:null,numPoints:1}}function createPointCluster(t){var e=t.geometry.coordinates,o=createCluster(lngX(e[0]),latY(e[1]));return o.point=t,o}function getClusterJSON(t){return t.point?t.point:{type:"Feature",properties:getClusterProperties(t),geometry:{type:"Point",coordinates:[xLng(t.wx),yLat(t.wy)]}}}function getClusterProperties(t){var e=t.numPoints,o=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:o}}function lngX(t){return t/360+.5}function latY(t){var e=Math.sin(t*Math.PI/180),o=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return 0>o?0:o>1?1:o}function xLng(t){return 360*(t-.5)}function yLat(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function distSq(t,e){var o=t.wx-e.wx,n=t.wy-e.wy;return o*o+n*n}function extend(t,e){for(var o in e)t[o]=e[o];return t}var rbush=require("rbush");module.exports=supercluster,SuperCluster.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:16,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var o="prepare "+t.length+" points";e&&console.time(o);var n=t.map(createPointCluster);e&&console.timeEnd(o);for(var r=this.options.maxZoom;r>=this.options.minZoom;r--){var i=+Date.now();this.trees[r+1].load(n),n=this._cluster(n,r),e&&console.log("z%d: %d clusters in %dms",r,n.length,+Date.now()-i)}return this.trees[this.options.minZoom].load(n),e&&console.timeEnd("total time"),this},getClusters:function(t,e){var o=[lngX(t[0]),latY(t[3]),lngX(t[2]),latY(t[1])],n=Math.max(this.options.minZoom,Math.min(e,this.options.maxZoom+1)),r=this.trees[n].search(o);return r.map(getClusterJSON)},getTile:function(t,e,o){var n=Math.pow(2,t),r=this.options.extent,i=this.options.radius/r,s=this.trees[t].search([(e-i)/n,(o-i)/n,(e+1+i)/n,(o+1+i)/n]);if(!s.length)return null;for(var u={features:[]},a=0;a<s.length;a++){var h=s[a],p={type:1,geometry:[[Math.round(r*(h.wx*n-e)),Math.round(r*(h.wy*n-o))]],tags:h.point?h.point.properties:getClusterProperties(h)};u.features.push(p)}return u},_initTrees:function(){this.trees=[];for(var t=0;t<=this.options.maxZoom+1;t++)this.trees[t]=rbush(this.options.nodeSize),this.trees[t].toBBox=toBBox,this.trees[t].compareMinX=compareMinX,this.trees[t].compareMinY=compareMinY},_cluster:function(t,e){for(var o=[],n=this.options.radius/(this.options.extent*Math.pow(2,e)),r=[0,0,0,0],i=0;i<t.length;i++){var s=t[i];if(!(s.zoom<=e)){s.zoom=e,r[0]=s.wx-n,r[1]=s.wy-n,r[2]=s.wx+n,r[3]=s.wy+n;for(var u=this.trees[e+1].search(r),a=!1,h=s.numPoints,p=s.wx*h,l=s.wy*h,c=0;c<u.length;c++){var m=u[c];e<m.zoom&&distSq(s,m)<=n*n&&(a=!0,m.zoom=e,p+=m.wx*m.numPoints,l+=m.wy*m.numPoints,h+=m.numPoints)}if(a){var x=createCluster(s.x,s.y);x.numPoints=h,x.wx=p/h,x.wy=l/h,o.push(x)}else o.push(s)}}return o}};
},{"rbush":152}],156:[function(require,module,exports){
function UnitBezier(t,i,e,r){this.cx=3*t,this.bx=3*(e-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(r-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=e,this.p2y=r}module.exports=UnitBezier,UnitBezier.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},UnitBezier.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},UnitBezier.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},UnitBezier.prototype.solveCurveX=function(t,i){"undefined"==typeof i&&(i=1e-6);var e,r,s,h,n;for(s=t,n=0;8>n;n++){if(h=this.sampleCurveX(s)-t,Math.abs(h)<i)return s;var u=this.sampleCurveDerivativeX(s);if(Math.abs(u)<1e-6)break;s-=h/u}if(e=0,r=1,s=t,e>s)return e;if(s>r)return r;for(;r>e;){if(h=this.sampleCurveX(s),Math.abs(h-t)<i)return s;t>h?e=s:r=s,s=.5*(r-e)+e}return s},UnitBezier.prototype.solve=function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))};
},{}],157:[function(require,module,exports){
module.exports.VectorTile=require("./lib/vectortile.js"),module.exports.VectorTileFeature=require("./lib/vectortilefeature.js"),module.exports.VectorTileLayer=require("./lib/vectortilelayer.js");
},{"./lib/vectortile.js":158,"./lib/vectortilefeature.js":159,"./lib/vectortilelayer.js":160}],158:[function(require,module,exports){
"use strict";function VectorTile(e,r){this.layers=e.readFields(readTile,{},r)}function readTile(e,r,i){if(3===e){var t=new VectorTileLayer(i,i.readVarint()+i.pos);t.length&&(r[t.name]=t)}}var VectorTileLayer=require("./vectortilelayer");module.exports=VectorTile;
},{"./vectortilelayer":160}],159:[function(require,module,exports){
"use strict";function VectorTileFeature(e,t,r,i,o){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,e.readFields(readFeature,this,t)}function readFeature(e,t,r){1==e?t._id=r.readVarint():2==e?readTag(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function readTag(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var i=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[i]=o}}var Point=require("point-geometry");module.exports=VectorTileFeature,VectorTileFeature.types=["Unknown","Point","LineString","Polygon"],VectorTileFeature.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,r=e.readVarint()+e.pos,i=1,o=0,a=0,n=0,s=[];e.pos<r;){if(!o){var p=e.readVarint();i=7&p,o=p>>3}if(o--,1===i||2===i)a+=e.readSVarint(),n+=e.readSVarint(),1===i&&(t&&s.push(t),t=[]),t.push(new Point(a,n));else{if(7!==i)throw new Error("unknown command "+i);t&&t.push(t[0].clone())}}return t&&s.push(t),s},VectorTileFeature.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,i=0,o=0,a=0,n=1/0,s=-(1/0),p=1/0,h=-(1/0);e.pos<t;){if(!i){var u=e.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)o+=e.readSVarint(),a+=e.readSVarint(),n>o&&(n=o),o>s&&(s=o),p>a&&(p=a),a>h&&(h=a);else if(7!==r)throw new Error("unknown command "+r)}return[n,p,s,h]},VectorTileFeature.prototype.toGeoJSON=function(e,t,r){for(var i=this.extent*Math.pow(2,r),o=this.extent*e,a=this.extent*t,n=this.loadGeometry(),s=VectorTileFeature.types[this.type],p=0;p<n.length;p++)for(var h=n[p],u=0;u<h.length;u++){var d=h[u],l=180-360*(d.y+a)/i;h[u]=[360*(d.x+o)/i-180,360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90]}"Point"===s&&1===n.length?n=n[0][0]:"Point"===s?(n=n[0],s="MultiPoint"):"LineString"===s&&1===n.length?n=n[0]:"LineString"===s&&(s="MultiLineString");var y={type:"Feature",geometry:{type:s,coordinates:n},properties:this.properties};return"_id"in this&&(y.id=this._id),y};
},{"point-geometry":161}],160:[function(require,module,exports){
"use strict";function VectorTileLayer(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(readLayer,this,t),this.length=this._features.length}function readLayer(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(readValueMessage(r))}function readValueMessage(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var a=e.readVarint()>>3;t=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return t}var VectorTileFeature=require("./vectortilefeature.js");module.exports=VectorTileLayer,VectorTileLayer.prototype.feature=function(e){if(0>e||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new VectorTileFeature(this._pbf,t,this.extent,this._keys,this._values)};
},{"./vectortilefeature.js":159}],161:[function(require,module,exports){
arguments[4][151][0].apply(exports,arguments)
},{"dup":151}],162:[function(require,module,exports){
var bundleFn=arguments[3],sources=arguments[4],cache=arguments[5],stringify=JSON.stringify;module.exports=function(r){for(var e,t=Object.keys(cache),n=0,o=t.length;o>n;n++){var a=t[n],i=cache[a].exports;if(i===r||i["default"]===r){e=a;break}}if(!e){e=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var s={},n=0,o=t.length;o>n;n++){var a=t[n];s[a]=a}sources[e]=[Function(["require","module","exports"],"("+r+")(self)"),s]}var u=Math.floor(Math.pow(16,8)*Math.random()).toString(16),f={};f[e]=e,sources[u]=[Function(["require"],"var f = require("+stringify(e)+");(f.default ? f.default : f)(self);"),f];var c="("+bundleFn+")({"+Object.keys(sources).map(function(r){return stringify(r)+":["+sources[r][0]+","+stringify(sources[r][1])+"]"}).join(",")+"},{},["+stringify(u)+"])",l=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(l.createObjectURL(new Blob([c],{type:"text/javascript"})))};
},{}]},{},[14])(14)
});
//# sourceMappingURL=mapbox-gl.js.map