From 2cf28f230185c5a532fbe8863ec74f27ff1ab8e3 Mon Sep 17 00:00:00 2001 From: Colleen Date: Wed, 31 Oct 2018 17:57:19 -0700 Subject: [PATCH] delete generated bench files --- bench/benchmarks_generated.js | 462 -------------- bench/benchmarks_view_generated.js | 945 ----------------------------- 2 files changed, 1407 deletions(-) delete mode 100644 bench/benchmarks_generated.js delete mode 100644 bench/benchmarks_view_generated.js diff --git a/bench/benchmarks_generated.js b/bench/benchmarks_generated.js deleted file mode 100644 index 9d015632adc..00000000000 --- a/bench/benchmarks_generated.js +++ /dev/null @@ -1,462 +0,0 @@ -(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;o0?r(function(o){o?i(o):asyncTimesSeries(e-1,r,i)}):i()}function createLayerFamilies(e){if(e!==createLayerFamiliesCacheKey){var r=new Worker({addEventListener:function(){}});r["set layers"](0,e),createLayerFamiliesCacheKey=e,createLayerFamiliesCacheValue=r.layerFamilies[0]}return createLayerFamiliesCacheValue}var VT=require("vector-tile"),Protobuf=require("pbf"),WorkerTile=require("../../js/source/worker_tile"),Worker=require("../../js/source/worker"),ajax=require("../../js/util/ajax"),Style=require("../../js/style/style"),util=require("../../js/util/util"),Evented=require("../../js/util/evented"),config=require("../../js/util/config"),coordinates=require("../lib/coordinates"),formatNumber=require("../lib/format_number"),accessToken=require("../lib/access_token"),SAMPLE_COUNT=10;module.exports=function(){config.ACCESS_TOKEN=accessToken;var e=util.extend({},Evented),r="https://api.mapbox.com/styles/v1/mapbox/streets-v9?access_token="+accessToken;return ajax.getJSON(r,function(r,i){return r?e.fire("error",{error:r}):(e.fire("log",{message:"preloading assets",color:"dark"}),void preloadAssets(i,function(r,o){function n(e,r){r(null,o.glyphs[JSON.stringify(e)])}function t(e,r){r(null,o.icons[JSON.stringify(e)])}function s(e,r){r(null,o.tiles[e])}if(r)return e.fire("error",{error:r});e.fire("log",{message:"starting first test",color:"dark"});var a=0,c=0;asyncTimesSeries(SAMPLE_COUNT,function(r){runSample(i,n,t,s,function(i,o){return i?e.fire("error",{error:i}):(a+=o,c++,e.fire("log",{message:formatNumber(o)+" ms"}),void r())})},function(r){if(r)e.fire("error",{error:r});else{var i=a/c;e.fire("end",{message:formatNumber(i)+" ms",score:i})}})}))}),e};var createLayerFamiliesCacheKey,createLayerFamiliesCacheValue; -},{"../../js/source/worker":64,"../../js/source/worker_tile":65,"../../js/style/style":69,"../../js/util/ajax":118,"../../js/util/config":123,"../../js/util/evented":127,"../../js/util/util":136,"../lib/access_token":11,"../lib/coordinates":12,"../lib/format_number":14,"pbf":204,"vector-tile":216}],3:[function(require,module,exports){ -"use strict";var Evented=require("../../js/util/evented"),util=require("../../js/util/util"),formatNumber=require("../lib/format_number"),measureFramerate=require("../lib/measure_framerate"),createMap=require("../lib/create_map"),DURATION_MILLISECONDS=5e3;module.exports=function(){var e=util.extend({},Evented),r=createMap({width:1024,height:768,zoom:5,center:[-77.032194,38.912753],style:"mapbox://styles/mapbox/bright-v9"});return r.on("load",function(){r.repaint=!0,e.fire("log",{message:"starting "+formatNumber(DURATION_MILLISECONDS/1e3)+" second test",color:"dark"}),measureFramerate(DURATION_MILLISECONDS,function(t,a){r.remove(),t?e.fire("error",{error:t}):e.fire("end",{message:formatNumber(a)+" fps",score:1/a})})}),e}; -},{"../../js/util/evented":127,"../../js/util/util":136,"../lib/create_map":13,"../lib/format_number":14,"../lib/measure_framerate":15}],4:[function(require,module,exports){ -"use strict";function measureFrameTime(e,r,o){var t=createMap({width:1024,height:768,zoom:r,center:[-77.032194,38.912753],style:"mapbox://styles/mapbox/streets-v9"});t.on("load",function(){t.repaint=!0,window.setTimeout(function(){var e=0,r=0,n=0,s=performance.now();t._realrender=t._render,t._render=function(){t._styleDirty=!0,t._sourcesDirty=!0;var u=performance.now();t._realrender();var m=performance.now(),a=m-u;e+=a,r++,a>=16&&n++,m-s>DURATION_MILLISECONDS&&(t.repaint=!1,t.remove(),t.getContainer().remove(),o(void 0,{sum:e,count:r,countAbove16:n}))}},100)})}function asyncSeries(e,r,o){e>0?r(e,function(t){t?o(t):asyncSeries(e-1,r,o)}):o()}var Evented=require("../../js/util/evented"),util=require("../../js/util/util"),formatNumber=require("../lib/format_number"),createMap=require("../lib/create_map"),DURATION_MILLISECONDS=5e3,zooms=[4,8,11,13,15,17],results=[];module.exports=function(e){function r(r,o){var n=zooms.length-r;measureFrameTime(e,zooms[n],function(e,r){results[n]=r,t.fire("log",{message:formatNumber(r.sum/r.count*10)/10+" ms, "+formatNumber(r.countAbove16/r.count*100)+"% > 16 ms at zoom "+zooms[n]}),o()})}function o(){for(var e=0,r=0,o=0,n=0;n 16ms",score:e/r})}window.devicePixelRatio=1/16;var t=util.extend({},Evented);return asyncSeries(zooms.length,r,o),t}; -},{"../../js/util/evented":127,"../../js/util/util":136,"../lib/create_map":13,"../lib/format_number":14}],5:[function(require,module,exports){ -"use strict";var Evented=require("../../js/util/evented"),util=require("../../js/util/util"),formatNumber=require("../lib/format_number"),setDataPerf=require("../lib/set_data_perf"),setupGeoJSONMap=require("../lib/setup_geojson_map"),createMap=require("../lib/create_map"),ajax=require("../../js/util/ajax");module.exports=function(){var e=util.extend({},Evented);return setTimeout(function(){e.fire("log",{message:"downloading large geojson"})},0),ajax.getJSON("http://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_land.geojson",function(r,t){if(e.fire("log",{message:"starting test"}),r)return e.fire("error",{error:r});var a=createMap({width:1024,height:768,zoom:5,center:[-77.032194,38.912753],style:"mapbox://styles/mapbox/bright-v9"});a.on("load",function(){a=setupGeoJSONMap(a),setDataPerf(a.style.sources.geojson,t,function(r,t){return r?e.fire("error",{error:r}):(a.remove(),void e.fire("end",{message:formatNumber(t)+" ms",score:t}))})})}),e}; -},{"../../js/util/ajax":118,"../../js/util/evented":127,"../../js/util/util":136,"../lib/create_map":13,"../lib/format_number":14,"../lib/set_data_perf":16,"../lib/setup_geojson_map":17}],6:[function(require,module,exports){ -"use strict";var Evented=require("../../js/util/evented"),util=require("../../js/util/util"),formatNumber=require("../lib/format_number"),setDataPerf=require("../lib/set_data_perf"),setupGeoJSONMap=require("../lib/setup_geojson_map"),createMap=require("../lib/create_map"),featureCollection={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[-77.032194,38.912753]}}]};module.exports=function(){var e=util.extend({},Evented),r=createMap({width:1024,height:768,zoom:5,center:[-77.032194,38.912753],style:"mapbox://styles/mapbox/bright-v9"});return r.on("load",function(){r=setupGeoJSONMap(r),setDataPerf(r.style.sources.geojson,featureCollection,function(t,o){return r.remove(),t?e.fire("error",{error:t}):void e.fire("end",{message:formatNumber(o)+" ms",score:o})})}),e}; -},{"../../js/util/evented":127,"../../js/util/util":136,"../lib/create_map":13,"../lib/format_number":14,"../lib/set_data_perf":16,"../lib/setup_geojson_map":17}],7:[function(require,module,exports){ -"use strict";var Evented=require("../../js/util/evented"),util=require("../../js/util/util"),formatNumber=require("../lib/format_number"),createMap=require("../lib/create_map");module.exports=function(){function e(){if(++i>=n){for(var e=Date.now()-a,u=0;u0?t(e,function(n){n?o(n):asyncSeries(e-1,t,o)}):o()}for(var Evented=require("../../js/util/evented"),util=require("../../js/util/util"),createMap=require("../lib/create_map"),width=1024,height=768,numSamples=10,zoomLevels=[],i=4;i<19;i++)zoomLevels.push(i);module.exports=function(){function e(){var e=o/n;t.fire("end",{message:e.toFixed(2)+" ms",score:e})}var t=util.extend({},Evented),o=0,n=0;return asyncSeries(zoomLevels.length,function(e,i){var r=zoomLevels[zoomLevels.length-e],s=createMap({width:width,height:height,zoom:r,center:[-77.032194,38.912753],style:"mapbox://styles/mapbox/streets-v9"});s.getContainer().style.display="none",s.on("load",function(){var e=0,a=0;asyncSeries(numSamples,function(t,i){var r=performance.now();s.queryRenderedFeatures({});var u=performance.now()-r;o+=u,n++,e+=u,a++,i()},function(){t.fire("log",{message:(e/a).toFixed(2)+" ms at zoom "+r}),s.remove(),i()})})},e),setTimeout(function(){t.fire("log",{message:"loading assets",color:"dark"})},0),t}; -},{"../../js/util/evented":127,"../../js/util/util":136,"../lib/create_map":13}],9:[function(require,module,exports){ -"use strict";function asyncSeries(e,t,o){e>0?t(e,function(r){r?o(r):asyncSeries(e-1,t,o)}):o()}for(var Evented=require("../../js/util/evented"),util=require("../../js/util/util"),createMap=require("../lib/create_map"),width=1024,height=768,zoomLevels=[],i=4;i<19;i++)zoomLevels.push(i);for(var queryPoints=[],d=20,x=0;x0?r(function(t){t?n(t):asyncTimesSeries(e-1,r,n)}):n()}var util=require("../../js/util/util"),Evented=require("../../js/util/evented"),ajax=require("../../js/util/ajax"),config=require("../../js/util/config"),Style=require("../../js/style/style"),formatNumber=require("../lib/format_number"),accessToken=require("../lib/access_token");module.exports=function(){config.ACCESS_TOKEN=accessToken;var e=util.extend({},Evented),r="https://api.mapbox.com/styles/v1/mapbox/streets-v9?access_token="+accessToken;return ajax.getJSON(r,function(r,n){if(r)return e.fire("error",{error:r});var t=0,i=0;asyncTimesSeries(20,function(r){var s=performance.now();new Style(n).on("error",function(r){e.fire("error",{error:r})}).on("style.load",function(){var e=performance.now()-s;t+=e,i++,r()})},function(){var r=t/i;e.fire("end",{message:formatNumber(r)+" ms",score:r})})}),e}; -},{"../../js/style/style":69,"../../js/util/ajax":118,"../../js/util/config":123,"../../js/util/evented":127,"../../js/util/util":136,"../lib/access_token":11,"../lib/format_number":14}],11:[function(require,module,exports){ -(function (process){ -"use strict";function getURLParameter(e){var c=new RegExp("[?&]"+e+"=([^&#]*)","i"),s=c.exec(window.location.href);return s&&s[1]}var accessToken=process.env.MapboxAccessToken||process.env.MAPBOX_ACCESS_TOKEN||getURLParameter("access_token")||localStorage.getItem("accessToken");localStorage.setItem("accessToken",accessToken),module.exports=accessToken; -}).call(this,require('_process')) -},{"_process":141}],12:[function(require,module,exports){ -"use strict";var Coordinate=require("../../js/geo/coordinate");module.exports=[new Coordinate(5242,12665,15),new Coordinate(5242,12666,15),new Coordinate(5242,12664,15),new Coordinate(2620,6332,14),new Coordinate(2620,6333,14),new Coordinate(2621,6332,14),new Coordinate(2621,6333,14),new Coordinate(2620,6331,14),new Coordinate(2621,6331,14),new Coordinate(1309,3166,13),new Coordinate(1309,3167,13),new Coordinate(655,1583,12),new Coordinate(655,1582,12),new Coordinate(654,1583,12),new Coordinate(654,1582,12),new Coordinate(327,790,11),new Coordinate(326,791,11),new Coordinate(326,790,11),new Coordinate(326,792,11),new Coordinate(328,791,11),new Coordinate(328,790,11),new Coordinate(328,792,11),new Coordinate(163,395,10),new Coordinate(164,395,10),new Coordinate(163,396,10),new Coordinate(164,396,10),new Coordinate(81,197,9),new Coordinate(82,197,9),new Coordinate(81,198,9),new Coordinate(82,198,9),new Coordinate(81,196,9),new Coordinate(82,196,9),new Coordinate(40,98,8),new Coordinate(41,98,8),new Coordinate(40,99,8),new Coordinate(41,99,8),new Coordinate(40,97,8),new Coordinate(41,97,8),new Coordinate(20,49,7),new Coordinate(20,48,7),new Coordinate(19,49,7),new Coordinate(19,48,7),new Coordinate(20,50,7),new Coordinate(19,50,7),new Coordinate(10,24,6),new Coordinate(9,24,6),new Coordinate(10,25,6),new Coordinate(9,25,6),new Coordinate(10,23,6),new Coordinate(9,23,6),new Coordinate(5,12,5),new Coordinate(4,12,5),new Coordinate(5,11,5),new Coordinate(4,11,5),new Coordinate(2,6,4),new Coordinate(2,5,4),new Coordinate(1,5,4),new Coordinate(1,6,4),new Coordinate(3,5,4),new Coordinate(3,6,4),new Coordinate(1,2,3),new Coordinate(1,3,3),new Coordinate(0,2,3),new Coordinate(0,3,3),new Coordinate(0,1,2),new Coordinate(0,0,2),new Coordinate(0,2,2),new Coordinate(1,1,2),new Coordinate(1,0,2),new Coordinate(1,2,2),new Coordinate(0,0,1),new Coordinate(0,1,1),new Coordinate(1,0,1),new Coordinate(1,1,1),new Coordinate(0,0,0),new Coordinate(1,1,2),new Coordinate(1,2,2),new Coordinate(1,0,2),new Coordinate(2,3,3),new Coordinate(2,2,3),new Coordinate(1,2,3),new Coordinate(4,6,4),new Coordinate(4,5,4),new Coordinate(9,12,5),new Coordinate(8,12,5),new Coordinate(9,11,5),new Coordinate(8,11,5),new Coordinate(9,13,5),new Coordinate(8,13,5),new Coordinate(18,24,6),new Coordinate(18,23,6),new Coordinate(19,24,6),new Coordinate(17,24,6),new Coordinate(18,25,6),new Coordinate(19,23,6),new Coordinate(17,23,6),new Coordinate(19,25,6),new Coordinate(17,25,6),new Coordinate(36,48,7),new Coordinate(37,48,7),new Coordinate(36,49,7),new Coordinate(37,49,7),new Coordinate(36,47,7),new Coordinate(37,47,7),new Coordinate(73,97,8),new Coordinate(73,98,8),new Coordinate(72,97,8),new Coordinate(73,96,8),new Coordinate(72,98,8),new Coordinate(72,96,8),new Coordinate(146,195,9),new Coordinate(147,195,9),new Coordinate(146,196,9),new Coordinate(146,194,9),new Coordinate(147,196,9),new Coordinate(147,194,9),new Coordinate(293,391,10),new Coordinate(292,391,10),new Coordinate(293,390,10),new Coordinate(292,390,10),new Coordinate(293,392,10),new Coordinate(292,392,10),new Coordinate(585,783,11),new Coordinate(586,783,11),new Coordinate(585,782,11),new Coordinate(586,782,11),new Coordinate(585,784,11),new Coordinate(586,784,11),new Coordinate(1171,1566,12),new Coordinate(1172,1566,12),new Coordinate(1171,1567,12),new Coordinate(1171,1565,12),new Coordinate(1172,1567,12),new Coordinate(1172,1565,12),new Coordinate(2343,3133,13),new Coordinate(2342,3133,13),new Coordinate(2343,3132,13),new Coordinate(2342,3132,13),new Coordinate(2343,3134,13),new Coordinate(2342,3134,13),new Coordinate(4686,6266,14),new Coordinate(4686,6267,14),new Coordinate(4685,6266,14),new Coordinate(4685,6267,14),new Coordinate(9372,12533,15),new Coordinate(9372,12534,15),new Coordinate(9373,12533,15),new Coordinate(9373,12534,15),new Coordinate(9372,12532,15),new Coordinate(9373,12532,15)]; -},{"../../js/geo/coordinate":28}],13:[function(require,module,exports){ -"use strict";var util=require("../../js/util/util"),mapboxgl=require("../../js/mapbox-gl");module.exports=function(e){e=util.extend({width:512,height:512},e);var t=document.createElement("div");t.style.width=e.width+"px",t.style.height=e.height+"px",t.style.margin="0 auto",document.body.appendChild(t),mapboxgl.accessToken=require("./access_token");var i=new mapboxgl.Map(util.extend({container:t,style:"mapbox://styles/mapbox/streets-v9",interactive:!1},e));return i.on("remove",function(){i.getContainer().remove()}),i}; -},{"../../js/mapbox-gl":34,"../../js/util/util":136,"./access_token":11}],14:[function(require,module,exports){ -"use strict";module.exports=function(t){return Math.round(t).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}; -},{}],15:[function(require,module,exports){ -"use strict";module.exports=function(e,n){var r=performance.now(),o=0;requestAnimationFrame(function a(){if(o++,performance.now()1?f.name+b:f.name;x[T]=h[b]*g}}},Bucket.VertexArrayType=function(e){return new StructArrayType({members:e,alignment:4})},Bucket.ElementArrayType=function(e){return new StructArrayType({members:[{type:"Uint16",name:"vertices",components:e||3}]})}; -},{"../util/struct_array":134,"../util/util":136,"./array_group":18,"./bucket/circle_bucket":20,"./bucket/fill_bucket":21,"./bucket/line_bucket":22,"./bucket/symbol_bucket":23,"./buffer_group":25}],20:[function(require,module,exports){ -"use strict";function CircleBucket(){Bucket.apply(this,arguments)}var Bucket=require("../bucket"),util=require("../../util/util"),loadGeometry=require("../load_geometry"),EXTENT=Bucket.EXTENT;module.exports=CircleBucket,CircleBucket.prototype=util.inherit(Bucket,{}),CircleBucket.prototype.addCircleVertex=function(e,t,r,i,a){return e.emplaceBack(2*t+(i+1)/2,2*r+(a+1)/2)},CircleBucket.prototype.programInterfaces={circle:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new Bucket.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(e,t,r){return e.getPaintValue("circle-color",t,r)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(e,t,r){return[e.getPaintValue("circle-radius",t,r)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(e,t,r){return[e.getPaintValue("circle-blur",t,r)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(e,t,r){return[e.getPaintValue("circle-opacity",t,r)]},multiplier:255,paintProperty:"circle-opacity"}]}},CircleBucket.prototype.addFeature=function(e){for(var t={zoom:this.zoom},r=loadGeometry(e),i=this.prepareArrayGroup("circle",0),a=i.layoutVertexArray.length,c=0;c=EXTENT||o<0||o>=EXTENT)){var u=this.prepareArrayGroup("circle",4),p=u.layoutVertexArray,y=this.addCircleVertex(p,n,o,-1,-1);this.addCircleVertex(p,n,o,1,-1),this.addCircleVertex(p,n,o,1,1),this.addCircleVertex(p,n,o,-1,1),u.elementArray.emplaceBack(y,y+1,y+2),u.elementArray.emplaceBack(y,y+3,y+2)}}this.populatePaintArrays("circle",t,e.properties,i,a)}; -},{"../../util/util":136,"../bucket":19,"../load_geometry":27}],21:[function(require,module,exports){ -"use strict";function FillBucket(){Bucket.apply(this,arguments)}var Bucket=require("../bucket"),util=require("../../util/util"),loadGeometry=require("../load_geometry"),earcut=require("earcut"),classifyRings=require("../../util/classify_rings"),EARCUT_MAX_RINGS=500;module.exports=FillBucket,FillBucket.prototype=util.inherit(Bucket,{}),FillBucket.prototype.programInterfaces={fill:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new Bucket.ElementArrayType(1),elementArrayType2:new Bucket.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(e,t,r){return e.getPaintValue("fill-color",t,r)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(e,t,r){return e.getPaintValue("fill-outline-color",t,r)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(e,t,r){return[e.getPaintValue("fill-opacity",t,r)]},multiplier:255,paintProperty:"fill-opacity"}]}},FillBucket.prototype.addFeature=function(e){for(var t=loadGeometry(e),r=classifyRings(t,EARCUT_MAX_RINGS),l=this.prepareArrayGroup("fill",0),a=l.layoutVertexArray.length,o=0;o0&&o.push(a.length/2);for(var p=0;p=1&&l.elementArray2.emplaceBack(c-1,c),a.push(y.x),a.push(y.y)}}for(var s=earcut(a,o),m=0;m>6)},LineBucket.prototype.programInterfaces={line:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(e,t,i){return e.getPaintValue("line-color",t,i)},multiplier:255,paintProperty:"line-color"}],elementArrayType:new Bucket.ElementArrayType}},LineBucket.prototype.addFeature=function(e){for(var t=loadGeometry(e,LINE_DISTANCE_BUFFER_BITS),i=0;i2&&e[n-1].equals(e[n-2]);)n--;if(!(e.length<2)){"bevel"===i&&(s=1.05);var u=SHARP_CORNER_OFFSET*(EXTENT/(512*this.overscaling)),h=e[0],d=e[n-1],l=h.equals(d),o=this.prepareArrayGroup("line",10*n),c=o.layoutVertexArray.length;if(2!==n||!l){this.distance=0;var p,_,y,E,m,x,C,A=r,L=l?"butt":r,V=!0;this.e1=this.e2=this.e3=-1,l&&(p=e[n-2],m=h.sub(p)._unit()._perp());for(var f=0;f0){var N=p.dist(_);if(N>2*u){var I=p.sub(p.sub(_)._mult(u/N)._round());this.distance+=I.dist(_),this.addCurrentVertex(I,this.distance,E.mult(1),0,0,!1),_=I}}var k=_&&y,b=k?i:y?A:L;if(k&&"round"===b&&(vs&&(b="bevel"),"bevel"===b&&(v>2&&(b="flipbevel"),v100)S=m.clone();else{var R=E.x*m.y-E.y*m.x>0?-1:1,g=v*E.add(m).mag()/E.sub(m).mag();S._perp()._mult(g*R)}this.addCurrentVertex(p,this.distance,S,0,0,!1),this.addCurrentVertex(p,this.distance,S.mult(-1),0,0,!1)}else if("bevel"===b||"fakeround"===b){var F=E.x*m.y-E.y*m.x>0,D=-Math.sqrt(v*v-1);if(F?(C=0,x=D):(x=0,C=D),V||this.addCurrentVertex(p,this.distance,E,x,C,!1),"fakeround"===b){for(var P,M=Math.floor(8*(.5-(T-.5))),q=0;q=0;O--)P=E.mult((O+1)/(M+1))._add(m)._unit(),this.addPieSliceVertex(p,this.distance,P,F)}y&&this.addCurrentVertex(p,this.distance,m,-x,-C,!1)}else"butt"===b?(V||this.addCurrentVertex(p,this.distance,E,0,0,!1),y&&this.addCurrentVertex(p,this.distance,m,0,0,!1)):"square"===b?(V||(this.addCurrentVertex(p,this.distance,E,1,1,!1),this.e1=this.e2=-1),y&&this.addCurrentVertex(p,this.distance,m,-1,-1,!1)):"round"===b&&(V||(this.addCurrentVertex(p,this.distance,E,0,0,!1),this.addCurrentVertex(p,this.distance,E,1,1,!0),this.e1=this.e2=-1),y&&(this.addCurrentVertex(p,this.distance,m,-1,-1,!0),this.addCurrentVertex(p,this.distance,m,0,0,!1)));if(B&&f2*u){var X=p.add(y.sub(p)._mult(u/U)._round());this.distance+=X.dist(p),this.addCurrentVertex(X,this.distance,m.mult(1),0,0,!1),p=X}}V=!1}this.populatePaintArrays("line",{zoom:this.zoom},t,o,c)}}},LineBucket.prototype.addCurrentVertex=function(e,t,i,r,s,a){var n,u=a?1:0,h=this.arrayGroups.line[this.arrayGroups.line.length-1],d=h.layoutVertexArray,l=h.elementArray;n=i.clone(),r&&n._sub(i.perp()._mult(r)),this.e3=this.addLineVertex(d,e,n,u,0,r,t),this.e1>=0&&this.e2>=0&&l.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,n=i.mult(-1),s&&n._sub(i.perp()._mult(s)),this.e3=this.addLineVertex(d,e,n,u,1,-s,t),this.e1>=0&&this.e2>=0&&l.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,t>MAX_LINE_DISTANCE/2&&(this.distance=0,this.addCurrentVertex(e,this.distance,i,r,s,a))},LineBucket.prototype.addPieSliceVertex=function(e,t,i,r){var s=r?1:0;i=i.mult(r?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1],n=a.layoutVertexArray,u=a.elementArray;this.e3=this.addLineVertex(n,e,i,0,s,0,t),this.e1>=0&&this.e2>=0&&u.emplaceBack(this.e1,this.e2,this.e3),r?this.e2=this.e3:this.e1=this.e3}; -},{"../../util/util":136,"../bucket":19,"../load_geometry":27}],23:[function(require,module,exports){ -"use strict";function SymbolBucket(e){Bucket.apply(this,arguments),this.showCollisionBoxes=e.showCollisionBoxes,this.overscaling=e.overscaling,this.collisionBoxArray=e.collisionBoxArray,this.symbolQuadsArray=e.symbolQuadsArray,this.symbolInstancesArray=e.symbolInstancesArray,this.sdfIcons=e.sdfIcons,this.iconsNeedLinear=e.iconsNeedLinear,this.adjustedTextSize=e.adjustedTextSize,this.adjustedIconSize=e.adjustedIconSize,this.fontstack=e.fontstack}function addVertex(e,t,o,a,n,i,s,r,l,y,c){return e.emplaceBack(t,o,Math.round(64*a),Math.round(64*n),i/4,s/4,10*(y||0),c,10*(r||0),10*Math.min(l||25,25))}var Point=require("point-geometry"),Bucket=require("../bucket"),Anchor=require("../../symbol/anchor"),getAnchors=require("../../symbol/get_anchors"),resolveTokens=require("../../util/token"),Quads=require("../../symbol/quads"),Shaping=require("../../symbol/shaping"),resolveText=require("../../symbol/resolve_text"),mergeLines=require("../../symbol/mergelines"),clipLine=require("../../symbol/clip_line"),util=require("../../util/util"),loadGeometry=require("../load_geometry"),CollisionFeature=require("../../symbol/collision_feature"),findPoleOfInaccessibility=require("../../util/find_pole_of_inaccessibility"),classifyRings=require("../../util/classify_rings"),shapeText=Shaping.shapeText,shapeIcon=Shaping.shapeIcon,getGlyphQuads=Quads.getGlyphQuads,getIconQuads=Quads.getIconQuads,EXTENT=Bucket.EXTENT;module.exports=SymbolBucket,SymbolBucket.MAX_QUADS=65535,SymbolBucket.prototype=util.inherit(Bucket,{}),SymbolBucket.prototype.serialize=function(){var e=Bucket.prototype.serialize.apply(this);return e.sdfIcons=this.sdfIcons,e.iconsNeedLinear=this.iconsNeedLinear,e.adjustedTextSize=this.adjustedTextSize,e.adjustedIconSize=this.adjustedIconSize,e.fontstack=this.fontstack,e};var layoutVertexArrayType=new Bucket.VertexArrayType([{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"}]),elementArrayType=new Bucket.ElementArrayType;SymbolBucket.prototype.addCollisionBoxVertex=function(e,t,o,a,n){return e.emplaceBack(t.x,t.y,Math.round(o.x),Math.round(o.y),10*a,10*n)},SymbolBucket.prototype.programInterfaces={glyph:{layoutVertexArrayType:layoutVertexArrayType,elementArrayType:elementArrayType},icon:{layoutVertexArrayType:layoutVertexArrayType,elementArrayType:elementArrayType},collisionBox:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},SymbolBucket.prototype.populateArrays=function(e,t,o){var a={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:a}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:a}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:a}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:a});var n=512*this.overscaling;this.tilePixelRatio=EXTENT/n,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var i=this.layer.layout,s=this.features,r=this.textFeatures,l=.5,y=.5;switch(i["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(i["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":y=1;break;case"top":case"top-right":case"top-left":y=0}for(var c="right"===i["text-justify"]?1:"left"===i["text-justify"]?0:.5,h=24,x=i["text-line-height"]*h,d="line"!==i["symbol-placement"]?i["text-max-width"]*h:0,u=i["text-letter-spacing"]*h,m=[i["text-offset"][0]*h,i["text-offset"][1]*h],p=this.fontstack=i["text-font"].join(","),g=[],b=0;bEXTENT||E.y<0||E.y>EXTENT);if(!x||P){var w=P||b;this.addSymbolInstance(E,k,t,o,this.layer,w,this.symbolInstancesArray.length,this.collisionBoxArray,a.index,this.sourceLayerIndex,this.index,l,d,p,c,u,g,{zoom:this.zoom},a.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 n=a[e],i=n.length-1;i>=0;i--)if(o.dist(n[i])3*Math.PI/2))){var m=d.tl,p=d.tr,g=d.bl,b=d.br,I=d.tex,f=d.anchorPoint,S=Math.max(c+Math.log(d.minScale)/Math.LN2,h),B=Math.min(c+Math.log(d.maxScale)/Math.LN2,25);if(!(B<=S)){S===h&&(S=0);var v=Math.round(d.glyphAngle/(2*Math.PI)*256),A=addVertex(y,f.x,f.y,m.x,m.y,I.x,I.y,S,B,h,v);addVertex(y,f.x,f.y,p.x,p.y,I.x+I.w,I.y,S,B,h,v),addVertex(y,f.x,f.y,g.x,g.y,I.x,I.y+I.h,S,B,h,v),addVertex(y,f.x,f.y,b.x,b.y,I.x+I.w,I.y+I.h,S,B,h,v),l.emplaceBack(A,A+1,A+2),l.emplaceBack(A+1,A+2,A+3)}}}},SymbolBucket.prototype.updateIcons=function(e){this.recalculateStyleLayers();var t=this.layer.layout["icon-image"];if(t)for(var o=0;oSymbolBucket.MAX_QUADS&&util.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),f>SymbolBucket.MAX_QUADS&&util.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),this.symbolInstancesArray.emplaceBack(z,E,P,w,I,f,S,B,e.x,e.y,s)},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)}; -},{"../../symbol/anchor":82,"../../symbol/clip_line":84,"../../symbol/collision_feature":86,"../../symbol/get_anchors":88,"../../symbol/mergelines":91,"../../symbol/quads":92,"../../symbol/resolve_text":93,"../../symbol/shaping":94,"../../util/classify_rings":122,"../../util/find_pole_of_inaccessibility":128,"../../util/token":135,"../../util/util":136,"../bucket":19,"../load_geometry":27,"point-geometry":206}],24:[function(require,module,exports){ -"use strict";function Buffer(t,e,r){this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e}module.exports=Buffer,Buffer.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var AttributeType={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};Buffer.prototype.setVertexAttribPointers=function(t,e){for(var r=0;r0?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;or.max||d.yr.max)&&util.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return u}; -},{"../util/util":136,"./bucket":19}],28:[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}}; -},{}],29:[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){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: , lat: }, or an array of [, ]")}; -},{"../util/util":136}],30:[function(require,module,exports){ -"use strict";function LngLatBounds(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]))}module.exports=LngLatBounds;var LngLat=require("./lng_lat");LngLatBounds.prototype={setNorthEast:function(t){return this._ne=LngLat.convert(t),this},setSouthWest:function(t){return this._sw=LngLat.convert(t),this},extend:function(t){var n,e,s=this._sw,r=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||r?(s.lng=Math.min(n.lng,s.lng),s.lat=Math.min(n.lat,s.lat),r.lng=Math.max(e.lng,r.lng),r.lat=Math.max(e.lat,r.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":29}],31:[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"),util=require("../util/util"),interp=require("../util/interpolate"),TileCoord=require("../source/tile_coord"),EXTENT=require("../data/bucket").EXTENT,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=-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))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var i=util.clamp(t,0,60)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var i=Math.max(.75,t);this._altitude!==i&&(this._unmodified=!1,this._altitude=i,this._calcMatrices())},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._calcMatrices(),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._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var i=this.coveringZoomLevel(t),o=i;if(it.maxzoom&&(i=t.maxzoom);var e=this,n=e.locationCoordinate(e.center)._zoomTo(i),a=new Point(n.column-.5,n.row-.5);return TileCoord.cover(i,[e.pointCoordinate(new Point(0,0))._zoomTo(i),e.pointCoordinate(new Point(e.width,0))._zoomTo(i),e.pointCoordinate(new Point(e.width,e.height))._zoomTo(i),e.pointCoordinate(new Point(0,e.height))._zoomTo(i)],t.reparseOverscaled?o:i).sort(function(t,i){return a.dist(t)-a.dist(i)})},resize:function(t,i){this.width=t,this.height=i,this.pixelsToGLUnits=[2/t,-2/i],this._calcMatrices(),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 o=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-o)*(i||this.worldSize)/360},xLng:function(t,i){return 360*t/(i||this.worldSize)-180},yLat:function(t,i){var o=180-360*t/(i||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90},panBy:function(t){var i=this.centerPoint._add(t);this.center=this.pointLocation(i)},setLocationAtPoint:function(t,i){var o=this.locationCoordinate(t),e=this.pointCoordinate(i),n=this.pointCoordinate(this.centerPoint),a=e._sub(o);this._unmodified=!1,this.center=this.coordinateLocation(n._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,o=LngLat.convert(t);return new Coordinate(this.lngX(o.lng)*i,this.latY(o.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){var i=0,o=[t.x,t.y,0,1],e=[t.x,t.y,1,1];vec4.transformMat4(o,o,this.pixelMatrixInverse),vec4.transformMat4(e,e,this.pixelMatrixInverse);var n=o[3],a=e[3],r=o[0]/n,h=e[0]/a,s=o[1]/n,c=e[1]/a,l=o[2]/n,u=e[2]/a,m=l===u?0:(i-l)/(u-l),d=this.worldSize/this.zoomScale(this.tileZoom);return new Coordinate(interp(r,h,m)/d,interp(s,c,m)/d,this.tileZoom)},coordinatePoint:function(t){var i=this.worldSize/this.zoomScale(t.zoom),o=[t.column*i,t.row*i,0,1];return vec4.transformMat4(o,o,this.pixelMatrix),new Point(o[0]/o[3],o[1]/o[3])},calculatePosMatrix:function(t,i){void 0===i&&(i=1/0),t instanceof TileCoord&&(t=t.toCoordinate(i));var o=Math.min(t.zoom,i),e=this.worldSize/Math.pow(2,o),n=new Float64Array(16);return mat4.identity(n),mat4.translate(n,n,[t.column*e,t.row*e,0]),mat4.scale(n,n,[e/EXTENT,e/EXTENT,1]),mat4.multiply(n,this.projMatrix,n),new Float32Array(n)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,i,o,e,n,a,r,h,s=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),i=this.latY(this.latRange[0]),n=i-ti&&(h=i-m)}if(this.lngRange){var d=this.x,g=s.x/2;d-ge&&(r=e-g)}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}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),i=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),o=Math.cos(Math.PI/2-this._pitch)*i+this.altitude,e=new Float64Array(16);if(mat4.perspective(e,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,o),mat4.translate(e,e,[0,0,-this.altitude]),mat4.scale(e,e,[1,-1,1/this.height]),mat4.rotateX(e,e,this._pitch),mat4.rotateZ(e,e,this.angle),mat4.translate(e,e,[-this.x,-this.y,0]),this.projMatrix=e,e=mat4.create(),mat4.scale(e,e,[this.width/2,-this.height/2,1]),mat4.translate(e,e,[1,-1,0]),this.pixelMatrix=mat4.multiply(new Float64Array(16),e,this.projMatrix),e=mat4.invert(new Float64Array(16),this.pixelMatrix),!e)throw new Error("failed to invert matrix");this.pixelMatrixInverse=e}}}; -},{"../data/bucket":19,"../source/tile_coord":60,"../util/interpolate":130,"../util/util":136,"./coordinate":28,"./lng_lat":29,"gl-matrix":164,"point-geometry":206}],32:[function(require,module,exports){ -"use strict";var WorkerPool=require("./util/worker_pool"),globalWorkerPool;module.exports=function(){return globalWorkerPool||(globalWorkerPool=new WorkerPool),globalWorkerPool}; -},{"./util/worker_pool":138}],33:[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;r>16,v>>16),o.uniform2f(i.u_pixel_coord_lower,65535&g,65535&v)}o.uniformMatrix4fv(i.u_matrix,!1,r.transform.calculatePosMatrix(p)),o.drawArrays(o.TRIANGLE_STRIP,0,r.tileExtentBuffer.length)}o.stencilMask(0),o.stencilFunc(o.EQUAL,128,128)}var pixelsToTileUnits=require("../source/pixels_to_tile_units"),createUniformPragmas=require("./create_uniform_pragmas"),tileSize=512;module.exports=drawBackground; -},{"../source/pixels_to_tile_units":54,"./create_uniform_pragmas":35}],37:[function(require,module,exports){ -"use strict";function drawCircles(e,r,t,i){if(!e.isOpaquePass){var a=e.gl;e.setDepthSublayer(0),e.depthMask(!1),a.disable(a.STENCIL_TEST);for(var s=0;s>16,p>>16),n.uniform2f(l.u_pixel_coord_lower,65535&s,65535&p),n.activeTexture(n.TEXTURE0),a.spriteAtlas.bind(n,!0)}}var pixelsToTileUnits=require("../source/pixels_to_tile_units");module.exports=draw; -},{"../source/pixels_to_tile_units":54}],41:[function(require,module,exports){ -"use strict";function drawLineTile(i,t,e,a){var r=t.getTile(a),n=r.getBucket(e);if(n){var f=n.bufferGroups.line;if(f){var o=i.gl,u=n.paintAttributes.line[e.id],l=1/browser.devicePixelRatio,s=e.paint["line-blur"]+l,m=e.paint["line-color"],_=i.transform,p=mat2.create();mat2.scale(p,p,[1,Math.cos(_._pitch)]),mat2.rotate(p,p,i.transform.angle);var g,h,d,v,x,c=Math.sqrt(_.height*_.height/4*(1+_.altitude*_.altitude)),T=_.height/2*Math.tan(_._pitch),b=(c+T)/c-1,w=e.paint["line-dasharray"],y=e.paint["line-pattern"];if(w)g=i.useProgram("linesdfpattern",u.defines,u.vertexPragmas,u.fragmentPragmas),o.uniform1f(g.u_linewidth,e.paint["line-width"]/2),o.uniform1f(g.u_gapwidth,e.paint["line-gap-width"]/2),o.uniform1f(g.u_antialiasing,l/2),o.uniform1f(g.u_blur,s),o.uniform4fv(g.u_color,m),o.uniform1f(g.u_opacity,e.paint["line-opacity"]),h=i.lineAtlas.getDash(w.from,"round"===e.layout["line-cap"]),d=i.lineAtlas.getDash(w.to,"round"===e.layout["line-cap"]),o.uniform1i(g.u_image,0),o.activeTexture(o.TEXTURE0),i.lineAtlas.bind(o),o.uniform1f(g.u_tex_y_a,h.y),o.uniform1f(g.u_tex_y_b,d.y),o.uniform1f(g.u_mix,w.t),o.uniform1f(g.u_extra,b),o.uniform1f(g.u_offset,-e.paint["line-offset"]),o.uniformMatrix2fv(g.u_antialiasingmatrix,!1,p);else if(y){if(v=i.spriteAtlas.getPosition(y.from,!0),x=i.spriteAtlas.getPosition(y.to,!0),!v||!x)return;g=i.useProgram("linepattern",u.defines,u.vertexPragmas,u.fragmentPragmas),o.uniform1i(g.u_image,0),o.activeTexture(o.TEXTURE0),i.spriteAtlas.bind(o,!0),o.uniform1f(g.u_linewidth,e.paint["line-width"]/2),o.uniform1f(g.u_gapwidth,e.paint["line-gap-width"]/2),o.uniform1f(g.u_antialiasing,l/2),o.uniform1f(g.u_blur,s),o.uniform2fv(g.u_pattern_tl_a,v.tl),o.uniform2fv(g.u_pattern_br_a,v.br),o.uniform2fv(g.u_pattern_tl_b,x.tl),o.uniform2fv(g.u_pattern_br_b,x.br),o.uniform1f(g.u_fade,y.t),o.uniform1f(g.u_opacity,e.paint["line-opacity"]),o.uniform1f(g.u_extra,b),o.uniform1f(g.u_offset,-e.paint["line-offset"]),o.uniformMatrix2fv(g.u_antialiasingmatrix,!1,p)}else g=i.useProgram("line",u.defines,u.vertexPragmas,u.fragmentPragmas),o.uniform1f(g.u_linewidth,e.paint["line-width"]/2),o.uniform1f(g.u_gapwidth,e.paint["line-gap-width"]/2),o.uniform1f(g.u_antialiasing,l/2),o.uniform1f(g.u_blur,s),o.uniform1f(g.u_extra,b),o.uniform1f(g.u_offset,-e.paint["line-offset"]),o.uniformMatrix2fv(g.u_antialiasingmatrix,!1,p),o.uniform4fv(g.u_color,m),o.uniform1f(g.u_opacity,e.paint["line-opacity"]);i.enableTileClippingMask(a);var P=i.translatePosMatrix(a.posMatrix,r,e.paint["line-translate"],e.paint["line-translate-anchor"]);o.uniformMatrix4fv(g.u_matrix,!1,P);var M=1/pixelsToTileUnits(r,1,i.transform.zoom);if(w){var S=h.width*w.fromScale,U=d.width*w.toScale,z=[1/pixelsToTileUnits(r,S,i.transform.tileZoom),-h.height/2],A=[1/pixelsToTileUnits(r,U,i.transform.tileZoom),-d.height/2],E=i.lineAtlas.width/(256*Math.min(S,U)*browser.devicePixelRatio)/2;o.uniform1f(g.u_ratio,M),o.uniform2fv(g.u_patternscale_a,z),o.uniform2fv(g.u_patternscale_b,A),o.uniform1f(g.u_sdfgamma,E)}else y?(o.uniform1f(g.u_ratio,M),o.uniform2fv(g.u_pattern_size_a,[pixelsToTileUnits(r,v.size[0]*y.fromScale,i.transform.tileZoom),x.size[1]]),o.uniform2fv(g.u_pattern_size_b,[pixelsToTileUnits(r,x.size[0]*y.toScale,i.transform.tileZoom),x.size[1]])):o.uniform1f(g.u_ratio,M);n.setUniforms(o,"line",g,e,{zoom:i.transform.zoom});for(var R=0;R0?1/(1-r):1+r}function saturationFactor(r){return r>0?1-1/(1.001-r):-r}function getOpacities(r,t,e,a){var o=[1,0],i=e.paint["raster-fade-duration"];if(r.sourceCache&&i>0){var n=(new Date).getTime(),u=(n-r.timeAdded)/i,s=t?(n-t.timeAdded)/i:-1,c=a.coveringZoomLevel({tileSize:r.sourceCache.getSource().tileSize,roundZoom:r.sourceCache.getSource().roundZoom}),f=!!t&&Math.abs(t.coord.z-c)>Math.abs(r.coord.z-c);!t||f?(o[0]=util.clamp(u,0,1),o[1]=1-o[0]):(o[0]=util.clamp(1-s,0,1),o[1]=1-o[0])}var d=e.paint["raster-opacity"];return o[0]*=d,o[1]*=d,o}var util=require("../util/util"),StructArrayType=require("../util/struct_array");module.exports=drawRaster,drawRaster.RasterBoundsArray=new StructArrayType({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]}); -},{"../util/struct_array":134,"../util/util":136}],43:[function(require,module,exports){ -"use strict";function drawSymbols(t,e,i,o){if(!t.isOpaquePass){var a=!(i.layout["text-allow-overlap"]||i.layout["icon-allow-overlap"]||i.layout["text-ignore-placement"]||i.layout["icon-ignore-placement"]),r=t.gl;a?r.disable(r.STENCIL_TEST):r.enable(r.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),r.disable(r.DEPTH_TEST),drawLayerSymbols(t,e,i,o,!1,i.paint["icon-translate"],i.paint["icon-translate-anchor"],i.layout["icon-rotation-alignment"],i.layout["icon-rotation-alignment"],i.layout["icon-size"],i.paint["icon-halo-width"],i.paint["icon-halo-color"],i.paint["icon-halo-blur"],i.paint["icon-opacity"],i.paint["icon-color"]),drawLayerSymbols(t,e,i,o,!0,i.paint["text-translate"],i.paint["text-translate-anchor"],i.layout["text-rotation-alignment"],i.layout["text-pitch-alignment"],i.layout["text-size"],i.paint["text-halo-width"],i.paint["text-halo-color"],i.paint["text-halo-blur"],i.paint["text-opacity"],i.paint["text-color"]),r.enable(r.DEPTH_TEST),e.map.showCollisionBoxes&&drawCollisionDebug(t,e,i,o)}}function drawLayerSymbols(t,e,i,o,a,r,n,l,u,s,f,m,p,c,d){for(var h=0;hthis.previousZoom;e--)this.changeTimes[e]=i,this.changeOpacities[e]=this.opacities[e];for(e=0;e<256;e++){var s=i-this.changeTimes[e],r=s/this.fadeDuration*255;e<=t?this.opacities[e]=this.changeOpacities[e]+r:this.opacities[e]=this.changeOpacities[e]-r}this.changed=!0,this.previousZoom=t},FrameHistory.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}; -},{}],45:[function(require,module,exports){ -"use strict";function LineAtlas(t,i){this.width=t,this.height=i,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var util=require("../util/util");module.exports=LineAtlas,LineAtlas.prototype.setSprite=function(t){this.sprite=t},LineAtlas.prototype.getDash=function(t,i){var e=t.join(",")+i;return this.positions[e]||(this.positions[e]=this.addDash(t,i)),this.positions[e]},LineAtlas.prototype.addDash=function(t,i){var e=i?7:0,h=2*e+1,s=128;if(this.nextRow+h>this.height)return util.warnOnce("LineAtlas out of space"),null;for(var a=0,r=0;r0?r.pop():null},Painter.prototype.lineWidth=function(e){this.gl.lineWidth(util.clamp(e,this.lineWidthRange[0],this.lineWidthRange[1]))},Painter.prototype.showOverdrawInspector=function(e){if(e||this._showOverdrawInspector){this._showOverdrawInspector=e;var r=this.gl;if(e){r.blendFunc(r.CONSTANT_COLOR,r.ONE);var t=8,i=1/t;r.blendColor(i,i,i,0),r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)}else r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA)}}; -},{"../data/bucket":19,"../data/buffer":24,"../source/pixels_to_tile_units":54,"../source/source_cache":58,"../util/browser":119,"../util/struct_array":134,"../util/util":136,"./create_uniform_pragmas":35,"./draw_background":36,"./draw_circle":37,"./draw_debug":39,"./draw_fill":40,"./draw_line":41,"./draw_raster":42,"./draw_symbol":43,"./frame_history":44,"./painter/use_program":47,"./vertex_array_object":48,"gl-matrix":164}],47:[function(require,module,exports){ -"use strict";function applyPragmas(r,e){return r.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(r,a,t,i,o){return e[a][o].replace(/{type}/g,i).replace(/{precision}/g,t)})}var util=require("../../util/util"),shaders=require("mapbox-gl-shaders"),utilSource=shaders.util;module.exports._createProgram=function(r,e,a,t){for(var i=this.gl,o=i.createProgram(),c=shaders[r],n="#define MAPBOX_GL_JS;\n",s=0;sthis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,o={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:i,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",o,function(i,o){if(t.unloadVectorData(this.map.painter),!t.aborted)return i?e(i):(t.loadVectorData(o,this.map.painter),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}}); -},{"../data/bucket":19,"../util/evented":127,"../util/util":136,"../util/window":121}],50:[function(require,module,exports){ -"use strict";function GeoJSONWorkerSource(e,r,t){t&&(this.loadGeoJSON=t),VectorTileWorkerSource.call(this,e,r)}var util=require("../util/util"),ajax=require("../util/ajax"),rewind=require("geojson-rewind"),GeoJSONWrapper=require("./geojson_wrapper"),vtpbf=require("vt-pbf"),supercluster=require("supercluster"),geojsonvt=require("geojson-vt"),VectorTileWorkerSource=require("./vector_tile_worker_source");module.exports=GeoJSONWorkerSource,GeoJSONWorkerSource.prototype=util.inherit(VectorTileWorkerSource,{_geoJSONIndexes:{},loadVectorData:function(e,r){var t=e.source,o=e.coord;if(!this._geoJSONIndexes[t])return r(null,null);var n=this._geoJSONIndexes[t].getTile(Math.min(o.z,e.maxZoom),o.x,o.y);if(!n)return r(null,null);var u=new GeoJSONWrapper(n.features);u.name="_geojsonTileLayer";var i=vtpbf({layers:{_geojsonTileLayer:u}});0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),u.rawData=i.buffer,r(null,u)},loadData:function(e,r){var t=function(t,o){return t?r(t):"object"!=typeof o?r(new Error("Input data is not a valid GeoJSON object.")):(rewind(o,!0),void this._indexData(o,e,function(t,o){return t?r(t):(this._geoJSONIndexes[e.source]=o,void r(null))}.bind(this)))}.bind(this);this.loadGeoJSON(e,t)},loadGeoJSON:function(e,r){if(e.url)ajax.getJSON(e.url,r);else{if("string"!=typeof e.data)return r(new Error("Input data is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(e){return r(new Error("Input data is not a valid GeoJSON object."))}}},_indexData:function(e,r,t){try{r.cluster?t(null,supercluster(r.superclusterOptions).load(e.features)):t(null,geojsonvt(e,r.geojsonVtOptions))}catch(e){return t(e)}}}); -},{"../util/ajax":118,"../util/util":136,"./geojson_wrapper":51,"./vector_tile_worker_source":62,"geojson-rewind":153,"geojson-vt":159,"supercluster":209,"vt-pbf":220}],51:[function(require,module,exports){ -"use strict";function GeoJSONWrapper(e){this.features=e,this.length=e.length,this.extent=EXTENT}function FeatureWrapper(e){if(this.type=e.type,1===e.type){this.rawGeometry=[];for(var t=0;ti)){var a=Math.pow(2,Math.min(s.coord.z,this._source.maxzoom)-Math.min(e.z,this._source.maxzoom));if(Math.floor(s.coord.x/a)===e.x&&Math.floor(s.coord.y/a)===e.y)for(t[r]=!0,o=!0;s&&s.coord.z-1>e.z;){var n=s.coord.parent(this._source.maxzoom).id;s=this._tiles[n],s&&s.hasData()&&(delete t[r],t[n]=!0)}}}return o},findLoadedParent:function(e,i,t){for(var o=e.z-1;o>=i;o--){e=e.parent(this._source.maxzoom);var r=this._tiles[e.id];if(r&&r.hasData())return t[e.id]=!0,r;if(this._cache.has(e.id))return this.addTile(e),t[e.id]=!0,this._tiles[e.id]}},updateCacheSize:function(e){var i=Math.ceil(e.width/e.tileSize)+1,t=Math.ceil(e.height/e.tileSize)+1,o=i*t,r=5;this._cache.setMaxSize(Math.floor(o*r))},update:function(e,i){if(this._sourceLoaded){var t,o,r;this.updateCacheSize(e);var s=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),a=Math.max(s-SourceCache.maxOverzooming,this._source.minzoom),n=Math.max(s+SourceCache.maxUnderzooming,this._source.minzoom),h={},d=(new Date).getTime();this._coveredTiles={};var c;for(c=this.used?this._source.coord?[this._source.coord]:e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}):[],t=0;td-(i||0)&&(this.findLoadedChildren(o,n,h)&&(h[_]=!0),this.findLoadedParent(o,a,u))}var f;for(f in u)h[f]||(this._coveredTiles[f]=!0);for(f in u)h[f]=!0;var T=util.keysDifference(this._tiles,h);for(t=0;tthis._source.maxzoom?Math.pow(2,o-this._source.maxzoom):1;i=new Tile(t,this._source.tileSize*r,this._source.maxzoom),this.loadTile(i,this._tileLoaded.bind(this,i))}return i.uses++,this._tiles[e.id]=i,this._source.fire("dataloading",{tile:i,dataType:"tile"}),i},removeTile:function(e){var i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._source.fire("data",{dataType:"tile"}),i.uses>0||(i.hasData()?this._cache.add(i.coord.wrapped().id,i):(i.aborted=!0,this.abortTile(i),this.unloadTile(i))))},clearTiles:function(){for(var e in this._tiles)this.removeTile(e);this._cache.reset()},tilesIn:function(e){for(var i={},t=this.getIds(),o=1/0,r=1/0,s=-(1/0),a=-(1/0),n=e[0].zoom,h=0;h=0&&m[1].y>=0){for(var _=[],f=0;f0;n--)r=1<i.row){var o=t;t=i,i=o}return{x0:t.column,y0:t.row,x1:i.column,y1:i.row,dx:i.column-t.column,dy:i.row-t.row}}function scanSpans(t,i,o,r,e){var n=Math.max(o,Math.floor(i.y0)),h=Math.min(r,Math.ceil(i.y1));if(t.x0===i.x0&&t.y0===i.y0?t.x0+i.dy/t.dy*t.dx0,l=i.dx<0,u=n;ua.dy&&(h=s,s=a,a=h),s.dy>d.dy&&(h=s,s=d,d=h),a.dy>d.dy&&(h=a,a=d,d=h),s.dy&&scanSpans(d,s,r,e,n),a.dy&&scanSpans(d,a,r,e,n)}var WhooTS=require("whoots-js"),Coordinate=require("../geo/coordinate");module.exports=TileCoord,TileCoord.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},TileCoord.prototype.toCoordinate=function(t){var i=Math.min(this.z,t),o=Math.pow(2,i),r=this.y,e=this.x+o*this.w;return new Coordinate(e,r,i)},TileCoord.fromID=function(t){var i=t%32,o=1<t?new TileCoord(this.z-1,this.x,this.y,this.w):new TileCoord(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},TileCoord.prototype.wrapped=function(){return new TileCoord(this.z,this.x,this.y,0)},TileCoord.prototype.children=function(t){if(this.z>=t)return[new TileCoord(this.z+1,this.x,this.y,this.w)];var i=this.z+1,o=2*this.x,r=2*this.y;return[new TileCoord(i,o,r,this.w),new TileCoord(i,o+1,r,this.w),new TileCoord(i,o,r+1,this.w),new TileCoord(i,o+1,r+1,this.w)]},TileCoord.cover=function(t,i,o){function r(t,i,r){var h,s,a;if(r>=0&&r<=e)for(h=t;hthis.maxzoom?Math.pow(2,e.coord.z-this.maxzoom):1,r={url:normalizeURL(e.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:e.uid,coord:e.coord,zoom:e.coord.z,tileSize:this.tileSize*o,source:this.id,overscaling:o,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};e.workerID?"loading"===e.state?e.reloadCallback=i:this.dispatcher.send("reload tile",r,t.bind(this),e.workerID):e.workerID=this.dispatcher.send("load tile",r,t.bind(this))},abortTile:function(e){this.dispatcher.send("abort tile",{uid:e.uid,source:this.id},null,e.workerID)},unloadTile:function(e){e.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:e.uid,source:this.id},null,e.workerID)}}); -},{"../util/evented":127,"../util/mapbox":133,"../util/util":136,"./load_tilejson":53}],62:[function(require,module,exports){ -"use strict";function VectorTileWorkerSource(e,r,t){this.actor=e,this.styleLayers=r,t&&(this.loadVectorData=t),this.loading={},this.loaded={}}var ajax=require("../util/ajax"),vt=require("vector-tile"),Protobuf=require("pbf"),WorkerTile=require("./worker_tile"),util=require("../util/util");module.exports=VectorTileWorkerSource,VectorTileWorkerSource.prototype={loadTile:function(e,r){function t(e,t){return delete this.loading[i][o],e?r(e):t?(a.vectorTile=t,a.parse(t,this.styleLayers.getLayerFamilies(),this.actor,function(e,i,o){return e?r(e):void r(null,util.extend({rawTileData:t.rawData},i),o)}),this.loaded[i]=this.loaded[i]||{},void(this.loaded[i][o]=a)):r(null,null)}var i=e.source,o=e.uid;this.loading[i]||(this.loading[i]={});var a=this.loading[i][o]=new WorkerTile(e);a.abort=this.loadVectorData(e,t.bind(this))},reloadTile:function(e,r){var t=this.loaded[e.source],i=e.uid;if(t&&t[i]){var o=t[i];o.parse(o.vectorTile,this.styleLayers.getLayerFamilies(),this.actor,r)}},abortTile:function(e){var r=this.loading[e.source],t=e.uid;r&&r[t]&&r[t].abort&&(r[t].abort(),delete r[t])},removeTile:function(e){var r=this.loaded[e.source],t=e.uid;r&&r[t]&&delete r[t]},loadVectorData:function(e,r){function t(e,t){if(e)return r(e);var i=new vt.VectorTile(new Protobuf(t));i.rawData=t,r(e,i)}var i=ajax.getArrayBuffer(e.url,t.bind(this));return function(){i.abort()}},redoPlacement:function(e,r){var t=this.loaded[e.source],i=this.loading[e.source],o=e.uid;if(t&&t[o]){var a=t[o],l=a.redoPlacement(e.angle,e.pitch,e.showCollisionBoxes);l.result&&r(null,l.result,l.transferables)}else i&&i[o]&&(i[o].angle=e.angle)}}; -},{"../util/ajax":118,"../util/util":136,"./worker_tile":65,"pbf":204,"vector-tile":216}],63:[function(require,module,exports){ -"use strict";function VideoSource(e,t){this.id=e,this.urls=t.urls,this.coordinates=t.coordinates,ajax.getVideo(t.urls,function(e,i){if(e)return this.fire("error",{error:e});this.video=i,this.video.loop=!0;var r;this.video.addEventListener("playing",function(){r=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(r)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(t.coordinates)),this.fire("data",{dataType:"source"}),this.fire("source.load")}.bind(this))}var util=require("../util/util"),TileCoord=require("./tile_coord"),LngLat=require("../geo/lng_lat"),Point=require("point-geometry"),Evented=require("../util/evented"),ajax=require("../util/ajax"),EXTENT=require("../data/bucket").EXTENT,RasterBoundsArray=require("../render/draw_raster").RasterBoundsArray,Buffer=require("../data/buffer"),VertexArrayObject=require("../render/vertex_array_object");module.exports=VideoSource,VideoSource.prototype=util.inherit(Evented,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(e){this.map||(this.map=e,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(e){this.coordinates=e;var t=this.map,i=e.map(function(e){return t.transform.locationCoordinate(LngLat.convert(e)).zoomTo(0)}),r=this.centerCoord=util.getCoordinatesCenter(i);return r.column=Math.round(r.column),r.row=Math.round(r.row),this.minzoom=this.maxzoom=r.zoom,this.coord=new TileCoord(r.zoom,r.column,r.row),this._tileCoords=i.map(function(e){var t=e.zoomTo(r.zoom);return new Point(Math.round((t.column-r.column)*EXTENT),Math.round((t.row-r.row)*EXTENT))}),this.fire("data",{dataType:"source"}),this},_setTile:function(e){this._prepared=!1,this.tile=e;var t=32767,i=new RasterBoundsArray;i.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),i.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,t,0),i.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,t),i.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,t,t),this.tile.buckets={},this.tile.boundsBuffer=new Buffer(i.serialize(),RasterBoundsArray.serialize(),Buffer.BufferType.VERTEX),this.tile.boundsVAO=new VertexArrayObject,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var e=this.map.painter.gl;this._prepared?(e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(e,t){this.coord&&this.coord.toString()===e.coord.toString()?(this._setTile(e),t(null)):(e.state="errored",t(null))},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}}); -},{"../data/bucket":19,"../data/buffer":24,"../geo/lng_lat":29,"../render/draw_raster":42,"../render/vertex_array_object":48,"../util/ajax":118,"../util/evented":127,"../util/util":136,"./tile_coord":60,"point-geometry":206}],64:[function(require,module,exports){ -"use strict";function Worker(e){this.self=e,this.actor=new Actor(e,this),this.layers={},this.layerFamilies={},this.workerSourceTypes={vector:VectorTileWorkerSource,geojson:GeoJSONWorkerSource},this.workerSources={},this.self.registerWorkerSource=function(e,r){if(this.workerSourceTypes[e])throw new Error('Worker source with name "'+e+'" already registered.');this.workerSourceTypes[e]=r}.bind(this)}function createLayerFamilies(e){var r={};for(var t in e){var i=e[t],o=i.ref||i.id,s=e[o];s.layout&&"none"===s.layout.visibility||(r[o]=r[o]||[],t===o?r[o].unshift(i):r[o].push(i))}return r}var Actor=require("../util/actor"),StyleLayer=require("../style/style_layer"),util=require("../util/util"),VectorTileWorkerSource=require("./vector_tile_worker_source"),GeoJSONWorkerSource=require("./geojson_worker_source"),featureFilter=require("feature-filter");module.exports=function(e){return new Worker(e)},util.extend(Worker.prototype,{"set layers":function(e,r){function t(e){var r=StyleLayer.create(e,e.ref&&i[e.ref]);r.updatePaintTransitions({},{transition:!1}),r.filter=featureFilter(r.filter),i[r.id]=r}for(var i=this.layers[e]={},o=[],s=0;s=0;r--)a(m,A[r]);n()}}function a(e,r){if(r.populateArrays(h,I,z),"symbol"!==r.type)for(var s=0;s=u.maxzoom||u.layout&&"none"===u.layout.visibility||e.layers&&!e.layers[u.sourceLayer]||(y=Bucket.create({layer:u,index:p++,childLayers:r[v],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:f.encode(u.sourceLayer||"_geojsonTileLayer")}),b[u.id]=y,e.layers&&(c=u.sourceLayer,g[c]=g[c]||{},g[c][u.id]=y)));if(e.layers)for(c in g)1===u.version&&util.warnOnce('Vector tile source "'+this.source+'" layer "'+c+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),u=e.layers[c],u&&o(u,g[c]);else o(e,b);var x=[],A=this.symbolBuckets=[],k=[];d.bucketLayerIDs={};for(var B in b)y=b[B],0!==y.features.length&&(d.bucketLayerIDs[y.index]=y.childLayers.map(getLayerId),x.push(y),"symbol"===y.type?A.push(y):k.push(y));var z={},I={},T=0;if(A.length>0){for(l=A.length-1;l>=0;l--)A[l].updateIcons(z),A[l].updateFont(I);for(var L in I)I[L]=Object.keys(I[L]).map(Number);z=Object.keys(z),s.send("get glyphs",{uid:this.uid,stacks:I},function(e,r){I=r,t(e)}),z.length?s.send("get icons",{icons:z},function(e,r){z=r,t(e)}):t()}for(l=k.length-1;l>=0;l--)a(this,k[l]);if(0===A.length)return n()},WorkerTile.prototype.redoPlacement=function(e,r,s){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=e,{};for(var i=new CollisionTile(e,r,this.collisionBoxArray),o=this.symbolBuckets,t=o.length-1;t>=0;t--)o[t].placeFeatures(i,s);var a=i.serialize(),n=o.filter(isBucketNonEmpty);return{result:{buckets:n.map(serializeBucket),collisionTile:a.data},transferables:getTransferables(n).concat(a.transferables)}}; -},{"../data/bucket":19,"../data/feature_index":26,"../symbol/collision_box":85,"../symbol/collision_tile":87,"../symbol/symbol_instances":96,"../symbol/symbol_quads":97,"../util/dictionary_coder":124,"../util/util":136}],66:[function(require,module,exports){ -"use strict";function AnimationLoop(){this.n=0,this.times=[]}module.exports=AnimationLoop,AnimationLoop.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},AnimationLoop.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},AnimationLoop.prototype.cancel=function(t){this.times=this.times.filter(function(i){return i.id!==t})}; -},{}],67:[function(require,module,exports){ -"use strict";function ImageSprite(t){this.base=t,this.retina=browser.devicePixelRatio>1;var i=this.retina?"@2x":"";ajax.getJSON(normalizeURL(t,i,".json"),function(t,i){return t?void this.fire("error",{error:t}):(this.data=i,void(this.img&&this.fire("data",{dataType:"style"})))}.bind(this)),ajax.getImage(normalizeURL(t,i,".png"),function(t,i){if(t)return void this.fire("error",{error:t});for(var e=i.getData(),r=i.data=new Uint8Array(e.length),a=0;a1!==this.retina){var t=new ImageSprite(this.base);t.on("data",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},SpritePosition.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},ImageSprite.prototype.getSpritePosition=function(t){if(!this.loaded())return new SpritePosition;var i=this.data&&this.data[t];return i&&this.img?i:new SpritePosition}; -},{"../util/ajax":118,"../util/browser":119,"../util/evented":127,"../util/mapbox":133}],68:[function(require,module,exports){ -"use strict";var parseColorString=require("csscolorparser").parseCSSColor,util=require("../util/util"),StyleFunction=require("./style_function"),cache={};module.exports=function r(e){if(StyleFunction.isFunctionDefinition(e))return util.extend({},e,{stops:e.stops.map(function(e){return[e[0],r(e[1])]})});if("string"==typeof e){if(!cache[e]){var t=parseColorString(e);if(!t)throw new Error("Invalid color "+e);cache[e]=[t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]]}return cache[e]}throw new Error("Invalid color "+e)}; -},{"../util/util":136,"./style_function":71,"csscolorparser":150}],69:[function(require,module,exports){ -"use strict";function Style(e,t,r){this.map=t,this.animationLoop=t&&t.animationLoop||new AnimationLoop,this.dispatcher=new Dispatcher(getWorkerPool(),this),this.spriteAtlas=new SpriteAtlas(1024,1024),this.lineAtlas=new LineAtlas(256,512),this._layers={},this._order=[],this._groups=[],this.sourceCaches={},this.zoomHistory={},util.bindAll(["_redoPlacement"],this),this._resetUpdates(),r=util.extend({validate:"string"!=typeof e||!mapbox.isMapboxURL(e)},r);var s=function(e,t){if(e)return void this.fire("error",{error:e});if(!r.validate||!validateStyle.emitErrors(this,validateStyle(t))){this._loaded=!0,this.stylesheet=t,this.updateClasses();for(var s in t.sources)this.addSource(s,t.sources[s],r);t.sprite&&(this.sprite=new ImageSprite(t.sprite),this.sprite.setEventedParent(this)),this.glyphSource=new GlyphSource(t.glyphs),this._resolve(),this.fire("data",{dataType:"style"}),this.fire("style.load")}}.bind(this);"string"==typeof e?ajax.getJSON(mapbox.normalizeStyleURL(e),s):browser.frame(s.bind(this,null,e)),this.on("source.load",function(e){var t=e.source;if(t&&t.vectorLayerIds)for(var r in this._layers){var s=this._layers[r];s.source===t.id&&this._validateLayer(s)}})}var Evented=require("../util/evented"),StyleLayer=require("./style_layer"),ImageSprite=require("./image_sprite"),GlyphSource=require("../symbol/glyph_source"),SpriteAtlas=require("../symbol/sprite_atlas"),LineAtlas=require("../render/line_atlas"),util=require("../util/util"),ajax=require("../util/ajax"),mapbox=require("../util/mapbox"),browser=require("../util/browser"),Dispatcher=require("../util/dispatcher"),AnimationLoop=require("./animation_loop"),validateStyle=require("./validate_style"),Source=require("../source/source"),QueryFeatures=require("../source/query_features"),SourceCache=require("../source/source_cache"),styleSpec=require("./style_spec"),StyleFunction=require("./style_function"),getWorkerPool=require("../global_worker_pool");module.exports=Style,Style.prototype=util.inherit(Evented,{_loaded:!1,_validateLayer:function(e){var t=this.sourceCaches[e.source];if(e.sourceLayer&&t){var r=t.getSource();r.vectorLayerIds&&r.vectorLayerIds.indexOf(e.sourceLayer)===-1&&this.fire("error",{error:new Error('Source layer "'+e.sourceLayer+'" does not exist on source "'+r.id+'" as specified by style layer "'+e.id+'"')})}},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!(this.sprite&&!this.sprite.loaded())},_resolve:function(){var e,t;this._layers={},this._order=this.stylesheet.layers.map(function(e){return e.id});for(var r=0;rMath.floor(e)&&(t.lastIntegerZoom=Math.floor(e+1),t.lastIntegerZoomTime=Date.now()),t.lastZoom=e},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(e,t){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var r=Object.keys(this._updates.layers);r.length&&this._updateWorkerLayers(r)}var s,i=Object.keys(this._updates.sources);for(s=0;s=0;return i&&this._validate(validateStyle.source,"sources."+e,t,null,r)?this:(t=new SourceCache(e,t,this.dispatcher),this.sourceCaches[e]=t,t.style=this,t.setEventedParent(this,{source:t.getSource()}),t.onAdd&&t.onAdd(this.map),this._updates.changed=!0,this)},removeSource:function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");var t=this.sourceCaches[e];return delete this.sourceCaches[e],delete this._updates.sources[e],t.setEventedParent(null),t.onRemove&&t.onRemove(this.map),this._updates.changed=!0,this},getSource:function(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()},addLayer:function(e,t,r){if(this._checkLoaded(),!(e instanceof StyleLayer)){if(this._validate(validateStyle.layer,"layers."+e.id,e,{arrayIndex:-1},r))return this;var s=e.ref&&this.getLayer(e.ref);e=StyleLayer.create(e,s)}return this._validateLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._order.splice(t?this._order.indexOf(t):1/0,0,e.id),this._updates.allLayers=!0,e.source&&(this._updates.sources[e.source]=!0),this.updateClasses(e.id)},removeLayer:function(e){this._checkLoaded();var t=this._layers[e];if(void 0===t)throw new Error("There is no layer with this ID");for(var r in this._layers)this._layers[r].ref===e&&this.removeLayer(r);return t.setEventedParent(null),delete this._layers[e],delete this._updates.layers[e],delete this._updates.paintProps[e],this._order.splice(this._order.indexOf(e),1),this._updates.allLayers=!0,this._updates.changed=!0,this},getLayer:function(e){return this._layers[e]},getReferentLayer:function(e){var t=this.getLayer(e);return t.ref&&(t=this.getLayer(t.ref)),t},setLayerZoomRange:function(e,t,r){this._checkLoaded();var s=this.getReferentLayer(e);return s.minzoom===t&&s.maxzoom===r?this:(null!=t&&(s.minzoom=t),null!=r&&(s.maxzoom=r),this._updateLayer(s))},setFilter:function(e,t){this._checkLoaded();var r=this.getReferentLayer(e);return null!==t&&this._validate(validateStyle.filter,"layers."+r.id+".filter",t)?this:util.deepEqual(r.filter,t)?this:(r.filter=util.clone(t),this._updateLayer(r))},getFilter:function(e){return util.clone(this.getReferentLayer(e).filter)},setLayoutProperty:function(e,t,r){this._checkLoaded();var s=this.getReferentLayer(e);return util.deepEqual(s.getLayoutProperty(t),r)?this:(s.setLayoutProperty(t,r),this._updateLayer(s))},getLayoutProperty:function(e,t){return this.getReferentLayer(e).getLayoutProperty(t)},setPaintProperty:function(e,t,r,s){this._checkLoaded();var i=this.getLayer(e);if(util.deepEqual(i.getPaintProperty(t,s),r))return this;var a=i.isPaintValueFeatureConstant(t);i.setPaintProperty(t,r,s);var o=!(r&&StyleFunction.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property);return o&&a||(this._updates.layers[e]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(e,t)},getPaintProperty:function(e,t,r){return this.getLayer(e).getPaintProperty(t,r)},updateClasses:function(e,t){if(this._updates.changed=!0,e){var r=this._updates.paintProps;r[e]||(r[e]={}),r[e][t||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return util.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:util.mapObject(this.sourceCaches,function(e){return e.serialize()}),layers:this._order.map(function(e){return this._layers[e].serialize()},this)},function(e){return void 0!==e})},_updateLayer:function(e){return this._updates.layers[e.id]=!0,e.source&&(this._updates.sources[e.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(e){for(var t=[],r=this._order.length-1;r>=0;r--)for(var s=this._order[r],i=0;il.lastIntegerZoom?(e=u+(1-u)*c,h*=2,s=t({zoom:a-1},i),n=t({zoom:a},i)):(e=1-(1-c)*u,n=t({zoom:a},i),s=t({zoom:a+1},i),h/=2),void 0===s||void 0===n?void 0:{from:s,fromScale:h,to:n,toScale:p,t:e}}}var MapboxGLFunction=require("./style_function"),parseColor=require("./parse_color"),util=require("../util/util");module.exports=StyleDeclaration; -},{"../util/util":136,"./parse_color":68,"./style_function":71}],71:[function(require,module,exports){ -"use strict";var MapboxGLFunction=require("mapbox-gl-function");exports.interpolated=function(n){var t=MapboxGLFunction.interpolated(n),o=function(n,o){return t(n&&n.zoom,o||{})};return o.isFeatureConstant=t.isFeatureConstant,o.isZoomConstant=t.isZoomConstant,o},exports["piecewise-constant"]=function(n){var t=MapboxGLFunction["piecewise-constant"](n),o=function(n,o){return t(n&&n.zoom,o||{})};return o.isFeatureConstant=t.isFeatureConstant,o.isZoomConstant=t.isZoomConstant,o},exports.isFunctionDefinition=MapboxGLFunction.isFunctionDefinition; -},{"mapbox-gl-function":176}],72:[function(require,module,exports){ -"use strict";function StyleLayer(t,i){this.set(t,i)}function getDeclarationValue(t){return t.value}var util=require("../util/util"),StyleTransition=require("./style_transition"),StyleDeclaration=require("./style_declaration"),styleSpec=require("./style_spec"),validateStyle=require("./validate_style"),parseColor=require("./parse_color"),Evented=require("../util/evented");module.exports=StyleLayer;var TRANSITION_SUFFIX="-transition";StyleLayer.prototype=util.inherit(Evented,{set:function(t,i){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(i||t).type,this.source=(i||t).source,this.sourceLayer=(i||t)["source-layer"],this.minzoom=(i||t).minzoom,this.maxzoom=(i||t).maxzoom,this.filter=(i||t).filter,this.paint={},this.layout={},this._paintSpecifications=styleSpec["paint_"+this.type],this._layoutSpecifications=styleSpec["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var a,e,n={validate:!1};for(var s in t){var o=s.match(/^paint(?:\.(.*))?$/);if(o){var r=o[1]||"";for(a in t[s])this.setPaintProperty(a,t[s][a],r,n)}}if(this.ref)this._layoutDeclarations=i._layoutDeclarations;else for(e in t.layout)this.setLayoutProperty(e,t.layout[e],n);for(a in this._paintSpecifications)this.paint[a]=this.getPaintValue(a);for(e in this._layoutSpecifications)this._updateLayoutValue(e)},setLayoutProperty:function(t,i,a){if(null==i)delete this._layoutDeclarations[t];else{var e="layers."+this.id+".layout."+t;if(this._validate(validateStyle.layoutProperty,e,t,i,a))return;this._layoutDeclarations[t]=new StyleDeclaration(this._layoutSpecifications[t],i)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,i,a){var e=this._layoutSpecifications[t],n=this._layoutDeclarations[t];return n?n.calculate(i,a):e.default},setPaintProperty:function(t,i,a,e){var n="layers."+this.id+(a?'["paint.'+a+'"].':".paint.")+t;if(util.endsWith(t,TRANSITION_SUFFIX))if(this._paintTransitionOptions[a||""]||(this._paintTransitionOptions[a||""]={}),null===i||void 0===i)delete this._paintTransitionOptions[a||""][t];else{if(this._validate(validateStyle.paintProperty,n,t,i,e))return;this._paintTransitionOptions[a||""][t]=i}else if(this._paintDeclarations[a||""]||(this._paintDeclarations[a||""]={}),null===i||void 0===i)delete this._paintDeclarations[a||""][t];else{if(this._validate(validateStyle.paintProperty,n,t,i,e))return;this._paintDeclarations[a||""][t]=new StyleDeclaration(this._paintSpecifications[t],i)}},getPaintProperty:function(t,i){return i=i||"",util.endsWith(t,TRANSITION_SUFFIX)?this._paintTransitionOptions[i]&&this._paintTransitionOptions[i][t]:this._paintDeclarations[i]&&this._paintDeclarations[i][t]&&this._paintDeclarations[i][t].value},getPaintValue:function(t,i,a){var e=this._paintSpecifications[t],n=this._paintTransitions[t];return n?n.calculate(i,a):"color"===e.type&&e.default?parseColor(e.default):e.default},getPaintValueStopZoomLevels:function(t){var i=this._paintTransitions[t];return i?i.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,i){var a=this._paintTransitions[t];return a.declaration.calculateInterpolationT({zoom:i})},isPaintValueFeatureConstant:function(t){var i=this._paintTransitions[t];return!i||i.declaration.isFeatureConstant},isLayoutValueFeatureConstant:function(t){var i=this._layoutDeclarations[t];return!i||i.isFeatureConstant},isPaintValueZoomConstant:function(t){var i=this._paintTransitions[t];return!i||i.declaration.isZoomConstant},isHidden:function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.layout.visibility)},updatePaintTransitions:function(t,i,a,e){for(var n=util.extend({},this._paintDeclarations[""]),s=0;s-a/2;){if(s--,s<0)return!1;f-=e[s].dist(i),i=e[s]}f+=e[s].dist(e[s+1]),s++;for(var l=[],o=0;fr;)o-=l.shift().angleDelta;if(o>n)return!1;s++,f+=c.dist(g)}return!0}module.exports=checkMaxAngle; -},{}],84:[function(require,module,exports){ -"use strict";function clipLine(n,x,y,o,e){for(var r=[],t=0;t=o&&w.x>=o||(P.x>=o?P=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round():w.x>=o&&(w=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round()),P.y>=e&&w.y>=e||(P.y>=e?P=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round():w.y>=e&&(w=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round()),i&&P.equals(i[i.length-1])||(i=[P],r.push(i)),i.push(w)))))}return r}var Point=require("point-geometry");module.exports=clipLine; -},{"point-geometry":206}],85:[function(require,module,exports){ -"use strict";var StructArrayType=require("../util/struct_array"),util=require("../util/util"),Point=require("point-geometry"),CollisionBoxArray=module.exports=new StructArrayType({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});util.extendAll(CollisionBoxArray.prototype.StructType.prototype,{get anchorPoint(){return new Point(this.anchorPointX,this.anchorPointY)}}); -},{"../util/struct_array":134,"../util/util":136,"point-geometry":206}],86:[function(require,module,exports){ -"use strict";function CollisionFeature(t,e,i,o,s,n,a,l,r,d,u){var h=a.top*l-r,x=a.bottom*l+r,f=a.left*l-r,m=a.right*l+r;if(this.boxStartIndex=t.length,d){var _=x-h,b=m-f;if(_>0)if(_=Math.max(10*l,_),u){var c=e[i.segment+1].sub(e[i.segment])._unit()._mult(b),g=[i.sub(c),i.add(c)];this._addLineCollisionBoxes(t,g,i,0,b,_,o,s,n)}else this._addLineCollisionBoxes(t,e,i,i.segment,b,_,o,s,n)}else t.emplaceBack(i.x,i.y,f,h,m,x,1/0,o,s,n,0,0,0,0,0);this.boxEndIndex=t.length}module.exports=CollisionFeature,CollisionFeature.prototype._addLineCollisionBoxes=function(t,e,i,o,s,n,a,l,r){var d=n/2,u=Math.floor(s/d),h=-n/2,x=this.boxes,f=i,m=o+1,_=h;do{if(m--,m<0)return x;_-=e[m].dist(f),f=e[m]}while(_>-s/2);for(var b=e[m].dist(e[m+1]),c=0;c=e.length)return x;b=e[m].dist(e[m+1])}var v=g-_,p=e[m],C=e[m+1],B=C.sub(p)._unit()._mult(v)._add(p)._round(),M=Math.max(Math.abs(g-h)-d/2,0),y=s/2/M;t.emplaceBack(B.x,B.y,-n/2,-n/2,n/2,n/2,y,a,l,r,0,0,0,0,0)}return x}; -},{}],87:[function(require,module,exports){ -"use strict";function CollisionTile(t,i,e){if("object"==typeof t){var r=t;e=i,t=r.angle,i=r.pitch,this.grid=new Grid(r.grid),this.ignoredGrid=new Grid(r.ignoredGrid)}else this.grid=new Grid(EXTENT,12,6),this.ignoredGrid=new Grid(EXTENT,12,0);this.angle=t,this.pitch=i;var a=Math.sin(t),o=Math.cos(t);if(this.rotationMatrix=[o,-a,a,o],this.reverseRotationMatrix=[o,a,-a,o],this.yStretch=1/Math.cos(i/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=e,0===e.length){e.emplaceBack();var n=32767;e.emplaceBack(0,0,0,-n,0,n,n,0,0,0,0,0,0,0,0,0),e.emplaceBack(EXTENT,0,0,-n,0,n,n,0,0,0,0,0,0,0,0,0),e.emplaceBack(0,0,-n,0,n,0,n,0,0,0,0,0,0,0,0,0),e.emplaceBack(0,EXTENT,-n,0,n,0,n,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=e.get(0),this.edges=[e.get(1),e.get(2),e.get(3),e.get(4)]}var Point=require("point-geometry"),EXTENT=require("../data/bucket").EXTENT,Grid=require("grid-index");module.exports=CollisionTile,CollisionTile.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},CollisionTile.prototype.minScale=.25,CollisionTile.prototype.maxScale=2,CollisionTile.prototype.placeCollisionFeature=function(t,i,e){for(var r=this.collisionBoxArray,a=this.minScale,o=this.rotationMatrix,n=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return a}if(e){var v;if(this.angle){var M=this.reverseRotationMatrix,b=new Point(s.x1,s.y1).matMult(M),T=new Point(s.x2,s.y1).matMult(M),P=new Point(s.x1,s.y2).matMult(M),B=new Point(s.x2,s.y2).matMult(M);v=this.tempCollisionBox,v.anchorPointX=s.anchorPoint.x,v.anchorPointY=s.anchorPoint.y,v.x1=Math.min(b.x,T.x,P.x,B.x),v.y1=Math.min(b.y,T.x,P.x,B.x),v.x2=Math.max(b.x,T.x,P.x,B.x),v.y2=Math.max(b.y,T.x,P.x,B.x),v.maxScale=s.maxScale}else v=s;for(var C=0;C=this.maxScale)return a}}}return a},CollisionTile.prototype.queryRenderedSymbols=function(t,i,e,r,a){var o={},n=[],l=this.collisionBoxArray,s=this.rotationMatrix,h=new Point(t,i)._matMult(s),x=this.tempCollisionBox;x.anchorX=h.x,x.anchorY=h.y,x.x1=0,x.y1=0,x.x2=e-t,x.y2=r-i,x.maxScale=a,a=x.maxScale;for(var c=[h.x+x.x1/a,h.y+x.y1/a*this.yStretch,h.x+x.x2/a,h.y+x.y2/a*this.yStretch],y=this.grid.query(c[0],c[1],c[2],c[3]),d=this.ignoredGrid.query(c[0],c[1],c[2],c[3]),g=0;g=a&&(o[p][S]=!0,n.push(y[m]))}}return n},CollisionTile.prototype.getPlacementScale=function(t,i,e,r,a){var o=i.x-r.x,n=i.y-r.y,l=(a.x1-e.x2)/o,s=(a.x2-e.x1)/o,h=(a.y1-e.y2)*this.yStretch/n,x=(a.y2-e.y1)*this.yStretch/n;(isNaN(l)||isNaN(s))&&(l=s=1),(isNaN(h)||isNaN(x))&&(h=x=1);var c=Math.min(Math.max(l,s),Math.max(h,x)),y=a.maxScale,d=e.maxScale;return c>y&&(c=y),c>d&&(c=d),c>t&&c>=a.placementScale&&(t=c),t},CollisionTile.prototype.insertCollisionFeature=function(t,i,e){for(var r=e?this.ignoredGrid:this.grid,a=this.collisionBoxArray,o=t.boxStartIndex;o=0&&k=0&&q=0&&p+c<=s){var M=new Anchor(k,q,y,f)._round();n&&!checkMaxAngle(e,M,l,n,a)||x.push(M)}}g+=A}return i||x.length||o||(x=resample(e,g/2,t,n,a,l,o,!0,h)),x}var interpolate=require("../util/interpolate"),Anchor=require("../symbol/anchor"),checkMaxAngle=require("./check_max_angle");module.exports=getAnchors; -},{"../symbol/anchor":82,"../util/interpolate":130,"./check_max_angle":83}],89:[function(require,module,exports){ -"use strict";function GlyphAtlas(){this.width=DEFAULT_SIZE,this.height=DEFAULT_SIZE,this.bin=new ShelfPack(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var ShelfPack=require("shelf-pack"),util=require("../util/util"),SIZE_GROWTH_RATE=4,DEFAULT_SIZE=128,MAX_SIZE=2048;module.exports=GlyphAtlas,GlyphAtlas.prototype.getGlyphs=function(){var t,i,e,h={};for(var r in this.ids)t=r.split("#"),i=t[0],e=t[1],h[i]||(h[i]=[]),h[i].push(e);return h},GlyphAtlas.prototype.getRects=function(){var t,i,e,h={};for(var r in this.ids)t=r.split("#"),i=t[0],e=t[1],h[i]||(h[i]={}),h[i][e]=this.index[r];return h},GlyphAtlas.prototype.addGlyph=function(t,i,e,h){if(!e)return null;var r=i+"#"+e.id;if(this.index[r])return this.ids[r].indexOf(t)<0&&this.ids[r].push(t),this.index[r];if(!e.bitmap)return null;var s=e.width+2*h,a=e.height+2*h,n=1,E=s+2*n,T=a+2*n;E+=4-E%4,T+=4-T%4;var u=this.bin.packOne(E,T);if(u||(this.resize(),u=this.bin.packOne(E,T)),!u)return util.warnOnce("glyph bitmap overflow"),null;this.index[r]=u,this.ids[r]=[t];for(var l=this.data,d=e.bitmap,A=0;A=MAX_SIZE||i>=MAX_SIZE)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=SIZE_GROWTH_RATE,this.height*=SIZE_GROWTH_RATE,this.bin.resize(this.width,this.height);for(var e=new ArrayBuffer(this.width*this.height),h=0;h65535)return l("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var s=this.loading[t];if(s[e])s[e].push(l);else{s[e]=[l];var a=256*e+"-"+(256*e+255),i=glyphUrl(t,a,this.url);ajax.getArrayBuffer(i,function(t,l){for(var a=!t&&new Glyphs(new Protobuf(l)),i=0;ie||u[r].codePoint===newLine)){var g=u[r+1].x;p=Math.max(g,p);for(var x=r+1;x<=v;x++)u[x].y+=n,u[x].x-=g;if(a){var b=r;invisible[u[r].codePoint]&&b--,justifyLine(u,t,f,b,a)}f=r+1,r=null,l+=g,c++}breakable[d.codePoint]&&(r=v)}var w=u[u.length-1],y=w.x+t[w.codePoint].advance;p=Math.max(p,y);var P=(c+1)*n;justifyLine(u,t,f,u.length-1,a),align(u,a,o,h,p,n,c,s),i.top+=-h*P,i.bottom=i.top+P,i.left+=-o*p,i.right=i.left+p}function justifyLine(i,t,n,e,o){for(var h=t[i[e].codePoint].advance,a=(i[e].x+h)*o,s=n;s<=e;s++)i[s].x-=a}function align(i,t,n,e,o,h,a,s){for(var r=(t-n)*o+s[0],l=(-e*(a+1)+.5)*h+s[1],f=0;f1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},SpriteAtlas.prototype.addIcons=function(t,i){for(var e=0;e1||(L?(clearTimeout(L),L=null,h("dblclick",t)):L=setTimeout(l,300))}function i(e){f("touchmove",e)}function c(e){f("touchend",e)}function d(e){f("touchcancel",e)}function l(){L=null}function s(e){var t=DOM.mousePos(g,e);t.equals(E)&&h("click",e)}function v(e){h("dblclick",e),e.preventDefault()}function m(e){p=e,e.preventDefault()}function h(t,n){var o=DOM.mousePos(g,n);return e.fire(t,{lngLat:e.unproject(o),point:o,originalEvent:n})}function f(t,n){var o=DOM.touchPos(g,n),r=o.reduce(function(e,t,n,o){return e.add(t.div(o.length))},new Point(0,0));return e.fire(t,{lngLat:e.unproject(r),point:r,lngLats:o.map(function(t){return e.unproject(t)},this),points:o,originalEvent:n})}var g=e.getCanvasContainer(),p=null,E=null,L=null;for(var b in handlers)e[b]=new handlers[b](e,t),t.interactive&&t[b]&&e[b].enable();g.addEventListener("mouseout",n,!1),g.addEventListener("mousedown",o,!1),g.addEventListener("mouseup",r,!1),g.addEventListener("mousemove",u,!1),g.addEventListener("touchstart",a,!1),g.addEventListener("touchend",c,!1),g.addEventListener("touchmove",i,!1),g.addEventListener("touchcancel",d,!1),g.addEventListener("click",s,!1),g.addEventListener("dblclick",v,!1),g.addEventListener("contextmenu",m,!1)}; -},{"../util/dom":126,"./handler/box_zoom":106,"./handler/dblclick_zoom":107,"./handler/drag_pan":108,"./handler/drag_rotate":109,"./handler/keyboard":110,"./handler/scroll_zoom":111,"./handler/touch_zoom_rotate":112,"point-geometry":206}],99:[function(require,module,exports){ -"use strict";var util=require("../util/util"),interpolate=require("../util/interpolate"),browser=require("../util/browser"),LngLat=require("../geo/lng_lat"),LngLatBounds=require("../geo/lng_lat_bounds"),Point=require("point-geometry"),Camera=module.exports=function(){};util.extend(Camera.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,i){return this.jumpTo({center:t},i),this},panBy:function(t,i,e){return this.panTo(this.transform.center,util.extend({offset:Point.convert(t).mult(-1)},i),e),this},panTo:function(t,i,e){return this.easeTo(util.extend({center:t},i),e)},getZoom:function(){return this.transform.zoom},setZoom:function(t,i){return this.jumpTo({zoom:t},i),this},zoomTo:function(t,i,e){return this.easeTo(util.extend({zoom:t},i),e)},zoomIn:function(t,i){return this.zoomTo(this.getZoom()+1,t,i),this},zoomOut:function(t,i){return this.zoomTo(this.getZoom()-1,t,i),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,i){return this.jumpTo({bearing:t},i),this},rotateTo:function(t,i,e){return this.easeTo(util.extend({bearing:t},i),e)},resetNorth:function(t,i){return this.rotateTo(0,util.extend({duration:1e3},t),i),this},snapToNorth:function(t,i){return Math.abs(this.getBearing())180&&(s.center.lng>0&&m.lng<0?m.lng+=360:s.center.lng<0&&m.lng>0&&(m.lng-=360));var p=s.zoomScale(g-h),l=s.point,v="center"in t?s.project(m).sub(a.div(p)):l,b=s.worldSize,z=t.curve,_=Math.max(s.width,s.height),M=_/p,T=v.sub(l).mag();if("minZoom"in t){var E=util.clamp(Math.min(t.minZoom,h,g),s.minZoom,s.maxZoom),x=_/s.zoomScale(E-h);z=Math.sqrt(x/T*2)}var L=z*z,P=e(0),Z=function(t){return o(P)/o(P+z*t)},B=function(t){return _*((o(P)*r(P+z*t)-n(P))/L)/T},j=(e(1)-P)/z;if(Math.abs(T)<1e-6){if(Math.abs(_-M)<1e-6)return this.easeTo(t);var q=M<_?-1:1;j=Math.abs(Math.log(M/_))/z,B=function(){return 0},Z=function(t){return Math.exp(q*z*t)}}if("duration"in t)t.duration=+t.duration;else{var w="screenSpeed"in t?+t.screenSpeed/z:+t.speed;t.duration=1e3*j/w}return this.zooming=!0,u!==f&&(this.rotating=!0),c!==d&&(this.pitching=!0),this.fire("movestart",i),this.fire("zoomstart",i),this._ease(function(t){var e=t*j,n=B(e);s.zoom=h+s.scaleZoom(1/Z(e)),s.center=s.unproject(l.add(v.sub(l).mult(n)),b),this.rotating&&(s.bearing=interpolate(u,f,t)),this.pitching&&(s.pitch=interpolate(c,d,t)),this.fire("move",i),this.fire("zoom",i),this.rotating&&this.fire("rotate",i),this.pitching&&this.fire("pitch",i)},function(){this.zooming=!1,this.rotating=!1,this.pitching=!1,this.fire("zoomend",i),this.fire("moveend",i)},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,i,e){this._finishFn=i,this._abortFn=browser.timed(function(i){t.call(this,e.easing(i)),1===i&&this._finishEase()},e.animate===!1?0:e.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,i){t=util.wrap(t,-180,180);var e=Math.abs(t-i);return Math.abs(t-360-i)=0)return!1;return!0}),this._container.innerHTML=t.join(" | ")}},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}}); -},{"../../util/dom":126,"../../util/util":136,"./control":101}],101:[function(require,module,exports){ -"use strict";function Control(){}var util=require("../../util/util"),Evented=require("../../util/evented");module.exports=Control,Control.prototype={addTo:function(t){this._map=t;var o=this._container=this.onAdd(t);if(this.options&&this.options.position){var i=this.options.position,e=t._controlCorners[i];o.className+=" mapboxgl-ctrl",i.indexOf("bottom")!==-1?e.insertBefore(o,e.firstChild):e.appendChild(o)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},util.extend(Control.prototype,Evented); -},{"../../util/evented":127,"../../util/util":136}],102:[function(require,module,exports){ -"use strict";function Fullscreen(e){util.setOptions(this,e)}var Control=require("./control"),browser=require("../../util/browser"),DOM=require("../../util/dom"),util=require("../../util/util"),window=require("../../util/window");module.exports=Fullscreen,Fullscreen.prototype=util.inherit(Control,{options:{position:"top-left"},onAdd:function(e){var t="mapboxgl-ctrl",n=this._container=DOM.create("div",t+"-group",e.getContainer());return this._fullscreenButton=DOM.create("button",t+"-icon "+t+"-fullscreen",this._container),this._fullscreenButton.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen.bind(this)),n},_onClickFullscreen:function(){var e=map.getContainer();e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}); -},{"../../util/browser":119,"../../util/dom":126,"../../util/util":136,"../../util/window":121,"./control":101}],103:[function(require,module,exports){ -"use strict";function Geolocate(t){util.setOptions(this,t)}var Control=require("./control"),browser=require("../../util/browser"),DOM=require("../../util/dom"),util=require("../../util/util"),window=require("../../util/window");module.exports=Geolocate;var geoOptions={enableHighAccuracy:!1,timeout:6e3};Geolocate.prototype=util.inherit(Control,{options:{position:"top-right"},onAdd:function(t){var i="mapboxgl-ctrl",o=this._container=DOM.create("div",i+"-group",t.getContainer());return browser.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=DOM.create("button",i+"-icon "+i+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),o):o},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){window.navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),geoOptions),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}}); -},{"../../util/browser":119,"../../util/dom":126,"../../util/util":136,"../../util/window":121,"./control":101}],104:[function(require,module,exports){ -"use strict";function Navigation(t){util.setOptions(this,t)}function copyMouseEvent(t){return new window.MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var Control=require("./control"),DOM=require("../../util/dom"),util=require("../../util/util"),window=require("../../util/window");module.exports=Navigation,Navigation.prototype=util.inherit(Control,{options:{position:"top-right"},onAdd:function(t){var o="mapboxgl-ctrl",e=this._container=DOM.create("div",o+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(o+"-icon "+o+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(o+"-icon "+o+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(o+"-icon "+o+"-compass",t.resetNorth.bind(t)),this._compassArrow=DOM.create("span","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),e},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(DOM.disableDrag(),window.document.addEventListener("mousemove",this._onCompassMove),window.document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(window.document.removeEventListener("mousemove",this._onCompassMove),window.document.removeEventListener("mouseup",this._onCompassUp),DOM.enableDrag(),this._el.dispatchEvent(copyMouseEvent(t)),t.stopPropagation())},_createButton:function(t,o){var e=DOM.create("button",t,this._container);return e.type="button",e.addEventListener("click",function(){o()}),e},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}}); -},{"../../util/dom":126,"../../util/util":136,"../../util/window":121,"./control":101}],105:[function(require,module,exports){ -"use strict";function Scale(t){util.setOptions(this,t)}function updateScale(t,e,n){var i=n&&n.maxWidth||100,o=t._container.clientHeight/2,a=getDistance(t.unproject([0,o]),t.unproject([i,o]));if(n&&"imperial"===n.unit){var r=3.2808*a;if(r>5280){var l=r/5280;setScale(e,i,l,"mi")}else setScale(e,i,r,"ft")}else setScale(e,i,a,"m")}function setScale(t,e,n,i){var o=getRoundNum(n),a=o/n;"m"===i&&o>=1e3&&(o/=1e3,i="km"),t.style.width=e*a+"px",t.innerHTML=o+i}function getDistance(t,e){var n=6371e3,i=Math.PI/180,o=t.lat*i,a=e.lat*i,r=Math.sin(o)*Math.sin(a)+Math.cos(o)*Math.cos(a)*Math.cos((e.lng-t.lng)*i),l=n*Math.acos(Math.min(r,1));return l}function getRoundNum(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),n=t/e;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1,e*n}var util=require("../../util/util"),Control=require("./control"),DOM=require("../../util/dom");module.exports=Scale,Scale.prototype=util.inherit(Control,{options:{position:"bottom-left"},onAdd:function(t){var e="mapboxgl-ctrl-scale",n=this._container=DOM.create("div",e,t.getContainer()),i=this.options;return updateScale(t,n,i),t.on("move",function(){updateScale(t,n,i)}),n}}); -},{"../../util/dom":126,"../../util/util":136,"./control":101}],106:[function(require,module,exports){ -"use strict";function BoxZoomHandler(e){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),LngLatBounds=require("../../geo/lng_lat_bounds"),util=require("../../util/util"),window=require("../../util/window");module.exports=BoxZoomHandler,BoxZoomHandler.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(e){e.shiftKey&&0===e.button&&(window.document.addEventListener("mousemove",this._onMouseMove,!1),window.document.addEventListener("keydown",this._onKeyDown,!1),window.document.addEventListener("mouseup",this._onMouseUp,!1),DOM.disableDrag(),this._startPos=DOM.mousePos(this._el,e),this._active=!0)},_onMouseMove:function(e){var t=this._startPos,o=DOM.mousePos(this._el,e);this._box||(this._box=DOM.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));var n=Math.min(t.x,o.x),i=Math.max(t.x,o.x),s=Math.min(t.y,o.y),a=Math.max(t.y,o.y);DOM.setTransform(this._box,"translate("+n+"px,"+s+"px)"),this._box.style.width=i-n+"px",this._box.style.height=a-s+"px"},_onMouseUp:function(e){if(0===e.button){var t=this._startPos,o=DOM.mousePos(this._el,e),n=(new LngLatBounds).extend(this._map.unproject(t)).extend(this._map.unproject(o));this._finish(),t.x===o.x&&t.y===o.y?this._fireEvent("boxzoomcancel",e):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:e,boxZoomBounds:n})}},_onKeyDown:function(e){27===e.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",e))},_finish:function(){this._active=!1,window.document.removeEventListener("mousemove",this._onMouseMove,!1),window.document.removeEventListener("keydown",this._onKeyDown,!1),window.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),DOM.enableDrag()},_fireEvent:function(e,t){return this._map.fire(e,{originalEvent:t})}}; -},{"../../geo/lng_lat_bounds":30,"../../util/dom":126,"../../util/util":136,"../../util/window":121}],107:[function(require,module,exports){ -"use strict";function DoubleClickZoomHandler(i){this._map=i,this._onDblClick=this._onDblClick.bind(this)}module.exports=DoubleClickZoomHandler,DoubleClickZoomHandler.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(i){this._map.zoomTo(this._map.getZoom()+(i.originalEvent.shiftKey?-1:1),{around:i.lngLat},i)}}; -},{}],108:[function(require,module,exports){ -"use strict";function DragPanHandler(t){this._map=t,this._el=t.getCanvasContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),util=require("../../util/util"),window=require("../../util/window");module.exports=DragPanHandler;var inertiaLinearity=.3,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=1400,inertiaDeceleration=2500;DragPanHandler.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(window.document.addEventListener("touchmove",this._onMove),window.document.addEventListener("touchend",this._onTouchEnd)):(window.document.addEventListener("mousemove",this._onMove),window.document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=DOM.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=DOM.mousePos(this._el,t),i=this._map;i.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),i.transform.setLocationAtPoint(i.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),i=this._inertia;if(i.length<2)return void e();var n=i[i.length-1],o=i[0],r=n[1].sub(o[1]),s=(n[0]-o[0])/1e3;if(0===s||n[1].equals(o[1]))return void e();var a=r.mult(inertiaLinearity/s),u=a.mag();u>inertiaMaxSpeed&&(u=inertiaMaxSpeed,a._unit()._mult(u));var h=u/(inertiaDeceleration*inertiaLinearity),v=a.mult(-h/2);this._map.panBy(v,{duration:1e3*h,easing:inertiaEasing,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),window.document.removeEventListener("mousemove",this._onMove),window.document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var i=1,n=0;return"mousemove"===t.type?t.buttons&0===i:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),i=160;t.length>0&&e-t[0][0]>i;)t.shift()}}; -},{"../../util/dom":126,"../../util/util":136,"../../util/window":121}],109:[function(require,module,exports){ -"use strict";function DragRotateHandler(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,this._pitchWithRotate=e.pitchWithRotate!==!1,util.bindHandlers(this)}var DOM=require("../../util/dom"),util=require("../../util/util"),window=require("../../util/window");module.exports=DragRotateHandler;var inertiaLinearity=.25,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=180,inertiaDeceleration=720;DragRotateHandler.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(window.document.addEventListener("mousemove",this._onMove),window.document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=DOM.mousePos(this._el,t),this._center=this._map.transform.centerPoint,t.preventDefault())},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var i=this._pos,n=DOM.mousePos(this._el,t),r=.8*(i.x-n.x),a=(i.y-n.y)*-.5,o=e.getBearing()-r,s=e.getPitch()-a,h=this._inertia,_=h[h.length-1];this._drainInertiaBuffer(),h.push([Date.now(),e._normalizeBearing(o,_[1])]),e.transform.bearing=o,this._pitchWithRotate&&(e.transform.pitch=s),this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(window.document.removeEventListener("mousemove",this._onMove),window.document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,i=e.getBearing(),n=this._inertia,r=function(){Math.abs(i)inertiaMaxSpeed&&(d=inertiaMaxSpeed);var l=d/(inertiaDeceleration*inertiaLinearity),c=v*d*(l/2);h+=c,Math.abs(e._normalizeBearing(h,0))1;var i=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===i:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),i=160;t.length>0&&e-t[0][0]>i;)t.shift()}}; -},{"../../util/dom":126,"../../util/util":136,"../../util/window":121}],110:[function(require,module,exports){ -"use strict";function KeyboardHandler(e){this._map=e,this._el=e.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}function easeOut(e){return e*(2-e)}module.exports=KeyboardHandler;var panStep=100,bearingStep=15,pitchStep=10;KeyboardHandler.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t=0,n=0,a=0,i=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),i=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),i=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?a=-1:(s=1,e.preventDefault())}var r=this._map,o=r.getZoom(),h={duration:300,delayEndEvents:500,easing:easeOut,zoom:t?Math.round(o)+t*(e.shiftKey?2:1):o,bearing:r.getBearing()+n*bearingStep,pitch:r.getPitch()+a*pitchStep,offset:[-i*panStep,-s*panStep],center:r.getCenter()};r.easeTo(h,{originalEvent:e})}}}; -},{}],111:[function(require,module,exports){ -"use strict";function ScrollZoomHandler(e){this._map=e,this._el=e.getCanvasContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),util=require("../../util/util"),browser=require("../../util/browser"),window=require("../../util/window");module.exports=ScrollZoomHandler;var ua=window.navigator.userAgent.toLowerCase(),firefox=ua.indexOf("firefox")!==-1,safari=ua.indexOf("safari")!==-1&&ua.indexOf("chrom")===-1;ScrollZoomHandler.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(e){var t;"wheel"===e.type?(t=e.deltaY,firefox&&e.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(t/=browser.devicePixelRatio),e.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(t*=40)):"mousewheel"===e.type&&(t=-e.wheelDeltaY,safari&&(t/=3));var i=browser.now(),o=i-(this._time||0);this._pos=DOM.mousePos(this._el,e),this._time=i,0!==t&&t%4.000244140625===0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(o*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&this._zoom(-t,e),e.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(e,t){if(0!==e){var i=this._map,o=2/(1+Math.exp(-Math.abs(e/100)));e<0&&0!==o&&(o=1/o);var s=i.ease?i.ease.to:i.transform.scale,a=i.transform.scaleZoom(s*o);i.zoomTo(a,{duration:"wheel"===this._type?200:0,around:i.unproject(this._pos),delayEndEvents:200,smoothEasing:!0},{originalEvent:t})}}}; -},{"../../util/browser":119,"../../util/dom":126,"../../util/util":136,"../../util/window":121}],112:[function(require,module,exports){ -"use strict";function TouchZoomRotateHandler(t){this._map=t,this._el=t.getCanvasContainer(),util.bindHandlers(this)}var DOM=require("../../util/dom"),util=require("../../util/util"),window=require("../../util/window");module.exports=TouchZoomRotateHandler;var inertiaLinearity=.15,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaDeceleration=12,inertiaMaxSpeed=2.5,significantScaleThreshold=.15,significantRotateThreshold=4;TouchZoomRotateHandler.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),i=DOM.mousePos(this._el,t.touches[1]);this._startVec=e.sub(i),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],window.document.addEventListener("touchmove",this._onMove,!1),window.document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),i=DOM.mousePos(this._el,t.touches[1]),n=e.add(i).div(2),a=e.sub(i),s=a.mag()/this._startVec.mag(),r=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,o=this._map;if(this._gestureIntent){var h={duration:0,around:o.unproject(n)};"rotate"===this._gestureIntent&&(h.bearing=this._startBearing+r),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(h.zoom=o.transform.scaleZoom(this._startScale*s)),o.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),s,n]),o.easeTo(h,{originalEvent:t})}else{var u=Math.abs(1-s)>significantScaleThreshold,l=Math.abs(r)>significantRotateThreshold;l?this._gestureIntent="rotate":u&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=o.transform.scale,this._startBearing=o.transform.bearing)}t.preventDefault()}},_onEnd:function(t){window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,i=this._map;if(e.length<2)return void i.snapToNorth({},{originalEvent:t});var n=e[e.length-1],a=e[0],s=i.transform.scaleZoom(this._startScale*n[1]),r=i.transform.scaleZoom(this._startScale*a[1]),o=s-r,h=(n[0]-a[0])/1e3,u=n[2];if(0===h||s===r)return void i.snapToNorth({},{originalEvent:t});var l=o*inertiaLinearity/h;Math.abs(l)>inertiaMaxSpeed&&(l=l>0?inertiaMaxSpeed:-inertiaMaxSpeed);var d=1e3*Math.abs(l/(inertiaDeceleration*inertiaLinearity)),_=s+l*d/2e3;_<0&&(_=0),i.easeTo({zoom:_,duration:d,easing:inertiaEasing,around:i.unproject(u)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),i=160;t.length>2&&e-t[0][0]>i;)t.shift()}}; -},{"../../util/dom":126,"../../util/util":136,"../../util/window":121}],113:[function(require,module,exports){ -"use strict";function Hash(){util.bindAll(["_onHashChange","_updateHash"],this)}module.exports=Hash;var util=require("../util/util"),window=require("../util/window");Hash.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=window.location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0),pitch:+(t[4]||0)}),!0)},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),a=this._map.getBearing(),h=this._map.getPitch(),i=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),n="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(i)+"/"+t.lng.toFixed(i);(a||h)&&(n+="/"+Math.round(10*a)/10),h&&(n+="/"+Math.round(h)),window.history.replaceState("","",n)}}; -},{"../util/util":136,"../util/window":121}],114:[function(require,module,exports){ -"use strict";function removeNode(t){t.parentNode&&t.parentNode.removeChild(t)}var util=require("../util/util"),browser=require("../util/browser"),window=require("../util/window"),Evented=require("../util/evented"),DOM=require("../util/dom"),Style=require("../style/style"),AnimationLoop=require("../style/animation_loop"),Painter=require("../render/painter"),Transform=require("../geo/transform"),Hash=require("./hash"),bindHandlers=require("./bind_handlers"),Camera=require("./camera"),LngLat=require("../geo/lng_lat"),LngLatBounds=require("../geo/lng_lat_bounds"),Point=require("point-geometry"),Attribution=require("./control/attribution"),isSupported=require("mapbox-gl-supported"),defaultMinZoom=0,defaultMaxZoom=20,defaultOptions={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:defaultMinZoom,maxZoom:defaultMaxZoom,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0},Map=module.exports=function(t){t=util.extend({},defaultOptions,t),this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=window.document.getElementById(t.container):this._container=t.container,this.animationLoop=new AnimationLoop,this.transform=new Transform(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),util.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof window&&(window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1)),bindHandlers(this,t),this._hash=t.hash&&(new Hash).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new Attribution(t.attributionControl)),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1})}),this.on("data",function(t){"style"===t.dataType?this._update(!0):this._update()})};util.extend(Map.prototype,Evented),util.extend(Map.prototype,Camera.prototype),util.extend(Map.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var i=this._classes.indexOf(t);return i<0||""===t?this:(this._classes.splice(i,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var i={},s=0;s=0},getClasses:function(){return this._classes},resize:function(){var t=this._containerDimensions(),e=t[0],i=t[1];return this._resizeCanvas(e,i),this.transform.resize(e,i),this.painter.resize(e,i),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new LngLatBounds(this.transform.pointLocation(new Point(0,this.transform.height)),this.transform.pointLocation(new Point(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new Point(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new Point(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=LngLatBounds.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?defaultMinZoom:t,t>=defaultMinZoom&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=defaultMaxZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+defaultMaxZoom+", inclusive")},project:function(t){return this.transform.locationPoint(LngLat.convert(t))},unproject:function(t){return this.transform.pointLocation(Point.convert(t))},queryRenderedFeatures:function(){function t(t){return t instanceof Point||Array.isArray(t)}var e,i={};return 2===arguments.length?(e=arguments[0],i=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(i=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(e),i,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[Point.convert([0,0]),Point.convert([this.transform.width,this.transform.height])]);var e,i=t instanceof Point||"number"==typeof t[0];if(i){var s=Point.convert(t);e=[s]}else{var n=[Point.convert(t[0]),Point.convert(t[1])];e=[n[0],new Point(n[1].x,n[0].y),n[1],new Point(n[0].x,n[1].y),n[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof Style?this.style=t:this.style=new Style(t,this),this.style.setEventedParent(this,{style:this.style}),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){if(this.style)return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,i){return this.style.addSourceType(t,e,i)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,i,s){return this.style.setPaintProperty(t,e,i,s),this._update(!0),this},getPaintProperty:function(t,e,i){return this.style.getPaintProperty(t,e,i)},setLayoutProperty:function(t,e,i){return this.style.setLayoutProperty(t,e,i),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas},_containerDimensions:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),[t,e]},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=DOM.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=DOM.create("canvas","mapboxgl-canvas",e),this._canvas.style.position="absolute",this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",0);var i=this._containerDimensions();this._resizeCanvas(i[0],i[1]);var s=this._controlContainer=DOM.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=DOM.create("div","mapboxgl-ctrl-"+t,s)})},_resizeCanvas:function(t,e){var i=window.devicePixelRatio||1;this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=t+"px",this._canvas.style.height=e+"px"},_setupPainter:function(){var t=util.extend({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer},isSupported.webGLContextAttributes),e=this._canvas.getContext("webgl",t)||this._canvas.getContext("experimental-webgl",t);return e?void(this.painter=new Painter(e,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&browser.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return!this._styleDirty&&!this._sourcesDirty&&!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||this._styleDirty)&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),browser.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof window&&window.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),removeNode(this._canvasContainer),removeNode(this._controlContainer),this._container.classList.remove("mapboxgl-map"),this.fire("remove")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=browser.frame(this._render))},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),util.extendAll(Map.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}}); -},{"../geo/lng_lat":29,"../geo/lng_lat_bounds":30,"../geo/transform":31,"../render/painter":46,"../style/animation_loop":66,"../style/style":69,"../util/browser":119,"../util/dom":126,"../util/evented":127,"../util/util":136,"../util/window":121,"./bind_handlers":98,"./camera":99,"./control/attribution":100,"./hash":113,"mapbox-gl-supported":202,"point-geometry":206}],115:[function(require,module,exports){ -"use strict";function Marker(t,i){this._offset=Point.convert(i&&i.offset||[0,0]),this._update=this._update.bind(this),this._onMapClick=this._onMapClick.bind(this),t||(t=DOM.create("div")),t.classList.add("mapboxgl-marker"),this._element=t,this._popup=null}module.exports=Marker;var DOM=require("../util/dom"),util=require("../util/util"),LngLat=require("../geo/lng_lat"),Point=require("point-geometry"),Popup=require("./popup");Marker.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update.bind(this)),t.on("moveend",this._update.bind(this,{roundPos:!0})),this._update({roundPos:!0}),this._map.on("click",this._onMapClick),this},remove:function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map=null),DOM.remove(this._element),this._popup&&this._popup.remove(),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=LngLat.convert(t),this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},getElement:function(){return this._element},setPopup:function(t){return this._popup&&(this._popup.remove(),this._popup=null),t&&(this._popup=t,this._popup.setLngLat(this._lngLat)),this},_onMapClick:function(t){var i=t.originalEvent.target,e=this._element;this._popup&&(i===e||e.contains(i))&&this.togglePopup()},getPopup:function(){return this._popup},togglePopup:function(){var t=this._popup;t&&(t.isOpen()?t.remove():t.addTo(this._map))},_update:function(t){if(this._map){var i=this._map.project(this._lngLat)._add(this._offset);t.roundPos&&(i=i.round()),DOM.setTransform(this._element,"translate("+i.x+"px,"+i.y+"px)")}}}; -},{"../geo/lng_lat":29,"../util/dom":126,"../util/util":136,"./popup":116,"point-geometry":206}],116:[function(require,module,exports){ -"use strict";function Popup(t){util.setOptions(this,t),util.bindAll(["_update","_onClickClose"],this)}function normalizeOffset(t){if(t){if("number"==typeof t){var o=Math.round(Math.sqrt(.5*Math.pow(t,2)));return{top:new Point(0,t),"top-left":new Point(o,o),"top-right":new Point((-o),o),bottom:new Point(0,(-t)),"bottom-left":new Point(o,(-o)),"bottom-right":new Point((-o),(-o)),left:new Point(t,0),right:new Point((-t),0)}}if(isPointLike(t)){var n=Point.convert(t);return{top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{top:Point.convert(t.top),"top-left":Point.convert(t["top-left"]),"top-right":Point.convert(t["top-right"]),bottom:Point.convert(t.bottom),"bottom-left":Point.convert(t["bottom-left"]),"bottom-right":Point.convert(t["bottom-right"]),left:Point.convert(t.left),right:Point.convert(t.right)}}return normalizeOffset(new Point(0,0))}function isPointLike(t){return t instanceof Point||Array.isArray(t)}module.exports=Popup;var util=require("../util/util"),Evented=require("../util/evented"),DOM=require("../util/dom"),LngLat=require("../geo/lng_lat"),Point=require("point-geometry"),window=require("../util/window");Popup.prototype=util.inherit(Evented,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},isOpen:function(){return!!this._map},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=LngLat.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(window.document.createTextNode(t))},setHTML:function(t){var o,n=window.document.createDocumentFragment(),e=window.document.createElement("body");for(e.innerHTML=t;;){if(o=e.firstChild,!o)break;n.appendChild(o)}return this.setDOMContent(n)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=DOM.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=DOM.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=DOM.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=DOM.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this.options.anchor,o=normalizeOffset(this.options.offset),n=this._map.project(this._lngLat).round();if(!t){var e=this._container.offsetWidth,i=this._container.offsetHeight;t=n.ythis._map.transform.height-i?["bottom"]:[],n.xthis._map.transform.width-e/2&&t.push("right"),t=0===t.length?"bottom":t.join("-")}var r=n.add(o[t]),s={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},a=this._container.classList;for(var h in s)a.remove("mapboxgl-popup-anchor-"+h);a.add("mapboxgl-popup-anchor-"+t),DOM.setTransform(this._container,s[t]+" translate("+r.x+"px,"+r.y+"px)")}},_onClickClose:function(){this.remove()}}); -},{"../geo/lng_lat":29,"../util/dom":126,"../util/evented":127,"../util/util":136,"../util/window":121,"point-geometry":206}],117:[function(require,module,exports){ -"use strict";function Actor(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}module.exports=Actor,Actor.prototype.send=function(t,e,i,s,a){var r=i?this.mapId+":"+this.callbackID++:null;i&&(this.callbacks[r]=i),this.target.postMessage({targetMapId:a,sourceMapId:this.mapId,type:t,id:String(r),data:e},s)},Actor.prototype.receive=function(t){function e(t,e,i){this.target.postMessage({sourceMapId:this.mapId,type:"",id:String(a),error:t?String(t):null,data:e},i)}var i,s=t.data,a=s.id;if(!s.targetMapId||this.mapId===s.targetMapId)if(""===s.type)i=this.callbacks[s.id],delete this.callbacks[s.id],i&&i(s.error||null,s.data);else if("undefined"!=typeof s.id&&this.parent[s.type])this.parent[s.type](s.sourceMapId,s.data,e.bind(this));else if("undefined"!=typeof s.id&&this.parent.getWorkerSource){var r=s.type.split("."),p=this.parent.getWorkerSource(s.sourceMapId,r[0]);p[r[1]](s.data,e.bind(this))}else this.parent[s.type](s.data)},Actor.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)}; -},{}],118:[function(require,module,exports){ -"use strict";function sameOrigin(e){var t=window.document.createElement("a");return t.href=e,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}var window=require("./window");exports.getJSON=function(e,t){var n=new window.XMLHttpRequest;return n.open("GET",e,!0),n.setRequestHeader("Accept","application/json"),n.onerror=function(e){t(e)},n.onload=function(){if(n.status>=200&&n.status<300&&n.response){var e;try{e=JSON.parse(n.response)}catch(e){return t(e)}t(null,e)}else t(new Error(n.statusText))},n.send(),n},exports.getArrayBuffer=function(e,t){var n=new window.XMLHttpRequest;return n.open("GET",e,!0),n.responseType="arraybuffer",n.onerror=function(e){t(e)},n.onload=function(){n.status>=200&&n.status<300&&n.response?t(null,n.response):t(new Error(n.statusText))},n.send(),n},exports.getImage=function(e,t){return exports.getArrayBuffer(e,function(e,n){if(e)return t(e);var r=new window.Image;r.onload=function(){t(null,r),(window.URL||window.webkitURL).revokeObjectURL(r.src)};var o=new window.Blob([new Uint8Array(n)],{type:"image/png"});return r.src=(window.URL||window.webkitURL).createObjectURL(o),r.getData=function(){var e=window.document.createElement("canvas"),t=e.getContext("2d");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0),t.getImageData(0,0,r.width,r.height).data},r})},exports.getVideo=function(e,t){var n=window.document.createElement("video");n.onloadstart=function(){t(null,n)};for(var r=0;r=i+n?e.call(o,1):(e.call(o,(a-i)/n),exports.frame(r)))}if(!n)return e.call(o,1),null;var t=!1,i=module.exports.now();return exports.frame(r),function(){t=!0}},exports.supported=require("mapbox-gl-supported"),exports.hardwareConcurrency=window.navigator.hardwareConcurrency||4,Object.defineProperty(exports,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),exports.supportsWebp=!1;var webpImgTest=window.document.createElement("img");webpImgTest.onload=function(){exports.supportsWebp=!0},webpImgTest.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",exports.supportsGeolocation=!!window.navigator.geolocation; -},{"./window":121,"mapbox-gl-supported":202}],120:[function(require,module,exports){ -"use strict";var WebWorkify=require("webworkify"),window=require("../window"),workerURL=window.URL.createObjectURL(new WebWorkify(require("../../source/worker"),{bare:!0}));module.exports=function(){return new window.Worker(workerURL)}; -},{"../../source/worker":64,"../window":121,"webworkify":223}],121:[function(require,module,exports){ -"use strict";module.exports=self; -},{}],122:[function(require,module,exports){ -"use strict";function compareAreas(e,r){return r.area-e.area}var quickselect=require("quickselect"),calculateSignedArea=require("./util").calculateSignedArea;module.exports=function(e,r){var a=e.length;if(a<=1)return[e];for(var t,u,c=[],i=0;i1)for(var n=0;ne.y!=h.y>e.y&&e.x<(h.x-a.x)*(e.y-a.y)/(h.y-a.y)+a.x&&(n=!n),r=Math.min(r,distToSegmentSquared(e,a,h))}return(n?1:-1)*Math.sqrt(r)}function getCentroidCell(e){for(var t=0,n=0,r=0,o=e[0],l=0,i=o.length,s=i-1;ll)&&(l=a.x),(!u||a.y>i)&&(i=a.y)}for(var h=l-r,p=i-o,y=Math.min(h,p),x=y/2,d=new Queue(null,compareMax),g=r;gm.d&&(m=v,n&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,c)),v.max-m.d<=t||(x=v.h/2,d.push(new Cell(v.p.x-x,v.p.y-x,x,e)),d.push(new Cell(v.p.x+x,v.p.y-x,x,e)),d.push(new Cell(v.p.x-x,v.p.y+x,x,e)),d.push(new Cell(v.p.x+x,v.p.y+x,x,e)),c+=4)}return n&&(console.log("num probes: "+c),console.log("best distance: "+m.d)),m.p}; -},{"./intersection_tests":131,"point-geometry":206,"tinyqueue":214}],129:[function(require,module,exports){ -"use strict";function Glyphs(a,e){this.stacks=a.readFields(readFontstacks,[],e)}function readFontstacks(a,e,r){if(1===a){var t=r.readMessage(readFontstack,{glyphs:{}});e.push(t)}}function readFontstack(a,e,r){if(1===a)e.name=r.readString();else if(2===a)e.range=r.readString();else if(3===a){var t=r.readMessage(readGlyph,{});e.glyphs[t.id]=t}}function readGlyph(a,e,r){1===a?e.id=r.readVarint():2===a?e.bitmap=r.readBytes():3===a?e.width=r.readVarint():4===a?e.height=r.readVarint():5===a?e.left=r.readSVarint():6===a?e.top=r.readSVarint():7===a&&(e.advance=r.readVarint())}module.exports=Glyphs; -},{}],130:[function(require,module,exports){ -"use strict";function interpolate(t,e,n){return t*(1-n)+e*n}module.exports=interpolate,interpolate.number=interpolate,interpolate.vec2=function(t,e,n){return[interpolate(t[0],e[0],n),interpolate(t[1],e[1],n)]},interpolate.color=function(t,e,n){return[interpolate(t[0],e[0],n),interpolate(t[1],e[1],n),interpolate(t[2],e[2],n),interpolate(t[3],e[3],n)]},interpolate.array=function(t,e,n){return t.map(function(t,r){return interpolate(t,e[r],n)})}; -},{}],131:[function(require,module,exports){ -"use strict";function multiPolygonIntersectsBufferedMultiPoint(e,n,t){for(var r=0;r=3)for(var l=0;l1){if(lineIntersectsLine(e,n))return!0;for(var r=0;r1?e.distSqr(t):e.distSqr(t.sub(n)._mult(i)._add(n))}function multiPolygonContainsPoint(e,n){for(var t,r,i,o=!1,u=0;un.y!=i.y>n.y&&n.x<(i.x-r.x)*(n.y-r.y)/(i.y-r.y)+r.x&&(o=!o)}return o}function polygonContainsPoint(e,n){for(var t=!1,r=0,i=e.length-1;rn.y!=u.y>n.y&&n.x<(u.x-o.x)*(n.y-o.y)/(u.y-o.y)+o.x&&(t=!t)}return t}var isCounterClockwise=require("./util").isCounterClockwise;module.exports={multiPolygonIntersectsBufferedMultiPoint:multiPolygonIntersectsBufferedMultiPoint,multiPolygonIntersectsMultiPolygon:multiPolygonIntersectsMultiPolygon,multiPolygonIntersectsBufferedMultiLine:multiPolygonIntersectsBufferedMultiLine,distToSegmentSquared:distToSegmentSquared}; -},{"./util":136}],132:[function(require,module,exports){ -"use strict";function LRUCache(t,e){this.max=t,this.onRemove=e,this.reset()}module.exports=LRUCache,LRUCache.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},LRUCache.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var i=this.get(this.order[0]);i&&this.onRemove(i)}return this},LRUCache.prototype.has=function(t){return t in this.data},LRUCache.prototype.keys=function(){return this.order},LRUCache.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},LRUCache.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}; -},{}],133:[function(require,module,exports){ -"use strict";function makeAPIURL(e,r,o){if(o=o||config.ACCESS_TOKEN,!o&&config.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");var t=config.API_URL+e+(r?"?"+r:"");if(config.REQUIRE_ACCESS_TOKEN){if("s"===o[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=(r?"&":"?")+"access_token="+o}return t}function replaceTempAccessToken(e){return e.access_token&&"tk."===e.access_token.slice(0,3)?util.extend({},e,{access_token:config.ACCESS_TOKEN}):e}var config=require("./config"),browser=require("./browser"),URL=require("url"),util=require("./util");module.exports.isMapboxURL=function(e){return"mapbox:"===URL.parse(e).protocol},module.exports.normalizeStyleURL=function(e,r){var o=URL.parse(e);return"mapbox:"!==o.protocol?e:makeAPIURL("/styles/v1"+o.pathname,o.query,r)},module.exports.normalizeSourceURL=function(e,r){var o=URL.parse(e);if("mapbox:"!==o.protocol)return e;var t=e.match(/mapbox:\/\/([^?]+)/)[1];return makeAPIURL("/v4/"+t+".json",o.query,r)+"&secure"},module.exports.normalizeGlyphsURL=function(e,r){var o=URL.parse(e);if("mapbox:"!==o.protocol)return e;var t=o.pathname.split("/")[1];return makeAPIURL("/fonts/v1/"+t+"/{fontstack}/{range}.pbf",o.query,r)},module.exports.normalizeSpriteURL=function(e,r,o,t){var a=URL.parse(e);return"mapbox:"!==a.protocol?(a.pathname+=r+o,URL.format(a)):makeAPIURL("/styles/v1"+a.pathname+"/sprite"+r+o,a.query,t)},module.exports.normalizeTileURL=function(e,r,o){var t=URL.parse(e,!0);if(!r)return e;var a=URL.parse(r);if("mapbox:"!==a.protocol)return e;var s=browser.supportsWebp?".webp":"$1",n=browser.devicePixelRatio>=2||512===o?"@2x":"";return URL.format({protocol:t.protocol,hostname:t.hostname,pathname:t.pathname.replace(/(\.(?:png|jpg)\d*)/,n+s),query:replaceTempAccessToken(t.query)})}; -},{"./browser":119,"./config":123,"./util":136,"url":146}],134:[function(require,module,exports){ -"use strict";function StructArrayType(t){function e(){Struct.apply(this,arguments)}function r(){StructArray.apply(this,arguments),this.members=e.prototype.members}var i=JSON.stringify(t);if(structArrayTypeCache[i])return structArrayTypeCache[i];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(Struct.prototype);var n=0,a=0,s=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},s.indexOf(r.type)<0&&s.push(r.type);var i=sizeOf(r.type);a=Math.max(a,i),r.offset=n=align(n,Math.max(t.alignment,i));for(var o=0;othis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},StructArray.prototype._refreshViews=function(){for(var t=0;t=1)return 1;var e=r*r,n=e*r;return 4*(r<.5?n:3*(r-e)+n-.75)},exports.bezier=function(r,e,n,t){var o=new UnitBezier(r,e,n,t);return function(r){return o.solve(r)}},exports.ease=exports.bezier(.25,.1,.25,1),exports.clamp=function(r,e,n){return Math.min(n,Math.max(e,r))},exports.wrap=function(r,e,n){var t=n-e,o=((r-e)%t+t)%t+e;return o===e?n:o},exports.coalesce=function(){for(var r=0;r=0)return!0;return!1};var warnOnceHistory={};exports.warnOnce=function(r){warnOnceHistory[r]||("undefined"!=typeof console&&console.warn(r),warnOnceHistory[r]=!0)},exports.isCounterClockwise=function(r,e,n){return(n.y-r.y)*(e.x-r.x)>(e.y-r.y)*(n.x-r.x)},exports.calculateSignedArea=function(r){for(var e,n,t=0,o=0,i=r.length,a=i-1;o0||Math.abs(e.y-n.y)>0)&&Math.abs(exports.calculateSignedArea(r))>.01}; -},{"../geo/coordinate":28,"unitbezier":215}],137:[function(require,module,exports){ -"use strict";function Feature(e,t,r,i){this._vectorTileFeature=e,e._z=t,e._x=r,e._y=i,this.properties=e.properties,null!=e.id&&(this.id=e.id)}module.exports=Feature,Feature.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(e){this._geometry=e},toJSON:function(){var e={};for(var t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"toJSON"!==t&&(e[t]=this[t]);return e}}; -},{}],138:[function(require,module,exports){ -"use strict";function WorkerPool(){this.active={}}var WebWorker=require("./web_worker");module.exports=WorkerPool,WorkerPool.prototype={acquire:function(e){if(!this.workers){var r=require("../mapbox-gl").workerCount;for(this.workers=[];this.workers.length=0;n--){var s=r[n];"."===s?r.splice(n,1):".."===s?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function filter(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n=-1&&!t;e--){var n=e>=0?arguments[e]:process.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(r=n+"/"+r,t="/"===n.charAt(0))}return r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"),(t?"/":"")+r||"."},exports.normalize=function(r){var t=exports.isAbsolute(r),e="/"===substr(r,-1);return r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"),r||t||(r="."),r&&e&&(r+="/"),(t?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(r,function(r,t){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),s=e(t.split("/")),i=Math.min(n.length,s.length),o=i,u=0;u1)for(var r=1;r1&&(t=r[0]+"@",e=r[1]),e=e.replace(S,".");var u=e.split("."),i=n(u,o).join(".");return t+i}function t(e){for(var o,n,r=[],t=0,u=e.length;t=55296&&o<=56319&&t65535&&(e-=65536,o+=P(e>>>10&1023|55296),e=56320|1023&e),o+=P(e)}).join("")}function i(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:b}function f(e,o){return e+22+75*(e<26)-((0!=o)<<5)}function c(e,o,n){var r=0;for(e=n?M(e/j):e>>1,e+=M(e/o);e>L*C>>1;r+=b)e=M(e/L);return M(r+(L+1)*e/(e+m))}function l(e){var n,r,t,f,l,s,d,a,p,h,v=[],g=e.length,w=0,m=I,j=A;for(r=e.lastIndexOf(E),r<0&&(r=0),t=0;t=128&&o("not-basic"),v.push(e.charCodeAt(t));for(f=r>0?r+1:0;f=g&&o("invalid-input"),a=i(e.charCodeAt(f++)),(a>=b||a>M((x-w)/s))&&o("overflow"),w+=a*s,p=d<=j?y:d>=j+C?C:d-j,!(aM(x/h)&&o("overflow"),s*=h;n=v.length+1,j=c(w-l,n,0==l),M(w/n)>x-m&&o("overflow"),m+=M(w/n),w%=n,v.splice(w++,0,m)}return u(v)}function s(e){var n,r,u,i,l,s,d,a,p,h,v,g,w,m,j,F=[];for(e=t(e),g=e.length,n=I,r=0,l=A,s=0;s=n&&vM((x-r)/w)&&o("overflow"),r+=(d-n)*w,n=d,s=0;sx&&o("overflow"),v==n){for(a=r,p=b;h=p<=l?y:p>=l+C?C:p-l,!(a= 0x80 (not a basic code point)","invalid-input":"Invalid input"},L=b-y,M=Math.floor,P=String.fromCharCode;if(g={version:"1.4.1",ucs2:{decode:t,encode:u},decode:l,encode:s,toASCII:a,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(p&&h)if(module.exports==p)h.exports=g;else for(w in g)g.hasOwnProperty(w)&&(p[w]=g[w]);else e.punycode=g}(this); -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],143:[function(require,module,exports){ -"use strict";function hasOwnProperty(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(r,e,t,n){e=e||"&",t=t||"=";var o={};if("string"!=typeof r||0===r.length)return o;var a=/\+/g;r=r.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var p=r.length;s>0&&p>s&&(p=s);for(var y=0;y=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)}; -},{}],144:[function(require,module,exports){ -"use strict";function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;n",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");Url.prototype.parse=function(t,s,e){if(!util.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var h=t.indexOf("?"),r=h!==-1&&h127?"x":q[O];if(!b.match(hostnamePartPattern)){var x=P.slice(0,f),U=P.slice(f+1),C=q.match(hostnamePartStart);C&&(x.push(C[1]),U.unshift(C[2])),U.length&&(n="/"+U.join(".")+n),this.hostname=x.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=punycode.toASCII(this.hostname));var A=this.port?":"+this.port:"",w=this.hostname||"";this.host=w+A,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==n[0]&&(n="/"+n))}if(!unsafeProtocol[u])for(var f=0,d=autoEscape.length;f0)&&e.host.split("@");b&&(e.auth=b.shift(),e.host=e.hostname=b.shift())}return e.search=t.search,e.query=t.query,util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!d.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var O=d.slice(-1)[0],j=(e.host||t.host||d.length>1)&&("."===O||".."===O)||""===O,x=0,U=d.length;U>=0;U--)O=d[U],"."===O?d.splice(U,1):".."===O?(d.splice(U,1),x++):x&&(d.splice(U,1),x--);if(!y&&!P)for(;x--;x)d.unshift("..");!y||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift(""),j&&"/"!==d.join("/").substr(-1)&&d.push("");var C=""===d[0]||d[0]&&"/"===d[0].charAt(0);if(q){e.hostname=e.host=C?"":d.length?d.shift():"";var b=!!(e.host&&e.host.indexOf("@")>0)&&e.host.split("@");b&&(e.auth=b.shift(),e.host=e.hostname=b.shift())}return y=y||e.host&&d.length,y&&!C&&d.unshift(""),d.length?e.pathname=d.join("/"):(e.pathname=null,e.path=null),util.isNull(e.pathname)&&util.isNull(e.search)||(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=t.auth||e.auth,e.slashes=e.slashes||t.slashes,e.href=e.format(),e},Url.prototype.parseHost=function(){var t=this.host,s=portPattern.exec(t);s&&(s=s[0],":"!==s&&(this.port=s.substr(1)),t=t.substr(0,t.length-s.length)),t&&(this.hostname=t)}; -},{"./util":147,"punycode":142,"querystring":145}],147:[function(require,module,exports){ -"use strict";module.exports={isString:function(n){return"string"==typeof n},isObject:function(n){return"object"==typeof n&&null!==n},isNull:function(n){return null===n},isNullOrUndefined:function(n){return null==n}}; -},{}],148:[function(require,module,exports){ -module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8}; -},{}],149:[function(require,module,exports){ -(function (process,global){ -function inspect(e,r){var t={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),isBoolean(r)?t.showHidden=r:r&&exports._extend(t,r),isUndefined(t.showHidden)&&(t.showHidden=!1),isUndefined(t.depth)&&(t.depth=2),isUndefined(t.colors)&&(t.colors=!1),isUndefined(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=stylizeWithColor),formatValue(t,e,t.depth)}function stylizeWithColor(e,r){var t=inspect.styles[r];return t?"["+inspect.colors[t][0]+"m"+e+"["+inspect.colors[t][1]+"m":e}function stylizeNoColor(e,r){return e}function arrayToHash(e){var r={};return e.forEach(function(e,t){r[e]=!0}),r}function formatValue(e,r,t){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==exports.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(t,e);return isString(n)||(n=formatValue(e,n,t)),n}var i=formatPrimitive(e,r);if(i)return i;var o=Object.keys(r),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),isError(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(r);if(0===o.length){if(isFunction(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var c="",a=!1,l=["{","}"];if(isArray(r)&&(a=!0,l=["[","]"]),isFunction(r)){var p=r.name?": "+r.name:"";c=" [Function"+p+"]"}if(isRegExp(r)&&(c=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(c=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(c=" "+formatError(r)),0===o.length&&(!a||0==r.length))return l[0]+c+l[1];if(t<0)return isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var f;return f=a?formatArray(e,r,t,s,o):o.map(function(n){return formatProperty(e,r,t,s,n,a)}),e.seen.pop(),reduceToSingleString(f,c,l)}function formatPrimitive(e,r){if(isUndefined(r))return e.stylize("undefined","undefined");if(isString(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return isNumber(r)?e.stylize(""+r,"number"):isBoolean(r)?e.stylize(""+r,"boolean"):isNull(r)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,r,t,n,i){for(var o=[],s=0,u=r.length;s-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return u;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function reduceToSingleString(e,r,t){var n=0,i=e.reduce(function(e,r){return n++,r.indexOf("\n")>=0&&n++,e+r.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?t[0]+(""===r?"":r+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}function timestamp(){var e=new Date,r=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],r].join(" ")}function hasOwnProperty(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var formatRegExp=/%[sdj%]/g;exports.format=function(e){if(!isString(e)){for(var r=[],t=0;t=i)return e;switch(e){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(e){return"[Circular]"}default:return e}}),s=n[t];t255?255:e}function clamp_css_float(e){return e<0?0:e>1?1:e}function parse_css_int(e){return clamp_css_byte("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function parse_css_float(e){return clamp_css_float("%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))}function css_hue_to_rgb(e,r,l){return l<0?l+=1:l>1&&(l-=1),6*l<1?e+(r-e)*l*6:2*l<1?r:3*l<2?e+(r-e)*(2/3-l)*6:e}function parseCSSColor(e){var r=e.replace(/ /g,"").toLowerCase();if(r in kCSSColorTable)return kCSSColorTable[r].slice();if("#"===r[0]){if(4===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null}if(7===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=16777215?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null}return null}var a=r.indexOf("("),t=r.indexOf(")");if(a!==-1&&t+1===r.length){var n=r.substr(0,a),s=r.substr(a+1,t-(a+1)).split(","),o=1;switch(n){case"rgba":if(4!==s.length)return null;o=parse_css_float(s.pop());case"rgb":return 3!==s.length?null:[parse_css_int(s[0]),parse_css_int(s[1]),parse_css_int(s[2]),o];case"hsla":if(4!==s.length)return null;o=parse_css_float(s.pop());case"hsl":if(3!==s.length)return null;var i=(parseFloat(s[0])%360+360)%360/360,u=parse_css_float(s[1]),g=parse_css_float(s[2]),d=g<=.5?g*(u+1):g+u-g*u,c=2*g-d;return[clamp_css_byte(255*css_hue_to_rgb(c,d,i+1/3)),clamp_css_byte(255*css_hue_to_rgb(c,d,i)),clamp_css_byte(255*css_hue_to_rgb(c,d,i-1/3)),o];default:return null}}return null}var kCSSColorTable={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{exports.parseCSSColor=parseCSSColor}catch(e){} -},{}],151:[function(require,module,exports){ -"use strict";function earcut(e,n,r){r=r||2;var t=n&&n.length,i=t?n[0]*r:e.length,x=linkedList(e,0,i,r,!0),a=[];if(!x)return a;var o,l,u,s,v,f,y;if(t&&(x=eliminateHoles(e,n,x,r)),e.length>80*r){o=u=e[0],l=s=e[1];for(var d=r;du&&(u=v),f>s&&(s=f);y=Math.max(u-o,s-l)}return earcutLinked(x,a,r,o,l,y),a}function linkedList(e,n,r,t,i){var x,a;if(i===signedArea(e,n,r,t)>0)for(x=n;x=n;x-=t)a=insertNode(x,e[x],e[x+1],a);return a&&equals(a,a.next)&&(removeNode(a),a=a.next),a}function filterPoints(e,n){if(!e)return e;n||(n=e);var r,t=e;do if(r=!1,t.steiner||!equals(t,t.next)&&0!==area(t.prev,t,t.next))t=t.next;else{if(removeNode(t),t=n=t.prev,t===t.next)return null;r=!0}while(r||t!==n);return n}function earcutLinked(e,n,r,t,i,x,a){if(e){!a&&x&&indexCurve(e,t,i,x);for(var o,l,u=e;e.prev!==e.next;)if(o=e.prev,l=e.next,x?isEarHashed(e,t,i,x):isEar(e))n.push(o.i/r),n.push(e.i/r),n.push(l.i/r),removeNode(e),e=l.next,u=l.next;else if(e=l,e===u){a?1===a?(e=cureLocalIntersections(e,n,r),earcutLinked(e,n,r,t,i,x,2)):2===a&&splitEarcut(e,n,r,t,i,x):earcutLinked(filterPoints(e),n,r,t,i,x,1);break}}}function isEar(e){var n=e.prev,r=e,t=e.next;if(area(n,r,t)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(pointInTriangle(n.x,n.y,r.x,r.y,t.x,t.y,i.x,i.y)&&area(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function isEarHashed(e,n,r,t){var i=e.prev,x=e,a=e.next;if(area(i,x,a)>=0)return!1;for(var o=i.xx.x?i.x>a.x?i.x:a.x:x.x>a.x?x.x:a.x,s=i.y>x.y?i.y>a.y?i.y:a.y:x.y>a.y?x.y:a.y,v=zOrder(o,l,n,r,t),f=zOrder(u,s,n,r,t),y=e.nextZ;y&&y.z<=f;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(y=e.prevZ;y&&y.z>=v;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.prevZ}return!0}function cureLocalIntersections(e,n,r){var t=e;do{var i=t.prev,x=t.next.next;!equals(i,x)&&intersects(i,t,t.next,x)&&locallyInside(i,x)&&locallyInside(x,i)&&(n.push(i.i/r),n.push(t.i/r),n.push(x.i/r),removeNode(t),removeNode(t.next),t=e=x),t=t.next}while(t!==e);return t}function splitEarcut(e,n,r,t,i,x){var a=e;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&isValidDiagonal(a,o)){var l=splitPolygon(a,o);return a=filterPoints(a,a.next),l=filterPoints(l,l.next),earcutLinked(a,n,r,t,i,x),void earcutLinked(l,n,r,t,i,x)}o=o.next}a=a.next}while(a!==e)}function eliminateHoles(e,n,r,t){var i,x,a,o,l,u=[];for(i=0,x=n.length;i=t.next.y){var o=t.x+(x-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=i&&o>a){if(a=o,o===i){if(x===t.y)return t;if(x===t.next.y)return t.next}r=t.x=t.x&&t.x>=s&&pointInTriangle(xr.x)&&locallyInside(t,e)&&(r=t,f=l)),t=t.next;return r}function indexCurve(e,n,r,t){var i=e;do null===i.z&&(i.z=zOrder(i.x,i.y,n,r,t)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,sortLinked(i)}function sortLinked(e){var n,r,t,i,x,a,o,l,u=1;do{for(r=e,e=null,x=null,a=0;r;){for(a++,t=r,o=0,n=0;n0||l>0&&t;)0===o?(i=t,t=t.nextZ,l--):0!==l&&t?r.z<=t.z?(i=r,r=r.nextZ,o--):(i=t,t=t.nextZ,l--):(i=r,r=r.nextZ,o--),x?x.nextZ=i:e=i,i.prevZ=x,x=i;r=t}x.nextZ=null,u*=2}while(a>1);return e}function zOrder(e,n,r,t,i){return e=32767*(e-r)/i,n=32767*(n-t)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),n=16711935&(n|n<<8),n=252645135&(n|n<<4),n=858993459&(n|n<<2),n=1431655765&(n|n<<1),e|n<<1}function getLeftmost(e){var n=e,r=e;do n.x=0&&(e-a)*(t-o)-(r-a)*(n-o)>=0&&(r-a)*(x-o)-(i-a)*(t-o)>=0}function isValidDiagonal(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!intersectsPolygon(e,n)&&locallyInside(e,n)&&locallyInside(n,e)&&middleInside(e,n)}function area(e,n,r){return(n.y-e.y)*(r.x-n.x)-(n.x-e.x)*(r.y-n.y)}function equals(e,n){return e.x===n.x&&e.y===n.y}function intersects(e,n,r,t){return!!(equals(e,n)&&equals(r,t)||equals(e,t)&&equals(r,n))||area(e,n,r)>0!=area(e,n,t)>0&&area(r,t,e)>0!=area(r,t,n)>0}function intersectsPolygon(e,n){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==n.i&&r.next.i!==n.i&&intersects(r,r.next,e,n))return!0;r=r.next}while(r!==e);return!1}function locallyInside(e,n){return area(e.prev,e,e.next)<0?area(e,n,e.next)>=0&&area(e,e.prev,n)>=0:area(e,n,e.prev)<0||area(e,e.next,n)<0}function middleInside(e,n){var r=e,t=!1,i=(e.x+n.x)/2,x=(e.y+n.y)/2;do r.y>x!=r.next.y>x&&i<(r.next.x-r.x)*(x-r.y)/(r.next.y-r.y)+r.x&&(t=!t),r=r.next;while(r!==e);return t}function splitPolygon(e,n){var r=new Node(e.i,e.x,e.y),t=new Node(n.i,n.x,n.y),i=e.next,x=n.prev;return e.next=n,n.prev=e,r.next=i,i.prev=r,t.next=r,r.prev=t,x.next=t,t.prev=x,t}function insertNode(e,n,r,t){var i=new Node(e,n,r);return t?(i.next=t.next,i.prev=t,t.next.prev=i,t.next=i):(i.prev=i,i.next=i),i}function removeNode(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Node(e,n,r){this.i=e,this.x=n,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(e,n,r,t){for(var i=0,x=n,a=r-t;x0&&(t+=e[i-1].length,r.holes.push(t))}return r}; -},{}],152:[function(require,module,exports){ -"use strict";function createFilter(e){return new Function("f","var p = (f && f.properties || {}); return "+compile(e))}function compile(e){if(!e)return"true";var i=e[0];if(e.length<=1)return"any"===i?"false":"true";var n="=="===i?compileComparisonOp(e[1],e[2],"===",!1):"!="===i?compileComparisonOp(e[1],e[2],"!==",!1):"<"===i||">"===i||"<="===i||">="===i?compileComparisonOp(e[1],e[2],i,!0):"any"===i?compileLogicalOp(e.slice(1),"||"):"all"===i?compileLogicalOp(e.slice(1),"&&"):"none"===i?compileNegation(compileLogicalOp(e.slice(1),"||")):"in"===i?compileInOp(e[1],e.slice(2)):"!in"===i?compileNegation(compileInOp(e[1],e.slice(2))):"has"===i?compileHasOp(e[1]):"!has"===i?compileNegation(compileHasOp([e[1]])):"true";return"("+n+")"}function compilePropertyReference(e){return"$type"===e?"f.type":"$id"===e?"f.id":"p["+JSON.stringify(e)+"]"}function compileComparisonOp(e,i,n,r){var o=compilePropertyReference(e),t="$type"===e?types.indexOf(i):JSON.stringify(i);return(r?"typeof "+o+"=== typeof "+t+"&&":"")+o+n+t}function compileLogicalOp(e,i){return e.map(compile).join(i)}function compileInOp(e,i){"$type"===e&&(i=i.map(function(e){return types.indexOf(e)}));var n=JSON.stringify(i.sort(compare)),r=compilePropertyReference(e);return i.length<=200?n+".indexOf("+r+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+r+", "+n+",0,"+(i.length-1)+")"}function compileHasOp(e){return JSON.stringify(e)+" in p"}function compileNegation(e){return"!("+e+")"}function compare(e,i){return ei?1:0}module.exports=createFilter;var types=["Unknown","Point","LineString","Polygon"]; -},{}],153:[function(require,module,exports){ -function rewind(r,e){switch(r&&r.type||null){case"FeatureCollection":return r.features=r.features.map(curryOuter(rewind,e)),r;case"Feature":return r.geometry=rewind(r.geometry,e),r;case"Polygon":case"MultiPolygon":return correct(r,e);default:return r}}function curryOuter(r,e){return function(n){return r(n,e)}}function correct(r,e){return"Polygon"===r.type?r.coordinates=correctRings(r.coordinates,e):"MultiPolygon"===r.type&&(r.coordinates=r.coordinates.map(curryOuter(correctRings,e))),r}function correctRings(r,e){e=!!e,r[0]=wind(r[0],!e);for(var n=1;n=0}var geojsonArea=require("geojson-area");module.exports=rewind; -},{"geojson-area":154}],154:[function(require,module,exports){ -function geometry(r){if("Polygon"===r.type)return polygonArea(r.coordinates);if("MultiPolygon"===r.type){for(var e=0,n=0;n0){e+=Math.abs(ringArea(r[0]));for(var n=1;n2){for(var n,t,o=0;o=t&&s<=n)return e;if(l>n||s=t&&c<=n)h.push(o);else if(!(a>n||c=r&&s<=t&&u.push(l)}return u}function clipGeometry(e,r,t,n,u,i){for(var l=[],s=0;st?(d.push(u(h,f,r),u(h,f,t)),i||(d=newSlice(l,d,v,m,w))):o>=r&&d.push(u(h,f,r)):c>t?ot&&(d.push(u(h,f,t)),i||(d=newSlice(l,d,v,m,w))));h=g[S-1],c=h[n],c>=r&&c<=t&&d.push(h),a=d[d.length-1],i&&a&&(d[0][0]!==a[0]||d[0][1]!==a[1])&&d.push(d[0]),newSlice(l,d,v,m,w)}return l}function newSlice(e,r,t,n,u){return r.length&&(r.area=t,r.dist=n,void 0!==u&&(r.outer=u),e.push(r)),[]}module.exports=clip;var createFeature=require("./feature"); -},{"./feature":158}],157:[function(require,module,exports){ -"use strict";function convert(e,t){var r=[];if("FeatureCollection"===e.type)for(var o=0;o1?1:o,[r,o,0]}function calcSize(e){for(var t,r,o=0,a=0,i=0;i1)return!1;var r=n.geometry[0].length;if(5!==r)return!1;for(var s=0;s1&&console.time("creation"),m=this.tiles[d]=createTile(e,p,i,o,f,t===a.maxZoom),this.tileCoords.push({z:t,x:i,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,o,m.numFeatures,m.numPoints,m.numSimplified),console.timeEnd("creation"));var h="z"+t;this.stats[h]=(this.stats[h]||0)+1,this.total++}if(m.source=e,n){if(t===a.maxZoom||t===n)continue;var x=1<1&&console.time("clipping");var g,v,M,T,b,y,S=.5*a.buffer/a.extent,Z=.5-S,q=.5+S,w=1+S;g=v=M=T=null,b=clip(e,p,i-S,i+q,0,intersectX,m.min[0],m.max[0]),y=clip(e,p,i+Z,i+w,0,intersectX,m.min[0],m.max[0]),b&&(g=clip(b,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),v=clip(b,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),y&&(M=clip(y,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),T=clip(y,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),u>1&&console.timeEnd("clipping"),e.length&&(l.push(g||[],t+1,2*i,2*o),l.push(v||[],t+1,2*i,2*o+1),l.push(M||[],t+1,2*i+1,2*o),l.push(T||[],t+1,2*i+1,2*o+1))}else n&&(c=t)}return c},GeoJSONVT.prototype.getTile=function(e,t,i){var o=this.options,n=o.extent,r=o.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var a,u=e,c=t,p=i;!a&&u>0;)u--,c=Math.floor(c/2),p=Math.floor(p/2),a=this.tiles[toID(u,c,p)];if(!a||!a.source)return null;if(r>1&&console.log("found parent tile z%d-%d-%d",u,c,p),isClippedSquare(a,n,o.buffer))return transform.tile(a,n);r>1&&console.time("drilling down");var d=this.splitTile(a.source,u,c,p,e,t,i);if(r>1&&console.timeEnd("drilling down"),null!==d){var m=1<p&&(s=e,p=r);p>o?(t[s][2]=p,g.push(u),g.push(s),u=s):(n=g.pop(),u=g.pop())}}function getSqSegDist(t,i,e){var p=i[0],r=i[1],s=e[0],o=e[1],f=t[0],u=t[1],n=s-p,g=o-r;if(0!==n||0!==g){var l=((f-p)*n+(u-r)*g)/(n*n+g*g);l>1?(p=s,r=o):l>0&&(p+=n*l,r+=g*l)}return n=f-p,g=u-r,n*n+g*g}module.exports=simplify; -},{}],161:[function(require,module,exports){ -"use strict";function createTile(e,n,r,i,t,u){for(var a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:i,z2:n,transformed:!1,min:[2,1],max:[-1,0]},m=0;ma.max[0]&&(a.max[0]=l[0]),l[1]>a.max[1]&&(a.max[1]=l[1])}return a}function addFeature(e,n,r,i){var t,u,a,m,s=n.geometry,l=n.type,o=[],f=r*r;if(1===l)for(t=0;tf)&&(d.push(m),e.numSimplified++),e.numPoints++;3===l&&rewind(d,a.outer),o.push(d)}else e.numPoints+=a.length;if(o.length){var g={geometry:o,type:l,tags:n.tags||null};null!==n.id&&(g.id=n.id),e.features.push(g)}}function rewind(e,n){var r=signedArea(e);r<0===n&&e.reverse()}function signedArea(e){for(var n,r,i=0,t=0,u=e.length,a=u-1;t0?(o=2*Math.sqrt(l+1),a[3]=.25*o,a[0]=(t[6]-t[9])/o,a[1]=(t[8]-t[2])/o,a[2]=(t[1]-t[4])/o):t[0]>t[5]&t[0]>t[10]?(o=2*Math.sqrt(1+t[0]-t[5]-t[10]),a[3]=(t[6]-t[9])/o,a[0]=.25*o,a[1]=(t[1]+t[4])/o,a[2]=(t[8]+t[2])/o):t[5]>t[10]?(o=2*Math.sqrt(1+t[5]-t[0]-t[10]),a[3]=(t[8]-t[2])/o,a[0]=(t[1]+t[4])/o,a[1]=.25*o,a[2]=(t[6]+t[9])/o):(o=2*Math.sqrt(1+t[10]-t[0]-t[5]),a[3]=(t[1]-t[4])/o,a[0]=(t[8]+t[2])/o,a[1]=(t[6]+t[9])/o,a[2]=.25*o),a},mat4.fromRotationTranslationScale=function(a,t,l,o){var M=t[0],S=t[1],x=t[2],I=t[3],D=M+M,F=S+S,r=x+x,s=M*D,u=M*F,e=M*r,m=S*F,n=S*r,i=x*r,h=I*D,d=I*F,z=I*r,f=o[0],c=o[1],b=o[2];return a[0]=(1-(m+i))*f,a[1]=(u+z)*f,a[2]=(e-d)*f,a[3]=0,a[4]=(u-z)*c,a[5]=(1-(s+i))*c,a[6]=(n+h)*c,a[7]=0,a[8]=(e+d)*b,a[9]=(n-h)*b,a[10]=(1-(s+m))*b,a[11]=0,a[12]=l[0],a[13]=l[1],a[14]=l[2],a[15]=1,a},mat4.fromRotationTranslationScaleOrigin=function(a,t,l,o,M){var S=t[0],x=t[1],I=t[2],D=t[3],F=S+S,r=x+x,s=I+I,u=S*F,e=S*r,m=S*s,n=x*r,i=x*s,h=I*s,d=D*F,z=D*r,f=D*s,c=o[0],b=o[1],w=o[2],v=M[0],p=M[1],g=M[2];return a[0]=(1-(n+h))*c,a[1]=(e+f)*c,a[2]=(m-z)*c,a[3]=0,a[4]=(e-f)*b,a[5]=(1-(u+h))*b,a[6]=(i+d)*b,a[7]=0,a[8]=(m+z)*w,a[9]=(i-d)*w,a[10]=(1-(u+n))*w,a[11]=0,a[12]=l[0]+v-(a[0]*v+a[4]*p+a[8]*g),a[13]=l[1]+p-(a[1]*v+a[5]*p+a[9]*g),a[14]=l[2]+g-(a[2]*v+a[6]*p+a[10]*g),a[15]=1,a},mat4.fromQuat=function(a,t){var l=t[0],o=t[1],M=t[2],S=t[3],x=l+l,I=o+o,D=M+M,F=l*x,r=o*x,s=o*I,u=M*x,e=M*I,m=M*D,n=S*x,i=S*I,h=S*D;return a[0]=1-s-m,a[1]=r+h,a[2]=u-i,a[3]=0,a[4]=r-h,a[5]=1-F-m,a[6]=e+n,a[7]=0,a[8]=u+i,a[9]=e-n,a[10]=1-F-s,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.frustum=function(a,t,l,o,M,S,x){var I=1/(l-t),D=1/(M-o),F=1/(S-x);return a[0]=2*S*I,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*S*D,a[6]=0,a[7]=0,a[8]=(l+t)*I,a[9]=(M+o)*D,a[10]=(x+S)*F,a[11]=-1,a[12]=0,a[13]=0,a[14]=x*S*2*F,a[15]=0,a},mat4.perspective=function(a,t,l,o,M){var S=1/Math.tan(t/2),x=1/(o-M);return a[0]=S/l,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=S,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(M+o)*x,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*M*o*x,a[15]=0,a},mat4.perspectiveFromFieldOfView=function(a,t,l,o){var M=Math.tan(t.upDegrees*Math.PI/180),S=Math.tan(t.downDegrees*Math.PI/180),x=Math.tan(t.leftDegrees*Math.PI/180),I=Math.tan(t.rightDegrees*Math.PI/180),D=2/(x+I),F=2/(M+S);return a[0]=D,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=F,a[6]=0,a[7]=0,a[8]=-((x-I)*D*.5),a[9]=(M-S)*F*.5,a[10]=o/(l-o),a[11]=-1,a[12]=0,a[13]=0,a[14]=o*l/(l-o),a[15]=0,a},mat4.ortho=function(a,t,l,o,M,S,x){var I=1/(t-l),D=1/(o-M),F=1/(S-x);return a[0]=-2*I,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*D,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*F,a[11]=0,a[12]=(t+l)*I,a[13]=(M+o)*D,a[14]=(x+S)*F,a[15]=1,a},mat4.lookAt=function(a,t,l,o){var M,S,x,I,D,F,r,s,u,e,m=t[0],n=t[1],i=t[2],h=o[0],d=o[1],z=o[2],f=l[0],c=l[1],b=l[2];return Math.abs(m-f).999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(vec3.cross(t,r,n),u[0]=t[0],u[1]=t[1],u[2]=t[2],u[3]=1+c,quat.normalize(u,u))}}(),quat.setAxes=function(){var t=mat3.create();return function(a,e,u,r){return t[0]=u[0],t[3]=u[1],t[6]=u[2],t[1]=r[0],t[4]=r[1],t[7]=r[2],t[2]=-e[0],t[5]=-e[1],t[8]=-e[2],quat.normalize(a,quat.fromMat3(a,t))}}(),quat.clone=vec4.clone,quat.fromValues=vec4.fromValues,quat.copy=vec4.copy,quat.set=vec4.set,quat.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},quat.setAxisAngle=function(t,a,e){e=.5*e;var u=Math.sin(e);return t[0]=u*a[0],t[1]=u*a[1],t[2]=u*a[2],t[3]=Math.cos(e),t},quat.getAxisAngle=function(t,a){var e=2*Math.acos(a[3]),u=Math.sin(e/2);return 0!=u?(t[0]=a[0]/u,t[1]=a[1]/u,t[2]=a[2]/u):(t[0]=1,t[1]=0,t[2]=0),e},quat.add=vec4.add,quat.multiply=function(t,a,e){var u=a[0],r=a[1],n=a[2],c=a[3],q=e[0],s=e[1],o=e[2],i=e[3];return t[0]=u*i+c*q+r*o-n*s,t[1]=r*i+c*s+n*q-u*o,t[2]=n*i+c*o+u*s-r*q,t[3]=c*i-u*q-r*s-n*o,t},quat.mul=quat.multiply,quat.scale=vec4.scale,quat.rotateX=function(t,a,e){e*=.5;var u=a[0],r=a[1],n=a[2],c=a[3],q=Math.sin(e),s=Math.cos(e);return t[0]=u*s+c*q,t[1]=r*s+n*q,t[2]=n*s-r*q,t[3]=c*s-u*q,t},quat.rotateY=function(t,a,e){e*=.5;var u=a[0],r=a[1],n=a[2],c=a[3],q=Math.sin(e),s=Math.cos(e);return t[0]=u*s-n*q,t[1]=r*s+c*q,t[2]=n*s+u*q,t[3]=c*s-r*q,t},quat.rotateZ=function(t,a,e){e*=.5;var u=a[0],r=a[1],n=a[2],c=a[3],q=Math.sin(e),s=Math.cos(e);return t[0]=u*s+r*q,t[1]=r*s-u*q,t[2]=n*s+c*q,t[3]=c*s-n*q,t},quat.calculateW=function(t,a){var e=a[0],u=a[1],r=a[2];return t[0]=e,t[1]=u,t[2]=r,t[3]=Math.sqrt(Math.abs(1-e*e-u*u-r*r)),t},quat.dot=vec4.dot,quat.lerp=vec4.lerp,quat.slerp=function(t,a,e,u){var r,n,c,q,s,o=a[0],i=a[1],v=a[2],l=a[3],f=e[0],h=e[1],M=e[2],m=e[3];return n=o*f+i*h+v*M+l*m,n<0&&(n=-n,f=-f,h=-h,M=-M,m=-m),1-n>1e-6?(r=Math.acos(n),c=Math.sin(r),q=Math.sin((1-u)*r)/c,s=Math.sin(u*r)/c):(q=1-u,s=u),t[0]=q*o+s*f,t[1]=q*i+s*h,t[2]=q*v+s*M,t[3]=q*l+s*m,t},quat.sqlerp=function(){var t=quat.create(),a=quat.create();return function(e,u,r,n,c,q){return quat.slerp(t,u,c,q),quat.slerp(a,r,n,q),quat.slerp(e,t,a,2*q*(1-q)),e}}(),quat.invert=function(t,a){var e=a[0],u=a[1],r=a[2],n=a[3],c=e*e+u*u+r*r+n*n,q=c?1/c:0;return t[0]=-e*q,t[1]=-u*q,t[2]=-r*q,t[3]=n*q,t},quat.conjugate=function(t,a){return t[0]=-a[0],t[1]=-a[1],t[2]=-a[2],t[3]=a[3],t},quat.length=vec4.length,quat.len=quat.length,quat.squaredLength=vec4.squaredLength,quat.sqrLen=quat.squaredLength,quat.normalize=vec4.normalize,quat.fromMat3=function(t,a){var e,u=a[0]+a[4]+a[8];if(u>0)e=Math.sqrt(u+1),t[3]=.5*e,e=.5/e,t[0]=(a[5]-a[7])*e,t[1]=(a[6]-a[2])*e,t[2]=(a[1]-a[3])*e;else{var r=0;a[4]>a[0]&&(r=1),a[8]>a[3*r+r]&&(r=2);var n=(r+1)%3,c=(r+2)%3;e=Math.sqrt(a[3*r+r]-a[3*n+n]-a[3*c+c]+1),t[r]=.5*e,e=.5/e,t[3]=(a[3*n+c]-a[3*c+n])*e,t[n]=(a[3*n+r]+a[3*r+n])*e,t[c]=(a[3*c+r]+a[3*r+c])*e}return t},quat.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},quat.exactEquals=vec4.exactEquals,quat.equals=vec4.equals,module.exports=quat; -},{"./common.js":165,"./mat3.js":168,"./vec3.js":172,"./vec4.js":173}],171:[function(require,module,exports){ -var glMatrix=require("./common.js"),vec2={};vec2.create=function(){var n=new glMatrix.ARRAY_TYPE(2);return n[0]=0,n[1]=0,n},vec2.clone=function(n){var t=new glMatrix.ARRAY_TYPE(2);return t[0]=n[0],t[1]=n[1],t},vec2.fromValues=function(n,t){var r=new glMatrix.ARRAY_TYPE(2);return r[0]=n,r[1]=t,r},vec2.copy=function(n,t){return n[0]=t[0],n[1]=t[1],n},vec2.set=function(n,t,r){return n[0]=t,n[1]=r,n},vec2.add=function(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n},vec2.subtract=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n},vec2.sub=vec2.subtract,vec2.multiply=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n},vec2.mul=vec2.multiply,vec2.divide=function(n,t,r){return n[0]=t[0]/r[0],n[1]=t[1]/r[1],n},vec2.div=vec2.divide,vec2.ceil=function(n,t){return n[0]=Math.ceil(t[0]),n[1]=Math.ceil(t[1]),n},vec2.floor=function(n,t){return n[0]=Math.floor(t[0]),n[1]=Math.floor(t[1]),n},vec2.min=function(n,t,r){return n[0]=Math.min(t[0],r[0]),n[1]=Math.min(t[1],r[1]),n},vec2.max=function(n,t,r){return n[0]=Math.max(t[0],r[0]),n[1]=Math.max(t[1],r[1]),n},vec2.round=function(n,t){return n[0]=Math.round(t[0]),n[1]=Math.round(t[1]),n},vec2.scale=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},vec2.scaleAndAdd=function(n,t,r,e){return n[0]=t[0]+r[0]*e,n[1]=t[1]+r[1]*e,n},vec2.distance=function(n,t){var r=t[0]-n[0],e=t[1]-n[1];return Math.sqrt(r*r+e*e)},vec2.dist=vec2.distance,vec2.squaredDistance=function(n,t){var r=t[0]-n[0],e=t[1]-n[1];return r*r+e*e},vec2.sqrDist=vec2.squaredDistance,vec2.length=function(n){var t=n[0],r=n[1];return Math.sqrt(t*t+r*r)},vec2.len=vec2.length,vec2.squaredLength=function(n){var t=n[0],r=n[1];return t*t+r*r},vec2.sqrLen=vec2.squaredLength,vec2.negate=function(n,t){return n[0]=-t[0],n[1]=-t[1],n},vec2.inverse=function(n,t){return n[0]=1/t[0],n[1]=1/t[1],n},vec2.normalize=function(n,t){var r=t[0],e=t[1],c=r*r+e*e;return c>0&&(c=1/Math.sqrt(c),n[0]=t[0]*c,n[1]=t[1]*c),n},vec2.dot=function(n,t){return n[0]*t[0]+n[1]*t[1]},vec2.cross=function(n,t,r){var e=t[0]*r[1]-t[1]*r[0];return n[0]=n[1]=0,n[2]=e,n},vec2.lerp=function(n,t,r,e){var c=t[0],a=t[1];return n[0]=c+e*(r[0]-c),n[1]=a+e*(r[1]-a),n},vec2.random=function(n,t){t=t||1;var r=2*glMatrix.RANDOM()*Math.PI;return n[0]=Math.cos(r)*t,n[1]=Math.sin(r)*t,n},vec2.transformMat2=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[2]*c,n[1]=r[1]*e+r[3]*c,n},vec2.transformMat2d=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[2]*c+r[4],n[1]=r[1]*e+r[3]*c+r[5],n},vec2.transformMat3=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[3]*c+r[6],n[1]=r[1]*e+r[4]*c+r[7],n},vec2.transformMat4=function(n,t,r){var e=t[0],c=t[1];return n[0]=r[0]*e+r[4]*c+r[12],n[1]=r[1]*e+r[5]*c+r[13],n},vec2.forEach=function(){var n=vec2.create();return function(t,r,e,c,a,u){var v,i;for(r||(r=2),e||(e=0),i=c?Math.min(c*r+e,t.length):t.length,v=e;v0&&(c=1/Math.sqrt(c),t[0]=n[0]*c,t[1]=n[1]*c,t[2]=n[2]*c),t},vec3.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]},vec3.cross=function(t,n,r){var e=n[0],a=n[1],c=n[2],u=r[0],v=r[1],i=r[2];return t[0]=a*i-c*v,t[1]=c*u-e*i,t[2]=e*v-a*u,t},vec3.lerp=function(t,n,r,e){var a=n[0],c=n[1],u=n[2];return t[0]=a+e*(r[0]-a),t[1]=c+e*(r[1]-c),t[2]=u+e*(r[2]-u),t},vec3.hermite=function(t,n,r,e,a,c){var u=c*c,v=u*(2*c-3)+1,i=u*(c-2)+c,o=u*(c-1),M=u*(3-2*c);return t[0]=n[0]*v+r[0]*i+e[0]*o+a[0]*M,t[1]=n[1]*v+r[1]*i+e[1]*o+a[1]*M,t[2]=n[2]*v+r[2]*i+e[2]*o+a[2]*M,t},vec3.bezier=function(t,n,r,e,a,c){var u=1-c,v=u*u,i=c*c,o=v*u,M=3*c*v,s=3*i*u,h=i*c;return t[0]=n[0]*o+r[0]*M+e[0]*s+a[0]*h,t[1]=n[1]*o+r[1]*M+e[1]*s+a[1]*h,t[2]=n[2]*o+r[2]*M+e[2]*s+a[2]*h,t},vec3.random=function(t,n){n=n||1;var r=2*glMatrix.RANDOM()*Math.PI,e=2*glMatrix.RANDOM()-1,a=Math.sqrt(1-e*e)*n;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=e*n,t},vec3.transformMat4=function(t,n,r){var e=n[0],a=n[1],c=n[2],u=r[3]*e+r[7]*a+r[11]*c+r[15];return u=u||1,t[0]=(r[0]*e+r[4]*a+r[8]*c+r[12])/u,t[1]=(r[1]*e+r[5]*a+r[9]*c+r[13])/u,t[2]=(r[2]*e+r[6]*a+r[10]*c+r[14])/u,t},vec3.transformMat3=function(t,n,r){var e=n[0],a=n[1],c=n[2];return t[0]=e*r[0]+a*r[3]+c*r[6],t[1]=e*r[1]+a*r[4]+c*r[7],t[2]=e*r[2]+a*r[5]+c*r[8],t},vec3.transformQuat=function(t,n,r){var e=n[0],a=n[1],c=n[2],u=r[0],v=r[1],i=r[2],o=r[3],M=o*e+v*c-i*a,s=o*a+i*e-u*c,h=o*c+u*a-v*e,f=-u*e-v*a-i*c;return t[0]=M*o+f*-u+s*-i-h*-v,t[1]=s*o+f*-v+h*-u-M*-i,t[2]=h*o+f*-i+M*-v-s*-u,t},vec3.rotateX=function(t,n,r,e){var a=[],c=[];return a[0]=n[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],c[0]=a[0],c[1]=a[1]*Math.cos(e)-a[2]*Math.sin(e),c[2]=a[1]*Math.sin(e)+a[2]*Math.cos(e),t[0]=c[0]+r[0],t[1]=c[1]+r[1],t[2]=c[2]+r[2],t},vec3.rotateY=function(t,n,r,e){var a=[],c=[];return a[0]=n[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],c[0]=a[2]*Math.sin(e)+a[0]*Math.cos(e),c[1]=a[1],c[2]=a[2]*Math.cos(e)-a[0]*Math.sin(e),t[0]=c[0]+r[0],t[1]=c[1]+r[1],t[2]=c[2]+r[2],t},vec3.rotateZ=function(t,n,r,e){var a=[],c=[];return a[0]=n[0]-r[0],a[1]=n[1]-r[1],a[2]=n[2]-r[2],c[0]=a[0]*Math.cos(e)-a[1]*Math.sin(e),c[1]=a[0]*Math.sin(e)+a[1]*Math.cos(e),c[2]=a[2],t[0]=c[0]+r[0],t[1]=c[1]+r[1],t[2]=c[2]+r[2],t},vec3.forEach=function(){var t=vec3.create();return function(n,r,e,a,c,u){var v,i;for(r||(r=3),e||(e=0),i=a?Math.min(a*r+e,n.length):n.length,v=e;v1?0:Math.acos(a)},vec3.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},vec3.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]},vec3.equals=function(t,n){var r=t[0],e=t[1],a=t[2],c=n[0],u=n[1],v=n[2];return Math.abs(r-c)<=glMatrix.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(e-u)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(a-v)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))},module.exports=vec3; -},{"./common.js":165}],173:[function(require,module,exports){ -var glMatrix=require("./common.js"),vec4={};vec4.create=function(){var t=new glMatrix.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},vec4.clone=function(t){var n=new glMatrix.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},vec4.fromValues=function(t,n,e,r){var a=new glMatrix.ARRAY_TYPE(4);return a[0]=t,a[1]=n,a[2]=e,a[3]=r,a},vec4.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},vec4.set=function(t,n,e,r,a){return t[0]=n,t[1]=e,t[2]=r,t[3]=a,t},vec4.add=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},vec4.subtract=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t},vec4.sub=vec4.subtract,vec4.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t[3]=n[3]*e[3],t},vec4.mul=vec4.multiply,vec4.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t},vec4.div=vec4.divide,vec4.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t[3]=Math.ceil(n[3]),t},vec4.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t[3]=Math.floor(n[3]),t},vec4.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t[3]=Math.min(n[3],e[3]),t},vec4.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t[3]=Math.max(n[3],e[3]),t},vec4.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t[3]=Math.round(n[3]),t},vec4.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},vec4.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t},vec4.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],a=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(e*e+r*r+a*a+c*c)},vec4.dist=vec4.distance,vec4.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],a=n[2]-t[2],c=n[3]-t[3];return e*e+r*r+a*a+c*c},vec4.sqrDist=vec4.squaredDistance,vec4.length=function(t){var n=t[0],e=t[1],r=t[2],a=t[3];return Math.sqrt(n*n+e*e+r*r+a*a)},vec4.len=vec4.length,vec4.squaredLength=function(t){var n=t[0],e=t[1],r=t[2],a=t[3];return n*n+e*e+r*r+a*a},vec4.sqrLen=vec4.squaredLength,vec4.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},vec4.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},vec4.normalize=function(t,n){var e=n[0],r=n[1],a=n[2],c=n[3],u=e*e+r*r+a*a+c*c;return u>0&&(u=1/Math.sqrt(u),t[0]=e*u,t[1]=r*u,t[2]=a*u,t[3]=c*u),t},vec4.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},vec4.lerp=function(t,n,e,r){var a=n[0],c=n[1],u=n[2],i=n[3];return t[0]=a+r*(e[0]-a),t[1]=c+r*(e[1]-c),t[2]=u+r*(e[2]-u),t[3]=i+r*(e[3]-i),t},vec4.random=function(t,n){return n=n||1,t[0]=glMatrix.RANDOM(),t[1]=glMatrix.RANDOM(),t[2]=glMatrix.RANDOM(),t[3]=glMatrix.RANDOM(),vec4.normalize(t,t),vec4.scale(t,t,n),t},vec4.transformMat4=function(t,n,e){var r=n[0],a=n[1],c=n[2],u=n[3];return t[0]=e[0]*r+e[4]*a+e[8]*c+e[12]*u,t[1]=e[1]*r+e[5]*a+e[9]*c+e[13]*u,t[2]=e[2]*r+e[6]*a+e[10]*c+e[14]*u,t[3]=e[3]*r+e[7]*a+e[11]*c+e[15]*u,t},vec4.transformQuat=function(t,n,e){var r=n[0],a=n[1],c=n[2],u=e[0],i=e[1],v=e[2],o=e[3],M=o*r+i*c-v*a,h=o*a+v*r-u*c,f=o*c+u*a-i*r,l=-u*r-i*a-v*c;return t[0]=M*o+l*-u+h*-v-f*-i,t[1]=h*o+l*-i+f*-u-M*-v,t[2]=f*o+l*-v+M*-i-h*-u,t[3]=n[3],t},vec4.forEach=function(){var t=vec4.create();return function(n,e,r,a,c,u){var i,v;for(e||(e=4),r||(r=0),v=a?Math.min(a*e+r,n.length):n.length,i=r;i=a[u+0]&&s>=a[u+1]?(n[f]=!0,h.push(l[f])):n[f]=!1}}},GridIndex.prototype._forEachCell=function(t,r,e,s,i,h,n){for(var o=this._convertToCellCoord(t),l=this._convertToCellCoord(r),a=this._convertToCellCoord(e),d=this._convertToCellCoord(s),f=o;f<=a;f++)for(var u=l;u<=d;u++){var y=this.d*u+f;if(i.call(this,t,r,e,s,y,h,n))return}},GridIndex.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},GridIndex.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,r=NUM_PARAMS+this.cells.length+1+1,e=0,s=0;st3?Math.pow(r,1/3):r/t2+t0}function lab2xyz(r){return r>t1?r*r*r:t2*(r-t0)}function xyz2rgb(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function rgb2xyz(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function rgbToLab(r){var t=rgb2xyz(r[0]),a=rgb2xyz(r[1]),n=rgb2xyz(r[2]),b=xyz2lab((.4124564*t+.3575761*a+.1804375*n)/Xn),o=xyz2lab((.2126729*t+.7151522*a+.072175*n)/Yn),g=xyz2lab((.0193339*t+.119192*a+.9503041*n)/Zn);return[116*o-16,500*(b-o),200*(o-g),r[3]]}function labToRgb(r){var t=(r[0]+16)/116,a=isNaN(r[1])?t:t+r[1]/500,n=isNaN(r[2])?t:t-r[2]/200;return t=Yn*lab2xyz(t),a=Xn*lab2xyz(a),n=Zn*lab2xyz(n),[xyz2rgb(3.2404542*a-1.5371385*t-.4985314*n),xyz2rgb(-.969266*a+1.8760108*t+.041556*n),xyz2rgb(.0556434*a-.2040259*t+1.0572252*n),r[3]]}function rgbToHcl(r){var t=rgbToLab(r),a=t[0],n=t[1],b=t[2],o=Math.atan2(b,n)*rad2deg;return[o<0?o+360:o,Math.sqrt(n*n+b*b),a,r[3]]}function hclToRgb(r){var t=r[0]*deg2rad,a=r[1],n=r[2];return labToRgb([n,Math.cos(t)*a,Math.sin(t)*a,r[3]])}var Kn=18,Xn=.95047,Yn=1,Zn=1.08883,t0=4/29,t1=6/29,t2=3*t1*t1,t3=t1*t1*t1,deg2rad=Math.PI/180,rad2deg=180/Math.PI;module.exports={lab:{forward:rgbToLab,reverse:labToRgb},hcl:{forward:rgbToHcl,reverse:hclToRgb}}; -},{}],176:[function(require,module,exports){ -"use strict";function identityFunction(t){return t}function createFunction(t,o){var n;if(isFunctionDefinition(t)){var e,r=t.stops&&"object"==typeof t.stops[0][0],i=r||void 0!==t.property,s=r||!i,a=t.type||o||"exponential";if("exponential"===a)e=evaluateExponentialFunction;else if("interval"===a)e=evaluateIntervalFunction;else if("categorical"===a)e=evaluateCategoricalFunction;else{if("identity"!==a)throw new Error('Unknown function type "'+a+'"');e=evaluateIdentityFunction}var p;if(t.colorSpace&&"rgb"!==t.colorSpace){if(!colorSpaces[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);var u=colorSpaces[t.colorSpace];t=JSON.parse(JSON.stringify(t));for(var c=0;c=t.stops.length)break;if(o<=t.stops[e][0])break;e++}return 0===e?t.stops[e][1]:e===t.stops.length?t.stops[e-1][1]:interpolate(o,n,t.stops[e-1][0],t.stops[e][0],t.stops[e-1][1],t.stops[e][1])}function evaluateIdentityFunction(t,o){return o}function interpolate(t,o,n,e,r,i){return"function"==typeof r?function(){var s=r.apply(void 0,arguments),a=i.apply(void 0,arguments);return interpolate(t,o,n,e,s,a)}:r.length?interpolateArray(t,o,n,e,r,i):interpolateNumber(t,o,n,e,r,i)}function interpolateNumber(t,o,n,e,r,i){var s,a=e-n,p=t-n;return s=1===o?p/a:(Math.pow(o,p)-1)/(Math.pow(o,a)-1),r*(1-s)+i*s}function interpolateArray(t,o,n,e,r,i){for(var s=[],a=0;a u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"},debug:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},fillExtrude:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nvarying vec4 v_color;\n#ifdef MAPBOX_GL_JS\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\n\n gl_FragColor = v_color;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\nuniform lowp vec4 u_outline_color;\n\nattribute vec2 a_pos;\nattribute vec3 a_normal;\nattribute float a_edgedistance;\n\nvarying vec4 v_color;\n\n#ifndef MAPBOX_GL_JS\nattribute float minH;\nattribute float maxH;\n#else\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\n\n float ed = a_edgedistance; // use each attrib in order to not trip a VAO assert\n float t = mod(a_normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? maxH : minH, 1);\n\n#ifdef OUTLINE\n color = u_outline_color;\n#endif\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(a_normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (a_normal.y != 0.0) {\n directional *= clamp((t + minH) * pow(maxH / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrudePattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#ifdef MAPBOX_GL_JS\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec3 a_normal;\nattribute float a_edgedistance;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#ifndef MAPBOX_GL_JS\nattribute float minH;\nattribute float maxH;\n#else\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\n\n float t = mod(a_normal.x, 2.0);\n float z = t > 0.0 ? maxH : minH;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the following offset calculation is duplicated from the regular pattern shader:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n if (a_normal.x == 1.0 && a_normal.y == 0.0 && a_normal.z == 16384.0) {\n // extrusion top\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n } else {\n // extrusion side\n float hf = z * u_height_factor;\n\n v_pos_a = (u_tile_units_to_pixels * vec2(a_edgedistance, hf) + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * vec2(a_edgedistance, hf) + offset_b) / scaled_size_b;\n }\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(a_normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (a_normal.y != 0.0) {\n directional *= clamp((t + minH) * pow(maxH / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},fillExtrudeTexture:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_texture, v_pos) * u_opacity;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform int u_xdim;\nuniform int u_ydim;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos.x = a_pos.x / float(u_xdim);\n v_pos.y = 1.0 - a_pos.y / float(u_ydim);\n}\n"},line:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp float u_opacity;\nuniform float u_blur;\n\n#pragma mapbox: define lowp vec4 color\n\nvarying vec2 v_linewidth;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\nuniform mediump float u_blur;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linePattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},lineSDF:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" -},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},symbolSDF:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"}},module.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"; -},{"path":140}],178:[function(require,module,exports){ -"use strict";function ValidationError(r,i){this.message=(r?r+": ":"")+format.apply(format,Array.prototype.slice.call(arguments,2)),null!==i&&void 0!==i&&i.__line__&&(this.line=i.__line__)}var format=require("util").format;module.exports=ValidationError; -},{"util":149}],179:[function(require,module,exports){ -"use strict";module.exports=function(r){for(var t=1;t7)return[new ValidationError(u,i,"constants have been deprecated as of v8")];if(!(i in l.constants))return[new ValidationError(u,i,'constant "%s" not found',i)];e=extend({},e,{value:l.constants[i]})}return n.function&&"object"===getType(i)?r(e):n.type&&a[n.type]?a[n.type](e):t(extend({},e,{valueSpec:n.type?o[n.type]:n}))}; -},{"../error/validation_error":178,"../util/extend":179,"../util/get_type":180,"./validate_array":183,"./validate_boolean":184,"./validate_color":185,"./validate_constants":186,"./validate_enum":187,"./validate_filter":188,"./validate_function":189,"./validate_layer":191,"./validate_number":194,"./validate_object":195,"./validate_source":197,"./validate_string":198}],183:[function(require,module,exports){ -"use strict";var getType=require("../util/get_type"),validate=require("./validate"),ValidationError=require("../error/validation_error");module.exports=function(e){var r=e.value,t=e.valueSpec,a=e.style,n=e.styleSpec,l=e.key,i=e.arrayElementValidator||validate;if("array"!==getType(r))return[new ValidationError(l,r,"array expected, %s found",getType(r))];if(t.length&&r.length!==t.length)return[new ValidationError(l,r,"array length %d expected, length %d found",t.length,r.length)];if(t["min-length"]&&r.length7)return t?[new ValidationError(e,t,"constants have been deprecated as of v8")]:[];var o=getType(t);if("object"!==o)return[new ValidationError(e,t,"object expected, %s found",o)];var n=[];for(var i in t)"@"!==i[0]&&n.push(new ValidationError(e+"."+i,t[i],'constants must start with "@"'));return n}; -},{"../error/validation_error":178,"../util/get_type":180}],187:[function(require,module,exports){ -"use strict";var ValidationError=require("../error/validation_error"),unbundle=require("../util/unbundle_jsonlint");module.exports=function(e){var r=e.key,n=e.value,u=e.valueSpec,o=[];return Array.isArray(u.values)?u.values.indexOf(unbundle(n))===-1&&o.push(new ValidationError(r,n,"expected one of [%s], %s found",u.values.join(", "),n)):Object.keys(u.values).indexOf(unbundle(n))===-1&&o.push(new ValidationError(r,n,"expected one of [%s], %s found",Object.keys(u.values).join(", "),n)),o}; -},{"../error/validation_error":178,"../util/unbundle_jsonlint":181}],188:[function(require,module,exports){ -"use strict";var ValidationError=require("../error/validation_error"),validateEnum=require("./validate_enum"),getType=require("../util/get_type"),unbundle=require("../util/unbundle_jsonlint");module.exports=function e(t){var r,a=t.value,n=t.key,l=t.styleSpec,s=[];if("array"!==getType(a))return[new ValidationError(n,a,"array expected, %s found",getType(a))];if(a.length<1)return[new ValidationError(n,a,"filter array must have at least 1 element")];switch(s=s.concat(validateEnum({key:n+"[0]",value:a[0],valueSpec:l.filter_operator,style:t.style,styleSpec:t.styleSpec})),unbundle(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"==a[1]&&s.push(new ValidationError(n,a,'"$type" cannot be use with operator "%s"',a[0]));case"==":case"!=":3!=a.length&&s.push(new ValidationError(n,a,'filter array for operator "%s" must have 3 elements',a[0]));case"in":case"!in":a.length>=2&&(r=getType(a[1]),"string"!==r?s.push(new ValidationError(n+"[1]",a[1],"string expected, %s found",r)):"@"===a[1][0]&&s.push(new ValidationError(n+"[1]",a[1],"filter key cannot be a constant")));for(var o=2;o=8&&(i&&!e.valueSpec["property-function"]?s.push(new ValidationError(e.key,e.value,"property functions not supported")):u&&!e.valueSpec["zoom-function"]&&s.push(new ValidationError(e.key,e.value,"zoom functions not supported"))),s}; -},{"../error/validation_error":178,"../util/get_type":180,"../util/unbundle_jsonlint":181,"./validate":182,"./validate_array":183,"./validate_number":194,"./validate_object":195}],190:[function(require,module,exports){ -"use strict";var ValidationError=require("../error/validation_error"),validateString=require("./validate_string");module.exports=function(r){var e=r.value,t=r.key,a=validateString(r);return a.length?a:(e.indexOf("{fontstack}")===-1&&a.push(new ValidationError(t,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new ValidationError(t,e,'"glyphs" url must include a "{range}" token')),a)}; -},{"../error/validation_error":178,"./validate_string":198}],191:[function(require,module,exports){ -"use strict";var ValidationError=require("../error/validation_error"),unbundle=require("../util/unbundle_jsonlint"),validateObject=require("./validate_object"),validateFilter=require("./validate_filter"),validatePaintProperty=require("./validate_paint_property"),validateLayoutProperty=require("./validate_layout_property"),extend=require("../util/extend");module.exports=function(e){var r=[],t=e.value,a=e.key,i=e.style,l=e.styleSpec;t.type||t.ref||r.push(new ValidationError(a,t,'either "type" or "ref" is required'));var o=unbundle(t.type),u=unbundle(t.ref);if(t.id)for(var n=0;nm.maximum?[new ValidationError(r,i,"%s is greater than the maximum value %s",i,m.maximum)]:[]}; -},{"../error/validation_error":178,"../util/get_type":180}],195:[function(require,module,exports){ -"use strict";var ValidationError=require("../error/validation_error"),getType=require("../util/get_type"),validate=require("./validate");module.exports=function(e){var r=e.key,t=e.value,i=e.valueSpec,o=e.objectElementValidators||{},a=e.style,l=e.styleSpec,n=[],u=getType(t);if("object"!==u)return[new ValidationError(r,t,"object expected, %s found",u)];for(var d in t){var p=d.split(".")[0],s=i&&(i[p]||i["*"]),c=o[p]||o["*"];s||c?n=n.concat((c||validate)({key:(r?r+".":r)+d,value:t[d],valueSpec:s,style:a,styleSpec:l,object:t,objectKey:d})):""!==r&&1!==r.split(".").length&&n.push(new ValidationError(r,t[d],'unknown property "%s"',d))}for(p in i)i[p].required&&void 0===i[p].default&&void 0===t[p]&&n.push(new ValidationError(r,t,'missing required property "%s"',p));return n}; -},{"../error/validation_error":178,"../util/get_type":180,"./validate":182}],196:[function(require,module,exports){ -"use strict";var validate=require("./validate"),ValidationError=require("../error/validation_error");module.exports=function(e){var r=e.key,a=e.style,t=e.styleSpec,i=e.value,l=e.objectKey,n=t["paint_"+e.layerType];if(!n)return[];var o=l.match(/^(.*)-transition$/);return o&&n[o[1]]&&n[o[1]].transition?validate({key:r,value:i,valueSpec:t.transition,style:a,styleSpec:t}):e.valueSpec||n[l]?validate({key:e.key,value:i,valueSpec:e.valueSpec||n[l],style:a,styleSpec:t}):[new ValidationError(r,i,'unknown property "%s"',l)]}; -},{"../error/validation_error":178,"./validate":182}],197:[function(require,module,exports){ -"use strict";var ValidationError=require("../error/validation_error"),unbundle=require("../util/unbundle_jsonlint"),validateObject=require("./validate_object"),validateEnum=require("./validate_enum");module.exports=function(e){var r=e.value,t=e.key,a=e.styleSpec,l=e.style;if(!r.type)return[new ValidationError(t,r,'"type" is required')];var u=unbundle(r.type);switch(u){case"vector":case"raster":var i=[];if(i=i.concat(validateObject({key:t,value:r,valueSpec:a.source_tile,style:e.style,styleSpec:a})),"url"in r)for(var s in r)["type","url","tileSize"].indexOf(s)<0&&i.push(new ValidationError(t+"."+s,r[s],'a source with a "url" property may not include a "%s" property',s));return i;case"geojson":return validateObject({key:t,value:r,valueSpec:a.source_geojson,style:l,styleSpec:a});case"video":return validateObject({key:t,value:r,valueSpec:a.source_video,style:l,styleSpec:a});case"image":return validateObject({key:t,value:r,valueSpec:a.source_image,style:l,styleSpec:a});default:return validateEnum({key:t+".type",value:r.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:a})}}; -},{"../error/validation_error":178,"../util/unbundle_jsonlint":181,"./validate_enum":187,"./validate_object":195}],198:[function(require,module,exports){ -"use strict";var getType=require("../util/get_type"),ValidationError=require("../error/validation_error");module.exports=function(r){var e=r.value,t=r.key,i=getType(e);return"string"!==i?[new ValidationError(t,e,"string expected, %s found",i)]:[]}; -},{"../error/validation_error":178,"../util/get_type":180}],199:[function(require,module,exports){ -"use strict";function validateStyleMin(e,a){a=a||latestStyleSpec;var t=[];return t=t.concat(validate({key:"",value:e,valueSpec:a.$root,styleSpec:a,style:e,objectElementValidators:{glyphs:validateGlyphsURL}})),a.$version>7&&e.constants&&(t=t.concat(validateConstants({key:"constants",value:e.constants,style:e,styleSpec:a}))),sortErrors(t)}function sortErrors(e){return[].concat(e).sort(function(e,a){return e.line-a.line})}function wrapCleanErrors(e){return function(){return sortErrors(e.apply(this,arguments))}}var validateConstants=require("./validate/validate_constants"),validate=require("./validate/validate"),latestStyleSpec=require("../reference/latest.min"),validateGlyphsURL=require("./validate/validate_glyphs_url");validateStyleMin.source=wrapCleanErrors(require("./validate/validate_source")),validateStyleMin.light=wrapCleanErrors(require("./validate/validate_light")),validateStyleMin.layer=wrapCleanErrors(require("./validate/validate_layer")),validateStyleMin.filter=wrapCleanErrors(require("./validate/validate_filter")),validateStyleMin.paintProperty=wrapCleanErrors(require("./validate/validate_paint_property")),validateStyleMin.layoutProperty=wrapCleanErrors(require("./validate/validate_layout_property")),module.exports=validateStyleMin; -},{"../reference/latest.min":200,"./validate/validate":182,"./validate/validate_constants":186,"./validate/validate_filter":188,"./validate/validate_glyphs_url":190,"./validate/validate_layer":191,"./validate/validate_layout_property":192,"./validate/validate_light":193,"./validate/validate_paint_property":196,"./validate/validate_source":197}],200:[function(require,module,exports){ -module.exports=require("./v8.min.json"); -},{"./v8.min.json":201}],201:[function(require,module,exports){ -module.exports={"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"transition":false},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"function":"interpolated","zoom-function":true,"property-function":false},"color":{"type":"color","default":"#ffffff","function":"interpolated","zoom-function":true,"property-function":false,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true}},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"type":"enum","values":{"vector":{},"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"raster":{},"background":{}}},"metadata":{"type":"*"},"ref":{"type":"string"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":22},"maxzoom":{"type":"number","minimum":0,"maximum":22},"interactive":{"type":"boolean","default":false},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"paint.*":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],"layout_background":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"visible":{},"none":{}},"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"visible":{},"none":{}},"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"visible":{},"none":{}},"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"butt":{},"round":{},"square":{}},"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"bevel":{},"round":{},"miter":{}},"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"visible":{},"none":{}},"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"point":{},"line":{}},"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"icon-text-fit":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":false,"values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"]},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}]},"icon-image":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"property-function":true,"units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"text-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"]},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field"]},"text-max-angle":{"type":"number","default":45,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"visible":{},"none":{}},"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"visible":{},"none":{}},"default":"visible"}},"filter":{"type":"array","value":"*"},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"}},"function_stop":{"type":"array","minimum":0,"maximum":22,"value":["number","color"],"length":2},"paint":["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true},"fill-extrude-height":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"transition":true},"fill-extrude-base":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"transition":true,"requires":[{"<=":"fill-extrude-height"}]}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"property-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{}},"default":"map"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} -},{}],202:[function(require,module,exports){ -"use strict";function isSupported(e){return!!(isBrowser()&&isArraySupported()&&isFunctionSupported()&&isObjectSupported()&&isJSONSupported()&&isWorkerSupported()&&isUint8ClampedArraySupported()&&isWebGLSupportedCached(e&&e.failIfMajorPerformanceCaveat))}function isBrowser(){return"undefined"!=typeof window&&"undefined"!=typeof document}function isArraySupported(){return Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray}function isFunctionSupported(){return Function.prototype&&Function.prototype.bind}function isObjectSupported(){return Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions}function isJSONSupported(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function isWorkerSupported(){return"Worker"in window}function isUint8ClampedArraySupported(){return"Uint8ClampedArray"in window}function isWebGLSupportedCached(e){return void 0===isWebGLSupportedCache[e]&&(isWebGLSupportedCache[e]=isWebGLSupported(e)),isWebGLSupportedCache[e]}function isWebGLSupported(e){var t=document.createElement("canvas"),r=Object.create(isSupported.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=e,t.probablySupportsContext?t.probablySupportsContext("webgl",r)||t.probablySupportsContext("experimental-webgl",r):t.supportsContext?t.supportsContext("webgl",r)||t.supportsContext("experimental-webgl",r):t.getContext("webgl",r)||t.getContext("experimental-webgl",r)}"undefined"!=typeof module&&module.exports?module.exports=isSupported:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=isSupported);var isWebGLSupportedCache={};isSupported.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}; -},{}],203:[function(require,module,exports){ -"use strict";function Buffer(t){var e;t&&t.length&&(e=t,t=e.length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=BufferMethods.readUInt32LE,r.writeUInt32LE=BufferMethods.writeUInt32LE,r.readInt32LE=BufferMethods.readInt32LE,r.writeInt32LE=BufferMethods.writeInt32LE,r.readFloatLE=BufferMethods.readFloatLE,r.writeFloatLE=BufferMethods.writeFloatLE,r.readDoubleLE=BufferMethods.readDoubleLE,r.writeDoubleLE=BufferMethods.writeDoubleLE,r.toString=BufferMethods.toString,r.write=BufferMethods.write,r.slice=BufferMethods.slice,r.copy=BufferMethods.copy,r._isBuffer=!0,r}function encodeString(t){for(var e,r,n=t.length,i=[],o=0;o55295&&e<57344){if(!r){e>56319||o+1===n?i.push(239,191,189):r=e;continue}if(e<56320){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);e<128?i.push(e):e<2048?i.push(e>>6|192,63&e|128):e<65536?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}module.exports=Buffer;var ieee754=require("ieee754"),BufferMethods,lastStr,lastStrEncoded;BufferMethods={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return ieee754.read(this,t,!0,23,4)},readDoubleLE:function(t){return ieee754.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return ieee754.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return ieee754.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var o=e;o=1;){if(i.pos>=e)throw new Error("Given varint doesn't fit into 10 bytes");var r=255&t;i.buf[i.pos++]=r|(t>=128?128:0),t/=128}}function reallocForRawMessage(t,i,e){var r=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.ceil(Math.log(i)/(7*Math.LN2));e.realloc(r);for(var s=e.pos-1;s>=t;s--)e.buf[s+r]=e.buf[s]}function writePackedVarint(t,i){for(var e=0;e>3,n=this.pos;t(s,i,this),this.pos===n&&this.skip(r)}return i},readMessage:function(t,i){return this.readFields(t,i,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,i,e=this.buf;return i=e[this.pos++],t=127&i,i<128?t:(i=e[this.pos++],t|=(127&i)<<7,i<128?t:(i=e[this.pos++],t|=(127&i)<<14,i<128?t:(i=e[this.pos++],t|=(127&i)<<21,i<128?t:readVarintRemainder(t,this))))},readVarint64:function(){var t=this.pos,i=this.readVarint();if(i127;);else if(i===Pbf.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Pbf.Fixed32)this.pos+=4;else{if(i!==Pbf.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(t,i){this.writeVarint(t<<3|i)},realloc:function(t){for(var i=this.length||16;i268435455?void writeBigVarint(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var i=Buffer.byteLength(t);this.writeVarint(i),this.realloc(i),this.buf.write(t,this.pos),this.pos+=i},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var i=t.length;this.writeVarint(i),this.realloc(i);for(var e=0;e=128&&reallocForRawMessage(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,i,e){this.writeTag(t,Pbf.Bytes),this.writeRawMessage(i,e)},writePackedVarint:function(t,i){this.writeMessage(t,writePackedVarint,i)},writePackedSVarint:function(t,i){this.writeMessage(t,writePackedSVarint,i)},writePackedBoolean:function(t,i){this.writeMessage(t,writePackedBoolean,i)},writePackedFloat:function(t,i){this.writeMessage(t,writePackedFloat,i)},writePackedDouble:function(t,i){this.writeMessage(t,writePackedDouble,i)},writePackedFixed32:function(t,i){this.writeMessage(t,writePackedFixed32,i)},writePackedSFixed32:function(t,i){this.writeMessage(t,writePackedSFixed32,i)},writePackedFixed64:function(t,i){this.writeMessage(t,writePackedFixed64,i)},writePackedSFixed64:function(t,i){this.writeMessage(t,writePackedSFixed64,i)},writeBytesField:function(t,i){this.writeTag(t,Pbf.Bytes),this.writeBytes(i)},writeFixed32Field:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeSFixed64(i)},writeVarintField:function(t,i){this.writeTag(t,Pbf.Varint),this.writeVarint(i)},writeSVarintField:function(t,i){this.writeTag(t,Pbf.Varint),this.writeSVarint(i)},writeStringField:function(t,i){this.writeTag(t,Pbf.Bytes),this.writeString(i)},writeFloatField:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeFloat(i)},writeDoubleField:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeDouble(i)},writeBooleanField:function(t,i){this.writeVarintField(t,Boolean(i))}}; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./buffer":203}],205:[function(require,module,exports){ -exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:(s?-1:1)*(1/0);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),o+=p+N>=1?n/f:n*Math.pow(2,1-N),o*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; -},{}],206:[function(require,module,exports){ -"use strict";function Point(t,n){this.x=t,this.y=n}module.exports=Point,Point.prototype={clone:function(){return new Point(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var n=Math.cos(t),i=Math.sin(t),s=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=s,this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Point.convert=function(t){return t instanceof Point?t:Array.isArray(t)?new Point(t[0],t[1]):t}; -},{}],207:[function(require,module,exports){ -"use strict";function partialSort(a,t,r,o,p){for(r=r||0,o=o||a.length-1,p=p||defaultCompare;o>r;){if(o-r>600){var f=o-r+1,e=t-r+1,l=Math.log(f),s=.5*Math.exp(2*l/3),i=.5*Math.sqrt(l*s*(f-s)/f)*(e-f/2<0?-1:1),n=Math.max(r,Math.floor(t-e*s/f+i)),h=Math.min(o,Math.floor(t+(f-e)*s/f+i));partialSort(a,t,n,h,p)}var u=a[t],M=r,w=o;for(swap(a,r,t),p(a[o],u)>0&&swap(a,r,o);M0;)w--}0===p(a[r],u)?swap(a,r,w):(w++,swap(a,w,o)),w<=t&&(r=w+1),t<=w&&(o=w-1)}}function swap(a,t,r){var o=a[t];a[t]=a[r],a[r]=o}function defaultCompare(a,t){return at?1:0}module.exports=partialSort; -},{}],208:[function(require,module,exports){ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ShelfPack=e()}(this,function(){function t(t,e,s){s=s||{},this.w=t||64,this.h=e||64,this.autoResize=!!s.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function e(t,e,s){this.x=0,this.y=t,this.w=this.free=e,this.h=s}return t.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var s,h,i,n=[],r=0;r0){for(var o=0,f=0,u=0;uh.h||t>h.free||sl)&&(a=2*Math.max(t,l)),(ff)&&(u=2*Math.max(s,f)),this.resize(a,u),this.packOne(t,s)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var s=0;sthis.free||e>this.h)return null;var s=this.x;return this.x+=t,this.free-=t,{x:s,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}); -},{}],209:[function(require,module,exports){ -"use strict";function supercluster(t){return new SuperCluster(t)}function SuperCluster(t){this.options=extend(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function createCluster(t,e,o,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:o}}function createPointCluster(t,e){var o=t.geometry.coordinates;return createCluster(lngX(o[0]),latY(o[1]),1,e)}function getClusterJSON(t){return{type:"Feature",properties:getClusterProperties(t),geometry:{type:"Point",coordinates:[xLng(t.x),yLat(t.y)]}}}function getClusterProperties(t){var e=t.numPoints,o=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:o}}function lngX(t){return t/360+.5}function latY(t){var e=Math.sin(t*Math.PI/180),o=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return o<0?0:o>1?1:o}function xLng(t){return 360*(t-.5)}function yLat(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function extend(t,e){for(var o in e)t[o]=e[o];return t}function getX(t){return t.x}function getY(t){return t.y}var kdbush=require("kdbush");module.exports=supercluster,SuperCluster.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var o="prepare "+t.length+" points";e&&console.time(o),this.points=t;var n=t.map(createPointCluster);e&&console.timeEnd(o);for(var r=this.options.maxZoom;r>=this.options.minZoom;r--){var i=+Date.now();this.trees[r+1]=kdbush(n,getX,getY,this.options.nodeSize,Float32Array),n=this._cluster(n,r),e&&console.log("z%d: %d clusters in %dms",r,n.length,+Date.now()-i)}return this.trees[this.options.minZoom]=kdbush(n,getX,getY,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var o=this.trees[this._limitZoom(e)],n=o.range(lngX(t[0]),latY(t[3]),lngX(t[2]),latY(t[1])),r=[],i=0;i=s&&a<=h&&t>=u&&t<=e&&f.push(p[i]);else{var c=Math.floor((g+v)/2);a=r[2*c],t=r[2*c+1],a>=s&&a<=h&&t>=u&&t<=e&&f.push(p[c]);var d=(l+1)%2;(0===l?s<=a:u<=t)&&(n.push(g),n.push(c-1),n.push(d)),(0===l?h>=a:e>=t)&&(n.push(c+1),n.push(v),n.push(d))}}return f}module.exports=range; -},{}],212:[function(require,module,exports){ -"use strict";function sortKD(t,a,o,s,r,e){if(!(r-s<=o)){var f=Math.floor((s+r)/2);select(t,a,f,s,r,e%2),sortKD(t,a,o,s,f-1,e+1),sortKD(t,a,o,f+1,r,e+1)}}function select(t,a,o,s,r,e){for(;r>s;){if(r-s>600){var f=r-s+1,p=o-s+1,w=Math.log(f),m=.5*Math.exp(2*w/3),n=.5*Math.sqrt(w*m*(f-m)/f)*(p-f/2<0?-1:1),c=Math.max(s,Math.floor(o-p*m/f+n)),h=Math.min(r,Math.floor(o+(f-p)*m/f+n));select(t,a,o,c,h,e)}var i=a[2*o+e],l=s,M=r;for(swapItem(t,a,s,o),a[2*r+e]>i&&swapItem(t,a,s,r);li;)M--}a[2*s+e]===i?swapItem(t,a,s,M):(M++,swapItem(t,a,M,r)),M<=o&&(s=M+1),o<=M&&(r=M-1)}}function swapItem(t,a,o,s){swap(t,o,s),swap(a,2*o,2*s),swap(a,2*o+1,2*s+1)}function swap(t,a,o){var s=t[a];t[a]=t[o],t[o]=s}module.exports=sortKD; -},{}],213:[function(require,module,exports){ -"use strict";function within(s,p,r,t,u,h){for(var i=[0,s.length-1,0],o=[],n=u*u;i.length;){var e=i.pop(),a=i.pop(),f=i.pop();if(a-f<=h)for(var v=f;v<=a;v++)sqDist(p[2*v],p[2*v+1],r,t)<=n&&o.push(s[v]);else{var l=Math.floor((f+a)/2),c=p[2*l],q=p[2*l+1];sqDist(c,q,r,t)<=n&&o.push(s[l]);var D=(e+1)%2;(0===e?r-u<=c:t-u<=q)&&(i.push(f),i.push(l-1),i.push(D)),(0===e?r+u>=c:t+u>=q)&&(i.push(l+1),i.push(a),i.push(D))}}return o}function sqDist(s,p,r,t){var u=s-r,h=p-t;return u*u+h*h}module.exports=within; -},{}],214:[function(require,module,exports){ -"use strict";function TinyQueue(t,i){if(!(this instanceof TinyQueue))return new TinyQueue(t,i);if(this.data=t||[],this.length=this.data.length,this.compare=i||defaultCompare,t)for(var a=Math.floor(this.length/2);a>=0;a--)this._down(a)}function defaultCompare(t,i){return ti?1:0}function swap(t,i,a){var n=t[i];t[i]=t[a],t[a]=n}module.exports=TinyQueue,TinyQueue.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){var t=this.data[0];return this.data[0]=this.data[this.length-1],this.length--,this.data.pop(),this._down(0),t},peek:function(){return this.data[0]},_up:function(t){for(var i=this.data,a=this.compare;t>0;){var n=Math.floor((t-1)/2);if(!(a(i[t],i[n])<0))break;swap(i,n,t),t=n}},_down:function(t){for(var i=this.data,a=this.compare,n=this.length;;){var e=2*t+1,h=e+1,s=t;if(er)return r;for(;eh?e=s:r=s,s=.5*(r-e)+e}return s},UnitBezier.prototype.solve=function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}; -},{}],216:[function(require,module,exports){ -module.exports.VectorTile=require("./lib/vectortile.js"),module.exports.VectorTileFeature=require("./lib/vectortilefeature.js"),module.exports.VectorTileLayer=require("./lib/vectortilelayer.js"); -},{"./lib/vectortile.js":217,"./lib/vectortilefeature.js":218,"./lib/vectortilelayer.js":219}],217:[function(require,module,exports){ -"use strict";function VectorTile(e,r){this.layers=e.readFields(readTile,{},r)}function readTile(e,r,i){if(3===e){var t=new VectorTileLayer(i,i.readVarint()+i.pos);t.length&&(r[t.name]=t)}}var VectorTileLayer=require("./vectortilelayer");module.exports=VectorTile; -},{"./vectortilelayer":219}],218:[function(require,module,exports){ -"use strict";function VectorTileFeature(e,t,r,i,a){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=a,e.readFields(readFeature,this,t)}function readFeature(e,t,r){1==e?t.id=r.readVarint():2==e?readTag(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function readTag(e,t){for(var r=e.readVarint()+e.pos;e.pos>3}if(a--,1===i||2===i)o+=e.readSVarint(),n+=e.readSVarint(),1===i&&(t&&s.push(t),t=[]),t.push(new Point(o,n));else{if(7!==i)throw new Error("unknown command "+i);t&&t.push(t[0].clone())}}return t&&s.push(t),s},VectorTileFeature.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,i=0,a=0,o=0,n=1/0,s=-(1/0),p=1/0,h=-(1/0);e.pos>3}if(i--,1===r||2===r)a+=e.readSVarint(),o+=e.readSVarint(),as&&(s=a),oh&&(h=o);else if(7!==r)throw new Error("unknown command "+r)}return[n,p,s,h]},VectorTileFeature.prototype.toGeoJSON=function(e,t,r){function i(e){for(var t=0;t>3;t=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return t}var VectorTileFeature=require("./vectortilefeature.js");module.exports=VectorTileLayer,VectorTileLayer.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new VectorTileFeature(this._pbf,t,this.extent,this._keys,this._values)}; -},{"./vectortilefeature.js":218}],220:[function(require,module,exports){ -function fromVectorTileJs(e){var r=[];for(var o in e.layers)r.push(prepareLayer(e.layers[o]));var t=new Pbf;return vtpb.tile.write({layers:r},t),t.finish()}function fromGeojsonVt(e){var r={};for(var o in e)r[o]=new GeoJSONWrapper(e[o].features),r[o].name=o;return fromVectorTileJs({layers:r})}function prepareLayer(e){for(var r={name:e.name||"",version:e.version||1,extent:e.extent||4096,keys:[],values:[],features:[]},o={},t={},n=0;n>31}function encodeGeometry(e){for(var r=[],o=0,t=0,n=e.length,a=0;a