mapbox-gl
Version:
A WebGL interactive maps library
38 lines • 392 kB
JavaScript
(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=StyleLayer.create(e.layer),this.layer.recalculate(this.zoom,{lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0}),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,this.filter=featureFilter(this.layer.filter),this.resetBuffers(e.buffers);for(var t in this.shaders){var r=this.shaders[t];this[this.getAddMethodName(t,"vertex")]=createVertexAddMethod(t,r,this.getBufferName(t,"vertex"))}}function createVertexAddMethod(e,t,r){for(var i=[],s=0;s<t.attributes.length;s++)i=i.concat(t.attributes[s].value);var a="return this.buffers."+r+".push("+i.join(", ")+");";return createVertexAddMethodCache[a]||(createVertexAddMethodCache[a]=new Function(t.attributeArgs,a)),createVertexAddMethodCache[a]}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)}var featureFilter=require("feature-filter"),ElementGroups=require("./element_groups"),Buffer=require("./buffer"),StyleLayer=require("../style/style_layer");module.exports=Bucket,Bucket.create=function(e){var t={fill:require("./fill_bucket"),line:require("./line_bucket"),circle:require("./circle_bucket"),symbol:require("./symbol_bucket")};return new t[e.layer.type](e)},Bucket.AttributeType=Buffer.AttributeType,Bucket.prototype.addFeatures=function(){for(var e=0;e<this.features.length;e++)this.addFeature(this.features[e])},Bucket.prototype.makeRoomFor=function(e,t){return this.elementGroups[e].makeRoomFor(t)},Bucket.prototype.resetBuffers=function(e){this.buffers=e,this.elementGroups={};for(var t in this.shaders){var r=this.shaders[t],i=this.getBufferName(t,"vertex");if(r.vertexBuffer&&!e[i]&&(e[i]=new Buffer({type:Buffer.BufferType.VERTEX,attributes:r.attributes})),r.elementBuffer){var s=this.getBufferName(t,"element");e[s]||(e[s]=createElementBuffer(r.elementBufferComponents)),this[this.getAddMethodName(t,"element")]=createElementAddMethod(this.buffers[s])}if(r.secondElementBuffer){var a=this.getBufferName(t,"secondElement");e[a]||(e[a]=createElementBuffer(r.secondElementBufferComponents)),this[this.getAddMethodName(t,"secondElement")]=createElementAddMethod(this.buffers[a])}this.elementGroups[t]=new ElementGroups(e[this.getBufferName(t,"vertex")],e[this.getBufferName(t,"element")],e[this.getBufferName(t,"secondElement")])}},Bucket.prototype.getAddMethodName=function(e,t){return"add"+capitalize(e)+capitalize(t)},Bucket.prototype.getBufferName=function(e,t){return e+capitalize(t)};var createVertexAddMethodCache={};
},{"../style/style_layer":47,"./buffer":2,"./circle_bucket":3,"./element_groups":4,"./fill_bucket":6,"./line_bucket":7,"./symbol_bucket":9,"feature-filter":106}],2:[function(require,module,exports){
"use strict";function Buffer(e){if(this.type=e.type,e.arrayBuffer)this.capacity=e.capacity,this.arrayBuffer=e.arrayBuffer,this.attributes=e.attributes,this.itemSize=e.itemSize,this.length=e.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 t=this.type===Buffer.BufferType.VERTEX?Buffer.VERTEX_ATTRIBUTE_ALIGNMENT:1;this.attributes=e.attributes.map(function(e){var r={};return r.name=e.name,r.components=e.components||1,r.type=e.type||Buffer.AttributeType.UNSIGNED_BYTE,r.size=r.type.size*r.components,r.offset=this.itemSize,this.itemSize=align(r.offset+r.size,t),r},this),this._createPushMethod(),this._refreshViews()}}function align(e,t){t=t||1;var r=e%t;return 1!==t&&0!==r&&(e+=t-r),e}Buffer.prototype.bind=function(e){var t=e[this.type];this.buffer?e.bindBuffer(t,this.buffer):(this.buffer=e.createBuffer(),e.bindBuffer(t,this.buffer),e.bufferData(t,this.arrayBuffer.slice(0,this.length*this.itemSize),e.STATIC_DRAW),this.arrayBuffer=null)},Buffer.prototype.destroy=function(e){this.buffer&&e.deleteBuffer(this.buffer)},Buffer.prototype.setAttribPointers=function(e,t,r){for(var i=0;i<this.attributes.length;i++){var f=this.attributes[i];e.vertexAttribPointer(t["a_"+f.name],f.components,e[f.type.name],!1,this.itemSize,r+f.offset)}},Buffer.prototype.get=function(e){this._refreshViews();for(var t={},r=e*this.itemSize,i=0;i<this.attributes.length;i++)for(var f=this.attributes[i],s=t[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 t},Buffer.prototype.validate=function(e){for(var t=0;t<this.attributes.length;t++)for(var r=0;r<this.attributes[t].components;r++);},Buffer.prototype._resize=function(e){var t=this.views.UNSIGNED_BYTE;this.capacity=align(e,Buffer.CAPACITY_ALIGNMENT),this.arrayBuffer=new ArrayBuffer(this.capacity),this._refreshViews(),this.views.UNSIGNED_BYTE.set(t)},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 e="",t=[];e+="var i = this.length++;\n",e+="var o = i * "+this.itemSize+";\n",e+="if (o + "+this.itemSize+" > this.capacity) { this._resize(this.capacity * 1.5); }\n";for(var r=0;r<this.attributes.length;r++){var i=this.attributes[r],f="o"+r;e+="\nvar "+f+" = (o + "+i.offset+") / "+i.type.size+";\n";for(var s=0;s<i.components;s++){var a="v"+t.length,h="this.views."+i.type.name+"["+f+" + "+s+"]";e+=h+" = "+a+";\n",t.push(a)}}e+="\nreturn i;\n",createPushMethodCache[e]||(createPushMethodCache[e]=new Function(t,e)),this.push=createPushMethodCache[e]},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.EXTENT=8192,Buffer.CAPACITY_DEFAULT=8192,Buffer.CAPACITY_ALIGNMENT=2,Buffer.VERTEX_ATTRIBUTE_ALIGNMENT=4,module.exports=Buffer;
},{}],3:[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=require("./buffer").EXTENT;module.exports=CircleBucket,CircleBucket.prototype=util.inherit(Bucket,{}),CircleBucket.prototype.shaders={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":99,"./bucket":1,"./buffer":2,"./load_geometry":8}],4:[function(require,module,exports){
"use strict";function ElementGroups(e,t,n){this.vertexBuffer=e,this.elementBuffer=t,this.secondElementBuffer=n,this.groups=[]}function ElementGroup(e,t,n){this.vertexStartIndex=e,this.elementStartIndex=t,this.secondElementStartIndex=n,this.elementLength=0,this.vertexLength=0,this.secondElementLength=0}module.exports=ElementGroups,ElementGroups.prototype.makeRoomFor=function(e){return(!this.current||this.current.vertexLength+e>65535)&&(this.current=new ElementGroup(this.vertexBuffer.length,this.elementBuffer&&this.elementBuffer.length,this.secondElementBuffer&&this.secondElementBuffer.length),this.groups.push(this.current)),this.current};
},{}],5:[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("./buffer").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,f=u[l].layers,x=vt.VectorTileFeature.types[y.type];if((!o.$type||x===o.$type)&&(!n||geometryContainsPoint(loadGeometry(y),x,new Point(i,s),n))&&geometryIntersectsBox(loadGeometry(y),x,r)){var h=y.toGeoJSON(this.x,this.y,this.z);o.includeGeometry||(h.geometry=null);for(var d=0;d<f.length;d++){var g=f[d];o.layerIds&&o.layerIds.indexOf(g)<0||a.push(util.extend({layer:g},h))}}}e(null,a)};
},{"../util/util":99,"./buffer":2,"./load_geometry":8,"point-geometry":152,"rbush":153,"vector-tile":158}],6:[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.shaders={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 u=e[o],n=this.addFillVertex(u.x,u.y)-i.vertexStartIndex;i.vertexLength++,0===o&&(t=n),o>=2&&(u.x!==e[0].x||u.y!==e[0].y)&&(this.addFillElement(t,l,n),i.elementLength++),o>=1&&(this.addFillSecondElement(l,n),i.secondElementLength++),l=n}};
},{"../util/util":99,"./bucket":1,"./load_geometry":8}],7:[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=require("./buffer").EXTENT,EXTRUDE_SCALE=63,COS_HALF_SHARP_CORNER=Math.cos(37.5*(Math.PI/180)),SHARP_CORNER_OFFSET=15;module.exports=LineBucket,LineBucket.prototype=util.inherit(Bucket,{}),LineBucket.prototype.shaders={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.BYTE,value:["Math.round("+EXTRUDE_SCALE+" * extrude.x)","Math.round("+EXTRUDE_SCALE+" * extrude.y)","((dir < 0) ? -1 : 1) * ((dir ? 1 : 0) | ((linesofar << 1) & 0x7F))","(linesofar >> 6) & 0x7F"]}]}},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,r,s){for(var u=e.length;u>2&&e[u-1].equals(e[u-2]);)u--;if(!(e.length<2)){"bevel"===t&&(r=1.05);var n=SHARP_CORNER_OFFSET*(EXTENT/(512*this.overscaling)),a=e[0],d=e[u-1],h=a.equals(d);if(this.makeRoomFor("line",10*u),2!==u||!h){var l,o,x,m,p,f,v,_=i,c=h?"butt":i,y=1,L=0,C=!0;this.e1=this.e2=this.e3=-1,h&&(l=e[u-2],p=a.sub(l)._unit()._perp());for(var E=0;u>E;E++)if(x=h&&E===u-1?e[1]:e[E+1],!x||!e[E].equals(x)){p&&(m=p),l&&(o=l),l=e[E],p=x?x.sub(l)._unit()._perp():m,m=m||p;var V=m.add(p)._unit(),b=V.x*p.x+V.y*p.y,S=1/b,k=COS_HALF_SHARP_CORNER>b&&o&&x;if(k&&E>0){var R=l.dist(o);if(R>2*n){var B=l.sub(l.sub(o)._mult(n/R)._round());L+=B.dist(o),this.addCurrentVertex(B,y,L,m.mult(1),0,0,!1),o=B}}var T=o&&x,g=T?t:x?_:c;if(T&&"round"===g&&(s>S?g="miter":2>=S&&(g="fakeround")),"miter"===g&&S>r&&(g="bevel"),"bevel"===g&&(S>2&&(g="flipbevel"),r>S&&(g="miter")),o&&(L+=l.dist(o)),"miter"===g)V._mult(S),this.addCurrentVertex(l,y,L,V,0,0,!1);else if("flipbevel"===g){if(S>100)V=p.clone();else{var A=m.x*p.y-m.y*p.x>0?-1:1,F=S*m.add(p).mag()/m.sub(p).mag();V._perp()._mult(F*A)}this.addCurrentVertex(l,y,L,V,0,0,!1),this.addCurrentVertex(l,-y,L,V,0,0,!1)}else if("bevel"===g||"fakeround"===g){var q=y*(m.x*p.y-m.y*p.x)>0,O=-Math.sqrt(S*S-1);if(q?(v=0,f=O):(f=0,v=O),C||this.addCurrentVertex(l,y,L,m,f,v,!1),"fakeround"===g){for(var P,H=Math.floor(8*(.5-(b-.5))),N=0;H>N;N++)P=p.mult((N+1)/(H+1))._add(m)._unit(),this.addPieSliceVertex(l,y,L,P,q);this.addPieSliceVertex(l,y,L,V,q);for(var M=H-1;M>=0;M--)P=m.mult((M+1)/(H+1))._add(p)._unit(),this.addPieSliceVertex(l,y,L,P,q)}x&&this.addCurrentVertex(l,y,L,p,-f,-v,!1)}else"butt"===g?(C||this.addCurrentVertex(l,y,L,m,0,0,!1),x&&this.addCurrentVertex(l,y,L,p,0,0,!1)):"square"===g?(C||(this.addCurrentVertex(l,y,L,m,1,1,!1),this.e1=this.e2=-1,y=1),x&&this.addCurrentVertex(l,y,L,p,-1,-1,!1)):"round"===g&&(C||(this.addCurrentVertex(l,y,L,m,0,0,!1),this.addCurrentVertex(l,y,L,m,1,1,!0),this.e1=this.e2=-1,y=1),x&&(this.addCurrentVertex(l,y,L,p,-1,-1,!0),this.addCurrentVertex(l,y,L,p,0,0,!1)));if(k&&u-1>E){var X=l.dist(x);if(X>2*n){var G=l.add(x.sub(l)._mult(n/X)._round());L+=G.dist(l),this.addCurrentVertex(G,y,L,p.mult(1),0,0,!1),l=G}}C=!1}}}},LineBucket.prototype.addCurrentVertex=function(e,t,i,r,s,u,n){var a,d=n?1:0,h=this.elementGroups.line.current;h.vertexLength+=2,a=r.mult(t),s&&a._sub(r.perp()._mult(s)),this.e3=this.addLineVertex(e,a,d,0,s,i)-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=r.mult(-t),u&&a._sub(r.perp()._mult(u)),this.e3=this.addLineVertex(e,a,d,1,-u,i)-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},LineBucket.prototype.addPieSliceVertex=function(e,t,i,r,s){var u=s?1:0;r=r.mult(t*(s?-1:1));var n=this.elementGroups.line.current;this.e3=this.addLineVertex(e,r,0,u,0,i)-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":99,"./bucket":1,"./buffer":2,"./load_geometry":8}],8:[function(require,module,exports){
"use strict";var EXTENT=require("./buffer").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};
},{"./buffer":2}],9:[function(require,module,exports){
"use strict";function SymbolBucket(e){Bucket.apply(this,arguments),this.collisionDebug=e.collisionDebug,this.overscaling=e.overscaling;var t={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",18,t),this.adjustedTextSize=this.layer.getLayoutValue("text-size",this.zoom+1,t),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",18,t),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",this.zoom+1,t)}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"),ElementGroups=require("./element_groups"),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"),shapeText=Shaping.shapeText,shapeIcon=Shaping.shapeIcon,getGlyphQuads=Quads.getGlyphQuads,getIconQuads=Quads.getIconQuads,clipLine=require("../symbol/clip_line"),util=require("../util/util"),loadGeometry=require("./load_geometry"),EXTENT=require("./buffer").EXTENT,CollisionFeature=require("../symbol/collision_feature");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.shaders={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.addFeatures=function(e,t,o){var i=512*this.overscaling;this.tilePixelRatio=EXTENT/i,this.compareText={},this.symbolInstances=[],this.iconsNeedLinear=!1;var a=this.layer.layout,s=this.features,n=this.textFeatures,l=.5,r=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}for(var h="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,u=24,c=a["text-line-height"]*u,m="line"!==a["symbol-placement"]?a["text-max-width"]*u:0,x=a["text-letter-spacing"]*u,y=[a["text-offset"][0]*u,a["text-offset"][1]*u],p=a["text-font"].join(","),d=[],g=0;g<s.length;g++)d.push(loadGeometry(s[g]));if("line"===a["symbol-placement"]){var f=mergeLines(s,n,d);d=f.geometries,s=f.features,n=f.textFeatures}for(var b,v,T=0;T<s.length;T++)if(d[T]){if(b=n[T]?shapeText(n[T],t[p],m,c,l,r,h,x,y):null,a["icon-image"]){var S=resolveTokens(s[T].properties,a["icon-image"]),B=o[S];v=shapeIcon(B,a),B&&(void 0===this.sdfIcons?this.sdfIcons=B.sdf:this.sdfIcons!==B.sdf&&console.warn("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),1!==B.pixelRatio&&(this.iconsNeedLinear=!0))}else v=null;(b||v)&&this.addFeature(d[T],b,v)}this.placeFeatures(e,this.buffers,this.collisionDebug)},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-placement"],f="line"===i["symbol-placement"],b=u/2;f&&(e=clipLine(e,0,0,EXTENT,EXTENT));for(var v=0;v<e.length;v++){var T,S=e[v];T=f?getAnchors(S,u,y,t,o,a,r,this.overscaling,EXTENT):[new Anchor(S[0].x,S[0].y,0)];for(var B=0,I=T.length;I>B;B++){var M=T[B];if(!(t&&f&&this.anchorIsTooClose(t.text,b,M))){var k=!(M.x<0||M.x>EXTENT||M.y<0||M.y>EXTENT);if(!c||k){var z=k||g;this.symbolInstances.push(new SymbolInstance(M,S,t,o,i,z,this.symbolInstances.length,l,m,p,h,x,d))}}}}},SymbolBucket.prototype.anchorIsTooClose=function(e,t,o){var i=this.compareText;if(e in i){for(var a=i[e],s=a.length-1;s>=0;s--)if(o.dist(a[s])<t)return!0}else i[e]=[];return i[e].push(o),!1},SymbolBucket.prototype.placeFeatures=function(e,t,o){this.resetBuffers(t);var i=this.elementGroups={glyph:new ElementGroups(t.glyphVertex,t.glyphElement),icon:new ElementGroups(t.iconVertex,t.iconElement),sdfIcons:this.sdfIcons,iconsNeedLinear:this.iconsNeedLinear},a=this.layer.layout,s=e.maxScale;i.glyph.adjustedSize=this.adjustedTextSize,i.icon.adjustedSize=this.adjustedIconSize,i.glyph.fontstack=a["text-font"].join(",");var n="map"===a["text-rotation-alignment"]&&"line"===a["symbol-placement"],l="map"===a["icon-rotation-alignment"]&&"line"===a["symbol-placement"],r=a["text-allow-overlap"]||a["icon-allow-overlap"]||a["text-ignore-placement"]||a["icon-ignore-placement"];if(r){var h=e.angle,u=Math.sin(h),c=Math.cos(h);this.symbolInstances.sort(function(e,t){var o=u*e.x+c*e.y|0,i=u*t.x+c*t.y|0;return o-i||t.index-e.index})}for(var m=0;m<this.symbolInstances.length;m++){var x=this.symbolInstances[m],y=x.hasText,p=x.hasIcon,d=a["text-optional"]||!y,g=a["icon-optional"]||!p,f=y?e.placeCollisionFeature(x.textCollisionFeature,a["text-allow-overlap"],a["symbol-avoid-edges"]):e.minScale,b=p?e.placeCollisionFeature(x.iconCollisionFeature,a["icon-allow-overlap"],a["symbol-avoid-edges"]):e.minScale;d||g?!g&&f?f=Math.max(b,f):!d&&b&&(b=Math.max(b,f)):b=f=Math.max(b,f),y&&(a["text-ignore-placement"]||e.insertCollisionFeature(x.textCollisionFeature,f),s>=f&&this.addSymbols("glyph",x.glyphQuads,f,a["text-keep-upright"],n,e.angle)),p&&(a["icon-ignore-placement"]||e.insertCollisionFeature(x.iconCollisionFeature,b),s>=b&&this.addSymbols("icon",x.iconQuads,b,a["icon-keep-upright"],l,e.angle))}o&&this.addToDebugBuffers(e)},SymbolBucket.prototype.addSymbols=function(e,t,o,i,a,s){for(var n=this.makeRoomFor(e,4*t.length),l=this[this.getAddMethodName(e,"element")].bind(this),r=this[this.getAddMethodName(e,"vertex")].bind(this),h=this.zoom,u=Math.max(Math.log(o)/Math.LN2+h,0),c=0;c<t.length;c++){var m=t[c],x=m.angle,y=(x+s+Math.PI)%(2*Math.PI);if(!(i&&a&&(y<=Math.PI/2||y>3*Math.PI/2))){var p=m.tl,d=m.tr,g=m.bl,f=m.br,b=m.tex,v=m.anchorPoint,T=Math.max(h+Math.log(m.minScale)/Math.LN2,u),S=Math.min(h+Math.log(m.maxScale)/Math.LN2,25);if(!(T>=S)){T===u&&(T=0);var B=r(v.x,v.y,p.x,p.y,b.x,b.y,T,S,u)-n.vertexStartIndex;r(v.x,v.y,d.x,d.y,b.x+b.w,b.y,T,S,u),r(v.x,v.y,g.x,g.y,b.x,b.y+b.h,T,S,u),r(v.x,v.y,f.x,f.y,b.x+b.w,b.y+b.h,T,S,u),n.vertexLength+=4,l(B,B+1,B+2),l(B+1,B+2,B+3),n.elementLength+=2}}}},SymbolBucket.prototype.updateIcons=function(e){var t=this.layer.layout["icon-image"];if(t)for(var o=0;o<this.features.length;o++){var i=resolveTokens(this.features[o].properties,t);i&&(e[i]=!0)}},SymbolBucket.prototype.updateFont=function(e){var t=this.layer.layout["text-font"],o=e[t]=e[t]||{};this.textFeatures=resolveText(this.features,this.layer.layout,o)},SymbolBucket.prototype.addToDebugBuffers=function(e){this.elementGroups.collisionBox=new ElementGroups(this.buffers.collisionBoxVertex);for(var t=this.makeRoomFor("collisionBox",0),o=-e.angle,i=e.yStretch,a=0;a<this.symbolInstances.length;a++)for(var s=0;2>s;s++){var n=this.symbolInstances[a][0===s?"textCollisionFeature":"iconCollisionFeature"];if(n)for(var l=n.boxes,r=0;r<l.length;r++){var h=l[r],u=h.anchorPoint,c=new Point(h.x1,h.y1*i)._rotate(o),m=new Point(h.x2,h.y1*i)._rotate(o),x=new Point(h.x1,h.y2*i)._rotate(o),y=new Point(h.x2,h.y2*i)._rotate(o),p=Math.max(0,Math.min(25,this.zoom+Math.log(h.maxScale)/Math.LN2)),d=Math.max(0,Math.min(25,this.zoom+Math.log(h.placementScale)/Math.LN2));this.addCollisionBoxVertex(u,c,p,d),this.addCollisionBoxVertex(u,m,p,d),this.addCollisionBoxVertex(u,m,p,d),this.addCollisionBoxVertex(u,y,p,d),this.addCollisionBoxVertex(u,y,p,d),this.addCollisionBoxVertex(u,x,p,d),this.addCollisionBoxVertex(u,x,p,d),this.addCollisionBoxVertex(u,c,p,d),t.vertexLength+=8}}};
},{"../symbol/anchor":57,"../symbol/clip_line":59,"../symbol/collision_feature":61,"../symbol/get_anchors":63,"../symbol/mergelines":66,"../symbol/quads":67,"../symbol/resolve_text":68,"../symbol/shaping":69,"../util/token":98,"../util/util":99,"./bucket":1,"./buffer":2,"./element_groups":4,"./load_geometry":8,"point-geometry":152}],10:[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}};
},{}],11:[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":99}],12:[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":11}],13:[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.center=this.unproject(new Point(a?(o+n)/2:this.x,e?(i+t)/2:this.y)),this.zoom+=this.scaleZoom(u),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var l=this.y,m=s.y/2;t>l-m&&(h=t+m),l+m>i&&(h=i-m)}if(this.lngRange){var g=this.x,d=s.x/2;n>g-d&&(r=n+d),g+d>o&&(r=o-d)}(void 0!==r||void 0!==h)&&(this.center=this.unproject(new Point(void 0!==r?r:this.x,void 0!==h?h:this.y))),this._unmodified=c,this._constraining=!1}},_calcProjMatrix:function(){var t=new Float64Array(16),i=Math.atan(.5/this.altitude),n=Math.sin(i)*this.altitude/Math.sin(Math.PI/2-this._pitch-i),o=Math.cos(Math.PI/2-this._pitch)*n+this.altitude;mat4.perspective(t,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,o),mat4.translate(t,t,[0,0,-this.altitude]),mat4.scale(t,t,[1,-1,1/this.height]),mat4.rotateX(t,t,this._pitch),mat4.rotateZ(t,t,this.angle),mat4.translate(t,t,[-this.x,-this.y,0]),this.projMatrix=t}};
},{"../util/interpolate":95,"../util/util":99,"./coordinate":10,"./lng_lat":11,"gl-matrix":114,"point-geometry":152}],14:[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,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,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]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-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]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-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]],q:[19,[15,14,15,-7,-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]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};module.exports=function(l,n,t,e){e=e||1;var r,o,u,s,i,x,f,p,h=[];for(r=0,o=l.length;o>r;r++)if(i=simplexFont[l[r]]){for(p=null,u=0,s=i[1].length;s>u;u+=2)-1===i[1][u]&&-1===i[1][u+1]?p=null:(x=n+i[1][u]*e,f=t-i[1][u+1]*e,p&&h.push(p.x,p.y,x,f),p={x:x,y:f});n+=i[0]*e}return h};
},{}],15:[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":11,"./geo/lng_lat_bounds":12,"./source/geojson_source":29,"./source/image_source":31,"./source/video_source":38,"./style/style":44,"./ui/control/attribution":72,"./ui/control/control":73,"./ui/control/navigation":74,"./ui/map":84,"./ui/popup":85,"./util/ajax":87,"./util/browser":88,"./util/config":92,"./util/evented":93,"./util/util":99,"point-geometry":152}],16:[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"],f=l?t.spriteAtlas.getPosition(l.from,!0):null,s=l?t.spriteAtlas.getPosition(l.to,!0):null;if(t.setDepthSublayer(0),f&&s){if(t.isOpaquePass)return;i=t.patternShader,a.switchShader(i),a.uniform1i(i.u_image,0),a.uniform2fv(i.u_pattern_tl_a,f.tl),a.uniform2fv(i.u_pattern_br_a,f.br),a.uniform2fv(i.u_pattern_tl_b,s.tl),a.uniform2fv(i.u_pattern_br_b,s.br),a.uniform1f(i.u_opacity,o),a.uniform1f(i.u_mix,l.t);var p=EXTENT/u.tileSize/Math.pow(2,0);a.uniform2fv(i.u_patternscale_a,[1/(f.size[0]*p*l.fromScale),1/(f.size[1]*p*l.fromScale)]),a.uniform2fv(i.u_patternscale_b,[1/(s.size[0]*p*l.toScale),1/(s.size[1]*p*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 c=pyramid.coveringTiles(u),m=0;m<c.length;m++)a.setPosMatrix(t.calculatePosMatrix(c[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/buffer").EXTENT;module.exports=drawBackground;
},{"../data/buffer":2,"../source/tile_pyramid":36,"../util/util":99}],17:[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 s=1/browser.devicePixelRatio/t.paint["circle-radius"],c=util.premultiply(t.paint["circle-color"],t.paint["circle-opacity"]);a.uniform4fv(l.u_color,c),a.uniform1f(l.u_blur,Math.max(t.paint["circle-blur"],s)),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);if(o.buffers){var f=o.getElementGroups(t,"circle");if(f){var p=o.buffers.circleVertex,m=o.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 d=0;d<f.groups.length;d++){var x=f.groups[d],b=x.vertexStartIndex*p.itemSize;p.bind(a),p.setAttribPointers(a,l,b),m.bind(a);var v=3*x.elementLength,S=x.elementStartIndex*m.itemSize;a.drawElements(a.TRIANGLES,v,a.UNSIGNED_SHORT,S)}}}}}}var browser=require("../util/browser"),util=require("../util/util");module.exports=drawCircles;
},{"../util/browser":88,"../util/util":99}],18:[function(require,module,exports){
"use strict";function drawCollisionDebug(o,r,e,t){var i=o.gl,a=o.collisionBoxShader;i.enable(i.STENCIL_TEST),i.switchShader(a);for(var s=0;s<t.length;s++){var l=t[s],n=r.getTile(l),u=n.getElementGroups(e,"collisionBox");if(u&&n.buffers&&0!==u.groups[0].vertexLength){var f=n.buffers.collisionBoxVertex;f.bind(i),f.setAttribPointers(i,a,0);var m=o.calculatePosMatrix(l,r.maxzoom);i.setPosMatrix(m),o.enableTileClippingMask(l),i.lineWidth(1),i.uniform1f(a.u_scale,Math.pow(2,o.transform.zoom-n.coord.z)),i.uniform1f(a.u_zoom,10*o.transform.zoom),i.uniform1f(a.u_maxzoom,10*(n.coord.z+1)),i.drawArrays(i.LINES,u.groups[0].vertexStartIndex,u.groups[0].vertexLength)}}}module.exports=drawCollisionDebug;
},{}],19:[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.de