u)&&(l=2*Math.max(r,u)),this.resize(h,l),this.packOne(t,r,n)):null},t.prototype.allocFreebin=function(t,e,r,n){var i=this.freebins.splice(t,1)[0];return i.id=n,i.w=e,i.h=r,i.refcount=0,this.bins[n]=i,this.ref(i),i},t.prototype.allocShelf=function(t,e,r,n){var i=this.shelves[t].alloc(e,r,n);return this.bins[n]=i,this.ref(i),i},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;r 0;)p--}0===i(t[n],h)?ot(t,n,p):ot(t,++p,r),p<=e&&(n=p+1),e<=p&&(r=p-1)}}function ot(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function st(t,e){if(!(this instanceof st))return new st(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function at(t,e){ut(t,0,t.children.length,e,t)}function ut(t,e,n,r,i){i||(i=yt(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s 0;)p--}0===i(t[n],h)?Be(t,n,p):Be(t,++p,r),p<=e&&(n=p+1),e<=p&&(r=p-1)}}function Be(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function ke(t,e){if(!(this instanceof ke))return new ke(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function ze(t,e){je(t,0,t.children.length,e,t)}function je(t,e,n,r,i){i||(i=Ze(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s>1,p=-7,h=r?i-1:0,c=r?-1:1,f=t[e+h];for(h+=c,a=f&(1<<-p)-1,f>>=-p,p+=s;p>0;a=256*a+t[e+h],h+=c,p-=8);for(o=a&(1<<-p)-1,a>>=-p,p+=n;p>0;o=256*o+t[e+h],h+=c,p-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),a-=l;}return(f?-1:1)*o*Math.pow(2,a-n)},jo=function(t,e,r,n,i,a){var o,s,u,l=8*a-i-1,p=(1<a&&(o=a-m);}if(this.lngRange){var _=this.x,g=c.x/2;_-gl&&(n=l-g);}void 0===n&&void 0===o||(this.center=this.unproject(new t.default(void 0!==n?n:this.x,void 0!==o?o:this.y))),this._unmodified=u,this._constraining=!1;}},wi.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var e=this._fov/2,i=Math.PI/2+this._pitch,n=Math.sin(e)*this.cameraToCenterDistance/Math.sin(Math.PI-i-e),o=this.x,r=this.y,a=1.01*(Math.cos(Math.PI/2-this._pitch)*n+this.cameraToCenterDistance),s=new Float64Array(16);t.perspective(s,this._fov,this.width/this.height,1,a),t.scale(s,s,[1,-1,1]),t.translate(s,s,[0,0,-this.cameraToCenterDistance]),t.rotateX(s,s,this._pitch),t.rotateZ(s,s,this.angle),t.translate(s,s,[-o,-r,0]);var l=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));t.scale(s,s,[1,1,l,1]),this.projMatrix=s;var c=this.width%2/2,u=this.height%2/2,h=Math.cos(this.angle),p=Math.sin(this.angle),d=o-Math.round(o)+h*c+p*u,f=r-Math.round(r)+h*u+p*c,m=new Float64Array(s);if(t.translate(m,m,[d>.5?d-1:d,f>.5?f-1:f,0]),this.alignedProjMatrix=m,s=t.create(),t.scale(s,s,[this.width/2,-this.height/2,1]),t.translate(s,s,[1,-1,0]),this.pixelMatrix=t.multiply(new Float64Array(16),s,this.projMatrix),!(s=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error(\"failed to invert matrix\");this.pixelMatrixInverse=s,this._posMatrixCache={},this._alignedPosMatrixCache={};}},wi.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.default(0,0)).zoomTo(this.zoom),i=[e.column*this.tileSize,e.row*this.tileSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance},Object.defineProperties(wi.prototype,Ei);var Ti=function(){var e,i,n,o,r;t.bindAll([\"_onHashChange\",\"_updateHash\"],this),this._updateHash=(e=this._updateHashUnthrottled.bind(this),i=300,n=!1,o=0,r=function(){o=0,n&&(e(),o=setTimeout(r,i),n=!1);},function(){return n=!0,o||r(),o});};Ti.prototype.addTo=function(e){return this._map=e,t.default$1.addEventListener(\"hashchange\",this._onHashChange,!1),this._map.on(\"moveend\",this._updateHash),this},Ti.prototype.remove=function(){return t.default$1.removeEventListener(\"hashchange\",this._onHashChange,!1),this._map.off(\"moveend\",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Ti.prototype.getHashString=function(t){var e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),r=Math.round(e.lng*o)/o,a=Math.round(e.lat*o)/o,s=this._map.getBearing(),l=this._map.getPitch(),c=\"\";return c+=t?\"#/\"+r+\"/\"+a+\"/\"+i:\"#\"+i+\"/\"+a+\"/\"+r,(s||l)&&(c+=\"/\"+Math.round(10*s)/10),l&&(c+=\"/\"+Math.round(l)),c},Ti.prototype._onHashChange=function(){var e=t.default$1.location.hash.replace(\"#\",\"\").split(\"/\");return e.length>=3&&(this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:+(e[3]||0),pitch:+(e[4]||0)}),!0)},Ti.prototype._updateHashUnthrottled=function(){var e=this.getHashString();t.default$1.history.replaceState(t.default$1.history.state,\"\",e);};var Ii=function(e){function n(n,o,r,a){void 0===a&&(a={});var s=i.mousePos(o.getCanvasContainer(),r),l=o.unproject(s);e.call(this,n,t.extend({point:s,lngLat:l,originalEvent:r},a)),this._defaultPrevented=!1,this.target=o;}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var o={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0;},o.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,o),n}(t.Event),Ci=function(e){function n(n,o,r){var a=i.touchPos(o.getCanvasContainer(),r),s=a.map(function(t){return o.unproject(t)}),l=a.reduce(function(t,e,i,n){return t.add(e.div(n.length))},new t.default(0,0)),c=o.unproject(l);e.call(this,n,{points:a,point:l,lngLats:s,lngLat:c,originalEvent:r}),this._defaultPrevented=!1;}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var o={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0;},o.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,o),n}(t.Event),Si=function(t){function e(e,i,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1;}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0;},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,i),e}(t.Event),zi=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,t.bindAll([\"_onWheel\",\"_onTimeout\",\"_onScrollFrame\",\"_onScrollFinished\"],this);};zi.prototype.isEnabled=function(){return!!this._enabled},zi.prototype.isActive=function(){return!!this._active},zi.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&\"center\"===t.around);},zi.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1);},zi.prototype.onWheel=function(e){if(this.isEnabled()){var i=e.deltaMode===t.default$1.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.default$2.now(),o=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%4.000244140625==0?this._type=\"wheel\":0!==i&&Math.abs(i)<4?this._type=\"trackpad\":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this.isActive()||this._start(e)),e.preventDefault();}},zi.prototype._onTimeout=function(t){this._type=\"wheel\",this._delta-=this._lastValue,this.isActive()||this._start(t);},zi.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this._map.fire(new t.Event(\"movestart\",{originalEvent:e})),this._map.fire(new t.Event(\"zoomstart\",{originalEvent:e})),this._finishTimeout&&clearTimeout(this._finishTimeout);var n=i.mousePos(this._el,e);this._around=B.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame));}},zi.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var i=this._map.transform;if(0!==this._delta){var n=\"wheel\"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,o=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==o&&(o=1/o);var r=\"number\"==typeof this._targetZoom?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(r*o))),\"wheel\"===this._type&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}var a=\"number\"==typeof this._targetZoom?this._targetZoom:i.zoom,s=this._startZoom,l=this._easing,c=!1;if(\"wheel\"===this._type&&s&&l){var u=Math.min((t.default$2.now()-this._lastWheelEventTime)/200,1),h=l(u);i.zoom=t.number(s,a,h),u<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):c=!0;}else i.zoom=a,c=!0;i.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event(\"move\",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event(\"zoom\",{originalEvent:this._lastWheelEvent})),c&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._map.fire(new t.Event(\"zoomend\",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event(\"moveend\",{originalEvent:e._lastWheelEvent})),delete e._targetZoom;},200));}},zi.prototype._smoothOutEasing=function(e){var i=t.ease;if(this._prevEase){var n=this._prevEase,o=(t.default$2.now()-n.start)/n.duration,r=n.easing(o+.01)-n.easing(o),a=.27/Math.sqrt(r*r+1e-4)*.01,s=Math.sqrt(.0729-a*a);i=t.bezier(a,s,.25,1);}return this._prevEase={start:t.default$2.now(),duration:e,easing:i},i};var Ai=function(e,i){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1,t.bindAll([\"_onMouseMove\",\"_onMouseUp\",\"_onKeyDown\"],this);};Ai.prototype.isEnabled=function(){return!!this._enabled},Ai.prototype.isActive=function(){return!!this._active},Ai.prototype.enable=function(){this.isEnabled()||(this._enabled=!0);},Ai.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1);},Ai.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.default$1.document.addEventListener(\"mousemove\",this._onMouseMove,!1),t.default$1.document.addEventListener(\"keydown\",this._onKeyDown,!1),t.default$1.document.addEventListener(\"mouseup\",this._onMouseUp,!1),i.disableDrag(),this._startPos=this._lastPos=i.mousePos(this._el,e),this._active=!0);},Ai.prototype._onMouseMove=function(t){var e=i.mousePos(this._el,t);if(!(this._lastPos.equals(e)||!this._box&&e.dist(this._startPos)this._map.transform.width-s/2&&a.push(\"right\"),o=0===a.length?\"bottom\":a.join(\"-\");}var c=n.add(r[o]).round();i.setTransform(this._container,Ji[o]+\" translate(\"+c.x+\"px,\"+c.y+\"px)\"),Qi(this._container,o,\"popup\");}},n.prototype._onClickClose=function(){this.remove();},n}(t.Evented);var pn={version:\"0.47.0\",supported:e,workerCount:Math.max(Math.floor(t.default$2.hardwareConcurrency/2),1),setRTLTextPlugin:t.setRTLTextPlugin,Map:qi,NavigationControl:Ki,GeolocateControl:on,AttributionControl:Ui,ScaleControl:an,FullscreenControl:cn,Popup:hn,Marker:en,Style:Ue,LngLat:B,LngLatBounds:O,Point:t.default,Evented:t.Evented,config:h,get accessToken(){return h.ACCESS_TOKEN},set accessToken(t){h.ACCESS_TOKEN=t;},workerUrl:\"\"};return pn});\n\n//\n\nreturn mapboxgl;\n\n})));\n//# sourceMappingURL=mapbox-gl.js.map\n","!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],e):e(t.turf={})}(this,function(t){\"use strict\";function e(t,e,n){if(n=n||{},!I(n))throw new Error(\"options is invalid\");var r=n.bbox,i=n.id;if(void 0===t)throw new Error(\"geometry is required\");if(e&&e.constructor!==Object)throw new Error(\"properties must be an Object\");r&&N(r),i&&C(i);var o={type:\"Feature\"};return i&&(o.id=i),r&&(o.bbox=r),o.properties=e||{},o.geometry=t,o}function n(t,e,n){if(n=n||{},!I(n))throw new Error(\"options is invalid\");var i=n.bbox;if(!t)throw new Error(\"type is required\");if(!e)throw new Error(\"coordinates is required\");if(!Array.isArray(e))throw new Error(\"coordinates must be an Array\");i&&N(i);var s;switch(t){case\"Point\":s=r(e).geometry;break;case\"LineString\":s=a(e).geometry;break;case\"Polygon\":s=o(e).geometry;break;case\"MultiPoint\":s=l(e).geometry;break;case\"MultiLineString\":s=h(e).geometry;break;case\"MultiPolygon\":s=p(e).geometry;break;default:throw new Error(t+\" is invalid\")}return i&&(s.bbox=i),s}function r(t,n,r){if(!t)throw new Error(\"coordinates is required\");if(!Array.isArray(t))throw new Error(\"coordinates must be an Array\");if(t.length<2)throw new Error(\"coordinates must be at least 2 numbers long\");if(!b(t[0])||!b(t[1]))throw new Error(\"coordinates must contain numbers\");return e({type:\"Point\",coordinates:t},n,r)}function i(t,e,n){if(!t)throw new Error(\"coordinates is required\");if(!Array.isArray(t))throw new Error(\"coordinates must be an Array\");return c(t.map(function(t){return r(t,e)}),n)}function o(t,n,r){if(!t)throw new Error(\"coordinates is required\");for(var i=0;i=0;h--)if(Math.abs(e[h][0][0]-u)<=1e-7&&Math.abs(e[h][0][1]-c)<=1e-7){for(var l=s.path.length-2;l>=0;--l)e[h].unshift(s.path[l]);a=!0;break}a||(e[n++]=s.path)}})}),e}(function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=0;oe&&(i.push(n),r=n);return r!==n&&i.push(n),i}(t,r),t=function(t,e){var n=t.length-1,r=[t[0]];return ie(t,0,n,e,r),r.push(t[n]),r}(t,r)}function se(t,e,n){return oe(t.map(function(t){return{x:t[0],y:t[1],z:t[2]}}),e,n).map(function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]})}function ae(t,e,n){return t.map(function(t){var r=t.map(function(t){return{x:t[0],y:t[1]}});if(r.length<4)throw new Error(\"invalid polygon\");for(var i=oe(r,e,n).map(function(t){return[t.x,t.y]});!function(t){return!(t.length<3||3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}(i);)i=oe(r,e-=.01*e,n).map(function(t){return[t.x,t.y]});return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i})}function ue(t,e){if(e=e||{},!I(e))throw new Error(\"options is invalid\");var n=e.resolution||1e4,r=e.sharpness||.85;if(!t)throw new Error(\"line is required\");if(!b(n))throw new Error(\"resolution must be an number\");if(!b(r))throw new Error(\"sharpness must be an number\");for(var i=[],o=new bs({points:J(t).coordinates.map(function(t){return{x:t[0],y:t[1]}}),duration:n,sharpness:r}),s=0;s