The COVID-19 pandemics is still impacting many countries around the world. Nations where the first wave of the pandemics is over are now facing the challenges of reopening phases. After many facilities, industries and schools have been closed, the question is now what to reopen first, which locations are safer and how to avoid overcrowding. Measures, such as smart-working and on-line courses for schools, are being discussed by many governments in Europe. Never as of today, the critical role of public transport and transportation systems, in general, is evident to the public opinion.
The shift in individual behaviour is another challenge that will have to be addressed and hard to foresee to the present day. Any planning related to transportations and activities reopening could fail because of unpredictable changes in what activities individuals typically do, where do they typically travel, why they move there and so on.
In this report, we show an update to what we presented in a previous post. There, we showed how it is possible to understand the preference of individuals in terms of visited locations. We performed that activity by merging open data about Points of Interest coming from OpenStreetMap, and High-Precision Anonymized Location-Based data (HFLB) provided in the context of CUEBIQ’s Data for Good Program.
In the following, we will present some interactive charts that allow exploring how individuals residing in different Italian regions visited different locations before during and after the lockdown phase. It is interesting to notice that while the country has been unequally affected by the pandemics, the effects of the lockdown have been symmetric all over the country, meaning that the individual response has been independent of the immediate risk of contagion.
The methodology used is the same as the one adopted in the previous post. We start using the High-Precision Anonymized Location-Based (HFLB) data collected via mobile phones app, and anonymized at the moment of their collection. These data have been provided in the context of CUEBIQ’s Data for Good Program. This first-party data is collected from anonymized users who have opted-in to provide access to their location data anonymously, through a GDPR-compliant framework. We then join these data with the ones fetched from OpenStreetMap, specifically the locations and categories of the Points of Interests (POIs) found in a given area, so as to quantify how many individuals have visited locations such as:
Workplaces and Homes where identified with a certain degree of approximation, but we cross-checked with Italian Census data to see if our guesses were correct. Note that the intrinsic noise of the position we had allows us to assign a location with a precision of around 100m.
By dividing individuals according to the region they live in, it has been possible to visualize the evolution of their visits to the different locations categories in time, from the beginning of January 2020 to the end of June 2020. The time frame covered by the analysis goes from a couple of months preceding the national lockdown, up to some weeks after the relaxation of the latest restrictions. The following figure allows to explore the time spent, the amount of users and the amount of stops observed in each kind of location.
Instructions for Fig. 1
By visualizing the number of individuals that visited each location in time, it is possible to have a better understanding of how different areas reacted to the restrictions and the reopening phase. The interactive map below allows for the exploration of how the frequency of visit for the various locations categories evolved in time in different regions. While in many locations the number of visits went back to the pre-COVID levels, some of them are still less visited than the pre-COVID. This outcome is partly due to the restrictions that are still in place (univerisities are still closed at the time of writing) and partially stems from the fact that many activities decided not to reopen yet, either for safety reasons or economic convenience.
Instructions for Fig. 2
As we explained in our previous post, the characterization of how individual adapted their habits in response to the COVID-19 outbreak is of utmost importance for the planning of the reopening phases and for the organization of the society during what someone calls the New Normal. New habits will affect the way in which cities will evolve in the future, and any form of planning -from transportation, to education and work- will have to take them into account. Data-driven approaches (i.e., Data-driven decision making) will play a key role during the design of the policies to be implemented and in the monitoring of their efficiency. This is particularly true because of the short time needed to measure the reaction of people to such policies and the level of details that can be achieved when using such large data bases. In this spirit, we already shown a paradigmatic example on how to inform policy-makers during the reopening phase: the modelling and forecast of the Social Distancing Index (SDI) on the public transport in Rome, that we presented in this post. We will further expand that model in collaboration with “Roma Servizi per la Mobilità” and report our findings in a future post in which we will explain how the information reported here will be used to plan the reopening of schools in the Metropolitan Area of Rome. So, stay Tuned!.
0;)p--}0===i(e[n],h)?go(e,n,p):go(e,++p,a),p<=r&&(n=p+1),r<=p&&(a=p-1)}}(t,e,r||0,n||t.length-1,a||vo)}function go(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function vo(t,e){return te?1:0}function mo(t,e){var r=t.length;if(r<=1)return[t];for(var n,a,i=[],o=0;o1)for(var l=0;l0&&(n+=t[a-1].length,r.holes.push(n))}return r},Ni.default=ji;var _o=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Qn,this.indexArray=new da,this.indexArray2=new ga,this.programConfigurations=new Qa(Bi,t.layers,t.zoom),this.segments=new Oa,this.segments2=new Oa,this.stateDependentLayerIds=this.layers.filter(function(t){return t.isStateDependent()}).map(function(t){return t.id})};_o.prototype.populate=function(t,e){this.hasPattern=xo("fill",this.layers,e);for(var r=this.layers[0].layout.get("fill-sort-key"),n=[],a=0,i=t;a>3}if(i--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new a(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&l.push(e),l},So.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,a=0,i=0,o=1/0,s=-1/0,l=1/0,c=-1/0;t.pos>3}if(n--,1===r||2===r)(a+=t.readSVarint())s&&(s=a),(i+=t.readSVarint())c&&(c=i);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,c]},So.prototype.toGeoJSON=function(t,e,r){var n,a,i=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,l=this.loadGeometry(),c=So.types[this.type];function u(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function zo(t,e,r){if(3===t){var n=new Co(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Po.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Ao(this._pbf,e,this.extent,this._keys,this._values)};var Io={VectorTile:function(t,e){this.layers=t.readFields(zo,{},e)},VectorTileFeature:Ao,VectorTileLayer:Co},Do=Io.VectorTileFeature.types,Ro=Math.pow(2,13);function Fo(t,e,r,n,a,i,o,s){t.emplaceBack(e,r,2*Math.floor(n*Ro)+o,a*Ro*2,i*Ro*2,Math.round(s))}var Bo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ta,this.indexArray=new da,this.programConfigurations=new Qa(Mo,t.layers,t.zoom),this.segments=new Oa,this.stateDependentLayerIds=this.layers.filter(function(t){return t.isStateDependent()}).map(function(t){return t.id})};function No(t,e){return t.x===e.x&&(t.x<0||t.x>ei)||t.y===e.y&&(t.y<0||t.y>ei)}function jo(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>ei})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>ei})}Bo.prototype.populate=function(t,e){this.features=[],this.hasPattern=xo("fill-extrusion",this.layers,e);for(var r=0,n=t;r=1){var m=p[g-1];if(!No(v,m)){u.vertexLength+4>Oa.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var y=v.sub(m)._perp()._unit(),x=m.dist(v);d+x>32768&&(d=0),Fo(this.layoutVertexArray,v.x,v.y,y.x,y.y,0,0,d),Fo(this.layoutVertexArray,v.x,v.y,y.x,y.y,0,1,d),d+=x,Fo(this.layoutVertexArray,m.x,m.y,y.x,y.y,0,0,d),Fo(this.layoutVertexArray,m.x,m.y,y.x,y.y,0,1,d);var b=u.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+s>Oa.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray)),"Polygon"===Do[t.type]){for(var _=[],w=[],k=u.vertexLength,T=0,M=o;T=2&&t[u-1].equals(t[u-2]);)u--;for(var h=0;h0;if(M&&x>h){var S=f.dist(g);if(S>2*p){var E=f.sub(f.sub(g)._mult(p/S)._round());this.updateDistance(g,E),this.addCurrentVertex(E,m,0,0,d),g=E}}var L=g&&v,C=L?r:c?"butt":n;if(L&&"round"===C&&(ka&&(C="bevel"),"bevel"===C&&(k>2&&(C="flipbevel"),k100)b=y.mult(-1);else{var P=k*m.add(y).mag()/m.sub(y).mag();b._perp()._mult(P*(A?-1:1))}this.addCurrentVertex(f,b,0,0,d),this.addCurrentVertex(f,b.mult(-1),0,0,d)}else if("bevel"===C||"fakeround"===C){var O=-Math.sqrt(k*k-1),z=A?O:0,I=A?0:O;if(g&&this.addCurrentVertex(f,m,z,I,d),"fakeround"===C)for(var D=Math.round(180*T/Math.PI/20),R=1;R2*p){var U=f.add(v.sub(f)._mult(p/V)._round());this.updateDistance(f,U),this.addCurrentVertex(U,y,0,0,d),f=U}}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,s)}},Zo.prototype.addCurrentVertex=function(t,e,r,n,a,i){void 0===i&&(i=!1);var o=e.x+e.y*r,s=e.y-e.x*r,l=-e.x+e.y*n,c=-e.y-e.x*n;this.addHalfVertex(t,o,s,i,!1,r,a),this.addHalfVertex(t,l,c,i,!0,-n,a),this.distance>Xo/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,a,i))},Zo.prototype.addHalfVertex=function(t,e,r,n,a,i,o){var s=t.x,l=t.y,c=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((s<<1)+(n?1:0),(l<<1)+(a?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===i?0:i<0?-1:1)|(63&c)<<2,c>>6);var u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),a?this.e2=u:this.e1=u},Zo.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(Xo-1):this.distance},dn("LineBucket",Zo,{omit:["layers","patternFeatures"]});var Jo=new Gn({"line-cap":new jn(Tt.layout_line["line-cap"]),"line-join":new Vn(Tt.layout_line["line-join"]),"line-miter-limit":new jn(Tt.layout_line["line-miter-limit"]),"line-round-limit":new jn(Tt.layout_line["line-round-limit"]),"line-sort-key":new Vn(Tt.layout_line["line-sort-key"])}),Ko={paint:new Gn({"line-opacity":new Vn(Tt.paint_line["line-opacity"]),"line-color":new Vn(Tt.paint_line["line-color"]),"line-translate":new jn(Tt.paint_line["line-translate"]),"line-translate-anchor":new jn(Tt.paint_line["line-translate-anchor"]),"line-width":new Vn(Tt.paint_line["line-width"]),"line-gap-width":new Vn(Tt.paint_line["line-gap-width"]),"line-offset":new Vn(Tt.paint_line["line-offset"]),"line-blur":new Vn(Tt.paint_line["line-blur"]),"line-dasharray":new qn(Tt.paint_line["line-dasharray"]),"line-pattern":new Un(Tt.paint_line["line-pattern"]),"line-gradient":new Hn(Tt.paint_line["line-gradient"])}),layout:Jo},Qo=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new Pn(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,a){return r=h({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,a)},e}(Vn))(Ko.paint.properties["line-width"].specification);Qo.useIntegerZoom=!0;var $o=function(t){function e(e){t.call(this,e,Ko)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=Ii(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=Qo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Zo(t)},e.prototype.queryRadius=function(t){var e=t,r=ts(mi("line-width",this,e),mi("line-gap-width",this,e)),n=mi("line-offset",this,e);return r/2+Math.abs(n)+yi(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,s){var l=xi(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),c=s/2*ts(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(n=function(t,e){for(var r=[],n=new a(0,0),i=0;i=3)for(var i=0;i0?e+2*t:t}var es=Jn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),rs=Jn([{name:"a_projected_pos",components:3,type:"Float32"}],4),ns=(Jn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Jn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),as=(Jn([{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:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),Jn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),is=Jn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function os(t,e,r){return t.sections.forEach(function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Cn.applyArabicShaping&&(t=Cn.applyArabicShaping(t)),t}(t.text,e,r)}),t}Jn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"}]),Jn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"radialTextOffset"}]),Jn([{type:"Float32",name:"offsetX"}]),Jn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var ss={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"},ls=24,cs={horizontal:1,vertical:2,horizontalOnly:3},us=function(){this.text="",this.sectionIndex=[],this.sections=[]};function hs(t,e,r,n,a,i,o,s,l,c,u){var h,f=us.fromFeature(t,r);c===cs.vertical&&f.verticalizePunctuation();var p=Cn.processBidirectionalText,d=Cn.processStyledBidirectionalText;if(p&&1===f.sections.length){h=[];for(var g=0,v=p(f.toString(),ms(f,s,n,e));g=0&&n>=t&&fs[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},us.prototype.substring=function(t,e){var r=new us;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},us.prototype.toString=function(){return this.text},us.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce(function(e,r){return Math.max(e,t.sections[r].scale)},0)};var fs={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ps={};function ds(t,e,r,n){var a=Math.pow(t-e,2);return n?t=0,l=0,c=0;c0)&&("constant"!==a.value.kind||a.value.value.length>0),l="constant"!==o.value.kind||o.value.value&&o.value.value.length>0,c=n.get("symbol-sort-key");if(this.features=[],s||l){for(var u=e.iconDependencies,h=e.glyphDependencies,f=new Pn(this.zoom),p=0,d=t;p=0;for(var A=0,S=x.sections;A=0;s--)i[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:a},s>0&&(a+=e[s-1].dist(e[s]));for(var l=0;l0;this.addCollisionDebugVertices(i,o,s,l,c?this.collisionCircle:this.collisionBox,a.anchorPoint,r,c)}},Os.prototype.generateCollisionDebugBuffers=function(){for(var t=0;t0},Os.prototype.hasIconData=function(){return this.icon.segments.get().length>0},Os.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},Os.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},Os.prototype.addIndicesForPlacedTextSymbol=function(t){for(var e=this.text.placedSymbolArray.get(t),r=e.vertexStartIndex+4*e.numGlyphs,n=e.vertexStartIndex;n1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedTextSymbol(t)}),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedTextSymbol(i.verticalPlacedTextSymbolIndex);var o=this.icon.placedSymbolArray.get(a);if(o.numGlyphs){var s=o.vertexStartIndex;this.icon.indexArray.emplaceBack(s,s+1,s+2),this.icon.indexArray.emplaceBack(s+1,s+2,s+3)}}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},dn("SymbolBucket",Os,{omit:["layers","collisionBoxArray","features","compareText"]}),Os.MAX_GLYPHS=65535,Os.addDynamicAttributes=Ls;var zs=new Gn({"symbol-placement":new jn(Tt.layout_symbol["symbol-placement"]),"symbol-spacing":new jn(Tt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new jn(Tt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Vn(Tt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new jn(Tt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new jn(Tt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new jn(Tt.layout_symbol["icon-ignore-placement"]),"icon-optional":new jn(Tt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new jn(Tt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Vn(Tt.layout_symbol["icon-size"]),"icon-text-fit":new jn(Tt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new jn(Tt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Vn(Tt.layout_symbol["icon-image"]),"icon-rotate":new Vn(Tt.layout_symbol["icon-rotate"]),"icon-padding":new jn(Tt.layout_symbol["icon-padding"]),"icon-keep-upright":new jn(Tt.layout_symbol["icon-keep-upright"]),"icon-offset":new Vn(Tt.layout_symbol["icon-offset"]),"icon-anchor":new Vn(Tt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new jn(Tt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new jn(Tt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new jn(Tt.layout_symbol["text-rotation-alignment"]),"text-field":new Vn(Tt.layout_symbol["text-field"]),"text-font":new Vn(Tt.layout_symbol["text-font"]),"text-size":new Vn(Tt.layout_symbol["text-size"]),"text-max-width":new Vn(Tt.layout_symbol["text-max-width"]),"text-line-height":new jn(Tt.layout_symbol["text-line-height"]),"text-letter-spacing":new Vn(Tt.layout_symbol["text-letter-spacing"]),"text-justify":new Vn(Tt.layout_symbol["text-justify"]),"text-radial-offset":new Vn(Tt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new jn(Tt.layout_symbol["text-variable-anchor"]),"text-anchor":new Vn(Tt.layout_symbol["text-anchor"]),"text-max-angle":new jn(Tt.layout_symbol["text-max-angle"]),"text-writing-mode":new jn(Tt.layout_symbol["text-writing-mode"]),"text-rotate":new Vn(Tt.layout_symbol["text-rotate"]),"text-padding":new jn(Tt.layout_symbol["text-padding"]),"text-keep-upright":new jn(Tt.layout_symbol["text-keep-upright"]),"text-transform":new Vn(Tt.layout_symbol["text-transform"]),"text-offset":new Vn(Tt.layout_symbol["text-offset"]),"text-allow-overlap":new jn(Tt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new jn(Tt.layout_symbol["text-ignore-placement"]),"text-optional":new jn(Tt.layout_symbol["text-optional"])}),Is={paint:new Gn({"icon-opacity":new Vn(Tt.paint_symbol["icon-opacity"]),"icon-color":new Vn(Tt.paint_symbol["icon-color"]),"icon-halo-color":new Vn(Tt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Vn(Tt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Vn(Tt.paint_symbol["icon-halo-blur"]),"icon-translate":new jn(Tt.paint_symbol["icon-translate"]),"icon-translate-anchor":new jn(Tt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Vn(Tt.paint_symbol["text-opacity"]),"text-color":new Vn(Tt.paint_symbol["text-color"],{runtimeType:Ft,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new Vn(Tt.paint_symbol["text-halo-color"]),"text-halo-width":new Vn(Tt.paint_symbol["text-halo-width"]),"text-halo-blur":new Vn(Tt.paint_symbol["text-halo-blur"]),"text-translate":new jn(Tt.paint_symbol["text-translate"]),"text-translate-anchor":new jn(Tt.paint_symbol["text-translate-anchor"])}),layout:zs},Ds=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:zt,this.defaultValue=t};Ds.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},Ds.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},Ds.prototype.possibleOutputs=function(){return[void 0]},Ds.prototype.serialize=function(){return null},dn("FormatSectionOverride",Ds,{omit:["defaultValue"]});var Rs=function(t){function e(e){t.call(this,e,Is)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e){if(t.prototype.recalculate.call(this,e),"auto"===this.layout.get("icon-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var r=this.layout.get("text-writing-mode");if(r){for(var n=[],a=0,i=r;a=0;f--){var p=o[f];if(!(h.w>p.w||h.h>p.h)){if(h.x=p.x,h.y=p.y,l=Math.max(l,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===p.w&&h.h===p.h){var d=o.pop();f>1,u=-7,h=r?a-1:0,f=r?-1:1,p=t[e+h];for(h+=f,i=p&(1<<-u)-1,p>>=-u,u+=s;u>0;i=256*i+t[e+h],h+=f,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+t[e+h],h+=f,u-=8);if(0===i)i=1-c;else{if(i===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),i-=c}return(p?-1:1)*o*Math.pow(2,i-n)},$s=function(t,e,r,n,a,i){var o,s,l,c=8*i-a-1,u=(1<>1,f=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(e*l-1)*Math.pow(2,a),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,a),o=0));a>=8;t[r+p]=255&s,p+=d,s/=256,a-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g},tl=el;function el(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function rl(t){return t.type===el.Bytes?t.readVarint()+t.pos:t.pos+1}function nl(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function al(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var a=r.pos-1;a>=t;a--)r.buf[a+n]=r.buf[a]}function il(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function vl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}el.Varint=0,el.Fixed64=1,el.Bytes=2,el.Fixed32=5,el.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,i=this.pos;this.type=7&n,t(a,e,this),this.pos===i&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=dl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=vl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=dl(this.buf,this.pos)+4294967296*dl(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=dl(this.buf,this.pos)+4294967296*vl(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Qs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Qs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,a,i=r.buf;if(n=(112&(a=i[r.pos++]))>>4,a<128)return nl(t,n,e);if(n|=(127&(a=i[r.pos++]))<<3,a<128)return nl(t,n,e);if(n|=(127&(a=i[r.pos++]))<<10,a<128)return nl(t,n,e);if(n|=(127&(a=i[r.pos++]))<<17,a<128)return nl(t,n,e);if(n|=(127&(a=i[r.pos++]))<<24,a<128)return nl(t,n,e);if(n|=(1&(a=i[r.pos++]))<<31,a<128)return nl(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){for(var n="",a=e;a239?4:l>223?3:l>191?2:1;if(a+u>r)break;1===u?l<128&&(c=l):2===u?128==(192&(i=t[a+1]))&&(c=(31&l)<<6|63&i)<=127&&(c=null):3===u?(i=t[a+1],o=t[a+2],128==(192&i)&&128==(192&o)&&((c=(15&l)<<12|(63&i)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(i=t[a+1],o=t[a+2],s=t[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&((c=(15&l)<<18|(63&i)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),a+=u}return n}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==el.Bytes)return t.push(this.readVarint(e));var r=rl(this);for(t=t||[];this.pos127;);else if(e===el.Bytes)this.pos=this.readVarint()+this.pos;else if(e===el.Fixed32)this.pos+=4;else{if(e!==el.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),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),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,a,i=0;i55295&&n<57344){if(!a){n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else a&&(t[r++]=239,t[r++]=191,t[r++]=189,a=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&al(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),$s(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),$s(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&al(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,el.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,cl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,ll,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ul,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,hl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,fl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,pl,e)},writeBytesField:function(t,e){this.writeTag(t,el.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,el.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,el.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,el.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,el.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,el.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,el.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,el.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,el.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,el.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var ml=3;function yl(t,e,r){1===t&&r.readMessage(xl,e)}function xl(t,e,r){if(3===t){var n=r.readMessage(bl,{}),a=n.id,i=n.bitmap,o=n.width,s=n.height,l=n.left,c=n.top,u=n.advance;e.push({id:a,bitmap:new Pi({width:o+2*ml,height:s+2*ml},i),metrics:{width:o,height:s,left:l,top:c,advance:u}})}}function bl(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}var _l=ml,wl=function(t){var e=this;this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){e._triggered=!1,e._callback()})};wl.prototype.trigger=function(){var t=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(function(){t._triggered=!1,t._callback()},0))};var kl=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},v(["receive","process"],this),this.invoker=new wl(this.process),this.target.addEventListener("message",this.receive,!1)};function Tl(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}kl.prototype.send=function(t,e,r,n){var a=this,i=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[i]=r);var o=[];return this.target.postMessage({id:i,type:t,hasCallback:!!r,targetMapId:n,sourceMapId:this.mapId,data:vn(e,o)},o),{cancel:function(){r&&delete a.callbacks[i],a.target.postMessage({id:i,type:"",targetMapId:n,sourceMapId:a.mapId})}}},kl.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()},kl.prototype.process=function(){var t=this;if(this.taskQueue.length){var e=this.taskQueue.shift(),r=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),r)if(""===r.type){var n=this.callbacks[e];delete this.callbacks[e],n&&(r.error?n(mn(r.error)):n(null,mn(r.data)))}else{var a=!1,i=r.hasCallback?function(r,n){a=!0,delete t.cancelCallbacks[e];var i=[];t.target.postMessage({id:e,type:"",sourceMapId:t.mapId,error:r?vn(r):null,data:vn(n,i)},i)}:function(t){a=!0},o=null,s=mn(r.data);if(this.parent[r.type])o=this.parent[r.type](r.sourceMapId,s,i);else if(this.parent.getWorkerSource){var l=r.type.split(".");o=this.parent.getWorkerSource(r.sourceMapId,l[0],s.source)[l[1]](s,i)}else i(new Error("Could not find function "+r.type));!a&&o&&o.cancel&&(this.cancelCallbacks[e]=o.cancel)}}},kl.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)};var Ml=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Ml.prototype.setNorthEast=function(t){return this._ne=t instanceof Al?new Al(t.lng,t.lat):Al.convert(t),this},Ml.prototype.setSouthWest=function(t){return this._sw=t instanceof Al?new Al(t.lng,t.lat):Al.convert(t),this},Ml.prototype.extend=function(t){var e,r,n=this._sw,a=this._ne;if(t instanceof Al)e=t,r=t;else{if(!(t instanceof Ml))return Array.isArray(t)?t.every(Array.isArray)?this.extend(Ml.convert(t)):this.extend(Al.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return n||a?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new Al(e.lng,e.lat),this._ne=new Al(r.lng,r.lat)),this},Ml.prototype.getCenter=function(){return new Al((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Ml.prototype.getSouthWest=function(){return this._sw},Ml.prototype.getNorthEast=function(){return this._ne},Ml.prototype.getNorthWest=function(){return new Al(this.getWest(),this.getNorth())},Ml.prototype.getSouthEast=function(){return new Al(this.getEast(),this.getSouth())},Ml.prototype.getWest=function(){return this._sw.lng},Ml.prototype.getSouth=function(){return this._sw.lat},Ml.prototype.getEast=function(){return this._ne.lng},Ml.prototype.getNorth=function(){return this._ne.lat},Ml.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Ml.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Ml.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Ml.convert=function(t){return!t||t instanceof Ml?t:new Ml(t)};var Al=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Al.prototype.wrap=function(){return new Al(u(this.lng,-180,180),this.lat)},Al.prototype.toArray=function(){return[this.lng,this.lat]},Al.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Al.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Ml(new Al(this.lng-r,this.lat-e),new Al(this.lng+r,this.lat+e))},Al.convert=function(t){if(t instanceof Al)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Al(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Al(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var Sl=2*Math.PI*6378137;function El(t){return Sl*Math.cos(t*Math.PI/180)}function Ll(t){return(180+t)/360}function Cl(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Pl(t,e){return t/El(e)}function Ol(t){var e=180-360*t;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}var zl=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};zl.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Al.convert(t);return new zl(Ll(r.lng),Cl(r.lat),Pl(e,r.lat))},zl.prototype.toLngLat=function(){return new Al(360*this.x-180,Ol(this.y))},zl.prototype.toAltitude=function(){return this.z*El(Ol(this.y))},zl.prototype.meterInMercatorCoordinateUnits=function(){return 1/Sl*(t=Ol(this.y),1/Math.cos(t*Math.PI/180));var t};var Il=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Fl(0,t,e,r)};Il.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Il.prototype.url=function(t,e){var r,n,a,i,o,s=(r=this.x,n=this.y,a=this.z,i=Tl(256*r,256*(n=Math.pow(2,a)-n-1),a),o=Tl(256*(r+1),256*(n+1),a),i[0]+","+i[1]+","+o[0]+","+o[1]),l=function(t,e,r){for(var n,a="",i=t;i>0;i--)a+=(e&(n=1<this.canonical.z?new Rl(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Rl(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Rl.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Rl.prototype.children=function(t){if(this.overscaledZ>=t)return[new Rl(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Rl(e,this.wrap,e,r,n),new Rl(e,this.wrap,e,r+1,n),new Rl(e,this.wrap,e,r,n+1),new Rl(e,this.wrap,e,r+1,n+1)]},Rl.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Bl.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Bl.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Bl.prototype.getPixels=function(){return new Oi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Bl.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,a=e*this.dim+this.dim,i=r*this.dim,o=r*this.dim+this.dim;switch(e){case-1:n=a-1;break;case 1:a=n+1}switch(r){case-1:i=o-1;break;case 1:o=i+1}for(var s=-e*this.dim,l=-r*this.dim,c=i;c=0)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(void 0!==e&&e>=0)if(this.stateChanges[t]&&this.stateChanges[t][n])for(r in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][r]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}},ql.prototype.getState=function(t,e){var r=String(e),n=this.state[t]||{},a=this.stateChanges[t]||{},i=h({},n[r],a[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var o=this.deletedStates[t][e];if(null===o)return{};for(var s in o)delete i[s]}return i},ql.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},ql.prototype.coalesceChanges=function(t,e){var r={};for(var n in this.stateChanges){this.state[n]=this.state[n]||{};var a={};for(var i in this.stateChanges[n])this.state[n][i]||(this.state[n][i]={}),h(this.state[n][i],this.stateChanges[n][i]),a[i]=this.state[n][i];r[n]=a}for(var o in this.deletedStates){this.state[o]=this.state[o]||{};var s={};if(null===this.deletedStates[o])for(var l in this.state[o])s[l]={},this.state[o][l]={};else for(var c in this.deletedStates[o]){if(null===this.deletedStates[o][c])this.state[o][c]={};else for(var u=0,f=Object.keys(this.deletedStates[o][c]);u=0&&u[3]>=0&&s.insert(o,u[0],u[1],u[2],u[3])}},Hl.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Io.VectorTile(new tl(this.rawTileData)).layers,this.sourceLayerCoder=new jl(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Hl.prototype.query=function(t,e,r){var n=this;this.loadVTLayers();for(var i=t.params||{},o=ei/t.tileSize/t.scale,s=Rr(i.filter),l=t.queryGeometry,c=t.queryPadding*o,u=Gl(l),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),f=Gl(t.cameraQueryGeometry),p=0,d=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,function(e,r,n,i){return function(t,e,r,n,i){for(var o=0,s=t;o=l.x&&i>=l.y)return!0}var c=[new a(e,r),new a(e,i),new a(n,i),new a(n,r)];if(t.length>2)for(var u=0,h=c;u=0)return!0;return!1}(i,l)){var c=this.sourceLayerCoder.decode(r),u=this.vtLayers[c].feature(n);if(a(new Pn(this.tileID.overscaledZ),u))for(var h=0;h-r/2;){if(--o<0)return!1;s-=t[o].dist(i),i=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],c=0;sn;)c-=l.shift().angleDelta;if(c>a)return!1;o++,s+=h.dist(f)}return!0}function Zl(t){for(var e=0,r=0;rc){var d=(c-l)/p,g=ye(h.x,f.x,d),v=ye(h.y,f.y,d),m=new bs(g,v,f.angleTo(h),u);return m._round(),!o||Xl(t,m,s,o,e)?m:void 0}l+=p}}function $l(t,e,r,n,a,i,o,s,l){var c=Jl(n,i,o),u=Kl(n,a),h=u*o,f=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&_=0&&w=0&&p+u<=h){var k=new bs(_,w,x,g);k._round(),a&&!Xl(e,k,o,a,i)||d.push(k)}}f+=y}return l||d.length||s||(d=t(e,f/2,n,a,i,o,s,!0,c)),d}(t,f?e/2*s%e:(u/2+2*i)*o*s%e,e,c,r,h,f,!1,l)}Wl.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e>l.z,u=new a(l.x*c,l.y*c),h=new a(u.x+c,u.y+c),f=this.segments.prepareSegment(4,r,n);r.emplaceBack(u.x,u.y,u.x,u.y),r.emplaceBack(h.x,u.y,h.x,u.y),r.emplaceBack(u.x,h.y,u.x,h.y),r.emplaceBack(h.x,h.y,h.x,h.y);var p=f.vertexLength;n.emplaceBack(p,p+1,p+2),n.emplaceBack(p+1,p+2,p+3),f.vertexLength+=4,f.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,Nl.members),this.maskedIndexBuffer=e.createIndexBuffer(n)}},Wl.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Wl.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},Wl.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=M(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var n=Date.now(),a=!1;if(this.expirationTime>n)a=!1;else if(e)if(this.expirationTime0&&(m=Math.max(10*l,m),this._addLineCollisionCircles(t,e,r,r.segment,y,m,n,i,o,h))}else{if(f){var x=new a(g,p),b=new a(v,p),_=new a(g,d),w=new a(v,d),k=f*Math.PI/180;x._rotate(k),b._rotate(k),_._rotate(k),w._rotate(k),g=Math.min(x.x,b.x,_.x,w.x),v=Math.max(x.x,b.x,_.x,w.x),p=Math.min(x.y,b.y,_.y,w.y),d=Math.max(x.y,b.y,_.y,w.y)}t.emplaceBack(r.x,r.y,g,p,v,d,n,i,o,0,0)}this.boxEndIndex=t.length};tc.prototype._addLineCollisionCircles=function(t,e,r,n,a,i,o,s,l,c){var u=i/2,h=Math.floor(a/u)||1,f=1+.4*Math.log(c)/Math.LN2,p=Math.floor(h*f/2),d=-i/2,g=r,v=n+1,m=d,y=-a/2,x=y-a/4;do{if(--v<0){if(m>y)return;v=0;break}m-=e[v].dist(g),g=e[v]}while(m>x);for(var b=e[v].dist(e[v+1]),_=-p;_a&&(k+=w-a),!(k=e.length)return;b=e[v].dist(e[v+1])}var T=k-m,M=e[v],A=e[v+1].sub(M)._unit()._mult(T)._add(M)._round(),S=Math.abs(k-d)0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function rc(t,e){return te?1:0}function nc(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,i=1/0,o=-1/0,s=-1/0,l=t[0],c=0;co)&&(o=u.x),(!c||u.y>s)&&(s=u.y)}var h=o-n,f=s-i,p=Math.min(h,f),d=p/2,g=new ec([],ac);if(0===p)return new a(n,i);for(var v=n;vy.d||!y.d)&&(y=b,r&&console.log("found best %d after %d probes",Math.round(1e4*b.d)/1e4,x)),b.max-y.d<=e||(d=b.h/2,g.push(new ic(b.p.x-d,b.p.y-d,d,t)),g.push(new ic(b.p.x+d,b.p.y-d,d,t)),g.push(new ic(b.p.x-d,b.p.y+d,d,t)),g.push(new ic(b.p.x+d,b.p.y+d,d,t)),x+=4)}return r&&(console.log("num probes: "+x),console.log("best distance: "+y.d)),y.p}function ac(t,e){return e.max-t.max}function ic(t,e,r,n){this.p=new a(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,a=0;at.y!=u.y>t.y&&t.x<(u.x-c.x)*(t.y-c.y)/(u.y-c.y)+c.x&&(r=!r),n=Math.min(n,pi(t,c,u))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}ec.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},ec.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},ec.prototype.peek=function(){return this.data[0]},ec.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var a=t-1>>1,i=e[a];if(r(n,i)>=0)break;e[t]=i,t=a}e[t]=n},ec.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,a=e[t];t=0)break;e[t]=o,t=i}e[t]=a};var oc=e(function(t){t.exports=function(t,e){var r,n,a,i,o,s,l,c;for(r=3&t.length,n=t.length-r,a=e,o=3432918353,s=461845907,c=0;c>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:a^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return a^=t.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}}),sc=e(function(t){t.exports=function(t,e){for(var r,n=t.length,a=e^n,i=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(i)|(255&t.charCodeAt(++i))<<8|(255&t.charCodeAt(++i))<<16|(255&t.charCodeAt(++i))<<24))+((1540483477*(r>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++i;switch(n){case 3:a^=(255&t.charCodeAt(i+2))<<16;case 2:a^=(255&t.charCodeAt(i+1))<<8;case 1:a=1540483477*(65535&(a^=255&t.charCodeAt(i)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}}),lc=oc,cc=oc,uc=sc;lc.murmur3=cc,lc.murmur2=uc;var hc=7;function fc(t,e){var r=0,n=0,a=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=a-hc;break;case"bottom-right":case"bottom-left":n=-a+hc;break;case"bottom":n=-e+hc;break;case"top":n=e-hc}switch(t){case"top-right":case"bottom-right":r=-a;break;case"top-left":case"bottom-left":r=a;break;case"left":r=e;break;case"right":r=-e}return[r,n]}function pc(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}var dc=65535;function gc(t,e,r,n,i,o,s,l,c,u,h,f,p){var d=function(t,e,r,n,i,o,s,l){for(var c=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=e.positionedGlyphs,h=[],f=0;fdc&&w(t.layerIds[0]+': Value for "text-size" is >= 256. Reduce your "text-size".'):"composite"===g.kind&&((v=[_s*p.compositeTextSizes[0].evaluate(o,{}),_s*p.compositeTextSizes[1].evaluate(o,{})])[0]>dc||v[1]>dc)&&w(t.layerIds[0]+': Value for "text-size" is >= 256. Reduce your "text-size".'),t.addSymbols(t.text,d,v,s,i,o,c,e,l.lineStartIndex,l.lineLength);for(var m=0,y=u;m=0;o--)if(n.dist(i[o])at&&(t.getActor().send("enforceCacheSizeLimit",nt),st=0)},t.clamp=c,t.clearTileCache=function(t){var e=self.caches.delete(rt);t&&e.catch(t).then(function(){return t()})},t.clone=function(t){var e=new ki(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=b,t.config=D,t.create=function(){var t=new ki(16);return ki!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new ki(9);return ki!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new ki(4);return ki!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=kr,t.createLayout=Jn,t.createStyleLayer=function(t){return"custom"===t.type?new Vs(t):new Us[t.type](t)},t.deepEqual=o,t.ease=l,t.emitValidationErrors=ln,t.endsWith=m,t.enforceCacheSizeLimit=function(t){self.caches&&self.caches.open(rt).then(function(e){e.keys().then(function(r){for(var n=0;n=ei||c.y<0||c.y>=ei||function(t,e,r,n,i,o,s,l,c,u,h,f,p,d,g,v,m,y,x,b,_){var k,T,M,A=t.addToLineVertexArray(e,r),S=0,E=0,L=0,C={},P=lc(""),O=(o.layout.get("text-radial-offset").evaluate(x,{})||0)*ls;if(t.allowVerticalPlacement&&n.vertical){var z=o.layout.get("text-rotate").evaluate(x,{})+90,I=n.vertical;M=new tc(s,r,e,l,c,u,I,h,f,p,t.overscaling,z)}for(var D in n.horizontal){var R=n.horizontal[D];if(!k){P=lc(R.text);var F=o.layout.get("text-rotate").evaluate(x,{});k=new tc(s,r,e,l,c,u,R,h,f,p,t.overscaling,F)}var B=1===R.lineCount;if(E+=gc(t,e,R,o,p,x,d,A,n.vertical?cs.horizontal:cs.horizontalOnly,B?Object.keys(n.horizontal):[D],C,b,_),B)break}n.vertical&&(L+=gc(t,e,n.vertical,o,p,x,d,A,cs.vertical,["vertical"],C,b,_));var N=k?k.boxStartIndex:t.collisionBoxArray.length,j=k?k.boxEndIndex:t.collisionBoxArray.length,V=M?M.boxStartIndex:t.collisionBoxArray.length,U=M?M.boxEndIndex:t.collisionBoxArray.length;if(i){var q=function(t,e,r,n,i,o){var s,l,c,u,h=e.image,f=r.layout,p=e.top-1/h.pixelRatio,d=e.left-1/h.pixelRatio,g=e.bottom+1/h.pixelRatio,v=e.right+1/h.pixelRatio;if("none"!==f.get("icon-text-fit")&&i){var m=v-d,y=g-p,x=f.get("text-size").evaluate(o,{})/24,b=i.left*x,_=i.right*x,w=i.top*x,k=_-b,T=i.bottom*x-w,M=f.get("icon-text-fit-padding")[0],A=f.get("icon-text-fit-padding")[1],S=f.get("icon-text-fit-padding")[2],E=f.get("icon-text-fit-padding")[3],L="width"===f.get("icon-text-fit")?.5*(T-y):0,C="height"===f.get("icon-text-fit")?.5*(k-m):0,P="width"===f.get("icon-text-fit")||"both"===f.get("icon-text-fit")?k:m,O="height"===f.get("icon-text-fit")||"both"===f.get("icon-text-fit")?T:y;s=new a(b+C-E,w+L-M),l=new a(b+C+A+P,w+L-M),c=new a(b+C+A+P,w+L+S+O),u=new a(b+C-E,w+L+S+O)}else s=new a(d,p),l=new a(v,p),c=new a(v,g),u=new a(d,g);var z=r.layout.get("icon-rotate").evaluate(o,{})*Math.PI/180;if(z){var I=Math.sin(z),D=Math.cos(z),R=[D,-I,I,D];s._matMult(R),l._matMult(R),u._matMult(R),c._matMult(R)}return[{tl:s,tr:l,bl:u,br:c,tex:h.paddedRect,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0}]}(0,i,o,0,vc(n.horizontal),x),H=o.layout.get("icon-rotate").evaluate(x,{});T=new tc(s,r,e,l,c,u,i,g,v,!1,t.overscaling,H),S=4*q.length;var G=t.iconSizeData,Y=null;"source"===G.kind?(Y=[_s*o.layout.get("icon-size").evaluate(x,{})])[0]>dc&&w(t.layerIds[0]+': Value for "icon-size" is >= 256. Reduce your "icon-size".'):"composite"===G.kind&&((Y=[_s*_.compositeIconSizes[0].evaluate(x,{}),_s*_.compositeIconSizes[1].evaluate(x,{})])[0]>dc||Y[1]>dc)&&w(t.layerIds[0]+': Value for "icon-size" is >= 256. Reduce your "icon-size".'),t.addSymbols(t.icon,q,Y,y,m,x,!1,e,A.lineStartIndex,A.lineLength)}var W=T?T.boxStartIndex:t.collisionBoxArray.length,X=T?T.boxEndIndex:t.collisionBoxArray.length;t.glyphOffsetArray.length>=Os.MAX_GLYPHS&&w("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),t.symbolInstances.emplaceBack(e.x,e.y,C.right>=0?C.right:-1,C.center>=0?C.center:-1,C.left>=0?C.left:-1,C.vertical||-1,P,N,j,V,U,W,X,l,E,L,S,0,h,O)}(t,c,l,r,n,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,x,k,s,m,b,T,f,e,i,o)};if("line"===M)for(var E=0,L=function(t,e,r,n,i){for(var o=[],s=0;s=n&&f.x>=n||(h.x>=n?h=new a(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new a(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=i&&f.y>=i||(h.y>=i?h=new a(h.x+(f.x-h.x)*((i-h.y)/(f.y-h.y)),i)._round():f.y>=i&&(f=new a(h.x+(f.x-h.x)*((i-h.y)/(f.y-h.y)),i)._round()),c&&h.equals(c[c.length-1])||(c=[h],o.push(c)),c.push(f)))))}return o}(e.geometry,0,0,ei,ei);E1){var F=Ql(R,_,r.vertical||p,n,24,v);F&&S(R,F)}}else if("Polygon"===e.type)for(var B=0,N=mo(e.geometry,0);B=A.maxzoom||"none"!==A.visibility&&(o(M,this.zoom),(d[A.id]=A.createBucket({index:c.bucketLayerIDs.length,layers:M,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,g),c.bucketLayerIDs.push(M.map(function(t){return t.id})))}}}var S=t.mapObject(g.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(S).length?n.send("getGlyphs",{uid:this.uid,stacks:S},function(t,e){u||(u=t,h=e,C.call(s))}):h={};var E=Object.keys(g.iconDependencies);E.length?n.send("getImages",{icons:E},function(t,e){u||(u=t,f=e,C.call(s))}):f={};var L=Object.keys(g.patternDependencies);function C(){if(u)return i(u);if(h&&f&&p){var e=new a(h),r=new t.ImageAtlas(f,p);for(var n in d){var s=d[n];s instanceof t.SymbolBucket?(o(s.layers,this.zoom),t.performSymbolLayout(s,h,e.positions,f,r.iconPositions,this.showCollisionBoxes)):s.hasPattern&&(s instanceof t.LineBucket||s instanceof t.FillBucket||s instanceof t.FillExtrusionBucket)&&(o(s.layers,this.zoom),s.addFeatures(g,r.patternPositions))}this.status="done",i(null,{buckets:t.values(d).filter(function(t){return!t.isEmpty()}),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?h:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}L.length?n.send("getImages",{icons:L},function(t,e){u||(u=t,p=e,C.call(s))}):p={},C.call(this)};var s="undefined"!=typeof performance,l={getEntriesByName:function(t){return!!(s&&performance&&performance.getEntriesByName)&&performance.getEntriesByName(t)},mark:function(t){return!!(s&&performance&&performance.mark)&&performance.mark(t)},measure:function(t,e,r){return!!(s&&performance&&performance.measure)&&performance.measure(t,e,r)},clearMarks:function(t){return!!(s&&performance&&performance.clearMarks)&&performance.clearMarks(t)},clearMeasures:function(t){return!!(s&&performance&&performance.clearMeasures)&&performance.clearMeasures(t)}},c=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},l.mark(this._marks.start)};function u(e,r){var n=t.getArrayBuffer(e.request,function(e,n,a,i){e?r(e):n&&r(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:a,expires:i})});return function(){n.cancel(),r()}}c.prototype.finish=function(){l.mark(this._marks.end);var t=l.getEntriesByName(this._marks.measure);return 0===t.length&&(l.measure(this._marks.measure,this._marks.start,this._marks.end),t=l.getEntriesByName(this._marks.measure),l.clearMarks(this._marks.start),l.clearMarks(this._marks.end),l.clearMeasures(this._marks.measure)),t},l.Performance=c;var h=function(t,e,r){this.actor=t,this.layerIndex=e,this.loadVectorData=r||u,this.loading={},this.loaded={}};h.prototype.loadTile=function(e,r){var n=this,a=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new l.Performance(e.request),s=this.loading[a]=new i(e);s.abort=this.loadVectorData(e,function(e,i){if(delete n.loading[a],e||!i)return s.status="done",n.loaded[a]=s,r(e);var l=i.rawData,c={};i.expires&&(c.expires=i.expires),i.cacheControl&&(c.cacheControl=i.cacheControl);var u={};if(o){var h=o.finish();h&&(u.resourceTiming=JSON.parse(JSON.stringify(h)))}s.vectorTile=i.vectorTile,s.parse(i.vectorTile,n.layerIndex,n.actor,function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,c,u))}),n.loaded=n.loaded||{},n.loaded[a]=s})},h.prototype.reloadTile=function(t,e){var r=this.loaded,n=t.uid,a=this;if(r&&r[n]){var i=r[n];i.showCollisionBoxes=t.showCollisionBoxes;var o=function(t,r){var n=i.reloadCallback;n&&(delete i.reloadCallback,i.parse(i.vectorTile,a.layerIndex,a.actor,n)),e(t,r)};"parsing"===i.status?i.reloadCallback=o:"done"===i.status&&(i.vectorTile?i.parse(i.vectorTile,this.layerIndex,this.actor,o):o())}},h.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},h.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var f=function(){this.loaded={}};f.prototype.loadTile=function(e,r){var n=e.uid,a=e.encoding,i=e.rawImageData,o=new t.DEMData(n,i,a);this.loaded=this.loaded||{},this.loaded[n]=o,r(null,o)},f.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var p={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function d(t){var e=0;if(t&&t.length>0){e+=Math.abs(g(t[0]));for(var r=1;r2){for(o=0;o=0}(t)===e?t:t.reverse()}var _=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,w=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};w.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function F(t,e){for(var r=t.loadGeometry(),n=t.type,a=0,i=0,o=r.length,s=0;s>1;!function t(e,r,n,a,i,o){for(;i>a;){if(i-a>600){var s=i-a+1,l=n-a+1,c=Math.log(s),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(s-u)/s)*(l-s/2<0?-1:1);t(e,r,n,Math.max(a,Math.floor(n-l*u/s+h)),Math.min(i,Math.floor(n+(s-l)*u/s+h)),o)}var f=r[2*n+o],p=a,d=i;for(N(e,r,a,n),r[2*i+o]>f&&N(e,r,a,i);pf;)d--}r[2*a+o]===f?N(e,r,a,d):N(e,r,++d,i),d<=n&&(a=d+1),n<=d&&(i=d-1)}}(e,r,s,a,i,o%2),t(e,r,n,a,s-1,o+1),t(e,r,n,s+1,i,o+1)}}(o,s,n,0,o.length-1,0)};H.prototype.range=function(t,e,r,n){return function(t,e,r,n,a,i,o){for(var s,l,c=[0,t.length-1,0],u=[];c.length;){var h=c.pop(),f=c.pop(),p=c.pop();if(f-p<=o)for(var d=p;d<=f;d++)s=e[2*d],l=e[2*d+1],s>=r&&s<=a&&l>=n&&l<=i&&u.push(t[d]);else{var g=Math.floor((p+f)/2);s=e[2*g],l=e[2*g+1],s>=r&&s<=a&&l>=n&&l<=i&&u.push(t[g]);var v=(h+1)%2;(0===h?r<=s:n<=l)&&(c.push(p),c.push(g-1),c.push(v)),(0===h?a>=s:i>=l)&&(c.push(g+1),c.push(f),c.push(v))}}return u}(this.ids,this.coords,t,e,r,n,this.nodeSize)},H.prototype.within=function(t,e,r){return function(t,e,r,n,a,i){for(var o=[0,t.length-1,0],s=[],l=a*a;o.length;){var c=o.pop(),u=o.pop(),h=o.pop();if(u-h<=i)for(var f=h;f<=u;f++)V(e[2*f],e[2*f+1],r,n)<=l&&s.push(t[f]);else{var p=Math.floor((h+u)/2),d=e[2*p],g=e[2*p+1];V(d,g,r,n)<=l&&s.push(t[p]);var v=(c+1)%2;(0===c?r-a<=d:n-a<=g)&&(o.push(h),o.push(p-1),o.push(v)),(0===c?r+a>=d:n+a>=g)&&(o.push(p+1),o.push(u),o.push(v))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var G={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,map:function(t){return t}},Y=function(t){this.options=$(Object.create(G),t),this.trees=new Array(this.options.maxZoom+1)};function W(t,e,r,n,a){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:a}}function X(t,e){var r=t.geometry.coordinates,n=r[0],a=r[1];return{x:K(n),y:Q(a),zoom:1/0,index:e,parentId:-1}}function Z(t){return{type:"Feature",id:t.id,properties:J(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function J(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return $($({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function K(t){return t/360+.5}function Q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function $(t,e){for(var r in e)t[r]=e[r];return t}function tt(t){return t.x}function et(t){return t.y}function rt(t,e,r,n,a,i){var o=a-r,s=i-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=a,n=i):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}function nt(t,e,r,n){var a={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)at(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(o+=n?(a*c-l*i)/2:Math.sqrt(Math.pow(l-a,2)+Math.pow(c-i,2))),a=l,i=c}var u=e.length-3;e[2]=1,function t(e,r,n,a){for(var i,o=a,s=n-r>>1,l=n-r,c=e[r],u=e[r+1],h=e[n],f=e[n+1],p=r+3;po)i=p,o=d;else if(d===o){var g=Math.abs(p-s);ga&&(i-r>3&&t(e,r,i,a),e[i+2]=o,n-i>3&&t(e,i,n,a))}(e,0,u,r),e[u+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function lt(t,e,r,n){for(var a=0;a1?1:r}function ht(t,e,r,n,a,i,o,s){if(n/=e,i>=(r/=e)&&o=n)return null;for(var l=[],c=0;c=r&&d=n)){var g=[];if("Point"===f||"MultiPoint"===f)ft(h,g,r,n,a);else if("LineString"===f)pt(h,g,r,n,a,!1,s.lineMetrics);else if("MultiLineString"===f)gt(h,g,r,n,a,!1);else if("Polygon"===f)gt(h,g,r,n,a,!0);else if("MultiPolygon"===f)for(var v=0;v=r&&o<=n&&(e.push(t[i]),e.push(t[i+1]),e.push(t[i+2]))}}function pt(t,e,r,n,a,i,o){for(var s,l,c=dt(t),u=0===a?mt:yt,h=t.start,f=0;fr&&(l=u(c,p,d,v,m,r),o&&(c.start=h+s*l)):y>n?x=r&&(l=u(c,p,d,v,m,r),b=!0),x>n&&y<=n&&(l=u(c,p,d,v,m,n),b=!0),!i&&b&&(o&&(c.end=h+s*l),e.push(c),c=dt(t)),o&&(h+=s)}var _=t.length-3;p=t[_],d=t[_+1],g=t[_+2],(y=0===a?p:d)>=r&&y<=n&&vt(c,p,d,g),_=c.length-3,i&&_>=3&&(c[_]!==c[0]||c[_+1]!==c[1])&&vt(c,c[0],c[1],c[2]),c.length&&e.push(c)}function dt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function gt(t,e,r,n,a,i){for(var o=0;oo.maxX&&(o.maxX=u),h>o.maxY&&(o.maxY=h)}return o}function Tt(t,e,r,n){var a=e.geometry,i=e.type,o=[];if("Point"===i||"MultiPoint"===i)for(var s=0;s0&&e.size<(a?o:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;lo)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;a&&function(t,e){for(var r=0,n=0,a=t.length,i=a-2;n0===e)for(n=0,a=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=n;c--){var u=+Date.now();s=this._cluster(s,c),this.trees[c]=new H(s,tt,et,i,Float32Array),r&&console.log("z%d: %d clusters in %dms",c,s.length,+Date.now()-u)}return r&&console.timeEnd("total time"),this},Y.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),a=180===t[2]?180:((t[2]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,a=180;else if(r>a){var o=this.getClusters([r,n,180,i],e),s=this.getClusters([-180,n,a,i],e);return o.concat(s)}for(var l=this.trees[this._limitZoom(e)],c=[],u=0,h=l.range(K(r),Q(i),K(a),Q(n));u>5,r=t%32,n="No cluster with the specified id.",a=this.trees[r];if(!a)throw new Error(n);var i=a.points[e];if(!i)throw new Error(n);for(var o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=[],l=0,c=a.within(i.x,i.y,o);l1?this._map(c,!0):null,v=(l<<5)+(e+1),m=0,y=h;m1&&console.time("creation"),f=this.tiles[h]=kt(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var p="z"+e;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(f.source=t,a){if(e===l.maxZoom||e===a)continue;var d=1<1&&console.time("clipping");var g,v,m,y,x,b,_=.5*l.buffer/l.extent,w=.5-_,k=.5+_,T=1+_;g=v=m=y=null,x=ht(t,u,r-_,r+k,0,f.minX,f.maxX,l),b=ht(t,u,r+w,r+T,0,f.minX,f.maxX,l),t=null,x&&(g=ht(x,u,n-_,n+k,1,f.minY,f.maxY,l),v=ht(x,u,n+w,n+T,1,f.minY,f.maxY,l),x=null),b&&(m=ht(b,u,n-_,n+k,1,f.minY,f.maxY,l),y=ht(b,u,n+w,n+T,1,f.minY,f.maxY,l),b=null),c>1&&console.timeEnd("clipping"),s.push(g||[],e+1,2*r,2*n),s.push(v||[],e+1,2*r,2*n+1),s.push(m||[],e+1,2*r+1,2*n),s.push(y||[],e+1,2*r+1,2*n+1)}}},At.prototype.getTile=function(t,e,r){var n=this.options,a=n.extent,i=n.debug;if(t<0||t>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,c=t,u=e,h=r;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[St(c,u,h)];return l&&l.source?(i>1&&console.log("found parent tile z%d-%d-%d",c,u,h),i>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,t,e,r),i>1&&console.timeEnd("drilling down"),this.tiles[s]?_t(this.tiles[s],a):null):null};var Lt=function(e){function r(t,r,n){e.call(this,t,r,Et),n&&(this.loadGeoJSON=n)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var a=!!(n&&n.request&&n.request.collectResourceTiming)&&new l.Performance(n.request);this.loadGeoJSON(n,function(i,o){if(i||!o)return r(i);if("object"!=typeof o)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(y(t,r)),e;case"GeometryCollection":return e.geometries=e.geometries.map(y(t,r)),e;case"Feature":return e.geometry=t(e.geometry,r),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=x(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(y(x,e))),t}(e,r);default:return e}}(o,!0);try{e._geoJSONIndex=n.cluster?new Y(function(e){var r=e.superclusterOptions,n=e.clusterProperties;if(!n||!r)return r;for(var a={},i={},o={accumulated:null,zoom:0},s={properties:null},l=Object.keys(n),c=0,u=l;c=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var f=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e=0?1.2:1))}function m(t,e,r,n,a,i,o){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else{var l=i.requests[s];l||(l=i.requests[s]=[],x.loadGlyphRange(r,s,n.url,n.requestManager,function(t,e){if(e)for(var r in e)n._doesCharSupportLocalGlyph(+r)||(i.glyphs[+r]=e[+r]);for(var a=0,o=l;athis.height)return t.warnOnce("LineAtlas out of space"),null;for(var i=0,o=0;o=n&&e.x=a&&e.y0&&(l[new t.OverscaledTileID(e.overscaledZ,i,r.z,a,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,o,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}})},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}}),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),a=this._data;"string"==typeof a?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(a),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(a),this.actor.send(this.type+".loadData",n,function(t,a){r._removed||a&&a.abandoned||(r._loaded=!0,a&&a.resourceTiming&&a.resourceTiming[r.id]&&(r._resourceTiming=a.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))})},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,a=e.actor?"reloadTile":"loadTile";e.actor=this.actor;var i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};e.request=this.actor.send(a,i,function(t,i){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(i,n.map.painter,"reloadTile"===a),r(null))})},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),P=function(e){function r(t,r,n,a){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=r}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),function(a,i){n._loaded=!0,a?n.fire(new t.ErrorEvent(a)):i&&(n.image=i,e&&(n.coordinates=e),r&&r(),n._finishLoading())})},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,function(){e.texture=null}),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,a=-1/0,i=-1/0,o=0,s=e;or.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var a=this.tiles[n];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(P),z=function(e){function r(r,n,a,i){e.call(this,r,n,a,i),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(function(t){return!Array.isArray(t)||2!==t.length||t.some(function(t){return"number"!=typeof t})})||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var a in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var i=this.tiles[a];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];tthis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this},N.prototype.has=function(t){return t.wrapped().key in this.data},N.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},N.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},N.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},N.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),a=this.data[r][n];return this.data[r].splice(n,1),a.timeout&&clearTimeout(a.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(a.value),this.order.splice(this.order.indexOf(r),1),this},N.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this};var j=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};j.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},j.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},j.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var V={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},U=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};U.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},U.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},U.prototype.enableAttributes=function(t,e){for(var r=0;r1||(Math.abs(r)>1&&(1===Math.abs(r+a)?r+=a:1===Math.abs(r-a)&&(r-=a)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[i]&&(t.neighboringTiles[i].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype.getZoom=function(t){return t.zoom+t.scaleZoom(t.tileSize/this._source.tileSize)},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var a in this._tiles){var i=this._tiles[a];if(!(n[a]||!i.hasData()||i.tileID.overscaledZ<=e||i.tileID.overscaledZ>r)){for(var o=i.tileID;i&&i.tileID.overscaledZ>e+1;){var s=i.tileID.scaledTo(i.tileID.overscaledZ-1);(i=this._tiles[s.key])&&i.hasData()&&(o=s)}for(var l=o;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){n[o.key]=o;break}}}},r.prototype.findLoadedParent=function(t,e){for(var r=t.overscaledZ-1;r>=e;r--){var n=t.scaledTo(r);if(!n)return;var a=String(n.key),i=this._tiles[a];if(i&&i.hasData())return i;if(this._cache.has(n))return this._cache.get(n)}},r.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},r.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,r=Math.round(e);if(this._prevLng=t,r){var n={};for(var a in this._tiles){var i=this._tiles[a];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+r),n[i.tileID.key]=i}for(var o in this._tiles=n,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var s in this._tiles){var l=this._tiles[s];this._setTileReloadTimer(s,l)}}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var a;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(a=a.filter(function(t){return n._source.hasTile(t)}))):a=[];var i=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),o=Math.max(i-r.maxOverzooming,this._source.minzoom),s=Math.max(i+r.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(a,i);if(Ot(this._source.type)){for(var c={},u={},h=0,f=Object.keys(l);hthis._source.maxzoom){var v=d.children(this._source.maxzoom)[0],m=this.getTile(v);if(m&&m.hasData()){n[v.key]=v;continue}}else{var y=d.children(this._source.maxzoom);if(n[y[0].key]&&n[y[1].key]&&n[y[2].key]&&n[y[3].key])continue}for(var x=g.wasRequested(),b=d.overscaledZ-1;b>=i;--b){var _=d.scaledTo(b);if(a[_.key])break;if(a[_.key]=!0,!(g=this.getTile(_))&&x&&(g=this._addTile(_)),g&&(n[_.key]=_,x=g.wasRequested(),g.hasData()))break}}}return n},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var n=Boolean(r);return n||(r=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(function(){r._reloadTile(t,"expired"),delete r._timers[t]},n))},r.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var a=this,i=[],o=this.transform;if(!o)return i;for(var s=n?o.getCameraQueryGeometry(e):e,l=e.map(function(t){return o.pointCoordinate(t)}),c=s.map(function(t){return o.pointCoordinate(t)}),u=this.getIds(),h=1/0,f=1/0,p=-1/0,d=-1/0,g=0,v=c;g=0&&m[1].y+v>=0){var y=l.map(function(t){return s.getTilePoint(t)}),x=c.map(function(t){return s.getTilePoint(t)});i.push({tile:n,tileID:s,queryGeometry:y,cameraQueryGeometry:x,scale:g})}}},x=0;x=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){t=t||"_geojsonTileLayer",this._state.updateState(t,e,r)},r.prototype.removeFeatureState=function(t,e,r){t=t||"_geojsonTileLayer",this._state.removeFeatureState(t,e,r)},r.prototype.getFeatureState=function(t,e){return t=t||"_geojsonTileLayer",this._state.getState(t,e)},r}(t.Evented);function Pt(t,e){return t%32-e%32||e-t}function Ot(t){return"raster"===t||"image"===t||"video"===t}function zt(){return new t.window.Worker($n.workerUrl)}Ct.maxOverzooming=10,Ct.maxUnderzooming=3;var It=function(){this.active={}};It.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function Qt(e,r,n,a,i,o,s,l){var c=a?e.textSizeData:e.iconSizeData,u=t.evaluateSizeForZoom(c,n.transform.zoom),h=[256/n.width*2+1,256/n.height*2+1],f=a?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();for(var p=e.lineVertexArray,d=a?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=n.transform.width/n.transform.height,v=!1,m=0;mMath.abs(n.x-r.x)*a?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function ee(e,r,n,a,i,o,s,l,c,u,h,f,p,d){var g,v=r/24,m=e.lineOffsetX*v,y=e.lineOffsetY*v;if(e.numGlyphs>1){var x=e.glyphStartIndex+e.numGlyphs,b=e.lineStartIndex,_=e.lineStartIndex+e.lineLength,w=$t(v,l,m,y,n,h,f,e,c,o,p,!1);if(!w)return{notEnoughRoom:!0};var k=Jt(w.first.point,s).point,T=Jt(w.last.point,s).point;if(a&&!n){var M=te(e.writingMode,k,T,d);if(M)return M}g=[w.first];for(var A=e.glyphStartIndex+1;A0?C.point:re(f,L,S,1,i),O=te(e.writingMode,S,P,d);if(O)return O}var z=ne(v*l.getoffsetX(e.glyphStartIndex),m,y,n,h,f,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,o,p,!1);if(!z)return{notEnoughRoom:!0};g=[z]}for(var I=0,D=g;I0?1:-1,v=0;a&&(g*=-1,v=Math.PI),g<0&&(v+=Math.PI);for(var m=g>0?l+s:l+s+1,y=m,x=i,b=i,_=0,w=0,k=Math.abs(d);_+w<=k;){if((m+=g)=c)return null;if(b=x,void 0===(x=f[m])){var T=new t.Point(u.getx(m),u.gety(m)),M=Jt(T,h);if(M.signedDistanceFromCamera>0)x=f[m]=M.point;else{var A=m-g;x=re(0===_?o:new t.Point(u.getx(A),u.gety(A)),T,b,k-_+1,h)}}_+=w,w=b.dist(x)}var S=(k-_)/w,E=x.sub(b),L=E.mult(S)._add(b);return L._add(E._unit()._perp()._mult(n*g)),{point:L,angle:v+Math.atan2(x.y-b.y,x.x-b.x),tileDistance:p?{prevTileDistance:m-g===y?0:u.gettileUnitDistanceFromAnchor(m-g),lastSegmentViewportDistance:k-_}:null}}Wt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Wt.prototype.insert=function(t,e,r,n,a){this._forEachCell(e,r,n,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a)},Wt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Wt.prototype._insertBoxCell=function(t,e,r,n,a,i){this.boxCells[a].push(i)},Wt.prototype._insertCircleCell=function(t,e,r,n,a,i){this.circleCells[a].push(i)},Wt.prototype._query=function(t,e,r,n,a,i){if(r<0||t>this.width||n<0||e>this.height)return!a&&[];var o=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(a)return!0;for(var s=0;s0:o},Wt.prototype._queryCircle=function(t,e,r,n,a){var i=t-r,o=t+r,s=e-r,l=e+r;if(o<0||i>this.width||l<0||s>this.height)return!n&&[];var c=[],u={hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(i,s,o,l,this._queryCellCircle,c,u,a),n?c.length>0:c},Wt.prototype.query=function(t,e,r,n,a){return this._query(t,e,r,n,!1,a)},Wt.prototype.hitTest=function(t,e,r,n,a){return this._query(t,e,r,n,!0,a)},Wt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Wt.prototype._queryCell=function(t,e,r,n,a,i,o,s){var l=o.seenUids,c=this.boxCells[a];if(null!==c)for(var u=this.bboxes,h=0,f=c;h=u[d+0]&&n>=u[d+1]&&(!s||s(this.boxKeys[p]))){if(o.hitTest)return i.push(!0),!0;i.push({key:this.boxKeys[p],x1:u[d],y1:u[d+1],x2:u[d+2],y2:u[d+3]})}}}var g=this.circleCells[a];if(null!==g)for(var v=this.circles,m=0,y=g;mo*o+s*s},Wt.prototype._circleAndRectCollide=function(t,e,r,n,a,i,o){var s=(i-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var c=(o-a)/2,u=Math.abs(e-(a+c));if(u>c+r)return!1;if(l<=s||u<=c)return!0;var h=l-s,f=u-c;return h*h+f*f<=r*r};var ae=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ie(t,e){for(var r=0;rS)le(e,E,!1);else{var z=this.projectPoint(c,L,C),I=P*T;if(d.length>0){var D=z.x-d[d.length-4],R=z.y-d[d.length-3];if(I*I*2>D*D+R*R&&E+8-A&&F=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},se.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t