@bewithjonam/mapboxgl-spiderifier
Version:
Spiderify markers on mapbox-gl using marker overlays.
42 lines • 534 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 serializePaintVertexArrays(r,e){var t={};for(var a in r){var n=r[a].paintVertexArray;if(0!==n.length){var i=n.serialize(e),s=n.constructor.serialize();t[a]={array:i,type:s}}}return t}var ProgramConfiguration=require("./program_configuration"),Segment=function(r,e){this.vertexOffset=r,this.primitiveOffset=e,this.vertexLength=0,this.primitiveLength=0},ArrayGroup=function(r,e,t){var a=this;this.globalProperties={zoom:t};var n=r.layoutVertexArrayType;this.layoutVertexArray=new n;var i=r.elementArrayType;i&&(this.elementArray=new i);var s=r.elementArrayType2;s&&(this.elementArray2=new s),this.layerData={};for(var y=0,o=e;y<o.length;y+=1){var l=o[y],h=ProgramConfiguration.createDynamic(r.paintAttributes||[],l,t);a.layerData[l.id]={layer:l,programConfiguration:h,paintVertexArray:new h.PaintVertexArray}}this.segments=[],this.segments2=[]};ArrayGroup.prototype.prepareSegment=function(r){var e=this.segments[this.segments.length-1];return(!e||e.vertexLength+r>ArrayGroup.MAX_VERTEX_ARRAY_LENGTH)&&(e=new Segment(this.layoutVertexArray.length,this.elementArray.length),this.segments.push(e)),e},ArrayGroup.prototype.prepareSegment2=function(r){var e=this.segments2[this.segments2.length-1];return(!e||e.vertexLength+r>ArrayGroup.MAX_VERTEX_ARRAY_LENGTH)&&(e=new Segment(this.layoutVertexArray.length,this.elementArray2.length),this.segments2.push(e)),e},ArrayGroup.prototype.populatePaintArrays=function(r){var e=this;for(var t in this.layerData){var a=e.layerData[t];0!==a.paintVertexArray.bytesPerElement&&a.programConfiguration.populatePaintArray(a.layer,a.paintVertexArray,e.layoutVertexArray.length,e.globalProperties,r)}},ArrayGroup.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},ArrayGroup.prototype.serialize=function(r){return{layoutVertexArray:this.layoutVertexArray.serialize(r),elementArray:this.elementArray&&this.elementArray.serialize(r),elementArray2:this.elementArray2&&this.elementArray2.serialize(r),paintVertexArrays:serializePaintVertexArrays(this.layerData,r),segments:this.segments,segments2:this.segments2}},ArrayGroup.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,module.exports=ArrayGroup;
},{"./program_configuration":15}],2:[function(require,module,exports){
"use strict";var ArrayGroup=require("./array_group"),BufferGroup=require("./buffer_group"),util=require("../util/util"),Bucket=function(r,e){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.index=r.index,r.arrays?this.buffers=new BufferGroup(e,r.layers,r.zoom,r.arrays):this.arrays=new ArrayGroup(e,r.layers,r.zoom)};Bucket.prototype.populate=function(r,e){for(var t=this,i=0,u=r;i<u.length;i+=1){var a=u[i];t.layers[0].filter(a)&&(t.addFeature(a),e.featureIndex.insert(a,t.index))}},Bucket.prototype.isEmpty=function(){return this.arrays.isEmpty()},Bucket.prototype.serialize=function(r){return{zoom:this.zoom,layerIds:this.layers.map(function(r){return r.id}),arrays:this.arrays.serialize(r)}},Bucket.prototype.destroy=function(){this.buffers&&(this.buffers.destroy(),this.buffers=null)},module.exports=Bucket,Bucket.deserialize=function(r,e){if(e){for(var t={},i=0,u=r;i<u.length;i+=1){var a=u[i],o=a.layerIds.map(function(r){return e.getLayer(r)}).filter(Boolean);if(0!==o.length)for(var s=o[0].createBucket(util.extend({layers:o},a)),n=0,f=o;n<f.length;n+=1){var l=f[n];t[l.id]=s}}return t}};
},{"../util/util":126,"./array_group":1,"./buffer_group":9}],3:[function(require,module,exports){
"use strict";function addCircleVertex(e,r,t,a,c){e.emplaceBack(2*r+(a+1)/2,2*t+(c+1)/2)}var Bucket=require("../bucket"),createVertexArrayType=require("../vertex_array_type"),createElementArrayType=require("../element_array_type"),loadGeometry=require("../load_geometry"),EXTENT=require("../extent"),circleInterface={layoutVertexArrayType:createVertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:createElementArrayType(),paintAttributes:[{property:"circle-color",type:"Uint8"},{property:"circle-radius",type:"Uint16",multiplier:10},{property:"circle-blur",type:"Uint16",multiplier:10},{property:"circle-opacity",type:"Uint8",multiplier:255}]},CircleBucket=function(e){function r(r){e.call(this,r,circleInterface)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.addFeature=function(e){for(var r=this.arrays,t=0,a=loadGeometry(e);t<a.length;t+=1)for(var c=a[t],p=0,y=c;p<y.length;p+=1){var i=y[p],l=i.x,o=i.y;if(!(l<0||l>=EXTENT||o<0||o>=EXTENT)){var n=r.prepareSegment(4),u=n.vertexLength;addCircleVertex(r.layoutVertexArray,l,o,-1,-1),addCircleVertex(r.layoutVertexArray,l,o,1,-1),addCircleVertex(r.layoutVertexArray,l,o,1,1),addCircleVertex(r.layoutVertexArray,l,o,-1,1),r.elementArray.emplaceBack(u,u+1,u+2),r.elementArray.emplaceBack(u,u+3,u+2),n.vertexLength+=4,n.primitiveLength+=2}}r.populatePaintArrays(e.properties)},r}(Bucket);module.exports=CircleBucket;
},{"../bucket":2,"../element_array_type":10,"../extent":11,"../load_geometry":13,"../vertex_array_type":17}],4:[function(require,module,exports){
"use strict";var Bucket=require("../bucket"),createVertexArrayType=require("../vertex_array_type"),createElementArrayType=require("../element_array_type"),loadGeometry=require("../load_geometry"),earcut=require("earcut"),classifyRings=require("../../util/classify_rings"),EARCUT_MAX_RINGS=500,fillInterface={layoutVertexArrayType:createVertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:createElementArrayType(3),elementArrayType2:createElementArrayType(2),paintAttributes:[{property:"fill-color",type:"Uint8"},{property:"fill-outline-color",type:"Uint8"},{property:"fill-opacity",type:"Uint8",multiplier:255}]},FillBucket=function(e){function r(r){e.call(this,r,fillInterface)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.addFeature=function(e){for(var r=this.arrays,t=0,a=classifyRings(loadGeometry(e),EARCUT_MAX_RINGS);t<a.length;t+=1){for(var l=a[t],p=0,n=0,y=l;n<y.length;n+=1){var o=y[n];p+=o.length}for(var i=r.prepareSegment(p),c=i.vertexLength,u=[],h=[],s=0,g=l;s<g.length;s+=1){var m=g[s];if(0!==m.length){m!==l[0]&&h.push(u.length/2);var f=r.prepareSegment2(m.length),A=f.vertexLength;r.layoutVertexArray.emplaceBack(m[0].x,m[0].y),r.elementArray2.emplaceBack(A+m.length-1,A),u.push(m[0].x),u.push(m[0].y);for(var v=1;v<m.length;v++)r.layoutVertexArray.emplaceBack(m[v].x,m[v].y),r.elementArray2.emplaceBack(A+v-1,A+v),u.push(m[v].x),u.push(m[v].y);f.vertexLength+=m.length,f.primitiveLength+=m.length}}for(var x=earcut(u,h),_=0;_<x.length;_+=3)r.elementArray.emplaceBack(c+x[_],c+x[_+1],c+x[_+2]);i.vertexLength+=p,i.primitiveLength+=x.length/3}r.populatePaintArrays(e.properties)},r}(Bucket);module.exports=FillBucket;
},{"../../util/classify_rings":110,"../bucket":2,"../element_array_type":10,"../load_geometry":13,"../vertex_array_type":17,"earcut":131}],5:[function(require,module,exports){
"use strict";function addVertex(e,r,t,a,n,y,o,i){e.emplaceBack(r,t,2*Math.floor(a*FACTOR)+o,n*FACTOR*2,y*FACTOR*2,Math.round(i))}function isBoundaryEdge(e,r){return e.x===r.x&&(e.x<0||e.x>EXTENT)||e.y===r.y&&(e.y<0||e.y>EXTENT)}var Bucket=require("../bucket"),createVertexArrayType=require("../vertex_array_type"),createElementArrayType=require("../element_array_type"),loadGeometry=require("../load_geometry"),EXTENT=require("../extent"),earcut=require("earcut"),classifyRings=require("../../util/classify_rings"),EARCUT_MAX_RINGS=500,fillExtrusionInterface={layoutVertexArrayType:createVertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal",components:3,type:"Int16"},{name:"a_edgedistance",components:1,type:"Int16"}]),elementArrayType:createElementArrayType(3),paintAttributes:[{property:"fill-extrusion-base",type:"Uint16"},{property:"fill-extrusion-height",type:"Uint16"},{property:"fill-extrusion-color",type:"Uint8"}]},FACTOR=Math.pow(2,13),FillExtrusionBucket=function(e){function r(r){e.call(this,r,fillExtrusionInterface)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.addFeature=function(e){for(var r=this.arrays,t=0,a=classifyRings(loadGeometry(e),EARCUT_MAX_RINGS);t<a.length;t+=1){for(var n=a[t],y=0,o=0,i=n;o<i.length;o+=1){var l=i[o];y+=l.length}for(var p=r.prepareSegment(5*y),u=[],c=[],x=[],s=0,d=n;s<d.length;s+=1){var h=d[s];if(0!==h.length){h!==n[0]&&c.push(u.length/2);for(var m=0,f=0;f<h.length;f++){var A=h[f];if(addVertex(r.layoutVertexArray,A.x,A.y,0,0,1,1,0),x.push(p.vertexLength++),f>=1){var g=h[f-1];if(!isBoundaryEdge(A,g)){var _=A.sub(g)._perp()._unit();addVertex(r.layoutVertexArray,A.x,A.y,_.x,_.y,0,0,m),addVertex(r.layoutVertexArray,A.x,A.y,_.x,_.y,0,1,m),m+=g.dist(A),addVertex(r.layoutVertexArray,g.x,g.y,_.x,_.y,0,0,m),addVertex(r.layoutVertexArray,g.x,g.y,_.x,_.y,0,1,m);var v=p.vertexLength;r.elementArray.emplaceBack(v,v+1,v+2),r.elementArray.emplaceBack(v+1,v+2,v+3),p.vertexLength+=4,p.primitiveLength+=2}}u.push(A.x),u.push(A.y)}}}for(var T=earcut(u,c),E=0;E<T.length;E+=3)r.elementArray.emplaceBack(x[T[E]],x[T[E+1]],x[T[E+2]]);p.primitiveLength+=T.length/3}r.populatePaintArrays(e.properties)},r}(Bucket);module.exports=FillExtrusionBucket;
},{"../../util/classify_rings":110,"../bucket":2,"../element_array_type":10,"../extent":11,"../load_geometry":13,"../vertex_array_type":17,"earcut":131}],6:[function(require,module,exports){
"use strict";function addLineVertex(e,t,r,i,a,n,d){e.emplaceBack(t.x<<1|i,t.y<<1|a,Math.round(EXTRUDE_SCALE*r.x)+128,Math.round(EXTRUDE_SCALE*r.y)+128,(0===n?0:n<0?-1:1)+1|(d*LINE_DISTANCE_SCALE&63)<<2,d*LINE_DISTANCE_SCALE>>6)}var Bucket=require("../bucket"),createVertexArrayType=require("../vertex_array_type"),createElementArrayType=require("../element_array_type"),loadGeometry=require("../load_geometry"),EXTENT=require("../extent"),EXTRUDE_SCALE=63,COS_HALF_SHARP_CORNER=Math.cos(37.5*(Math.PI/180)),SHARP_CORNER_OFFSET=15,LINE_DISTANCE_BUFFER_BITS=15,LINE_DISTANCE_SCALE=.5,MAX_LINE_DISTANCE=Math.pow(2,LINE_DISTANCE_BUFFER_BITS-1)/LINE_DISTANCE_SCALE,lineInterface={layoutVertexArrayType:createVertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),paintAttributes:[{property:"line-color",type:"Uint8"},{property:"line-blur",multiplier:10,type:"Uint8"},{property:"line-opacity",multiplier:10,type:"Uint8"},{property:"line-width",multiplier:10,type:"Uint8"},{property:"line-gap-width",multiplier:10,type:"Uint8",name:"a_gapwidth"},{property:"line-offset",multiplier:1,type:"Int8"}],elementArrayType:createElementArrayType()},LineBucket=function(e){function t(t){e.call(this,t,lineInterface)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.addFeature=function(e){for(var t=this,r=this.layers[0].layout,i=r["line-join"],a=r["line-cap"],n=r["line-miter-limit"],d=r["line-round-limit"],s=0,u=loadGeometry(e,LINE_DISTANCE_BUFFER_BITS);s<u.length;s+=1){var l=u[s];t.addLine(l,e.properties,i,a,n,d)}},t.prototype.addLine=function(e,t,r,i,a,n){for(var d=this,s=e.length;s>2&&e[s-1].equals(e[s-2]);)s--;if(!(e.length<2)){"bevel"===r&&(a=1.05);var u=SHARP_CORNER_OFFSET*(EXTENT/(512*this.overscaling)),l=e[0],p=e[s-1],o=l.equals(p),c=this.arrays,_=c.prepareSegment(10*s);if(2!==s||!o){this.distance=0;var h,y,m,E,x,C,A,f=i,v=o?"butt":i,L=!0;this.e1=this.e2=this.e3=-1,o&&(h=e[s-2],x=l.sub(h)._unit()._perp());for(var S=0;S<s;S++)if(m=o&&S===s-1?e[1]:e[S+1],!m||!e[S].equals(m)){x&&(E=x),h&&(y=h),h=e[S],x=m?m.sub(h)._unit()._perp():E,E=E||x;var V=E.add(x)._unit(),T=V.x*x.x+V.y*x.y,I=1/T,N=T<COS_HALF_SHARP_CORNER&&y&&m;if(N&&S>0){var b=h.dist(y);if(b>2*u){var R=h.sub(h.sub(y)._mult(u/b)._round());d.distance+=R.dist(y),d.addCurrentVertex(R,d.distance,E.mult(1),0,0,!1,_),y=R}}var g=y&&m,B=g?r:m?f:v;if(g&&"round"===B&&(I<n?B="miter":I<=2&&(B="fakeround")),"miter"===B&&I>a&&(B="bevel"),"bevel"===B&&(I>2&&(B="flipbevel"),I<a&&(B="miter")),y&&(d.distance+=h.dist(y)),"miter"===B)V._mult(I),d.addCurrentVertex(h,d.distance,V,0,0,!1,_);else if("flipbevel"===B){if(I>100)V=x.clone();else{var F=E.x*x.y-E.y*x.x>0?-1:1,k=I*E.add(x).mag()/E.sub(x).mag();V._perp()._mult(k*F)}d.addCurrentVertex(h,d.distance,V,0,0,!1,_),d.addCurrentVertex(h,d.distance,V.mult(-1),0,0,!1,_)}else if("bevel"===B||"fakeround"===B){var D=E.x*x.y-E.y*x.x>0,U=-Math.sqrt(I*I-1);if(D?(A=0,C=U):(C=0,A=U),L||d.addCurrentVertex(h,d.distance,E,C,A,!1,_),"fakeround"===B){for(var q,P=Math.floor(8*(.5-(T-.5))),M=0;M<P;M++)q=x.mult((M+1)/(P+1))._add(E)._unit(),d.addPieSliceVertex(h,d.distance,q,D,_);d.addPieSliceVertex(h,d.distance,V,D,_);for(var O=P-1;O>=0;O--)q=E.mult((O+1)/(P+1))._add(x)._unit(),d.addPieSliceVertex(h,d.distance,q,D,_)}m&&d.addCurrentVertex(h,d.distance,x,-C,-A,!1,_)}else"butt"===B?(L||d.addCurrentVertex(h,d.distance,E,0,0,!1,_),m&&d.addCurrentVertex(h,d.distance,x,0,0,!1,_)):"square"===B?(L||(d.addCurrentVertex(h,d.distance,E,1,1,!1,_),d.e1=d.e2=-1),m&&d.addCurrentVertex(h,d.distance,x,-1,-1,!1,_)):"round"===B&&(L||(d.addCurrentVertex(h,d.distance,E,0,0,!1,_),d.addCurrentVertex(h,d.distance,E,1,1,!0,_),d.e1=d.e2=-1),m&&(d.addCurrentVertex(h,d.distance,x,-1,-1,!0,_),d.addCurrentVertex(h,d.distance,x,0,0,!1,_)));if(N&&S<s-1){var X=h.dist(m);if(X>2*u){var H=h.add(m.sub(h)._mult(u/X)._round());d.distance+=H.dist(h),d.addCurrentVertex(H,d.distance,x.mult(1),0,0,!1,_),h=H}}L=!1}c.populatePaintArrays(t)}}},t.prototype.addCurrentVertex=function(e,t,r,i,a,n,d){var s,u=n?1:0,l=this.arrays,p=l.layoutVertexArray,o=l.elementArray;s=r.clone(),i&&s._sub(r.perp()._mult(i)),addLineVertex(p,e,s,u,0,i,t),this.e3=d.vertexLength++,this.e1>=0&&this.e2>=0&&(o.emplaceBack(this.e1,this.e2,this.e3),d.primitiveLength++),this.e1=this.e2,this.e2=this.e3,s=r.mult(-1),a&&s._sub(r.perp()._mult(a)),addLineVertex(p,e,s,u,1,-a,t),this.e3=d.vertexLength++,this.e1>=0&&this.e2>=0&&(o.emplaceBack(this.e1,this.e2,this.e3),d.primitiveLength++),this.e1=this.e2,this.e2=this.e3,t>MAX_LINE_DISTANCE/2&&(this.distance=0,this.addCurrentVertex(e,this.distance,r,i,a,n,d))},t.prototype.addPieSliceVertex=function(e,t,r,i,a){var n=i?1:0;r=r.mult(i?-1:1);var d=this.arrays,s=d.layoutVertexArray,u=d.elementArray;addLineVertex(s,e,r,0,n,0,t),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(u.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},t}(Bucket);module.exports=LineBucket;
},{"../bucket":2,"../element_array_type":10,"../extent":11,"../load_geometry":13,"../vertex_array_type":17}],7:[function(require,module,exports){
"use strict";function addVertex(e,t,o,a,r,n,i,s,l,c,y){e.emplaceBack(t,o,Math.round(64*a),Math.round(64*r),n/4,i/4,10*(c||0),y,10*(s||0),10*Math.min(l||25,25))}function addCollisionBoxVertex(e,t,o,a,r){return e.emplaceBack(t.x,t.y,Math.round(o.x),Math.round(o.y),10*a,10*r)}var Point=require("point-geometry"),ArrayGroup=require("../array_group"),BufferGroup=require("../buffer_group"),createVertexArrayType=require("../vertex_array_type"),createElementArrayType=require("../element_array_type"),EXTENT=require("../extent"),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"),scriptDetection=require("../../util/script_detection"),loadGeometry=require("../load_geometry"),CollisionFeature=require("../../symbol/collision_feature"),findPoleOfInaccessibility=require("../../util/find_pole_of_inaccessibility"),classifyRings=require("../../util/classify_rings"),shapeText=Shaping.shapeText,shapeIcon=Shaping.shapeIcon,WritingMode=Shaping.WritingMode,getGlyphQuads=Quads.getGlyphQuads,getIconQuads=Quads.getIconQuads,elementArrayType=createElementArrayType(),layoutVertexArrayType=createVertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),symbolInterfaces={glyph:{layoutVertexArrayType:layoutVertexArrayType,elementArrayType:elementArrayType},icon:{layoutVertexArrayType:layoutVertexArrayType,elementArrayType:elementArrayType},collisionBox:{layoutVertexArrayType:createVertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}]),elementArrayType:createElementArrayType(2)}},SymbolBucket=function(e){var t=this;if(this.collisionBoxArray=e.collisionBoxArray,this.symbolQuadsArray=e.symbolQuadsArray,this.symbolInstancesArray=e.symbolInstancesArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.index=e.index,this.sdfIcons=e.sdfIcons,this.iconsNeedLinear=e.iconsNeedLinear,this.adjustedTextSize=e.adjustedTextSize,this.adjustedIconSize=e.adjustedIconSize,this.fontstack=e.fontstack,e.arrays){this.buffers={};for(var o in e.arrays)e.arrays[o]&&(t.buffers[o]=new BufferGroup(symbolInterfaces[o],e.layers,e.zoom,e.arrays[o]))}};SymbolBucket.prototype.populate=function(e,t){var o=this,a=this.layers[0].layout,r=a["text-field"],n=a["text-font"],i=a["icon-image"],s=r&&n,l=i;if(this.features=[],s||l){for(var c=t.iconDependencies,y=t.glyphDependencies,d=y[n]=y[n]||{},h=0;h<e.length;h++){var x=e[h];if(o.layers[0].filter(x)){var u;s&&(u=resolveText(x,a));var m;if(l&&(m=resolveTokens(x.properties,i)),(u||m)&&(o.features.push({text:u,icon:m,index:h,sourceLayerIndex:x.sourceLayerIndex,geometry:loadGeometry(x),properties:x.properties}),m&&(c[m]=!0),u))for(var p=0;p<u.length;p++)d[u.charCodeAt(p)]=!0}}"line"===a["symbol-placement"]&&(this.features=mergeLines(this.features))}},SymbolBucket.prototype.isEmpty=function(){return this.arrays.icon.isEmpty()&&this.arrays.glyph.isEmpty()&&this.arrays.collisionBox.isEmpty()},SymbolBucket.prototype.serialize=function(e){return{zoom:this.zoom,layerIds:this.layers.map(function(e){return e.id}),sdfIcons:this.sdfIcons,iconsNeedLinear:this.iconsNeedLinear,adjustedTextSize:this.adjustedTextSize,adjustedIconSize:this.adjustedIconSize,fontstack:this.fontstack,arrays:util.mapObject(this.arrays,function(t){return t.isEmpty()?null:t.serialize(e)})}},SymbolBucket.prototype.destroy=function(){this.buffers&&(this.buffers.icon&&this.buffers.icon.destroy(),this.buffers.glyph&&this.buffers.glyph.destroy(),this.buffers.collisionBox&&this.buffers.collisionBox.destroy(),this.buffers=null)},SymbolBucket.prototype.createArrays=function(){var e=this;this.arrays=util.mapObject(symbolInterfaces,function(t){return new ArrayGroup(t,e.layers,e.zoom)})},SymbolBucket.prototype.prepare=function(e,t){var o=this;this.createArrays(),this.adjustedTextMaxSize=this.layers[0].getLayoutValue("text-size",{zoom:18}),this.adjustedTextSize=this.layers[0].getLayoutValue("text-size",{zoom:this.zoom+1}),this.adjustedIconMaxSize=this.layers[0].getLayoutValue("icon-size",{zoom:18}),this.adjustedIconSize=this.layers[0].getLayoutValue("icon-size",{zoom:this.zoom+1});var a=512*this.overscaling;this.tilePixelRatio=EXTENT/a,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var r=this.layers[0].layout,n=.5,i=.5;switch(r["text-anchor"]){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(r["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}for(var s="right"===r["text-justify"]?1:"left"===r["text-justify"]?0:.5,l=24,c=r["text-line-height"]*l,y="line"!==r["symbol-placement"]?r["text-max-width"]*l:0,d=r["text-letter-spacing"]*l,h=[r["text-offset"][0]*l,r["text-offset"][1]*l],x=this.fontstack=r["text-font"].join(","),u="map"===r["text-rotation-alignment"]&&"line"===r["symbol-placement"],m=0,p=this.features;m<p.length;m+=1){var g,f=p[m];if(f.text){var b=scriptDetection.allowsVerticalWritingMode(f.text);g={},g[WritingMode.horizontal]=shapeText(f.text,e[x],y,c,n,i,s,d,h,l,WritingMode.horizontal),g[WritingMode.vertical]=b&&u&&shapeText(f.text,e[x],y,c,n,i,s,d,h,l,WritingMode.vertical)}else g={};var I;if(f.icon){var S=t[f.icon];I=shapeIcon(S,r),S&&(void 0===o.sdfIcons?o.sdfIcons=S.sdf:o.sdfIcons!==S.sdf&&util.warnOnce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),1!==S.pixelRatio?o.iconsNeedLinear=!0:0===r["icon-rotate"]&&o.layers[0].isLayoutValueFeatureConstant("icon-rotate")||(o.iconsNeedLinear=!0))}(g[WritingMode.horizontal]||I)&&o.addFeature(f,g,I)}this.symbolInstancesEndIndex=this.symbolInstancesArray.length},SymbolBucket.prototype.addFeature=function(e,t,o){var a=this,r=e.geometry,n=this.layers[0].layout,i=24,s=this.adjustedTextSize/i,l=void 0!==this.adjustedTextMaxSize?this.adjustedTextMaxSize:this.adjustedTextSize,c=this.tilePixelRatio*s,y=this.tilePixelRatio*l/i,d=this.tilePixelRatio*this.adjustedIconSize,h=this.tilePixelRatio*n["symbol-spacing"],x=n["symbol-avoid-edges"],u=n["text-padding"]*this.tilePixelRatio,m=n["icon-padding"]*this.tilePixelRatio,p=n["text-max-angle"]/180*Math.PI,g="map"===n["text-rotation-alignment"]&&"line"===n["symbol-placement"],f="map"===n["icon-rotation-alignment"]&&"line"===n["symbol-placement"],b=n["text-allow-overlap"]||n["icon-allow-overlap"]||n["text-ignore-placement"]||n["icon-ignore-placement"],I=n["symbol-placement"],S="line"===I,v=h/2,A=null;A=S?clipLine(r,0,0,EXTENT,EXTENT):classifyRings(r,0);for(var M=0;M<A.length;M++){var B=null,T=A[M],z=null;S?(z=T,B=getAnchors(z,h,p,t[WritingMode.vertical]||t[WritingMode.horizontal],o,i,y,a.overscaling,EXTENT)):(z=T[0],B=a.findPolygonAnchors(T));for(var k=0,E=B.length;k<E;k++){var P=B[k];if(!(t[WritingMode.horizontal]&&S&&a.anchorIsTooClose(t[WritingMode.horizontal].text,v,P))){var _=!(P.x<0||P.x>EXTENT||P.y<0||P.y>EXTENT);if(!x||_){var w=_||b;a.addSymbolInstance(P,z,t,o,a.layers[0],w,a.symbolInstancesArray.length,a.collisionBoxArray,e.index,e.sourceLayerIndex,a.index,c,u,g,d,m,f,{zoom:a.zoom},e.properties)}}}}},SymbolBucket.prototype.findPolygonAnchors=function(e){var t=e[0];if(0===t.length)return[];if(t.length<3||!util.isClosedPolygon(t))return[new Anchor(t[0].x,t[0].y,0)];var o=null,a=findPoleOfInaccessibility(e,16);return o=[new Anchor(a.x,a.y,0)]},SymbolBucket.prototype.anchorIsTooClose=function(e,t,o){var a=this.compareText;if(e in a){for(var r=a[e],n=r.length-1;n>=0;n--)if(o.dist(r[n])<t)return!0}else a[e]=[];return a[e].push(o),!1},SymbolBucket.prototype.place=function(e,t){var o=this;this.createArrays();var a=this.layers[0].layout,r=e.maxScale,n="map"===a["text-rotation-alignment"]&&"line"===a["symbol-placement"],i="map"===a["icon-rotation-alignment"]&&"line"===a["symbol-placement"],s=a["text-allow-overlap"]||a["icon-allow-overlap"]||a["text-ignore-placement"]||a["icon-ignore-placement"];if(s){var l=this.symbolInstancesArray.toArray(this.symbolInstancesStartIndex,this.symbolInstancesEndIndex),c=e.angle,y=Math.sin(c),d=Math.cos(c);this.sortedSymbolInstances=l.sort(function(e,t){var o=y*e.anchorPointX+d*e.anchorPointY|0,a=y*t.anchorPointX+d*t.anchorPointY|0;return o-a||t.index-e.index})}for(var h=this.symbolInstancesStartIndex;h<this.symbolInstancesEndIndex;h++){var x=o.sortedSymbolInstances?o.sortedSymbolInstances[h-o.symbolInstancesStartIndex]:o.symbolInstancesArray.get(h),u={boxStartIndex:x.textBoxStartIndex,boxEndIndex:x.textBoxEndIndex},m={boxStartIndex:x.iconBoxStartIndex,boxEndIndex:x.iconBoxEndIndex},p=!(x.textBoxStartIndex===x.textBoxEndIndex),g=!(x.iconBoxStartIndex===x.iconBoxEndIndex),f=a["text-optional"]||!p,b=a["icon-optional"]||!g,I=p?e.placeCollisionFeature(u,a["text-allow-overlap"],a["symbol-avoid-edges"]):e.minScale,S=g?e.placeCollisionFeature(m,a["icon-allow-overlap"],a["symbol-avoid-edges"]):e.minScale;f||b?!b&&I?I=Math.max(S,I):!f&&S&&(S=Math.max(S,I)):S=I=Math.max(S,I),p&&(e.insertCollisionFeature(u,I,a["text-ignore-placement"]),I<=r&&o.addSymbols(o.arrays.glyph,x.glyphQuadStartIndex,x.glyphQuadEndIndex,I,a["text-keep-upright"],n,e.angle,x.writingModes)),g&&(e.insertCollisionFeature(m,S,a["icon-ignore-placement"]),S<=r&&o.addSymbols(o.arrays.icon,x.iconQuadStartIndex,x.iconQuadEndIndex,S,a["icon-keep-upright"],i,e.angle))}t&&this.addToDebugBuffers(e)},SymbolBucket.prototype.addSymbols=function(e,t,o,a,r,n,i,s){for(var l=this,c=e.elementArray,y=e.layoutVertexArray,d=this.zoom,h=Math.max(Math.log(a)/Math.LN2+d,0),x=t;x<o;x++){var u=l.symbolQuadsArray.get(x).SymbolQuad,m=(u.anchorAngle+i+Math.PI)%(2*Math.PI);if(s&WritingMode.vertical){if(n&&u.writingMode===WritingMode.vertical){if(r&&n&&m<=5*Math.PI/4||m>7*Math.PI/4)continue}else if(r&&n&&m<=3*Math.PI/4||m>5*Math.PI/4)continue}else if(r&&n&&(m<=Math.PI/2||m>3*Math.PI/2))continue;var p=u.tl,g=u.tr,f=u.bl,b=u.br,I=u.tex,S=u.anchorPoint,v=Math.max(d+Math.log(u.minScale)/Math.LN2,h),A=Math.min(d+Math.log(u.maxScale)/Math.LN2,25);if(!(A<=v)){v===h&&(v=0);var M=Math.round(u.glyphAngle/(2*Math.PI)*256),B=e.prepareSegment(4),T=B.vertexLength;addVertex(y,S.x,S.y,p.x,p.y,I.x,I.y,v,A,h,M),addVertex(y,S.x,S.y,g.x,g.y,I.x+I.w,I.y,v,A,h,M),addVertex(y,S.x,S.y,f.x,f.y,I.x,I.y+I.h,v,A,h,M),addVertex(y,S.x,S.y,b.x,b.y,I.x+I.w,I.y+I.h,v,A,h,M),c.emplaceBack(T,T+1,T+2),c.emplaceBack(T+1,T+2,T+3),B.vertexLength+=4,B.primitiveLength+=2}}},SymbolBucket.prototype.addToDebugBuffers=function(e){for(var t=this,o=this.arrays.collisionBox,a=o.layoutVertexArray,r=o.elementArray,n=-e.angle,i=e.yStretch,s=this.symbolInstancesStartIndex;s<this.symbolInstancesEndIndex;s++){var l=t.symbolInstancesArray.get(s);l.textCollisionFeature={boxStartIndex:l.textBoxStartIndex,boxEndIndex:l.textBoxEndIndex},l.iconCollisionFeature={boxStartIndex:l.iconBoxStartIndex,boxEndIndex:l.iconBoxEndIndex};for(var c=0;c<2;c++){var y=l[0===c?"textCollisionFeature":"iconCollisionFeature"];if(y)for(var d=y.boxStartIndex;d<y.boxEndIndex;d++){var h=t.collisionBoxArray.get(d),x=h.anchorPoint,u=new Point(h.x1,h.y1*i)._rotate(n),m=new Point(h.x2,h.y1*i)._rotate(n),p=new Point(h.x1,h.y2*i)._rotate(n),g=new Point(h.x2,h.y2*i)._rotate(n),f=Math.max(0,Math.min(25,t.zoom+Math.log(h.maxScale)/Math.LN2)),b=Math.max(0,Math.min(25,t.zoom+Math.log(h.placementScale)/Math.LN2)),I=o.prepareSegment(4),S=I.vertexLength;addCollisionBoxVertex(a,x,u,f,b),addCollisionBoxVertex(a,x,m,f,b),addCollisionBoxVertex(a,x,g,f,b),addCollisionBoxVertex(a,x,p,f,b),r.emplaceBack(S,S+1),r.emplaceBack(S+1,S+2),r.emplaceBack(S+2,S+3),r.emplaceBack(S+3,S),I.vertexLength+=4,I.primitiveLength+=4}}}},SymbolBucket.prototype.addSymbolInstance=function(e,t,o,a,r,n,i,s,l,c,y,d,h,x,u,m,p,g,f){var b,I,S,v=this,A=[];for(var M in o){var B=parseInt(M,10);o[B]&&(A=A.concat(n?getGlyphQuads(e,o[B],d,t,r,x,B):[]),b=new CollisionFeature(s,t,e,l,c,y,o[B],d,h,x,!1))}var T=this.symbolQuadsArray.length;if(A&&A.length)for(var z=0;z<A.length;z++)v.addSymbolQuad(A[z]);var k=this.symbolQuadsArray.length,E=b?b.boxStartIndex:this.collisionBoxArray.length,P=b?b.boxEndIndex:this.collisionBoxArray.length;a&&(S=n?getIconQuads(e,a,u,t,r,p,o[WritingMode.horizontal],g,f):[],I=new CollisionFeature(s,t,e,l,c,y,a,u,m,p,!0));var _=this.symbolQuadsArray.length;S&&1===S.length&&this.addSymbolQuad(S[0]);var w=this.symbolQuadsArray.length,L=I?I.boxStartIndex:this.collisionBoxArray.length,Q=I?I.boxEndIndex:this.collisionBoxArray.length;w>SymbolBucket.MAX_QUADS&&util.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),k>SymbolBucket.MAX_QUADS&&util.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907");var V=(o[WritingMode.vertical]?WritingMode.vertical:0)|(o[WritingMode.horizontal]?WritingMode.horizontal:0);return this.symbolInstancesArray.emplaceBack(E,P,L,Q,T,k,_,w,e.x,e.y,i,V)},SymbolBucket.prototype.addSymbolQuad=function(e){return this.symbolQuadsArray.emplaceBack(e.anchorPoint.x,e.anchorPoint.y,e.tl.x,e.tl.y,e.tr.x,e.tr.y,e.bl.x,e.bl.y,e.br.x,e.br.y,e.tex.h,e.tex.w,e.tex.x,e.tex.y,e.anchorAngle,e.glyphAngle,e.maxScale,e.minScale,e.writingMode)},SymbolBucket.MAX_QUADS=65535,module.exports=SymbolBucket;
},{"../../symbol/anchor":72,"../../symbol/clip_line":74,"../../symbol/collision_feature":76,"../../symbol/get_anchors":78,"../../symbol/mergelines":81,"../../symbol/quads":82,"../../symbol/resolve_text":83,"../../symbol/shaping":84,"../../util/classify_rings":110,"../../util/find_pole_of_inaccessibility":116,"../../util/script_detection":123,"../../util/token":125,"../../util/util":126,"../array_group":1,"../buffer_group":9,"../element_array_type":10,"../extent":11,"../load_geometry":13,"../vertex_array_type":17,"point-geometry":203}],8:[function(require,module,exports){
"use strict";var AttributeType={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"},Buffer=function(e,t,r){this.arrayBuffer=e.arrayBuffer,this.length=e.length,this.attributes=t.members,this.itemSize=t.bytesPerElement,this.type=r,this.arrayType=t};Buffer.fromStructArray=function(e,t){return new Buffer(e.serialize(),e.constructor.serialize(),t)},Buffer.prototype.bind=function(e){var t=e[this.type];this.buffer?e.bindBuffer(t,this.buffer):(this.gl=e,this.buffer=e.createBuffer(),e.bindBuffer(t,this.buffer),e.bufferData(t,this.arrayBuffer,e.STATIC_DRAW),this.arrayBuffer=null)},Buffer.prototype.setVertexAttribPointers=function(e,t,r){for(var f=this,i=0;i<this.attributes.length;i++){var u=f.attributes[i],s=t[u.name];void 0!==s&&e.vertexAttribPointer(s,u.components,e[AttributeType[u.type]],!1,f.arrayType.bytesPerElement,u.offset+(f.arrayType.bytesPerElement*r||0))}},Buffer.prototype.destroy=function(){this.buffer&&this.gl.deleteBuffer(this.buffer)},Buffer.BufferType={VERTEX:"ARRAY_BUFFER",ELEMENT:"ELEMENT_ARRAY_BUFFER"},module.exports=Buffer;
},{}],9:[function(require,module,exports){
"use strict";var util=require("../util/util"),Buffer=require("./buffer"),ProgramConfiguration=require("./program_configuration"),VertexArrayObject=require("../render/vertex_array_object"),BufferGroup=function(e,r,t,a){var f=this;this.layoutVertexBuffer=new Buffer(a.layoutVertexArray,e.layoutVertexArrayType.serialize(),Buffer.BufferType.VERTEX),a.elementArray&&(this.elementBuffer=new Buffer(a.elementArray,e.elementArrayType.serialize(),Buffer.BufferType.ELEMENT)),a.elementArray2&&(this.elementBuffer2=new Buffer(a.elementArray2,e.elementArrayType2.serialize(),Buffer.BufferType.ELEMENT)),this.layerData={};for(var i=0,n=r;i<n.length;i+=1){var u=n[i],s=a.paintVertexArrays&&a.paintVertexArrays[u.id],o=ProgramConfiguration.createDynamic(e.paintAttributes||[],u,t),y=s?new Buffer(s.array,s.type,Buffer.BufferType.VERTEX):null;f.layerData[u.id]={programConfiguration:o,paintVertexBuffer:y}}this.segments=a.segments,this.segments2=a.segments2;for(var l=0,m=[this.segments,this.segments2];l<m.length;l+=1)for(var B=m[l],h=0,p=B||[];h<p.length;h+=1){var g=p[h];g.vaos=util.mapObject(f.layerData,function(){return new VertexArrayObject})}};BufferGroup.prototype.destroy=function(){var e=this;this.layoutVertexBuffer.destroy(),this.elementBuffer&&this.elementBuffer.destroy(),this.elementBuffer2&&this.elementBuffer2.destroy();for(var r in this.layerData){var t=e.layerData[r].paintVertexBuffer;t&&t.destroy()}for(var a=0,f=[this.segments,this.segments2];a<f.length;a+=1)for(var i=f[a],n=0,u=i||[];n<u.length;n+=1){var s=u[n];for(var o in s.vaos)s.vaos[o].destroy()}},module.exports=BufferGroup;
},{"../render/vertex_array_object":38,"../util/util":126,"./buffer":8,"./program_configuration":15}],10:[function(require,module,exports){
"use strict";function createElementArrayType(e){return createStructArrayType({members:[{type:"Uint16",name:"vertices",components:e||3}]})}var createStructArrayType=require("../util/struct_array");module.exports=createElementArrayType;
},{"../util/struct_array":124}],11:[function(require,module,exports){
"use strict";module.exports=8192;
},{}],12:[function(require,module,exports){
"use strict";function translateDistance(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function topDownFeatureComparator(e,t){return t-e}function getLineWidth(e){return e["line-gap-width"]>0?e["line-gap-width"]+2*e["line-width"]:e["line-width"]}function translate(e,t,r,i,n){if(!t[0]&&!t[1])return e;t=Point.convert(t),"viewport"===r&&t._rotate(-i);for(var a=[],o=0;o<e.length;o++){for(var s=e[o],l=[],u=0;u<s.length;u++)l.push(s[u].sub(t._mult(n)));a.push(l)}return a}function offsetLine(e,t){for(var r=[],i=new Point(0,0),n=0;n<e.length;n++){for(var a=e[n],o=[],s=0;s<a.length;s++){var l=a[s-1],u=a[s],c=a[s+1],y=0===s?i:u.sub(l)._unit()._perp(),f=s===a.length-1?i:c.sub(u)._unit()._perp(),d=y._add(f)._unit(),h=d.x*f.x+d.y*f.y;d._mult(1/h),o.push(d._mult(t)._add(u))}r.push(o)}return r}var Point=require("point-geometry"),loadGeometry=require("./load_geometry"),EXTENT=require("./extent"),featureFilter=require("feature-filter"),createStructArrayType=require("../util/struct_array"),Grid=require("grid-index"),DictionaryCoder=require("../util/dictionary_coder"),vt=require("vector-tile"),Protobuf=require("pbf"),GeoJSONFeature=require("../util/vectortile_to_geojson"),arraysIntersect=require("../util/util").arraysIntersect,intersection=require("../util/intersection_tests"),multiPolygonIntersectsBufferedMultiPoint=intersection.multiPolygonIntersectsBufferedMultiPoint,multiPolygonIntersectsMultiPolygon=intersection.multiPolygonIntersectsMultiPolygon,multiPolygonIntersectsBufferedMultiLine=intersection.multiPolygonIntersectsBufferedMultiLine,FeatureIndexArray=createStructArrayType({members:[{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]}),FeatureIndex=function(e,t,r){if(e.grid){var i=e,n=t;e=i.coord,t=i.overscaling,this.grid=new Grid(i.grid),this.featureIndexArray=new FeatureIndexArray(i.featureIndexArray),this.rawTileData=n,this.bucketLayerIDs=i.bucketLayerIDs}else this.grid=new Grid(EXTENT,16,0),this.featureIndexArray=new FeatureIndexArray;this.coord=e,this.overscaling=t,this.x=e.x,this.y=e.y,this.z=e.z-Math.log(t)/Math.LN2,this.setCollisionTile(r)};FeatureIndex.prototype.insert=function(e,t){var r=this,i=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(e.index,e.sourceLayerIndex,t);for(var n=loadGeometry(e),a=0;a<n.length;a++){for(var o=n[a],s=[1/0,1/0,-(1/0),-(1/0)],l=0;l<o.length;l++){var u=o[l];s[0]=Math.min(s[0],u.x),s[1]=Math.min(s[1],u.y),s[2]=Math.max(s[2],u.x),s[3]=Math.max(s[3],u.y)}r.grid.insert(i,s[0],s[1],s[2],s[3])}},FeatureIndex.prototype.setCollisionTile=function(e){this.collisionTile=e},FeatureIndex.prototype.serialize=function(e){var t=this.grid.toArrayBuffer();return e&&e.push(t),{coord:this.coord,overscaling:this.overscaling,grid:t,featureIndexArray:this.featureIndexArray.serialize(e),bucketLayerIDs:this.bucketLayerIDs}},FeatureIndex.prototype.query=function(e,t){this.vtLayers||(this.vtLayers=new vt.VectorTile(new Protobuf(this.rawTileData)).layers,this.sourceLayerCoder=new DictionaryCoder(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]));var r={},i=e.params||{},n=EXTENT/e.tileSize/e.scale,a=featureFilter(i.filter),o=0;for(var s in t){var l=t[s],u=l.paint,c=0;"line"===l.type?c=getLineWidth(u)/2+Math.abs(u["line-offset"])+translateDistance(u["line-translate"]):"fill"===l.type?c=translateDistance(u["fill-translate"]):"fill-extrusion"===l.type?c=translateDistance(u["fill-extrusion-translate"]):"circle"===l.type&&(c=u["circle-radius"]+translateDistance(u["circle-translate"])),o=Math.max(o,c*n)}for(var y=e.queryGeometry.map(function(e){return e.map(function(e){return new Point(e.x,e.y)})}),f=1/0,d=1/0,h=-(1/0),g=-(1/0),p=0;p<y.length;p++)for(var v=y[p],x=0;x<v.length;x++){var I=v[x];f=Math.min(f,I.x),d=Math.min(d,I.y),h=Math.max(h,I.x),g=Math.max(g,I.y)}var m=this.grid.query(f-o,d-o,h+o,g+o);m.sort(topDownFeatureComparator),this.filterMatching(r,m,this.featureIndexArray,y,a,i.layers,t,e.bearing,n);var L=this.collisionTile.queryRenderedSymbols(y,e.scale);return L.sort(),this.filterMatching(r,L,this.collisionTile.collisionBoxArray,y,a,i.layers,t,e.bearing,n),r},FeatureIndex.prototype.filterMatching=function(e,t,r,i,n,a,o,s,l){for(var u,c=this,y=0;y<t.length;y++){var f=t[y];if(f!==u){u=f;var d=r.get(f),h=c.bucketLayerIDs[d.bucketIndex];if(!a||arraysIntersect(a,h)){var g=c.sourceLayerCoder.decode(d.sourceLayerIndex),p=c.vtLayers[g],v=p.feature(d.featureIndex);if(n(v))for(var x=null,I=0;I<h.length;I++){var m=h[I];if(!(a&&a.indexOf(m)<0)){var L=o[m];if(L){var M;if("symbol"!==L.type){x||(x=loadGeometry(v));var P=L.paint;if("line"===L.type){M=translate(i,P["line-translate"],P["line-translate-anchor"],s,l);var b=getLineWidth(P)/2*l;if(P["line-offset"]&&(x=offsetLine(x,P["line-offset"]*l)),!multiPolygonIntersectsBufferedMultiLine(M,x,b))continue}else if("fill"===L.type||"fill-extrusion"===L.type){var w=L.type;if(M=translate(i,P[w+"-translate"],P[w+"-translate-anchor"],s,l),!multiPolygonIntersectsMultiPolygon(M,x))continue}else if("circle"===L.type){M=translate(i,P["circle-translate"],P["circle-translate-anchor"],s,l);var _=P["circle-radius"]*l;if(!multiPolygonIntersectsBufferedMultiPoint(M,x,_))continue}}var q=new GeoJSONFeature(v,c.z,c.x,c.y);q.layer=L.serialize();var T=e[m];void 0===T&&(T=e[m]=[]),T.push(q)}}}}}}},module.exports=FeatureIndex;
},{"../util/dictionary_coder":112,"../util/intersection_tests":119,"../util/struct_array":124,"../util/util":126,"../util/vectortile_to_geojson":127,"./extent":11,"./load_geometry":13,"feature-filter":133,"grid-index":154,"pbf":202,"point-geometry":203,"vector-tile":213}],13:[function(require,module,exports){
"use strict";function createBounds(e){return{min:-1*Math.pow(2,e-1),max:Math.pow(2,e-1)-1}}var util=require("../util/util"),EXTENT=require("./extent"),boundsLookup={15:createBounds(15),16:createBounds(16)};module.exports=function(e,t){for(var r=boundsLookup[t||16],o=EXTENT/e.extent,u=e.loadGeometry(),n=0;n<u.length;n++)for(var a=u[n],i=0;i<a.length;i++){var d=a[i];d.x=Math.round(d.x*o),d.y=Math.round(d.y*o),(d.x<r.min||d.x>r.max||d.y<r.min||d.y>r.max)&&util.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return u};
},{"../util/util":126,"./extent":11}],14:[function(require,module,exports){
"use strict";var createStructArrayType=require("../util/struct_array"),PosArray=createStructArrayType({members:[{name:"a_pos",type:"Int16",components:2}]});module.exports=PosArray;
},{"../util/struct_array":124}],15:[function(require,module,exports){
"use strict";function getPaintAttributeValue(t,e,r,i){if(!t.zoomStops)return e.getPaintValue(t.property,r,i);var a=t.zoomStops.map(function(a){return e.getPaintValue(t.property,util.extend({},r,{zoom:a}),i)});return 1===a.length?a[0]:a}function normalizePaintAttribute(t,e){var r=t.property.replace(e.type+"-","").replace(/-/g,"_"),i="color"===e._paintSpecifications[t.property].type;return util.extend({name:"a_"+r,components:i?4:1,multiplier:i?255:1},t)}var createVertexArrayType=require("./vertex_array_type"),util=require("../util/util"),ProgramConfiguration=function(){this.attributes=[],this.uniforms=[],this.interpolationUniforms=[],this.pragmas={vertex:{},fragment:{}},this.cacheKey=""};ProgramConfiguration.createDynamic=function(t,e,r){for(var i=new ProgramConfiguration,a=0,n=t;a<n.length;a+=1){var o=n[a],p=normalizePaintAttribute(o,e),u=p.name.slice(2);e.isPaintValueFeatureConstant(p.property)?i.addZoomAttribute(u,p):e.isPaintValueZoomConstant(p.property)?i.addPropertyAttribute(u,p):i.addZoomAndPropertyAttribute(u,p,e,r)}return i.PaintVertexArray=createVertexArrayType(i.attributes),i},ProgramConfiguration.createStatic=function(t){for(var e=new ProgramConfiguration,r=0,i=t;r<i.length;r+=1){var a=i[r];e.addUniform(a,"u_"+a)}return e},ProgramConfiguration.prototype.addUniform=function(t,e){var r=this.getPragmas(t);r.define.push("uniform {precision} {type} "+e+";"),r.initialize.push("{precision} {type} "+t+" = "+e+";"),this.cacheKey+="/u_"+t},ProgramConfiguration.prototype.addZoomAttribute=function(t,e){this.uniforms.push(e),this.addUniform(t,e.name)},ProgramConfiguration.prototype.addPropertyAttribute=function(t,e){var r=this.getPragmas(t);this.attributes.push(e),r.define.push("varying {precision} {type} "+t+";"),r.vertex.define.push("attribute {precision} {type} "+e.name+";"),r.vertex.initialize.push(t+" = "+e.name+" / "+e.multiplier+".0;"),this.cacheKey+="/a_"+t},ProgramConfiguration.prototype.addZoomAndPropertyAttribute=function(t,e,r,i){var a=this,n=this.getPragmas(t);n.define.push("varying {precision} {type} "+t+";");for(var o=0,p=r.getPaintValueStopZoomLevels(e.property);o<p.length&&p[o]<i;)o++;var u=Math.max(0,Math.min(p.length-4,o-2)),s="u_"+t+"_t";n.vertex.define.push("uniform lowp float "+s+";"),this.interpolationUniforms.push({name:s,property:e.property,stopOffset:u});for(var m=[],f=0;f<4;f++)m.push(p[Math.min(u+f,p.length-1)]);var g=[];if(1===e.components)this.attributes.push(util.extend({},e,{components:4,zoomStops:m})),n.vertex.define.push("attribute {precision} vec4 "+e.name+";"),g.push(e.name);else for(var h=0;h<4;h++){var l=e.name+h;g.push(l),a.attributes.push(util.extend({},e,{name:l,zoomStops:[m[h]]})),n.vertex.define.push("attribute {precision} {type} "+l+";")}n.vertex.initialize.push(t+" = evaluate_zoom_function_"+e.components+"( "+g.join(", ")+", "+s+") / "+e.multiplier+".0;"),this.cacheKey+="/z_"+t},ProgramConfiguration.prototype.getPragmas=function(t){return this.pragmas[t]||(this.pragmas[t]={define:[],initialize:[]},this.pragmas[t].fragment={define:[],initialize:[]},this.pragmas[t].vertex={define:[],initialize:[]}),this.pragmas[t]},ProgramConfiguration.prototype.applyPragmas=function(t,e){var r=this;return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,i,a,n,o){return r.pragmas[o][i].concat(r.pragmas[o][e][i]).join("\n").replace(/{type}/g,n).replace(/{precision}/g,a)})},ProgramConfiguration.prototype.populatePaintArray=function(t,e,r,i,a){var n=e.length;e.resize(r);for(var o=0,p=this.attributes;o<p.length;o+=1)for(var u=p[o],s=getPaintAttributeValue(u,t,i,a),m=n;m<r;m++){var f=e.get(m);if(4===u.components)for(var g=0;g<4;g++)f[u.name+g]=s[g]*u.multiplier;else f[u.name]=s*u.multiplier}},ProgramConfiguration.prototype.setUniforms=function(t,e,r,i){for(var a=0,n=this.uniforms;a<n.length;a+=1){var o=n[a],p=r.getPaintValue(o.property,i);4===o.components?t.uniform4fv(e[o.name],p):t.uniform1f(e[o.name],p)}for(var u=0,s=this.interpolationUniforms;u<s.length;u+=1){var m=s[u],f=r.getPaintInterpolationT(m.property,i);t.uniform1f(e[m.name],Math.max(0,Math.min(4,f-m.stopOffset)))}},module.exports=ProgramConfiguration;
},{"../util/util":126,"./vertex_array_type":17}],16:[function(require,module,exports){
"use strict";var createStructArrayType=require("../util/struct_array"),RasterBoundsArray=createStructArrayType({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]});module.exports=RasterBoundsArray;
},{"../util/struct_array":124}],17:[function(require,module,exports){
"use strict";function createVertexArrayType(r){return createStructArrayType({members:r,alignment:4})}var createStructArrayType=require("../util/struct_array");module.exports=createVertexArrayType;
},{"../util/struct_array":124}],18:[function(require,module,exports){
"use strict";var Coordinate=function(o,t,n){this.column=o,this.row=t,this.zoom=n};Coordinate.prototype.clone=function(){return new Coordinate(this.column,this.row,this.zoom)},Coordinate.prototype.zoomTo=function(o){return this.clone()._zoomTo(o)},Coordinate.prototype.sub=function(o){return this.clone()._sub(o)},Coordinate.prototype._zoomTo=function(o){var t=Math.pow(2,o-this.zoom);return this.column*=t,this.row*=t,this.zoom=o,this},Coordinate.prototype._sub=function(o){return o=o.zoomTo(this.zoom),this.column-=o.column,this.row-=o.row,this},module.exports=Coordinate;
},{}],19:[function(require,module,exports){
"use strict";var wrap=require("../util/util").wrap,LngLat=function(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")};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){if(t instanceof LngLat)return t;if(t&&t.hasOwnProperty("lng")&&t.hasOwnProperty("lat"))return new LngLat(t.lng,t.lat);if(Array.isArray(t)&&2===t.length)return new LngLat(t[0],t[1]);throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")},module.exports=LngLat;
},{"../util/util":126}],20:[function(require,module,exports){
"use strict";var LngLat=require("./lng_lat"),LngLatBounds=function(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};LngLatBounds.prototype.setNorthEast=function(t){return this._ne=LngLat.convert(t),this},LngLatBounds.prototype.setSouthWest=function(t){return this._sw=LngLat.convert(t),this},LngLatBounds.prototype.extend=function(t){var n,e,s=this._sw,o=this._ne;if(t instanceof LngLat)n=t,e=t;else{if(!(t instanceof LngLatBounds))return Array.isArray(t)?t.every(Array.isArray)?this.extend(LngLatBounds.convert(t)):this.extend(LngLat.convert(t)):this;if(n=t._sw,e=t._ne,!n||!e)return this}return s||o?(s.lng=Math.min(n.lng,s.lng),s.lat=Math.min(n.lat,s.lat),o.lng=Math.max(e.lng,o.lng),o.lat=Math.max(e.lat,o.lat)):(this._sw=new LngLat(n.lng,n.lat),this._ne=new LngLat(e.lng,e.lat)),this},LngLatBounds.prototype.getCenter=function(){return new LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},LngLatBounds.prototype.getSouthWest=function(){return this._sw},LngLatBounds.prototype.getNorthEast=function(){return this._ne},LngLatBounds.prototype.getNorthWest=function(){return new LngLat(this.getWest(),this.getNorth())},LngLatBounds.prototype.getSouthEast=function(){return new LngLat(this.getEast(),this.getSouth())},LngLatBounds.prototype.getWest=function(){return this._sw.lng},LngLatBounds.prototype.getSouth=function(){return this._sw.lat},LngLatBounds.prototype.getEast=function(){return this._ne.lng},LngLatBounds.prototype.getNorth=function(){return this._ne.lat},LngLatBounds.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},LngLatBounds.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},LngLatBounds.convert=function(t){return!t||t instanceof LngLatBounds?t:new LngLatBounds(t)},module.exports=LngLatBounds;
},{"./lng_lat":19}],21:[function(require,module,exports){
"use strict";var LngLat=require("./lng_lat"),Point=require("point-geometry"),Coordinate=require("./coordinate"),util=require("../util/util"),interp=require("../util/interpolate"),TileCoord=require("../source/tile_coord"),EXTENT=require("../data/extent"),glmatrix=require("gl-matrix"),vec4=glmatrix.vec4,mat4=glmatrix.mat4,mat2=glmatrix.mat2,Transform=function(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},prototypeAccessors={minZoom:{},maxZoom:{},worldSize:{},centerPoint:{},size:{},bearing:{},pitch:{},altitude:{},zoom:{},center:{},unmodified:{},x:{},y:{},point:{}};prototypeAccessors.minZoom.get=function(){return this._minZoom},prototypeAccessors.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},prototypeAccessors.maxZoom.get=function(){return this._maxZoom},prototypeAccessors.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},prototypeAccessors.worldSize.get=function(){return this.tileSize*this.scale},prototypeAccessors.centerPoint.get=function(){return this.size._div(2)},prototypeAccessors.size.get=function(){return new Point(this.width,this.height)},prototypeAccessors.bearing.get=function(){return-this.angle/Math.PI*180},prototypeAccessors.bearing.set=function(t){var i=-util.wrap(t,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=mat2.create(),mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},prototypeAccessors.pitch.get=function(){return this._pitch/Math.PI*180},prototypeAccessors.pitch.set=function(t){var i=util.clamp(t,0,60)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())},prototypeAccessors.altitude.get=function(){return this._altitude},prototypeAccessors.altitude.set=function(t){var i=Math.max(.75,t);this._altitude!==i&&(this._unmodified=!1,this._altitude=i,this._calcMatrices())},prototypeAccessors.zoom.get=function(){return this._zoom},prototypeAccessors.zoom.set=function(t){var i=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this.scale=this.zoo