(A)
| 3225 | {name:nonlatin}`,"text-max-width":8,"icon-image":"star_11","text-offset":[.4,0],"icon-size":.8,"text-anchor":"left",visibility:"visible"},paint:{"text-color":"#333","text-halo-width":1.2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-other",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["!has","iso_a2"]],layout:{"text-font":["Noto Sans Italic"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-3",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],[">=","rank",3],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[3,11],[7,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-2",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",2],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[2,11],[5,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-country-1",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",filter:["all",["==","class","country"],["==","rank",1],["has","iso_a2"]],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":{stops:[[1,11],[4,17]]},"text-transform":"uppercase","text-max-width":6.25,visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}},{id:"place-continent",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"place",maxzoom:1,filter:["==","class","continent"],layout:{"text-font":["Noto Sans Bold"],"text-field":"{name:latin}","text-size":14,"text-max-width":6.25,"text-transform":"uppercase",visibility:"visible"},paint:{"text-halo-blur":1,"text-color":"#334","text-halo-width":2,"text-halo-color":"rgba(255,255,255,0.8)"}}],id:"qebnlkra6"}});var PHe=ye((dbr,LHe)=>{LHe.exports={version:8,name:"orto",metadata:{},center:[1.537786,41.837539],zoom:12,bearing:0,pitch:0,light:{anchor:"viewport",color:"white",intensity:.4,position:[1.15,45,30]},sources:{ortoEsri:{type:"raster",tiles:["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],tileSize:256,maxzoom:18,attribution:"ESRI © <a href='http://www.esri.com'>ESRI</a>"},ortoInstaMaps:{type:"raster",tiles:["https://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{z}/{x}/{y}.png"],tileSize:256,maxzoom:13},ortoICGC:{type:"raster",tiles:["https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg"],tileSize:256,minzoom:13.1,maxzoom:20},openmaptiles:{type:"vector",url:"https://geoserveis.icgc.cat/contextmaps/basemap.json"}},sprite:"https://geoserveis.icgc.cat/contextmaps/sprites/sprite@1",glyphs:"https://geoserveis.icgc.cat/contextmaps/glyphs/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"#F4F9F4"}},{id:"ortoEsri",type:"raster",source:"ortoEsri",maxzoom:16,layout:{visibility:"visible"}},{id:"ortoICGC",type:"raster",source:"ortoICGC",minzoom:13.1,maxzoom:19,layout:{visibility:"visible"}},{id:"ortoInstaMaps",type:"raster",source:"ortoInstaMaps",maxzoom:13,layout:{visibility:"visible"}}]}});var Ix=ye((vbr,zHe)=>{"use strict";var $Wt=t_(),QWt=CHe(),eXt=PHe(),tXt='\xA9 <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',IHe="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",RHe="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",u7="https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",rXt="https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json",iXt="https://basemaps.cartocdn.com/gl/dark-matter-nolabels-gl-style/style.json",nXt="https://basemaps.cartocdn.com/gl/voyager-nolabels-gl-style/style.json",FHe={basic:u7,streets:u7,outdoors:u7,light:IHe,dark:RHe,satellite:eXt,"satellite-streets":QWt,"open-street-map":{id:"osm",version:8,sources:{"plotly-osm-tiles":{type:"raster",attribution:tXt,tiles:["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}],glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"},"carto-positron":IHe,"carto-darkmatter":RHe,"carto-voyager":u7,"carto-positron-nolabels":rXt,"carto-darkmatter-nolabels":iXt,"carto-voyager-nolabels":nXt},DHe=$Wt(FHe);zHe.exports={styleValueDflt:"basic",stylesMap:FHe,styleValuesMap:DHe,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",missingStyleErrorMsg:["No valid maplibre style found, please set `map.style` to one of:",DHe.join(", "),"or use a tile service."].join(` |
| 3226 | `),mapOnErrorMsg:"Map error."}});var eC=ye((pbr,UHe)=>{"use strict";var qHe=Pr(),OHe=ka().defaultLine,aXt=Cc().attributes,oXt=ec(),sXt=pf().textposition,lXt=mc().overrideAll,uXt=vl().templatedArray,BHe=Ix(),NHe=oXt({noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0});NHe.family.dflt="Open Sans Regular, Arial Unicode MS Regular";var cXt=UHe.exports=lXt({_arrayAttrRegexps:[qHe.counterRegex("map",".layers",!0)],domain:aXt({name:"map"}),style:{valType:"any",values:BHe.styleValuesMap,dflt:BHe.styleValueDflt},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},bounds:{west:{valType:"number"},east:{valType:"number"},south:{valType:"number"},north:{valType:"number"}},layers:uXt("layer",{visible:{valType:"boolean",dflt:!0},sourcetype:{valType:"enumerated",values:["geojson","vector","raster","image"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},sourceattribution:{valType:"string"},type:{valType:"enumerated",values:["circle","line","fill","symbol","raster"],dflt:"circle"},coordinates:{valType:"any"},below:{valType:"string"},color:{valType:"color",dflt:OHe},opacity:{valType:"number",min:0,max:1,dflt:1},minzoom:{valType:"number",min:0,max:24,dflt:0},maxzoom:{valType:"number",min:0,max:24,dflt:24},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2},dash:{valType:"data_array"}},fill:{outlinecolor:{valType:"color",dflt:OHe}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},placement:{valType:"enumerated",values:["point","line","line-center"],dflt:"point"},textfont:NHe,textposition:qHe.extendFlat({},sXt,{arrayOk:!1})}})},"plot","from-root");cXt.uirevision={valType:"any",editType:"none"}});var c7=ye((gbr,jHe)=>{"use strict";var{hovertemplateAttrs:fXt,texttemplateAttrs:hXt,templatefallbackAttrs:VHe}=Ll(),dXt=Pg(),tC=tw(),I5=pf(),GHe=eC(),vXt=Gl(),pXt=Tu(),pw=Ao().extendFlat,gXt=mc().overrideAll,mXt=eC(),HHe=tC.line,R5=tC.marker;jHe.exports=gXt({lon:tC.lon,lat:tC.lat,cluster:{enabled:{valType:"boolean"},maxzoom:pw({},mXt.layers.maxzoom,{}),step:{valType:"number",arrayOk:!0,dflt:-1,min:-1},size:{valType:"number",arrayOk:!0,dflt:20,min:0},color:{valType:"color",arrayOk:!0},opacity:pw({},R5.opacity,{dflt:1})},mode:pw({},I5.mode,{dflt:"markers"}),text:pw({},I5.text,{}),texttemplate:hXt({editType:"plot"},{keys:["lat","lon","text"]}),texttemplatefallback:VHe({editType:"plot"}),hovertext:pw({},I5.hovertext,{}),line:{color:HHe.color,width:HHe.width},connectgaps:I5.connectgaps,marker:pw({symbol:{valType:"string",dflt:"circle",arrayOk:!0},angle:{valType:"number",dflt:"auto",arrayOk:!0},allowoverlap:{valType:"boolean",dflt:!1},opacity:R5.opacity,size:R5.size,sizeref:R5.sizeref,sizemin:R5.sizemin,sizemode:R5.sizemode},pXt("marker")),fill:tC.fill,fillcolor:dXt(),textfont:GHe.layers.symbol.textfont,textposition:GHe.layers.symbol.textposition,below:{valType:"string"},selected:{marker:I5.selected.marker},unselected:{marker:I5.unselected.marker},hoverinfo:pw({},vXt.hoverinfo,{flags:["lon","lat","text","name"]}),hovertemplate:fXt(),hovertemplatefallback:VHe()},"calc","nested")});var LJ=ye((mbr,WHe)=>{"use strict";var yXt=["Metropolis Black Italic","Metropolis Black","Metropolis Bold Italic","Metropolis Bold","Metropolis Extra Bold Italic","Metropolis Extra Bold","Metropolis Extra Light Italic","Metropolis Extra Light","Metropolis Light Italic","Metropolis Light","Metropolis Medium Italic","Metropolis Medium","Metropolis Regular Italic","Metropolis Regular","Metropolis Semi Bold Italic","Metropolis Semi Bold","Metropolis Thin Italic","Metropolis Thin","Open Sans Bold Italic","Open Sans Bold","Open Sans Extrabold Italic","Open Sans Extrabold","Open Sans Italic","Open Sans Light Italic","Open Sans Light","Open Sans Regular","Open Sans Semibold Italic","Open Sans Semibold","Klokantech Noto Sans Bold","Klokantech Noto Sans CJK Bold","Klokantech Noto Sans CJK Regular","Klokantech Noto Sans Italic","Klokantech Noto Sans Regular"];WHe.exports={isSupportedFont:function(e){return yXt.indexOf(e)!==-1}}});var YHe=ye((ybr,ZHe)=>{"use strict";var rC=Pr(),PJ=Ru(),_Xt=$p(),xXt=D0(),bXt=F0(),wXt=Fg(),XHe=c7(),TXt=LJ().isSupportedFont;ZHe.exports=function(t,r,n,i){function a(p,k){return rC.coerce(t,r,XHe,p,k)}function o(p,k){return rC.coerce2(t,r,XHe,p,k)}var s=AXt(t,r,a);if(!s){r.visible=!1;return}if(a("text"),a("texttemplate"),a("texttemplatefallback"),a("hovertext"),a("hovertemplate"),a("hovertemplatefallback"),a("mode"),a("below"),PJ.hasMarkers(r)){_Xt(t,r,n,i,a,{noLine:!0,noAngle:!0}),a("marker.allowoverlap"),a("marker.angle");var l=r.marker;l.symbol!=="circle"&&(rC.isArrayOrTypedArray(l.size)&&(l.size=l.size[0]),rC.isArrayOrTypedArray(l.color)&&(l.color=l.color[0]))}PJ.hasLines(r)&&(xXt(t,r,n,i,a,{noDash:!0}),a("connectgaps"));var u=o("cluster.maxzoom"),c=o("cluster.step"),f=o("cluster.color",r.marker&&r.marker.color||n),h=o("cluster.size"),d=o("cluster.opacity"),v=u!==!1||c!==!1||f!==!1||h!==!1||d!==!1,m=a("cluster.enabled",v);if(m||PJ.hasText(r)){var b=i.font.family;bXt(t,r,i,a,{noSelect:!0,noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0,font:{family:TXt(b)?b:"Open Sans Regular",weight:i.font.weight,style:i.font.style,size:i.font.size,color:i.font.color}})}a("fill"),r.fill!=="none"&&wXt(t,r,n,a),rC.coerceSelectionMarkerOpacity(r,a)};function AXt(e,t,r){var n=r("lon")||[],i=r("lat")||[],a=Math.min(n.length,i.length);return t._length=a,a}});var IJ=ye((_br,JHe)=>{"use strict";var KHe=ho();JHe.exports=function(t,r,n){var i={},a=n[r.subplot]._subplot,o=a.mockAxis,s=t.lonlat;return i.lonLabel=KHe.tickText(o,o.c2l(s[0]),!0).text,i.latLabel=KHe.tickText(o,o.c2l(s[1]),!0).text,i}});var RJ=ye((xbr,QHe)=>{"use strict";var $He=Pr();QHe.exports=function(t,r){var n=t.split(" "),i=n[0],a=n[1],o=$He.isArrayOrTypedArray(r)?$He.mean(r):r,s=.5+o/100,l=1.5+o/100,u=["",""],c=[0,0];switch(i){case"top":u[0]="top",c[1]=-l;break;case"bottom":u[0]="bottom",c[1]=l;break}switch(a){case"left":u[1]="right",c[0]=-s;break;case"right":u[1]="left",c[0]=s;break}var f;return u[0]&&u[1]?f=u.join("-"):u[0]?f=u[0]:u[1]?f=u[1]:f="center",{anchor:f,offset:c}}});var aje=ye((bbr,nje)=>{"use strict";var rje=Eo(),sv=Pr(),SXt=fs().BADNUM,h7=fx(),eje=tc(),MXt=So(),EXt=B3(),d7=Ru(),kXt=LJ().isSupportedFont,CXt=RJ(),LXt=ip().appendArrayPointValue,PXt=Zl().NEWLINES,IXt=Zl().BR_TAG_ALL;nje.exports=function(t,r){var n=r[0].trace,i=n.visible===!0&&n._length!==0,a=n.fill!=="none",o=d7.hasLines(n),s=d7.hasMarkers(n),l=d7.hasText(n),u=s&&n.marker.symbol==="circle",c=s&&n.marker.symbol!=="circle",f=n.cluster&&n.cluster.enabled,h=f7("fill"),d=f7("line"),v=f7("circle"),m=f7("symbol"),b={fill:h,line:d,circle:v,symbol:m};if(!i)return b;var p;if((a||o)&&(p=h7.calcTraceToLineCoords(r)),a&&(h.geojson=h7.makePolygon(p),h.layout.visibility="visible",sv.extendFlat(h.paint,{"fill-color":n.fillcolor})),o&&(d.geojson=h7.makeLine(p),d.layout.visibility="visible",sv.extendFlat(d.paint,{"line-width":n.line.width,"line-color":n.line.color,"line-opacity":n.opacity})),u){var k=RXt(r);v.geojson=k.geojson,v.layout.visibility="visible",f&&(v.filter=["!",["has","point_count"]],b.cluster={type:"circle",filter:["has","point_count"],layout:{visibility:"visible"},paint:{"circle-color":FJ(n.cluster.color,n.cluster.step),"circle-radius":FJ(n.cluster.size,n.cluster.step),"circle-opacity":FJ(n.cluster.opacity,n.cluster.step)}},b.clusterCount={type:"symbol",filter:["has","point_count"],paint:{},layout:{"text-field":"{point_count_abbreviated}","text-font":tje(n),"text-size":12}}),sv.extendFlat(v.paint,{"circle-color":k.mcc,"circle-radius":k.mrc,"circle-opacity":k.mo})}if(u&&f&&(v.filter=["!",["has","point_count"]]),(c||l)&&(m.geojson=DXt(r,t),sv.extendFlat(m.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),c&&(sv.extendFlat(m.layout,{"icon-size":n.marker.size/10}),"angle"in n.marker&&n.marker.angle!=="auto"&&sv.extendFlat(m.layout,{"icon-rotate":{type:"identity",property:"angle"},"icon-rotation-alignment":"map"}),m.layout["icon-allow-overlap"]=n.marker.allowoverlap,sv.extendFlat(m.paint,{"icon-opacity":n.opacity*n.marker.opacity,"icon-color":n.marker.color})),l)){var M=(n.marker||{}).size,T=CXt(n.textposition,M);sv.extendFlat(m.layout,{"text-size":n.textfont.size,"text-anchor":T.anchor,"text-offset":T.offset,"text-font":tje(n)}),sv.extendFlat(m.paint,{"text-color":n.textfont.color,"text-opacity":n.opacity})}return b};function f7(e){return{type:e,geojson:h7.makeBlank(),layout:{visibility:"none"},filter:null,paint:{}}}function RXt(e){var t=e[0].trace,r=t.marker,n=t.selectedpoints,i=sv.isArrayOrTypedArray(r.color),a=sv.isArrayOrTypedArray(r.size),o=sv.isArrayOrTypedArray(r.opacity),s;function l(M){return t.opacity*M}function u(M){return M/2}var c;i&&(eje.hasColorscale(t,"marker")?c=eje.makeColorScaleFuncFromTrace(r):c=sv.identity);var f;a&&(f=EXt(t));var h;o&&(h=function(M){var T=rje(M)?+sv.constrain(M,0,1):0;return l(T)});var d=[];for(s=0;s<e.length;s++){var v=e[s],m=v.lonlat;if(!ije(m)){var b={};c&&(b.mcc=v.mcc=c(v.mc)),f&&(b.mrc=v.mrc=f(v.ms)),h&&(b.mo=h(v.mo)),n&&(b.selected=v.selected||0),d.push({type:"Feature",id:s+1,geometry:{type:"Point",coordinates:m},properties:b})}}var p;if(n)for(p=MXt.makeSelectedPointStyleFns(t),s=0;s<d.length;s++){var k=d[s].properties;p.selectedOpacityFn&&(k.mo=l(p.selectedOpacityFn(k))),p.selectedColorFn&&(k.mcc=p.selectedColorFn(k)),p.selectedSizeFn&&(k.mrc=p.selectedSizeFn(k))}return{geojson:{type:"FeatureCollection",features:d},mcc:i||p&&p.selectedColorFn?{type:"identity",property:"mcc"}:r.color,mrc:a||p&&p.selectedSizeFn?{type:"identity",property:"mrc"}:u(r.size),mo:o||p&&p.selectedOpacityFn?{type:"identity",property:"mo"}:l(r.opacity)}}function DXt(e,t){for(var r=t._fullLayout,n=e[0].trace,i=n.marker||{},a=i.symbol,o=i.angle,s=a!=="circle"?DJ(a):v7,l=o!=="auto"?DJ(o,!0):v7,u=d7.hasText(n)?DJ(n.text):v7,c=[],f=0;f<e.length;f++){var h=e[f];if(!ije(h.lonlat)){var d=n.texttemplate,v;if(d){var m=Array.isArray(d)?d[f]||"":d,b=n._module.formatLabels(h,n,r),p={};LXt(p,n,h.i),v=sv.texttemplateString({data:[p,h,n._meta],fallback:n.texttemplatefallback,labels:b,locale:r._d3locale,template:m})}else v=u(f);v&&(v=v.replace(PXt,"").replace(IXt,` |
| 3227 | `)),c.push({type:"Feature",geometry:{type:"Point",coordinates:h.lonlat},properties:{symbol:s(f),angle:l(f),text:v}})}}return{type:"FeatureCollection",features:c}}function DJ(e,t){return sv.isArrayOrTypedArray(e)?t?function(r){return rje(e[r])?+e[r]:0}:function(r){return e[r]}:e?function(){return e}:v7}function v7(){return""}function ije(e){return e[0]===SXt}function FJ(e,t){var r;if(sv.isArrayOrTypedArray(e)&&sv.isArrayOrTypedArray(t)){r=["step",["get","point_count"],e[0]];for(var n=1;n<e.length;n++)r.push(t[n-1],e[n])}else r=e;return r}function tje(e){var t=e.textfont,r=t.family,n=t.style,i=t.weight,a=r.split(" "),o=a[a.length-1]==="Italic";o&&a.pop(),o=o||n==="italic";var s=a.join(" ");i==="bold"&&a.indexOf("Bold")===-1?s+=" Bold":i<=1e3&&(a[0]==="Metropolis"?(s="Metropolis",i>850?s+=" Black":i>750?s+=" Extra Bold":i>650?s+=" Bold":i>550?s+=" Semi Bold":i>450?s+=" Medium":i>350?s+=" Regular":i>250?s+=" Light":i>150?s+=" Extra Light":s+=" Thin"):a.slice(0,2).join(" ")==="Open Sans"?(s="Open Sans",i>750?s+=" Extrabold":i>650?s+=" Bold":i>550?s+=" Semibold":i>350?s+=" Regular":s+=" Light"):a.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(s="Klokantech Noto Sans",a[3]==="CJK"&&(s+=" CJK"),s+=i>500?" Bold":" Regular")),o&&(s+=" Italic"),s==="Open Sans Regular Italic"?s="Open Sans Italic":s==="Open Sans Regular Bold"?s="Open Sans Bold":s==="Open Sans Regular Bold Italic"?s="Open Sans Bold Italic":s==="Klokantech Noto Sans Regular Italic"&&(s="Klokantech Noto Sans Italic"),kXt(s)||(s=r);var l=s.split(", ");return l}});var uje=ye((wbr,lje)=>{"use strict";var FXt=Pr(),oje=aje(),D5=Ix().traceLayerPrefix,og={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function sje(e,t,r,n){this.type="scattermap",this.subplot=e,this.uid=t,this.clusterEnabled=r,this.isHidden=n,this.sourceIds={fill:"source-"+t+"-fill",line:"source-"+t+"-line",circle:"source-"+t+"-circle",symbol:"source-"+t+"-symbol",cluster:"source-"+t+"-circle",clusterCount:"source-"+t+"-circle"},this.layerIds={fill:D5+t+"-fill",line:D5+t+"-line",circle:D5+t+"-circle",symbol:D5+t+"-symbol",cluster:D5+t+"-cluster",clusterCount:D5+t+"-cluster-count"},this.below=null}var iC=sje.prototype;iC.addSource=function(e,t,r){var n={type:"geojson",data:t.geojson};r&&r.enabled&&FXt.extendFlat(n,{cluster:!0,clusterMaxZoom:r.maxzoom});var i=this.subplot.map.getSource(this.sourceIds[e]);i?i.setData(t.geojson):this.subplot.map.addSource(this.sourceIds[e],n)};iC.setSourceData=function(e,t){this.subplot.map.getSource(this.sourceIds[e]).setData(t.geojson)};iC.addLayer=function(e,t,r){var n={type:t.type,id:this.layerIds[e],source:this.sourceIds[e],layout:t.layout,paint:t.paint};t.filter&&(n.filter=t.filter);for(var i=this.layerIds[e],a,o=this.subplot.getMapLayers(),s=0;s<o.length;s++)if(o[s].id===i){a=!0;break}a?(this.subplot.setOptions(i,"setLayoutProperty",n.layout),n.layout.visibility==="visible"&&this.subplot.setOptions(i,"setPaintProperty",n.paint)):this.subplot.addLayer(n,r)};iC.update=function(t){var r=t[0].trace,n=this.subplot,i=n.map,a=oje(n.gd,t),o=n.belowLookup["trace-"+this.uid],s=!!(r.cluster&&r.cluster.enabled),l=!!this.clusterEnabled,u=this;function c(M){M||u.addSource("circle",a.circle,r.cluster);for(var T=og.cluster,L=0;L<T.length;L++){var x=T[L],C=a[x];u.addLayer(x,C,o)}}function f(M){for(var T=og.cluster,L=T.length-1;L>=0;L--){var x=T[L];i.removeLayer(u.layerIds[x])}M||i.removeSource(u.sourceIds.circle)}function h(M){for(var T=og.nonCluster,L=0;L<T.length;L++){var x=T[L],C=a[x];M||u.addSource(x,C),u.addLayer(x,C,o)}}function d(M){for(var T=og.nonCluster,L=T.length-1;L>=0;L--){var x=T[L];i.removeLayer(u.layerIds[x]),M||i.removeSource(u.sourceIds[x])}}function v(M){l?f(M):d(M)}function m(M){s?c(M):h(M)}function b(){for(var M=s?og.cluster:og.nonCluster,T=0;T<M.length;T++){var L=M[T],x=a[L];x&&(n.setOptions(u.layerIds[L],"setLayoutProperty",x.layout),x.layout.visibility==="visible"&&(L!=="cluster"&&u.setSourceData(L,x),n.setOptions(u.layerIds[L],"setPaintProperty",x.paint)))}}var p=this.isHidden,k=r.visible!==!0;k?p||v():p?k||m():l!==s?(v(),m()):(this.below!==o&&(v(!0),m(!0)),b()),this.clusterEnabled=s,this.isHidden=k,this.below=o,t[0].trace._glTrace=this};iC.dispose=function(){for(var t=this.subplot.map,r=this.clusterEnabled?og.cluster:og.nonCluster,n=r.length-1;n>=0;n--){var i=r[n];t.removeLayer(this.layerIds[i]),t.removeSource(this.sourceIds[i])}};lje.exports=function(t,r){var n=r[0].trace,i=n.cluster&&n.cluster.enabled,a=n.visible!==!0,o=new sje(t,n.uid,i,a),s=oje(t.gd,r),l=o.below=t.belowLookup["trace-"+n.uid],u,c,f;if(i)for(o.addSource("circle",s.circle,n.cluster),u=0;u<og.cluster.length;u++)c=og.cluster[u],f=s[c],o.addLayer(c,f,l);else for(u=0;u<og.nonCluster.length;u++)c=og.nonCluster[u],f=s[c],o.addSource(c,f,n.cluster),o.addLayer(c,f,l);return r[0].trace._glTrace=o,o}});var p7=ye((Tbr,fje)=>{"use strict";var zXt=ef(),zJ=Pr(),qXt=yT(),OXt=zJ.fillText,BXt=fs().BADNUM,NXt=Ix().traceLayerPrefix;function UXt(e,t,r){var n=e.cd,i=n[0].trace,a=e.xa,o=e.ya,s=e.subplot,l=[],u=NXt+i.uid+"-circle",c=i.cluster&&i.cluster.enabled;if(c){var f=s.map.queryRenderedFeatures(null,{layers:[u]});l=f.map(function(S){return S.id})}var h=t>=0?Math.floor((t+180)/360):Math.ceil((t-180)/360),d=h*360,v=t-d;function m(S){var g=S.lonlat;if(g[0]===BXt||c&&l.indexOf(S.i+1)===-1)return 1/0;var P=zJ.modHalf(g[0],360),E=g[1],z=s.project([P,E]),q=z.x-a.c2p([v,E]),V=z.y-o.c2p([P,r]),G=Math.max(3,S.mrc||0);return Math.max(Math.sqrt(q*q+V*V)-G,1-3/G)}if(zXt.getClosest(n,m,e),e.index!==!1){var b=n[e.index],p=b.lonlat,k=[zJ.modHalf(p[0],360)+d,p[1]],M=a.c2p(k),T=o.c2p(k),L=b.mrc||1;e.x0=M-L,e.x1=M+L,e.y0=T-L,e.y1=T+L;var x={};x[i.subplot]={_subplot:s};var C=i._module.formatLabels(b,i,x);return e.lonLabel=C.lonLabel,e.latLabel=C.latLabel,e.color=qXt(i,b),e.extraText=cje(i,b,n[0].t.labels),e.hovertemplate=i.hovertemplate,[e]}}function cje(e,t,r){if(e.hovertemplate)return;var n=t.hi||e.hoverinfo,i=n.split("+"),a=i.indexOf("all")!==-1,o=i.indexOf("lon")!==-1,s=i.indexOf("lat")!==-1,l=t.lonlat,u=[];function c(f){return f+"\xB0"}return a||o&&s?u.push("("+c(l[1])+", "+c(l[0])+")"):o?u.push(r.lon+c(l[0])):s&&u.push(r.lat+c(l[1])),(a||i.indexOf("text")!==-1)&&OXt(t,e,u),u.join("<br>")}fje.exports={hoverPoints:UXt,getExtraText:cje}});var dje=ye((Abr,hje)=>{"use strict";hje.exports=function(t,r){return t.lon=r.lon,t.lat=r.lat,t}});var pje=ye((Sbr,vje)=>{"use strict";var VXt=Pr(),GXt=Ru(),HXt=fs().BADNUM;vje.exports=function(t,r){var n=t.cd,i=t.xaxis,a=t.yaxis,o=[],s=n[0].trace,l;if(!GXt.hasMarkers(s))return[];if(r===!1)for(l=0;l<n.length;l++)n[l].selected=0;else for(l=0;l<n.length;l++){var u=n[l],c=u.lonlat;if(c[0]!==HXt){var f=[VXt.modHalf(c[0],360),c[1]],h=[i.c2p(f),a.c2p(f)];r.contains(h,null,l,t)?(o.push({pointNumber:l,lon:c[0],lat:c[1]}),u.selected=1):u.selected=0}}return o}});var mje=ye((qJ,OJ)=>{(function(e,t){typeof qJ=="object"&&typeof OJ!="undefined"?OJ.exports=t():(e=typeof globalThis!="undefined"?globalThis:e||self,e.maplibregl=t())})(qJ,function(){"use strict";var e={},t={};function r(i,a,o){if(t[i]=o,i==="index"){var s="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",l={};return t.shared(l),t.index(e,l),typeof window!="undefined"&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([s],{type:"text/javascript"}))),e}}r("shared",["exports"],function(i){"use strict";function a(R,A,F,W){return new(F||(F=Promise))(function(te,fe){function pe(ft){try{Ke(W.next(ft))}catch(Rt){fe(Rt)}}function Re(ft){try{Ke(W.throw(ft))}catch(Rt){fe(Rt)}}function Ke(ft){var Rt;ft.done?te(ft.value):(Rt=ft.value,Rt instanceof F?Rt:new F(function(er){er(Rt)})).then(pe,Re)}Ke((W=W.apply(R,A||[])).next())})}function o(R){return R&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R}typeof SuppressedError=="function"&&SuppressedError;var s=l;function l(R,A){this.x=R,this.y=A}l.prototype={clone:function(){return new l(this.x,this.y)},add:function(R){return this.clone()._add(R)},sub:function(R){return this.clone()._sub(R)},multByPoint:function(R){return this.clone()._multByPoint(R)},divByPoint:function(R){return this.clone()._divByPoint(R)},mult:function(R){return this.clone()._mult(R)},div:function(R){return this.clone()._div(R)},rotate:function(R){return this.clone()._rotate(R)},rotateAround:function(R,A){return this.clone()._rotateAround(R,A)},matMult:function(R){return this.clone()._matMult(R)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(R){return this.x===R.x&&this.y===R.y},dist:function(R){return Math.sqrt(this.distSqr(R))},distSqr:function(R){var A=R.x-this.x,F=R.y-this.y;return A*A+F*F},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(R){return Math.atan2(this.y-R.y,this.x-R.x)},angleWith:function(R){return this.angleWithSep(R.x,R.y)},angleWithSep:function(R,A){return Math.atan2(this.x*A-this.y*R,this.x*R+this.y*A)},_matMult:function(R){var A=R[2]*this.x+R[3]*this.y;return this.x=R[0]*this.x+R[1]*this.y,this.y=A,this},_add:function(R){return this.x+=R.x,this.y+=R.y,this},_sub:function(R){return this.x-=R.x,this.y-=R.y,this},_mult:function(R){return this.x*=R,this.y*=R,this},_div:function(R){return this.x/=R,this.y/=R,this},_multByPoint:function(R){return this.x*=R.x,this.y*=R.y,this},_divByPoint:function(R){return this.x/=R.x,this.y/=R.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var R=this.y;return this.y=this.x,this.x=-R,this},_rotate:function(R){var A=Math.cos(R),F=Math.sin(R),W=F*this.x+A*this.y;return this.x=A*this.x-F*this.y,this.y=W,this},_rotateAround:function(R,A){var F=Math.cos(R),W=Math.sin(R),te=A.y+W*(this.x-A.x)+F*(this.y-A.y);return this.x=A.x+F*(this.x-A.x)-W*(this.y-A.y),this.y=te,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},l.convert=function(R){return R instanceof l?R:Array.isArray(R)?new l(R[0],R[1]):R};var u=o(s),c=f;function f(R,A,F,W){this.cx=3*R,this.bx=3*(F-R)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*A,this.by=3*(W-A)-this.cy,this.ay=1-this.cy-this.by,this.p1x=R,this.p1y=A,this.p2x=F,this.p2y=W}f.prototype={sampleCurveX:function(R){return((this.ax*R+this.bx)*R+this.cx)*R},sampleCurveY:function(R){return((this.ay*R+this.by)*R+this.cy)*R},sampleCurveDerivativeX:function(R){return(3*this.ax*R+2*this.bx)*R+this.cx},solveCurveX:function(R,A){if(A===void 0&&(A=1e-6),R<0)return 0;if(R>1)return 1;for(var F=R,W=0;W<8;W++){var te=this.sampleCurveX(F)-R;if(Math.abs(te)<A)return F;var fe=this.sampleCurveDerivativeX(F);if(Math.abs(fe)<1e-6)break;F-=te/fe}var pe=0,Re=1;for(F=R,W=0;W<20&&(te=this.sampleCurveX(F),!(Math.abs(te-R)<A));W++)R>te?pe=F:Re=F,F=.5*(Re-pe)+pe;return F},solve:function(R,A){return this.sampleCurveY(this.solveCurveX(R,A))}};var h=o(c);let d,v;function m(){return d==null&&(d=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),d}function b(){if(v==null&&(v=!1,m())){let A=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(A){for(let W=0;W<5*5;W++){let te=4*W;A.fillStyle=`rgb(${te},${te+1},${te+2})`,A.fillRect(W%5,Math.floor(W/5),1,1)}let F=A.getImageData(0,0,5,5).data;for(let W=0;W<5*5*4;W++)if(W%4!=3&&F[W]!==W){v=!0;break}}}return v||!1}function p(R,A,F,W){let te=new h(R,A,F,W);return fe=>te.solve(fe)}let k=p(.25,.1,.25,1);function M(R,A,F){return Math.min(F,Math.max(A,R))}function T(R,A,F){let W=F-A,te=((R-A)%W+W)%W+A;return te===A?F:te}function L(R,...A){for(let F of A)for(let W in F)R[W]=F[W];return R}let x=1;function C(R,A,F){let W={};for(let te in R)W[te]=A.call(this,R[te],te,R);return W}function S(R,A,F){let W={};for(let te in R)A.call(this,R[te],te,R)&&(W[te]=R[te]);return W}function g(R){return Array.isArray(R)?R.map(g):typeof R=="object"&&R?C(R,g):R}let P={};function E(R){P[R]||(typeof console!="undefined"&&console.warn(R),P[R]=!0)}function z(R,A,F){return(F.y-R.y)*(A.x-R.x)>(A.y-R.y)*(F.x-R.x)}function q(R){return typeof WorkerGlobalScope!="undefined"&&R!==void 0&&R instanceof WorkerGlobalScope}let V=null;function G(R){return typeof ImageBitmap!="undefined"&&R instanceof ImageBitmap}let Z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function j(R,A,F,W,te){return a(this,void 0,void 0,function*(){if(typeof VideoFrame=="undefined")throw new Error("VideoFrame not supported");let fe=new VideoFrame(R,{timestamp:0});try{let pe=fe==null?void 0:fe.format;if(!pe||!pe.startsWith("BGR")&&!pe.startsWith("RGB"))throw new Error(`Unrecognized format ${pe}`);let Re=pe.startsWith("BGR"),Ke=new Uint8ClampedArray(W*te*4);if(yield fe.copyTo(Ke,function(ft,Rt,er,ur,vr){let kr=4*Math.max(-Rt,0),Dr=(Math.max(0,er)-er)*ur*4+kr,li=4*ur,pi=Math.max(0,Rt),vn=Math.max(0,er);return{rect:{x:pi,y:vn,width:Math.min(ft.width,Rt+ur)-pi,height:Math.min(ft.height,er+vr)-vn},layout:[{offset:Dr,stride:li}]}}(R,A,F,W,te)),Re)for(let ft=0;ft<Ke.length;ft+=4){let Rt=Ke[ft];Ke[ft]=Ke[ft+2],Ke[ft+2]=Rt}return Ke}finally{fe.close()}})}let N,H,ie="AbortError";function ae(){return new Error(ie)}let _e={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Ee(R){return _e.REGISTERED_PROTOCOLS[R.substring(0,R.indexOf("://"))]}let Ce="global-dispatcher";class ge extends Error{constructor(A,F,W,te){super(`AJAXError: ${F} (${A}): ${W}`),this.status=A,this.statusText=F,this.url=W,this.body=te}}let re=()=>q(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Se=function(R,A){if(/:\/\//.test(R.url)&&!/^https?:|^file:/.test(R.url)){let W=Ee(R.url);if(W)return W(R,A);if(q(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:R,targetMapId:Ce},A)}if(!(/^file:/.test(F=R.url)||/^file:/.test(re())&&!/^\w+:/.test(F))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(W,te){return a(this,void 0,void 0,function*(){let fe=new Request(W.url,{method:W.method||"GET",body:W.body,credentials:W.credentials,headers:W.headers,cache:W.cache,referrer:re(),signal:te.signal});W.type!=="json"||fe.headers.has("Accept")||fe.headers.set("Accept","application/json");let pe=yield fetch(fe);if(!pe.ok){let ft=yield pe.blob();throw new ge(pe.status,pe.statusText,W.url,ft)}let Re;Re=W.type==="arrayBuffer"||W.type==="image"?pe.arrayBuffer():W.type==="json"?pe.json():pe.text();let Ke=yield Re;if(te.signal.aborted)throw ae();return{data:Ke,cacheControl:pe.headers.get("Cache-Control"),expires:pe.headers.get("Expires")}})}(R,A);if(q(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:R,mustQueue:!0,targetMapId:Ce},A)}var F;return function(W,te){return new Promise((fe,pe)=>{var Re;let Ke=new XMLHttpRequest;Ke.open(W.method||"GET",W.url,!0),W.type!=="arrayBuffer"&&W.type!=="image"||(Ke.responseType="arraybuffer");for(let ft in W.headers)Ke.setRequestHeader(ft,W.headers[ft]);W.type==="json"&&(Ke.responseType="text",!((Re=W.headers)===null||Re===void 0)&&Re.Accept||Ke.setRequestHeader("Accept","application/json")),Ke.withCredentials=W.credentials==="include",Ke.onerror=()=>{pe(new Error(Ke.statusText))},Ke.onload=()=>{if(!te.signal.aborted)if((Ke.status>=200&&Ke.status<300||Ke.status===0)&&Ke.response!==null){let ft=Ke.response;if(W.type==="json")try{ft=JSON.parse(Ke.response)}catch(Rt){return void pe(Rt)}fe({data:ft,cacheControl:Ke.getResponseHeader("Cache-Control"),expires:Ke.getResponseHeader("Expires")})}else{let ft=new Blob([Ke.response],{type:Ke.getResponseHeader("Content-Type")});pe(new ge(Ke.status,Ke.statusText,W.url,ft))}},te.signal.addEventListener("abort",()=>{Ke.abort(),pe(ae())}),Ke.send(W.body)})}(R,A)};function ke(R){if(!R||R.indexOf("://")<=0||R.indexOf("data:image/")===0||R.indexOf("blob:")===0)return!0;let A=new URL(R),F=window.location;return A.protocol===F.protocol&&A.host===F.host}function be(R,A,F){F[R]&&F[R].indexOf(A)!==-1||(F[R]=F[R]||[],F[R].push(A))}function Be(R,A,F){if(F&&F[R]){let W=F[R].indexOf(A);W!==-1&&F[R].splice(W,1)}}class Le{constructor(A,F={}){L(this,F),this.type=A}}class me extends Le{constructor(A,F={}){super("error",L({error:A},F))}}class Pe{on(A,F){return this._listeners=this._listeners||{},be(A,F,this._listeners),this}off(A,F){return Be(A,F,this._listeners),Be(A,F,this._oneTimeListeners),this}once(A,F){return F?(this._oneTimeListeners=this._oneTimeListeners||{},be(A,F,this._oneTimeListeners),this):new Promise(W=>this.once(A,W))}fire(A,F){typeof A=="string"&&(A=new Le(A,F||{}));let W=A.type;if(this.listens(W)){A.target=this;let te=this._listeners&&this._listeners[W]?this._listeners[W].slice():[];for(let Re of te)Re.call(this,A);let fe=this._oneTimeListeners&&this._oneTimeListeners[W]?this._oneTimeListeners[W].slice():[];for(let Re of fe)Be(W,Re,this._oneTimeListeners),Re.call(this,A);let pe=this._eventedParent;pe&&(L(A,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),pe.fire(A))}else A instanceof me&&console.error(A.error);return this}listens(A){return this._listeners&&this._listeners[A]&&this._listeners[A].length>0||this._oneTimeListeners&&this._oneTimeListeners[A]&&this._oneTimeListeners[A].length>0||this._eventedParent&&this._eventedParent.listens(A)}setEventedParent(A,F){return this._eventedParent=A,this._eventedParentData=F,this}}var ce={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};let He=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function lt(R,A){let F={};for(let W in R)W!=="ref"&&(F[W]=R[W]);return He.forEach(W=>{W in A&&(F[W]=A[W])}),F}function mt(R,A){if(Array.isArray(R)){if(!Array.isArray(A)||R.length!==A.length)return!1;for(let F=0;F<R.length;F++)if(!mt(R[F],A[F]))return!1;return!0}if(typeof R=="object"&&R!==null&&A!==null){if(typeof A!="object"||Object.keys(R).length!==Object.keys(A).length)return!1;for(let F in R)if(!mt(R[F],A[F]))return!1;return!0}return R===A}function Ht(R,A){R.push(A)}function at(R,A,F){Ht(F,{command:"addSource",args:[R,A[R]]})}function ct(R,A,F){Ht(A,{command:"removeSource",args:[R]}),F[R]=!0}function ar(R,A,F,W){ct(R,F,W),at(R,A,F)}function Vt(R,A,F){let W;for(W in R[F])if(Object.prototype.hasOwnProperty.call(R[F],W)&&W!=="data"&&!mt(R[F][W],A[F][W]))return!1;for(W in A[F])if(Object.prototype.hasOwnProperty.call(A[F],W)&&W!=="data"&&!mt(R[F][W],A[F][W]))return!1;return!0}function rr(R,A,F,W,te,fe){R=R||{},A=A||{};for(let pe in R)Object.prototype.hasOwnProperty.call(R,pe)&&(mt(R[pe],A[pe])||F.push({command:fe,args:[W,pe,A[pe],te]}));for(let pe in A)Object.prototype.hasOwnProperty.call(A,pe)&&!Object.prototype.hasOwnProperty.call(R,pe)&&(mt(R[pe],A[pe])||F.push({command:fe,args:[W,pe,A[pe],te]}))}function tt(R){return R.id}function je(R,A){return R[A.id]=A,R}class Ue{constructor(A,F,W,te){this.message=(A?`${A}: `:"")+W,te&&(this.identifier=te),F!=null&&F.__line__&&(this.line=F.__line__)}}function Ae(R,...A){for(let F of A)for(let W in F)R[W]=F[W];return R}class rt extends Error{constructor(A,F){super(F),this.message=F,this.key=A}}class St{constructor(A,F=[]){this.parent=A,this.bindings={};for(let[W,te]of F)this.bindings[W]=te}concat(A){return new St(this,A)}get(A){if(this.bindings[A])return this.bindings[A];if(this.parent)return this.parent.get(A);throw new Error(`${A} not found in scope.`)}has(A){return!!this.bindings[A]||!!this.parent&&this.parent.has(A)}}let Tt={kind:"null"},dt={kind:"number"},Et={kind:"string"},pt={kind:"boolean"},jt={kind:"color"},or={kind:"object"},mr={kind:"value"},Ar={kind:"collator"},ei={kind:"formatted"},qr={kind:"padding"},jr={kind:"resolvedImage"},gt={kind:"variableAnchorOffsetCollection"};function Ge(R,A){return{kind:"array",itemType:R,N:A}}function Je(R){if(R.kind==="array"){let A=Je(R.itemType);return typeof R.N=="number"?`array<${A}, ${R.N}>`:R.itemType.kind==="value"?"array":`array<${A}>`}return R.kind}let We=[Tt,dt,Et,pt,jt,ei,or,Ge(mr),qr,jr,gt];function et(R,A){if(A.kind==="error")return null;if(R.kind==="array"){if(A.kind==="array"&&(A.N===0&&A.itemType.kind==="value"||!et(R.itemType,A.itemType))&&(typeof R.N!="number"||R.N===A.N))return null}else{if(R.kind===A.kind)return null;if(R.kind==="value"){for(let F of We)if(!et(F,A))return null}}return`Expected ${Je(R)} but found ${Je(A)} instead.`}function xt(R,A){return A.some(F=>F.kind===R.kind)}function At(R,A){return A.some(F=>F==="null"?R===null:F==="array"?Array.isArray(R):F==="object"?R&&!Array.isArray(R)&&typeof R=="object":F===typeof R)}function Kt(R,A){return R.kind==="array"&&A.kind==="array"?R.itemType.kind===A.itemType.kind&&typeof R.N=="number":R.kind===A.kind}let Qt=.96422,Mr=.82521,Gr=4/29,Ir=6/29,Yr=3*Ir*Ir,_i=Ir*Ir*Ir,Pi=Math.PI/180,ai=180/Math.PI;function mi(R){return(R%=360)<0&&(R+=360),R}function un([R,A,F,W]){let te,fe,pe=An((.2225045*(R=Fn(R))+.7168786*(A=Fn(A))+.0606169*(F=Fn(F)))/1);R===A&&A===F?te=fe=pe:(te=An((.4360747*R+.3850649*A+.1430804*F)/Qt),fe=An((.0139322*R+.0971045*A+.7141733*F)/Mr));let Re=116*pe-16;return[Re<0?0:Re,500*(te-pe),200*(pe-fe),W]}function Fn(R){return R<=.04045?R/12.92:Math.pow((R+.055)/1.055,2.4)}function An(R){return R>_i?Math.pow(R,1/3):R/Yr+Gr}function Hn([R,A,F,W]){let te=(R+16)/116,fe=isNaN(A)?te:te+A/500,pe=isNaN(F)?te:te-F/200;return te=1*Vi(te),fe=Qt*Vi(fe),pe=Mr*Vi(pe),[Qn(3.1338561*fe-1.6168667*te-.4906146*pe),Qn(-.9787684*fe+1.9161415*te+.033454*pe),Qn(.0719453*fe-.2289914*te+1.4052427*pe),W]}function Qn(R){return(R=R<=.00304?12.92*R:1.055*Math.pow(R,1/2.4)-.055)<0?0:R>1?1:R}function Vi(R){return R>Ir?R*R*R:Yr*(R-Gr)}function Kn(R){return parseInt(R.padEnd(2,R),16)/255}function Jn(R,A){return Gt(A?R/100:R,0,1)}function Gt(R,A,F){return Math.min(Math.max(A,R),F)}function wt(R){return!R.some(Number.isNaN)}let tr={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class ir{constructor(A,F,W,te=1,fe=!0){this.r=A,this.g=F,this.b=W,this.a=te,fe||(this.r*=te,this.g*=te,this.b*=te,te||this.overwriteGetter("rgb",[A,F,W,te]))}static parse(A){if(A instanceof ir)return A;if(typeof A!="string")return;let F=function(W){if((W=W.toLowerCase().trim())==="transparent")return[0,0,0,0];let te=tr[W];if(te){let[pe,Re,Ke]=te;return[pe/255,Re/255,Ke/255,1]}if(W.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(W)){let pe=W.length<6?1:2,Re=1;return[Kn(W.slice(Re,Re+=pe)),Kn(W.slice(Re,Re+=pe)),Kn(W.slice(Re,Re+=pe)),Kn(W.slice(Re,Re+pe)||"ff")]}if(W.startsWith("rgb")){let pe=W.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(pe){let[Re,Ke,ft,Rt,er,ur,vr,kr,Dr,li,pi,vn]=pe,zi=[Rt||" ",vr||" ",li].join("");if(zi===" "||zi===" /"||zi===",,"||zi===",,,"){let ln=[ft,ur,Dr].join(""),Tn=ln==="%%%"?100:ln===""?255:0;if(Tn){let pa=[Gt(+Ke/Tn,0,1),Gt(+er/Tn,0,1),Gt(+kr/Tn,0,1),pi?Jn(+pi,vn):1];if(wt(pa))return pa}}return}}let fe=W.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(fe){let[pe,Re,Ke,ft,Rt,er,ur,vr,kr]=fe,Dr=[Ke||" ",Rt||" ",ur].join("");if(Dr===" "||Dr===" /"||Dr===",,"||Dr===",,,"){let li=[+Re,Gt(+ft,0,100),Gt(+er,0,100),vr?Jn(+vr,kr):1];if(wt(li))return function([pi,vn,zi,ln]){function Tn(pa){let ro=(pa+pi/30)%12,Vo=vn*Math.min(zi,1-zi);return zi-Vo*Math.max(-1,Math.min(ro-3,9-ro,1))}return pi=mi(pi),vn/=100,zi/=100,[Tn(0),Tn(8),Tn(4),ln]}(li)}}}(A);return F?new ir(...F,!1):void 0}get rgb(){let{r:A,g:F,b:W,a:te}=this,fe=te||1/0;return this.overwriteGetter("rgb",[A/fe,F/fe,W/fe,te])}get hcl(){return this.overwriteGetter("hcl",function(A){let[F,W,te,fe]=un(A),pe=Math.sqrt(W*W+te*te);return[Math.round(1e4*pe)?mi(Math.atan2(te,W)*ai):NaN,pe,F,fe]}(this.rgb))}get lab(){return this.overwriteGetter("lab",un(this.rgb))}overwriteGetter(A,F){return Object.defineProperty(this,A,{value:F}),F}toString(){let[A,F,W,te]=this.rgb;return`rgba(${[A,F,W].map(fe=>Math.round(255*fe)).join(",")},${te})`}}ir.black=new ir(0,0,0,1),ir.white=new ir(1,1,1,1),ir.transparent=new ir(0,0,0,0),ir.red=new ir(1,0,0,1);class wr{constructor(A,F,W){this.sensitivity=A?F?"variant":"case":F?"accent":"base",this.locale=W,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(A,F){return this.collator.compare(A,F)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Xr{constructor(A,F,W,te,fe){this.text=A,this.image=F,this.scale=W,this.fontStack=te,this.textColor=fe}}class ti{constructor(A){this.sections=A}static fromString(A){return new ti([new Xr(A,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(A=>A.text.length!==0||A.image&&A.image.name.length!==0)}static factory(A){return A instanceof ti?A:ti.fromString(A)}toString(){return this.sections.length===0?"":this.sections.map(A=>A.text).join("")}}class $r{constructor(A){this.values=A.slice()}static parse(A){if(A instanceof $r)return A;if(typeof A=="number")return new $r([A,A,A,A]);if(Array.isArray(A)&&!(A.length<1||A.length>4)){for(let F of A)if(typeof F!="number")return;switch(A.length){case 1:A=[A[0],A[0],A[0],A[0]];break;case 2:A=[A[0],A[1],A[0],A[1]];break;case 3:A=[A[0],A[1],A[2],A[1]]}return new $r(A)}}toString(){return JSON.stringify(this.values)}}let Ri=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Zi{constructor(A){this.values=A.slice()}static parse(A){if(A instanceof Zi)return A;if(Array.isArray(A)&&!(A.length<1)&&A.length%2==0){for(let F=0;F<A.length;F+=2){let W=A[F],te=A[F+1];if(typeof W!="string"||!Ri.has(W)||!Array.isArray(te)||te.length!==2||typeof te[0]!="number"||typeof te[1]!="number")return}return new Zi(A)}}toString(){return JSON.stringify(this.values)}}class en{constructor(A){this.name=A.name,this.available=A.available}toString(){return this.name}static fromString(A){return A?new en({name:A,available:!1}):null}}function fn(R,A,F,W){return typeof R=="number"&&R>=0&&R<=255&&typeof A=="number"&&A>=0&&A<=255&&typeof F=="number"&&F>=0&&F<=255?W===void 0||typeof W=="number"&&W>=0&&W<=1?null:`Invalid rgba value [${[R,A,F,W].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof W=="number"?[R,A,F,W]:[R,A,F]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function yn(R){if(R===null||typeof R=="string"||typeof R=="boolean"||typeof R=="number"||R instanceof ir||R instanceof wr||R instanceof ti||R instanceof $r||R instanceof Zi||R instanceof en)return!0;if(Array.isArray(R)){for(let A of R)if(!yn(A))return!1;return!0}if(typeof R=="object"){for(let A in R)if(!yn(R[A]))return!1;return!0}return!1}function Mn(R){if(R===null)return Tt;if(typeof R=="string")return Et;if(typeof R=="boolean")return pt;if(typeof R=="number")return dt;if(R instanceof ir)return jt;if(R instanceof wr)return Ar;if(R instanceof ti)return ei;if(R instanceof $r)return qr;if(R instanceof Zi)return gt;if(R instanceof en)return jr;if(Array.isArray(R)){let A=R.length,F;for(let W of R){let te=Mn(W);if(F){if(F===te)continue;F=mr;break}F=te}return Ge(F||mr,A)}return or}function Ba(R){let A=typeof R;return R===null?"":A==="string"||A==="number"||A==="boolean"?String(R):R instanceof ir||R instanceof ti||R instanceof $r||R instanceof Zi||R instanceof en?R.toString():JSON.stringify(R)}class ua{constructor(A,F){this.type=A,this.value=F}static parse(A,F){if(A.length!==2)return F.error(`'literal' expression requires exactly one argument, but found ${A.length-1} instead.`);if(!yn(A[1]))return F.error("invalid value");let W=A[1],te=Mn(W),fe=F.expectedType;return te.kind!=="array"||te.N!==0||!fe||fe.kind!=="array"||typeof fe.N=="number"&&fe.N!==0||(te=fe),new ua(te,W)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ma{constructor(A){this.name="ExpressionEvaluationError",this.message=A}toJSON(){return this.message}}let Wa={string:Et,number:dt,boolean:pt,object:or};class Fa{constructor(A,F){this.type=A,this.args=F}static parse(A,F){if(A.length<2)return F.error("Expected at least one argument.");let W,te=1,fe=A[0];if(fe==="array"){let Re,Ke;if(A.length>2){let ft=A[1];if(typeof ft!="string"||!(ft in Wa)||ft==="object")return F.error('The item type argument of "array" must be one of string, number, boolean',1);Re=Wa[ft],te++}else Re=mr;if(A.length>3){if(A[2]!==null&&(typeof A[2]!="number"||A[2]<0||A[2]!==Math.floor(A[2])))return F.error('The length argument to "array" must be a positive integer literal',2);Ke=A[2],te++}W=Ge(Re,Ke)}else{if(!Wa[fe])throw new Error(`Types doesn't contain name = ${fe}`);W=Wa[fe]}let pe=[];for(;te<A.length;te++){let Re=F.parse(A[te],te,mr);if(!Re)return null;pe.push(Re)}return new Fa(W,pe)}evaluate(A){for(let F=0;F<this.args.length;F++){let W=this.args[F].evaluate(A);if(!et(this.type,Mn(W)))return W;if(F===this.args.length-1)throw new ma(`Expected value to be of type ${Je(this.type)}, but found ${Je(Mn(W))} instead.`)}throw new Error}eachChild(A){this.args.forEach(A)}outputDefined(){return this.args.every(A=>A.outputDefined())}}let Xo={"to-boolean":pt,"to-color":jt,"to-number":dt,"to-string":Et};class da{constructor(A,F){this.type=A,this.args=F}static parse(A,F){if(A.length<2)return F.error("Expected at least one argument.");let W=A[0];if(!Xo[W])throw new Error(`Can't parse ${W} as it is not part of the known types`);if((W==="to-boolean"||W==="to-string")&&A.length!==2)return F.error("Expected one argument.");let te=Xo[W],fe=[];for(let pe=1;pe<A.length;pe++){let Re=F.parse(A[pe],pe,mr);if(!Re)return null;fe.push(Re)}return new da(te,fe)}evaluate(A){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(A);case"color":{let F,W;for(let te of this.args){if(F=te.evaluate(A),W=null,F instanceof ir)return F;if(typeof F=="string"){let fe=A.parseColor(F);if(fe)return fe}else if(Array.isArray(F)&&(W=F.length<3||F.length>4?`Invalid rbga value ${JSON.stringify(F)}: expected an array containing either three or four numeric values.`:fn(F[0],F[1],F[2],F[3]),!W))return new ir(F[0]/255,F[1]/255,F[2]/255,F[3])}throw new ma(W||`Could not parse color from value '${typeof F=="string"?F:JSON.stringify(F)}'`)}case"padding":{let F;for(let W of this.args){F=W.evaluate(A);let te=$r.parse(F);if(te)return te}throw new ma(`Could not parse padding from value '${typeof F=="string"?F:JSON.stringify(F)}'`)}case"variableAnchorOffsetCollection":{let F;for(let W of this.args){F=W.evaluate(A);let te=Zi.parse(F);if(te)return te}throw new ma(`Could not parse variableAnchorOffsetCollection from value '${typeof F=="string"?F:JSON.stringify(F)}'`)}case"number":{let F=null;for(let W of this.args){if(F=W.evaluate(A),F===null)return 0;let te=Number(F);if(!isNaN(te))return te}throw new ma(`Could not convert ${JSON.stringify(F)} to number.`)}case"formatted":return ti.fromString(Ba(this.args[0].evaluate(A)));case"resolvedImage":return en.fromString(Ba(this.args[0].evaluate(A)));default:return Ba(this.args[0].evaluate(A))}}eachChild(A){this.args.forEach(A)}outputDefined(){return this.args.every(A=>A.outputDefined())}}let jn=["Unknown","Point","LineString","Polygon"];class Ha{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?jn[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(A){let F=this._parseColorCache[A];return F||(F=this._parseColorCache[A]=ir.parse(A)),F}}class vo{constructor(A,F,W=[],te,fe=new St,pe=[]){this.registry=A,this.path=W,this.key=W.map(Re=>`[${Re}]`).join(""),this.scope=fe,this.errors=pe,this.expectedType=te,this._isConstant=F}parse(A,F,W,te,fe={}){return F?this.concat(F,W,te)._parse(A,fe):this._parse(A,fe)}_parse(A,F){function W(te,fe,pe){return pe==="assert"?new Fa(fe,[te]):pe==="coerce"?new da(fe,[te]):te}if(A!==null&&typeof A!="string"&&typeof A!="boolean"&&typeof A!="number"||(A=["literal",A]),Array.isArray(A)){if(A.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let te=A[0];if(typeof te!="string")return this.error(`Expression name must be a string, but found ${typeof te} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let fe=this.registry[te];if(fe){let pe=fe.parse(A,this);if(!pe)return null;if(this.expectedType){let Re=this.expectedType,Ke=pe.type;if(Re.kind!=="string"&&Re.kind!=="number"&&Re.kind!=="boolean"&&Re.kind!=="object"&&Re.kind!=="array"||Ke.kind!=="value")if(Re.kind!=="color"&&Re.kind!=="formatted"&&Re.kind!=="resolvedImage"||Ke.kind!=="value"&&Ke.kind!=="string")if(Re.kind!=="padding"||Ke.kind!=="value"&&Ke.kind!=="number"&&Ke.kind!=="array")if(Re.kind!=="variableAnchorOffsetCollection"||Ke.kind!=="value"&&Ke.kind!=="array"){if(this.checkSubtype(Re,Ke))return null}else pe=W(pe,Re,F.typeAnnotation||"coerce");else pe=W(pe,Re,F.typeAnnotation||"coerce");else pe=W(pe,Re,F.typeAnnotation||"coerce");else pe=W(pe,Re,F.typeAnnotation||"assert")}if(!(pe instanceof ua)&&pe.type.kind!=="resolvedImage"&&this._isConstant(pe)){let Re=new Ha;try{pe=new ua(pe.type,pe.evaluate(Re))}catch(Ke){return this.error(Ke.message),null}}return pe}return this.error(`Unknown expression "${te}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(A===void 0?"'undefined' value invalid. Use null instead.":typeof A=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof A} instead.`)}concat(A,F,W){let te=typeof A=="number"?this.path.concat(A):this.path,fe=W?this.scope.concat(W):this.scope;return new vo(this.registry,this._isConstant,te,F||null,fe,this.errors)}error(A,...F){let W=`${this.key}${F.map(te=>`[${te}]`).join("")}`;this.errors.push(new rt(W,A))}checkSubtype(A,F){let W=et(A,F);return W&&this.error(W),W}}class Gn{constructor(A,F){this.type=F.type,this.bindings=[].concat(A),this.result=F}evaluate(A){return this.result.evaluate(A)}eachChild(A){for(let F of this.bindings)A(F[1]);A(this.result)}static parse(A,F){if(A.length<4)return F.error(`Expected at least 3 arguments, but found ${A.length-1} instead.`);let W=[];for(let fe=1;fe<A.length-1;fe+=2){let pe=A[fe];if(typeof pe!="string")return F.error(`Expected string, but found ${typeof pe} instead.`,fe);if(/[^a-zA-Z0-9_]/.test(pe))return F.error("Variable names must contain only alphanumeric characters or '_'.",fe);let Re=F.parse(A[fe+1],fe+1);if(!Re)return null;W.push([pe,Re])}let te=F.parse(A[A.length-1],A.length-1,F.expectedType,W);return te?new Gn(W,te):null}outputDefined(){return this.result.outputDefined()}}class Ct{constructor(A,F){this.type=F.type,this.name=A,this.boundExpression=F}static parse(A,F){if(A.length!==2||typeof A[1]!="string")return F.error("'var' expression requires exactly one string literal argument.");let W=A[1];return F.scope.has(W)?new Ct(W,F.scope.get(W)):F.error(`Unknown variable "${W}". Make sure "${W}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(A){return this.boundExpression.evaluate(A)}eachChild(){}outputDefined(){return!1}}class Sr{constructor(A,F,W){this.type=A,this.index=F,this.input=W}static parse(A,F){if(A.length!==3)return F.error(`Expected 2 arguments, but found ${A.length-1} instead.`);let W=F.parse(A[1],1,dt),te=F.parse(A[2],2,Ge(F.expectedType||mr));return W&&te?new Sr(te.type.itemType,W,te):null}evaluate(A){let F=this.index.evaluate(A),W=this.input.evaluate(A);if(F<0)throw new ma(`Array index out of bounds: ${F} < 0.`);if(F>=W.length)throw new ma(`Array index out of bounds: ${F} > ${W.length-1}.`);if(F!==Math.floor(F))throw new ma(`Array index must be an integer, but found ${F} instead.`);return W[F]}eachChild(A){A(this.index),A(this.input)}outputDefined(){return!1}}class Jr{constructor(A,F){this.type=pt,this.needle=A,this.haystack=F}static parse(A,F){if(A.length!==3)return F.error(`Expected 2 arguments, but found ${A.length-1} instead.`);let W=F.parse(A[1],1,mr),te=F.parse(A[2],2,mr);return W&&te?xt(W.type,[pt,Et,dt,Tt,mr])?new Jr(W,te):F.error(`Expected first argument to be of type boolean, string, number or null, but found ${Je(W.type)} instead`):null}evaluate(A){let F=this.needle.evaluate(A),W=this.haystack.evaluate(A);if(!W)return!1;if(!At(F,["boolean","string","number","null"]))throw new ma(`Expected first argument to be of type boolean, string, number or null, but found ${Je(Mn(F))} instead.`);if(!At(W,["string","array"]))throw new ma(`Expected second argument to be of type array or string, but found ${Je(Mn(W))} instead.`);return W.indexOf(F)>=0}eachChild(A){A(this.needle),A(this.haystack)}outputDefined(){return!0}}class hi{constructor(A,F,W){this.type=dt,this.needle=A,this.haystack=F,this.fromIndex=W}static parse(A,F){if(A.length<=2||A.length>=5)return F.error(`Expected 3 or 4 arguments, but found ${A.length-1} instead.`);let W=F.parse(A[1],1,mr),te=F.parse(A[2],2,mr);if(!W||!te)return null;if(!xt(W.type,[pt,Et,dt,Tt,mr]))return F.error(`Expected first argument to be of type boolean, string, number or null, but found ${Je(W.type)} instead`);if(A.length===4){let fe=F.parse(A[3],3,dt);return fe?new hi(W,te,fe):null}return new hi(W,te)}evaluate(A){let F=this.needle.evaluate(A),W=this.haystack.evaluate(A);if(!At(F,["boolean","string","number","null"]))throw new ma(`Expected first argument to be of type boolean, string, number or null, but found ${Je(Mn(F))} instead.`);let te;if(this.fromIndex&&(te=this.fromIndex.evaluate(A)),At(W,["string"])){let fe=W.indexOf(F,te);return fe===-1?-1:[...W.slice(0,fe)].length}if(At(W,["array"]))return W.indexOf(F,te);throw new ma(`Expected second argument to be of type array or string, but found ${Je(Mn(W))} instead.`)}eachChild(A){A(this.needle),A(this.haystack),this.fromIndex&&A(this.fromIndex)}outputDefined(){return!1}}class hn{constructor(A,F,W,te,fe,pe){this.inputType=A,this.type=F,this.input=W,this.cases=te,this.outputs=fe,this.otherwise=pe}static parse(A,F){if(A.length<5)return F.error(`Expected at least 4 arguments, but found only ${A.length-1}.`);if(A.length%2!=1)return F.error("Expected an even number of arguments.");let W,te;F.expectedType&&F.expectedType.kind!=="value"&&(te=F.expectedType);let fe={},pe=[];for(let ft=2;ft<A.length-1;ft+=2){let Rt=A[ft],er=A[ft+1];Array.isArray(Rt)||(Rt=[Rt]);let ur=F.concat(ft);if(Rt.length===0)return ur.error("Expected at least one branch label.");for(let kr of Rt){if(typeof kr!="number"&&typeof kr!="string")return ur.error("Branch labels must be numbers or strings.");if(typeof kr=="number"&&Math.abs(kr)>Number.MAX_SAFE_INTEGER)return ur.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof kr=="number"&&Math.floor(kr)!==kr)return ur.error("Numeric branch labels must be integer values.");if(W){if(ur.checkSubtype(W,Mn(kr)))return null}else W=Mn(kr);if(fe[String(kr)]!==void 0)return ur.error("Branch labels must be unique.");fe[String(kr)]=pe.length}let vr=F.parse(er,ft,te);if(!vr)return null;te=te||vr.type,pe.push(vr)}let Re=F.parse(A[1],1,mr);if(!Re)return null;let Ke=F.parse(A[A.length-1],A.length-1,te);return Ke?Re.type.kind!=="value"&&F.concat(1).checkSubtype(W,Re.type)?null:new hn(W,te,Re,fe,pe,Ke):null}evaluate(A){let F=this.input.evaluate(A);return(Mn(F)===this.inputType&&this.outputs[this.cases[F]]||this.otherwise).evaluate(A)}eachChild(A){A(this.input),this.outputs.forEach(A),A(this.otherwise)}outputDefined(){return this.outputs.every(A=>A.outputDefined())&&this.otherwise.outputDefined()}}class Sn{constructor(A,F,W){this.type=A,this.branches=F,this.otherwise=W}static parse(A,F){if(A.length<4)return F.error(`Expected at least 3 arguments, but found only ${A.length-1}.`);if(A.length%2!=0)return F.error("Expected an odd number of arguments.");let W;F.expectedType&&F.expectedType.kind!=="value"&&(W=F.expectedType);let te=[];for(let pe=1;pe<A.length-1;pe+=2){let Re=F.parse(A[pe],pe,pt);if(!Re)return null;let Ke=F.parse(A[pe+1],pe+1,W);if(!Ke)return null;te.push([Re,Ke]),W=W||Ke.type}let fe=F.parse(A[A.length-1],A.length-1,W);if(!fe)return null;if(!W)throw new Error("Can't infer output type");return new Sn(W,te,fe)}evaluate(A){for(let[F,W]of this.branches)if(F.evaluate(A))return W.evaluate(A);return this.otherwise.evaluate(A)}eachChild(A){for(let[F,W]of this.branches)A(F),A(W);A(this.otherwise)}outputDefined(){return this.branches.every(([A,F])=>F.outputDefined())&&this.otherwise.outputDefined()}}class En{constructor(A,F,W,te){this.type=A,this.input=F,this.beginIndex=W,this.endIndex=te}static parse(A,F){if(A.length<=2||A.length>=5)return F.error(`Expected 3 or 4 arguments, but found ${A.length-1} instead.`);let W=F.parse(A[1],1,mr),te=F.parse(A[2],2,dt);if(!W||!te)return null;if(!xt(W.type,[Ge(mr),Et,mr]))return F.error(`Expected first argument to be of type array or string, but found ${Je(W.type)} instead`);if(A.length===4){let fe=F.parse(A[3],3,dt);return fe?new En(W.type,W,te,fe):null}return new En(W.type,W,te)}evaluate(A){let F=this.input.evaluate(A),W=this.beginIndex.evaluate(A),te;if(this.endIndex&&(te=this.endIndex.evaluate(A)),At(F,["string"]))return[...F].slice(W,te).join("");if(At(F,["array"]))return F.slice(W,te);throw new ma(`Expected first argument to be of type array or string, but found ${Je(Mn(F))} instead.`)}eachChild(A){A(this.input),A(this.beginIndex),this.endIndex&&A(this.endIndex)}outputDefined(){return!1}}function ki(R,A){let F=R.length-1,W,te,fe=0,pe=F,Re=0;for(;fe<=pe;)if(Re=Math.floor((fe+pe)/2),W=R[Re],te=R[Re+1],W<=A){if(Re===F||A<te)return Re;fe=Re+1}else{if(!(W>A))throw new ma("Input is not a number.");pe=Re-1}return 0}class _n{constructor(A,F,W){this.type=A,this.input=F,this.labels=[],this.outputs=[];for(let[te,fe]of W)this.labels.push(te),this.outputs.push(fe)}static parse(A,F){if(A.length-1<4)return F.error(`Expected at least 4 arguments, but found only ${A.length-1}.`);if((A.length-1)%2!=0)return F.error("Expected an even number of arguments.");let W=F.parse(A[1],1,dt);if(!W)return null;let te=[],fe=null;F.expectedType&&F.expectedType.kind!=="value"&&(fe=F.expectedType);for(let pe=1;pe<A.length;pe+=2){let Re=pe===1?-1/0:A[pe],Ke=A[pe+1],ft=pe,Rt=pe+1;if(typeof Re!="number")return F.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ft);if(te.length&&te[te.length-1][0]>=Re)return F.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',ft);let er=F.parse(Ke,Rt,fe);if(!er)return null;fe=fe||er.type,te.push([Re,er])}return new _n(fe,W,te)}evaluate(A){let F=this.labels,W=this.outputs;if(F.length===1)return W[0].evaluate(A);let te=this.input.evaluate(A);if(te<=F[0])return W[0].evaluate(A);let fe=F.length;return te>=F[fe-1]?W[fe-1].evaluate(A):W[ki(F,te)].evaluate(A)}eachChild(A){A(this.input);for(let F of this.outputs)A(F)}outputDefined(){return this.outputs.every(A=>A.outputDefined())}}function ya(R){return R&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R}var ea=Ma;function Ma(R,A,F,W){this.cx=3*R,this.bx=3*(F-R)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*A,this.by=3*(W-A)-this.cy,this.ay=1-this.cy-this.by,this.p1x=R,this.p1y=A,this.p2x=F,this.p2y=W}Ma.prototype={sampleCurveX:function(R){return((this.ax*R+this.bx)*R+this.cx)*R},sampleCurveY:function(R){return((this.ay*R+this.by)*R+this.cy)*R},sampleCurveDerivativeX:function(R){return(3*this.ax*R+2*this.bx)*R+this.cx},solveCurveX:function(R,A){if(A===void 0&&(A=1e-6),R<0)return 0;if(R>1)return 1;for(var F=R,W=0;W<8;W++){var te=this.sampleCurveX(F)-R;if(Math.abs(te)<A)return F;var fe=this.sampleCurveDerivativeX(F);if(Math.abs(fe)<1e-6)break;F-=te/fe}var pe=0,Re=1;for(F=R,W=0;W<20&&(te=this.sampleCurveX(F),!(Math.abs(te-R)<A));W++)R>te?pe=F:Re=F,F=.5*(Re-pe)+pe;return F},solve:function(R,A){return this.sampleCurveY(this.solveCurveX(R,A))}};var _o=ya(ea);function No(R,A,F){return R+F*(A-R)}function po(R,A,F){return R.map((W,te)=>No(W,A[te],F))}let Lo={number:No,color:function(R,A,F,W="rgb"){switch(W){case"rgb":{let[te,fe,pe,Re]=po(R.rgb,A.rgb,F);return new ir(te,fe,pe,Re,!1)}case"hcl":{let[te,fe,pe,Re]=R.hcl,[Ke,ft,Rt,er]=A.hcl,ur,vr;if(isNaN(te)||isNaN(Ke))isNaN(te)?isNaN(Ke)?ur=NaN:(ur=Ke,pe!==1&&pe!==0||(vr=ft)):(ur=te,Rt!==1&&Rt!==0||(vr=fe));else{let vn=Ke-te;Ke>te&&vn>180?vn-=360:Ke<te&&te-Ke>180&&(vn+=360),ur=te+F*vn}let[kr,Dr,li,pi]=function([vn,zi,ln,Tn]){return vn=isNaN(vn)?0:vn*Pi,Hn([ln,Math.cos(vn)*zi,Math.sin(vn)*zi,Tn])}([ur,vr!=null?vr:No(fe,ft,F),No(pe,Rt,F),No(Re,er,F)]);return new ir(kr,Dr,li,pi,!1)}case"lab":{let[te,fe,pe,Re]=Hn(po(R.lab,A.lab,F));return new ir(te,fe,pe,Re,!1)}}},array:po,padding:function(R,A,F){return new $r(po(R.values,A.values,F))},variableAnchorOffsetCollection:function(R,A,F){let W=R.values,te=A.values;if(W.length!==te.length)throw new ma(`Cannot interpolate values of different length. from: ${R.toString()}, to: ${A.toString()}`);let fe=[];for(let pe=0;pe<W.length;pe+=2){if(W[pe]!==te[pe])throw new ma(`Cannot interpolate values containing mismatched anchors. from[${pe}]: ${W[pe]}, to[${pe}]: ${te[pe]}`);fe.push(W[pe]);let[Re,Ke]=W[pe+1],[ft,Rt]=te[pe+1];fe.push([No(Re,ft,F),No(Ke,Rt,F)])}return new Zi(fe)}};class ko{constructor(A,F,W,te,fe){this.type=A,this.operator=F,this.interpolation=W,this.input=te,this.labels=[],this.outputs=[];for(let[pe,Re]of fe)this.labels.push(pe),this.outputs.push(Re)}static interpolationFactor(A,F,W,te){let fe=0;if(A.name==="exponential")fe=Ds(F,A.base,W,te);else if(A.name==="linear")fe=Ds(F,1,W,te);else if(A.name==="cubic-bezier"){let pe=A.controlPoints;fe=new _o(pe[0],pe[1],pe[2],pe[3]).solve(Ds(F,1,W,te))}return fe}static parse(A,F){let[W,te,fe,...pe]=A;if(!Array.isArray(te)||te.length===0)return F.error("Expected an interpolation type expression.",1);if(te[0]==="linear")te={name:"linear"};else if(te[0]==="exponential"){let ft=te[1];if(typeof ft!="number")return F.error("Exponential interpolation requires a numeric base.",1,1);te={name:"exponential",base:ft}}else{if(te[0]!=="cubic-bezier")return F.error(`Unknown interpolation type ${String(te[0])}`,1,0);{let ft=te.slice(1);if(ft.length!==4||ft.some(Rt=>typeof Rt!="number"||Rt<0||Rt>1))return F.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);te={name:"cubic-bezier",controlPoints:ft}}}if(A.length-1<4)return F.error(`Expected at least 4 arguments, but found only ${A.length-1}.`);if((A.length-1)%2!=0)return F.error("Expected an even number of arguments.");if(fe=F.parse(fe,2,dt),!fe)return null;let Re=[],Ke=null;W==="interpolate-hcl"||W==="interpolate-lab"?Ke=jt:F.expectedType&&F.expectedType.kind!=="value"&&(Ke=F.expectedType);for(let ft=0;ft<pe.length;ft+=2){let Rt=pe[ft],er=pe[ft+1],ur=ft+3,vr=ft+4;if(typeof Rt!="number")return F.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ur);if(Re.length&&Re[Re.length-1][0]>=Rt)return F.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',ur);let kr=F.parse(er,vr,Ke);if(!kr)return null;Ke=Ke||kr.type,Re.push([Rt,kr])}return Kt(Ke,dt)||Kt(Ke,jt)||Kt(Ke,qr)||Kt(Ke,gt)||Kt(Ke,Ge(dt))?new ko(Ke,W,te,fe,Re):F.error(`Type ${Je(Ke)} is not interpolatable.`)}evaluate(A){let F=this.labels,W=this.outputs;if(F.length===1)return W[0].evaluate(A);let te=this.input.evaluate(A);if(te<=F[0])return W[0].evaluate(A);let fe=F.length;if(te>=F[fe-1])return W[fe-1].evaluate(A);let pe=ki(F,te),Re=ko.interpolationFactor(this.interpolation,te,F[pe],F[pe+1]),Ke=W[pe].evaluate(A),ft=W[pe+1].evaluate(A);switch(this.operator){case"interpolate":return Lo[this.type.kind](Ke,ft,Re);case"interpolate-hcl":return Lo.color(Ke,ft,Re,"hcl");case"interpolate-lab":return Lo.color(Ke,ft,Re,"lab")}}eachChild(A){A(this.input);for(let F of this.outputs)A(F)}outputDefined(){return this.outputs.every(A=>A.outputDefined())}}function Ds(R,A,F,W){let te=W-F,fe=R-F;return te===0?0:A===1?fe/te:(Math.pow(A,fe)-1)/(Math.pow(A,te)-1)}class Fs{constructor(A,F){this.type=A,this.args=F}static parse(A,F){if(A.length<2)return F.error("Expectected at least one argument.");let W=null,te=F.expectedType;te&&te.kind!=="value"&&(W=te);let fe=[];for(let Re of A.slice(1)){let Ke=F.parse(Re,1+fe.length,W,void 0,{typeAnnotation:"omit"});if(!Ke)return null;W=W||Ke.type,fe.push(Ke)}if(!W)throw new Error("No output type");let pe=te&&fe.some(Re=>et(te,Re.type));return new Fs(pe?mr:W,fe)}evaluate(A){let F,W=null,te=0;for(let fe of this.args)if(te++,W=fe.evaluate(A),W&&W instanceof en&&!W.available&&(F||(F=W.name),W=null,te===this.args.length&&(W=F)),W!==null)break;return W}eachChild(A){this.args.forEach(A)}outputDefined(){return this.args.every(A=>A.outputDefined())}}function ll(R,A){return R==="=="||R==="!="?A.kind==="boolean"||A.kind==="string"||A.kind==="number"||A.kind==="null"||A.kind==="value":A.kind==="string"||A.kind==="number"||A.kind==="value"}function ul(R,A,F,W){return W.compare(A,F)===0}function zl(R,A,F){let W=R!=="=="&&R!=="!=";return class gje{constructor(fe,pe,Re){this.type=pt,this.lhs=fe,this.rhs=pe,this.collator=Re,this.hasUntypedArgument=fe.type.kind==="value"||pe.type.kind==="value"}static parse(fe,pe){if(fe.length!==3&&fe.length!==4)return pe.error("Expected two or three arguments.");let Re=fe[0],Ke=pe.parse(fe[1],1,mr);if(!Ke)return null;if(!ll(Re,Ke.type))return pe.concat(1).error(`"${Re}" comparisons are not supported for type '${Je(Ke.type)}'.`);let ft=pe.parse(fe[2],2,mr);if(!ft)return null;if(!ll(Re,ft.type))return pe.concat(2).error(`"${Re}" comparisons are not supported for type '${Je(ft.type)}'.`);if(Ke.type.kind!==ft.type.kind&&Ke.type.kind!=="value"&&ft.type.kind!=="value")return pe.error(`Cannot compare types '${Je(Ke.type)}' and '${Je(ft.type)}'.`);W&&(Ke.type.kind==="value"&&ft.type.kind!=="value"?Ke=new Fa(ft.type,[Ke]):Ke.type.kind!=="value"&&ft.type.kind==="value"&&(ft=new Fa(Ke.type,[ft])));let Rt=null;if(fe.length===4){if(Ke.type.kind!=="string"&&ft.type.kind!=="string"&&Ke.type.kind!=="value"&&ft.type.kind!=="value")return pe.error("Cannot use collator to compare non-string types.");if(Rt=pe.parse(fe[3],3,Ar),!Rt)return null}return new gje(Ke,ft,Rt)}evaluate(fe){let pe=this.lhs.evaluate(fe),Re=this.rhs.evaluate(fe);if(W&&this.hasUntypedArgument){let Ke=Mn(pe),ft=Mn(Re);if(Ke.kind!==ft.kind||Ke.kind!=="string"&&Ke.kind!=="number")throw new ma(`Expected arguments for "${R}" to be (string, string) or (number, number), but found (${Ke.kind}, ${ft.kind}) instead.`)}if(this.collator&&!W&&this.hasUntypedArgument){let Ke=Mn(pe),ft=Mn(Re);if(Ke.kind!=="string"||ft.kind!=="string")return A(fe,pe,Re)}return this.collator?F(fe,pe,Re,this.collator.evaluate(fe)):A(fe,pe,Re)}eachChild(fe){fe(this.lhs),fe(this.rhs),this.collator&&fe(this.collator)}outputDefined(){return!0}}}let us=zl("==",function(R,A,F){return A===F},ul),il=zl("!=",function(R,A,F){return A!==F},function(R,A,F,W){return!ul(0,A,F,W)}),As=zl("<",function(R,A,F){return A<F},function(R,A,F,W){return W.compare(A,F)<0}),cl=zl(">",function(R,A,F){return A>F},function(R,A,F,W){return W.compare(A,F)>0}),Ks=zl("<=",function(R,A,F){return A<=F},function(R,A,F,W){return W.compare(A,F)<=0}),zs=zl(">=",function(R,A,F){return A>=F},function(R,A,F,W){return W.compare(A,F)>=0});class Io{constructor(A,F,W){this.type=Ar,this.locale=W,this.caseSensitive=A,this.diacriticSensitive=F}static parse(A,F){if(A.length!==2)return F.error("Expected one argument.");let W=A[1];if(typeof W!="object"||Array.isArray(W))return F.error("Collator options argument must be an object.");let te=F.parse(W["case-sensitive"]!==void 0&&W["case-sensitive"],1,pt);if(!te)return null;let fe=F.parse(W["diacritic-sensitive"]!==void 0&&W["diacritic-sensitive"],1,pt);if(!fe)return null;let pe=null;return W.locale&&(pe=F.parse(W.locale,1,Et),!pe)?null:new Io(te,fe,pe)}evaluate(A){return new wr(this.caseSensitive.evaluate(A),this.diacriticSensitive.evaluate(A),this.locale?this.locale.evaluate(A):null)}eachChild(A){A(this.caseSensitive),A(this.diacriticSensitive),this.locale&&A(this.locale)}outputDefined(){return!1}}class ls{constructor(A,F,W,te,fe){this.type=Et,this.number=A,this.locale=F,this.currency=W,this.minFractionDigits=te,this.maxFractionDigits=fe}static parse(A,F){if(A.length!==3)return F.error("Expected two arguments.");let W=F.parse(A[1],1,dt);if(!W)return null;let te=A[2];if(typeof te!="object"||Array.isArray(te))return F.error("NumberFormat options argument must be an object.");let fe=null;if(te.locale&&(fe=F.parse(te.locale,1,Et),!fe))return null;let pe=null;if(te.currency&&(pe=F.parse(te.currency,1,Et),!pe))return null;let Re=null;if(te["min-fraction-digits"]&&(Re=F.parse(te["min-fraction-digits"],1,dt),!Re))return null;let Ke=null;return te["max-fraction-digits"]&&(Ke=F.parse(te["max-fraction-digits"],1,dt),!Ke)?null:new ls(W,fe,pe,Re,Ke)}evaluate(A){return new Intl.NumberFormat(this.locale?this.locale.evaluate(A):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(A):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(A):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(A):void 0}).format(this.number.evaluate(A))}eachChild(A){A(this.number),this.locale&&A(this.locale),this.currency&&A(this.currency),this.minFractionDigits&&A(this.minFractionDigits),this.maxFractionDigits&&A(this.maxFractionDigits)}outputDefined(){return!1}}class Yl{constructor(A){this.type=ei,this.sections=A}static parse(A,F){if(A.length<2)return F.error("Expected at least one argument.");let W=A[1];if(!Array.isArray(W)&&typeof W=="object")return F.error("First argument must be an image or text section.");let te=[],fe=!1;for(let pe=1;pe<=A.length-1;++pe){let Re=A[pe];if(fe&&typeof Re=="object"&&!Array.isArray(Re)){fe=!1;let Ke=null;if(Re["font-scale"]&&(Ke=F.parse(Re["font-scale"],1,dt),!Ke))return null;let ft=null;if(Re["text-font"]&&(ft=F.parse(Re["text-font"],1,Ge(Et)),!ft))return null;let Rt=null;if(Re["text-color"]&&(Rt=F.parse(Re["text-color"],1,jt),!Rt))return null;let er=te[te.length-1];er.scale=Ke,er.font=ft,er.textColor=Rt}else{let Ke=F.parse(A[pe],1,mr);if(!Ke)return null;let ft=Ke.type.kind;if(ft!=="string"&&ft!=="value"&&ft!=="null"&&ft!=="resolvedImage")return F.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");fe=!0,te.push({content:Ke,scale:null,font:null,textColor:null})}}return new Yl(te)}evaluate(A){return new ti(this.sections.map(F=>{let W=F.content.evaluate(A);return Mn(W)===jr?new Xr("",W,null,null,null):new Xr(Ba(W),null,F.scale?F.scale.evaluate(A):null,F.font?F.font.evaluate(A).join(","):null,F.textColor?F.textColor.evaluate(A):null)}))}eachChild(A){for(let F of this.sections)A(F.content),F.scale&&A(F.scale),F.font&&A(F.font),F.textColor&&A(F.textColor)}outputDefined(){return!1}}class Su{constructor(A){this.type=jr,this.input=A}static parse(A,F){if(A.length!==2)return F.error("Expected two arguments.");let W=F.parse(A[1],1,Et);return W?new Su(W):F.error("No image name provided.")}evaluate(A){let F=this.input.evaluate(A),W=en.fromString(F);return W&&A.availableImages&&(W.available=A.availableImages.indexOf(F)>-1),W}eachChild(A){A(this.input)}outputDefined(){return!1}}class nc{constructor(A){this.type=dt,this.input=A}static parse(A,F){if(A.length!==2)return F.error(`Expected 1 argument, but found ${A.length-1} instead.`);let W=F.parse(A[1],1);return W?W.type.kind!=="array"&&W.type.kind!=="string"&&W.type.kind!=="value"?F.error(`Expected argument of type string or array, but found ${Je(W.type)} instead.`):new nc(W):null}evaluate(A){let F=this.input.evaluate(A);if(typeof F=="string")return[...F].length;if(Array.isArray(F))return F.length;throw new ma(`Expected value to be of type string or array, but found ${Je(Mn(F))} instead.`)}eachChild(A){A(this.input)}outputDefined(){return!1}}let bs=8192;function Rn(R,A){let F=(180+R[0])/360,W=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+R[1]*Math.PI/360)))/360,te=Math.pow(2,A.z);return[Math.round(F*te*bs),Math.round(W*te*bs)]}function _a(R,A){let F=Math.pow(2,A.z);return[(te=(R[0]/bs+A.x)/F,360*te-180),(W=(R[1]/bs+A.y)/F,360/Math.PI*Math.atan(Math.exp((180-360*W)*Math.PI/180))-90)];var W,te}function Vu(R,A){R[0]=Math.min(R[0],A[0]),R[1]=Math.min(R[1],A[1]),R[2]=Math.max(R[2],A[0]),R[3]=Math.max(R[3],A[1])}function ql(R,A){return!(R[0]<=A[0]||R[2]>=A[2]||R[1]<=A[1]||R[3]>=A[3])}function xo(R,A,F){let W=R[0]-A[0],te=R[1]-A[1],fe=R[0]-F[0],pe=R[1]-F[1];return W*pe-fe*te==0&&W*fe<=0&&te*pe<=0}function Kl(R,A,F,W){return(te=[W[0]-F[0],W[1]-F[1]])[0]*(fe=[A[0]-R[0],A[1]-R[1]])[1]-te[1]*fe[0]!=0&&!(!Oo(R,A,F,W)||!Oo(F,W,R,A));var te,fe}function Ns(R,A,F){for(let W of F)for(let te=0;te<W.length-1;++te)if(Kl(R,A,W[te],W[te+1]))return!0;return!1}function Hl(R,A,F=!1){let W=!1;for(let Re of A)for(let Ke=0;Ke<Re.length-1;Ke++){if(xo(R,Re[Ke],Re[Ke+1]))return F;(fe=Re[Ke])[1]>(te=R)[1]!=(pe=Re[Ke+1])[1]>te[1]&&te[0]<(pe[0]-fe[0])*(te[1]-fe[1])/(pe[1]-fe[1])+fe[0]&&(W=!W)}var te,fe,pe;return W}function ac(R,A){for(let F of A)if(Hl(R,F))return!0;return!1}function oa(R,A){for(let F of R)if(!Hl(F,A))return!1;for(let F=0;F<R.length-1;++F)if(Ns(R[F],R[F+1],A))return!1;return!0}function qo(R,A){for(let F of A)if(oa(R,F))return!0;return!1}function Oo(R,A,F,W){let te=W[0]-F[0],fe=W[1]-F[1],pe=(R[0]-F[0])*fe-te*(R[1]-F[1]),Re=(A[0]-F[0])*fe-te*(A[1]-F[1]);return pe>0&&Re<0||pe<0&&Re>0}function Ol(R,A,F){let W=[];for(let te=0;te<R.length;te++){let fe=[];for(let pe=0;pe<R[te].length;pe++){let Re=Rn(R[te][pe],F);Vu(A,Re),fe.push(Re)}W.push(fe)}return W}function Pc(R,A,F){let W=[];for(let te=0;te<R.length;te++){let fe=Ol(R[te],A,F);W.push(fe)}return W}function Do(R,A,F,W){if(R[0]<F[0]||R[0]>F[2]){let te=.5*W,fe=R[0]-F[0]>te?-W:F[0]-R[0]>te?W:0;fe===0&&(fe=R[0]-F[2]>te?-W:F[2]-R[0]>te?W:0),R[0]+=fe}Vu(A,R)}function nf(R,A,F,W){let te=Math.pow(2,W.z)*bs,fe=[W.x*bs,W.y*bs],pe=[];for(let Re of R)for(let Ke of Re){let ft=[Ke.x+fe[0],Ke.y+fe[1]];Do(ft,A,F,te),pe.push(ft)}return pe}function Vf(R,A,F,W){let te=Math.pow(2,W.z)*bs,fe=[W.x*bs,W.y*bs],pe=[];for(let Ke of R){let ft=[];for(let Rt of Ke){let er=[Rt.x+fe[0],Rt.y+fe[1]];Vu(A,er),ft.push(er)}pe.push(ft)}if(A[2]-A[0]<=te/2){(Re=A)[0]=Re[1]=1/0,Re[2]=Re[3]=-1/0;for(let Ke of pe)for(let ft of Ke)Do(ft,A,F,te)}var Re;return pe}class pl{constructor(A,F){this.type=pt,this.geojson=A,this.geometries=F}static parse(A,F){if(A.length!==2)return F.error(`'within' expression requires exactly one argument, but found ${A.length-1} instead.`);if(yn(A[1])){let W=A[1];if(W.type==="FeatureCollection"){let te=[];for(let fe of W.features){let{type:pe,coordinates:Re}=fe.geometry;pe==="Polygon"&&te.push(Re),pe==="MultiPolygon"&&te.push(...Re)}if(te.length)return new pl(W,{type:"MultiPolygon",coordinates:te})}else if(W.type==="Feature"){let te=W.geometry.type;if(te==="Polygon"||te==="MultiPolygon")return new pl(W,W.geometry)}else if(W.type==="Polygon"||W.type==="MultiPolygon")return new pl(W,W)}return F.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(A){if(A.geometry()!=null&&A.canonicalID()!=null){if(A.geometryType()==="Point")return function(F,W){let te=[1/0,1/0,-1/0,-1/0],fe=[1/0,1/0,-1/0,-1/0],pe=F.canonicalID();if(W.type==="Polygon"){let Re=Ol(W.coordinates,fe,pe),Ke=nf(F.geometry(),te,fe,pe);if(!ql(te,fe))return!1;for(let ft of Ke)if(!Hl(ft,Re))return!1}if(W.type==="MultiPolygon"){let Re=Pc(W.coordinates,fe,pe),Ke=nf(F.geometry(),te,fe,pe);if(!ql(te,fe))return!1;for(let ft of Ke)if(!ac(ft,Re))return!1}return!0}(A,this.geometries);if(A.geometryType()==="LineString")return function(F,W){let te=[1/0,1/0,-1/0,-1/0],fe=[1/0,1/0,-1/0,-1/0],pe=F.canonicalID();if(W.type==="Polygon"){let Re=Ol(W.coordinates,fe,pe),Ke=Vf(F.geometry(),te,fe,pe);if(!ql(te,fe))return!1;for(let ft of Ke)if(!oa(ft,Re))return!1}if(W.type==="MultiPolygon"){let Re=Pc(W.coordinates,fe,pe),Ke=Vf(F.geometry(),te,fe,pe);if(!ql(te,fe))return!1;for(let ft of Ke)if(!qo(ft,Re))return!1}return!0}(A,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Zc=class{constructor(R=[],A=(F,W)=>F<W?-1:F>W?1:0){if(this.data=R,this.length=this.data.length,this.compare=A,this.length>0)for(let F=(this.length>>1)-1;F>=0;F--)this._down(F)}push(R){this.data.push(R),this._up(this.length++)}pop(){if(this.length===0)return;let R=this.data[0],A=this.data.pop();return--this.length>0&&(this.data[0]=A,this._down(0)),R}peek(){return this.data[0]}_up(R){let{data:A,compare:F}=this,W=A[R];for(;R>0;){let te=R-1>>1,fe=A[te];if(F(W,fe)>=0)break;A[R]=fe,R=te}A[R]=W}_down(R){let{data:A,compare:F}=this,W=this.length>>1,te=A[R];for(;R<W;){let fe=1+(R<<1),pe=fe+1;if(pe<this.length&&F(A[pe],A[fe])<0&&(fe=pe),F(A[fe],te)>=0)break;A[R]=A[fe],R=fe}A[R]=te}};function Jl(R,A,F,W,te){qs(R,A,F,W||R.length-1,te||oc)}function qs(R,A,F,W,te){for(;W>F;){if(W-F>600){var fe=W-F+1,pe=A-F+1,Re=Math.log(fe),Ke=.5*Math.exp(2*Re/3),ft=.5*Math.sqrt(Re*Ke*(fe-Ke)/fe)*(pe-fe/2<0?-1:1);qs(R,A,Math.max(F,Math.floor(A-pe*Ke/fe+ft)),Math.min(W,Math.floor(A+(fe-pe)*Ke/fe+ft)),te)}var Rt=R[A],er=F,ur=W;for(yu(R,F,A),te(R[W],Rt)>0&&yu(R,F,W);er<ur;){for(yu(R,er,ur),er++,ur--;te(R[er],Rt)<0;)er++;for(;te(R[ur],Rt)>0;)ur--}te(R[F],Rt)===0?yu(R,F,ur):yu(R,++ur,W),ur<=A&&(F=ur+1),A<=ur&&(W=ur-1)}}function yu(R,A,F){var W=R[A];R[A]=R[F],R[F]=W}function oc(R,A){return R<A?-1:R>A?1:0}function Cf(R,A){if(R.length<=1)return[R];let F=[],W,te;for(let fe of R){let pe=jh(fe);pe!==0&&(fe.area=Math.abs(pe),te===void 0&&(te=pe<0),te===pe<0?(W&&F.push(W),W=[fe]):W.push(fe))}if(W&&F.push(W),A>1)for(let fe=0;fe<F.length;fe++)F[fe].length<=A||(Jl(F[fe],A,1,F[fe].length-1,sc),F[fe]=F[fe].slice(0,A));return F}function sc(R,A){return A.area-R.area}function jh(R){let A=0;for(let F,W,te=0,fe=R.length,pe=fe-1;te<fe;pe=te++)F=R[te],W=R[pe],A+=(W.x-F.x)*(F.y+W.y);return A}let Lf=1/298.257223563,cs=Lf*(2-Lf),af=Math.PI/180;class Gf{constructor(A){let F=6378.137*af*1e3,W=Math.cos(A*af),te=1/(1-cs*(1-W*W)),fe=Math.sqrt(te);this.kx=F*fe*W,this.ky=F*fe*te*(1-cs)}distance(A,F){let W=this.wrap(A[0]-F[0])*this.kx,te=(A[1]-F[1])*this.ky;return Math.sqrt(W*W+te*te)}pointOnLine(A,F){let W,te,fe,pe,Re=1/0;for(let Ke=0;Ke<A.length-1;Ke++){let ft=A[Ke][0],Rt=A[Ke][1],er=this.wrap(A[Ke+1][0]-ft)*this.kx,ur=(A[Ke+1][1]-Rt)*this.ky,vr=0;er===0&&ur===0||(vr=(this.wrap(F[0]-ft)*this.kx*er+(F[1]-Rt)*this.ky*ur)/(er*er+ur*ur),vr>1?(ft=A[Ke+1][0],Rt=A[Ke+1][1]):vr>0&&(ft+=er/this.kx*vr,Rt+=ur/this.ky*vr)),er=this.wrap(F[0]-ft)*this.kx,ur=(F[1]-Rt)*this.ky;let kr=er*er+ur*ur;kr<Re&&(Re=kr,W=ft,te=Rt,fe=Ke,pe=vr)}return{point:[W,te],index:fe,t:Math.max(0,Math.min(1,pe))}}wrap(A){for(;A<-180;)A+=360;for(;A>180;)A-=360;return A}}function $l(R,A){return A[0]-R[0]}function fl(R){return R[1]-R[0]+1}function lc(R,A){return R[1]>=R[0]&&R[1]<A}function Fu(R,A){if(R[0]>R[1])return[null,null];let F=fl(R);if(A){if(F===2)return[R,null];let te=Math.floor(F/2);return[[R[0],R[0]+te],[R[0]+te,R[1]]]}if(F===1)return[R,null];let W=Math.floor(F/2)-1;return[[R[0],R[0]+W],[R[0]+W+1,R[1]]]}function Es(R,A){if(!lc(A,R.length))return[1/0,1/0,-1/0,-1/0];let F=[1/0,1/0,-1/0,-1/0];for(let W=A[0];W<=A[1];++W)Vu(F,R[W]);return F}function Hs(R){let A=[1/0,1/0,-1/0,-1/0];for(let F of R)for(let W of F)Vu(A,W);return A}function Go(R){return R[0]!==-1/0&&R[1]!==-1/0&&R[2]!==1/0&&R[3]!==1/0}function ps(R,A,F){if(!Go(R)||!Go(A))return NaN;let W=0,te=0;return R[2]<A[0]&&(W=A[0]-R[2]),R[0]>A[2]&&(W=R[0]-A[2]),R[1]>A[3]&&(te=R[1]-A[3]),R[3]<A[1]&&(te=A[1]-R[3]),F.distance([0,0],[W,te])}function uc(R,A,F){let W=F.pointOnLine(A,R);return F.distance(R,W.point)}function xl(R,A,F,W,te){let fe=Math.min(uc(R,[F,W],te),uc(A,[F,W],te)),pe=Math.min(uc(F,[R,A],te),uc(W,[R,A],te));return Math.min(fe,pe)}function Gu(R,A,F,W,te){if(!lc(A,R.length)||!lc(W,F.length))return 1/0;let fe=1/0;for(let pe=A[0];pe<A[1];++pe){let Re=R[pe],Ke=R[pe+1];for(let ft=W[0];ft<W[1];++ft){let Rt=F[ft],er=F[ft+1];if(Kl(Re,Ke,Rt,er))return 0;fe=Math.min(fe,xl(Re,Ke,Rt,er,te))}}return fe}function Os(R,A,F,W,te){if(!lc(A,R.length)||!lc(W,F.length))return NaN;let fe=1/0;for(let pe=A[0];pe<=A[1];++pe)for(let Re=W[0];Re<=W[1];++Re)if(fe=Math.min(fe,te.distance(R[pe],F[Re])),fe===0)return fe;return fe}function od(R,A,F){if(Hl(R,A,!0))return 0;let W=1/0;for(let te of A){let fe=te[0],pe=te[te.length-1];if(fe!==pe&&(W=Math.min(W,uc(R,[pe,fe],F)),W===0))return W;let Re=F.pointOnLine(te,R);if(W=Math.min(W,F.distance(R,Re.point)),W===0)return W}return W}function Po(R,A,F,W){if(!lc(A,R.length))return NaN;for(let fe=A[0];fe<=A[1];++fe)if(Hl(R[fe],F,!0))return 0;let te=1/0;for(let fe=A[0];fe<A[1];++fe){let pe=R[fe],Re=R[fe+1];for(let Ke of F)for(let ft=0,Rt=Ke.length,er=Rt-1;ft<Rt;er=ft++){let ur=Ke[er],vr=Ke[ft];if(Kl(pe,Re,ur,vr))return 0;te=Math.min(te,xl(pe,Re,ur,vr,W))}}return te}function sd(R,A){for(let F of R)for(let W of F)if(Hl(W,A,!0))return!0;return!1}function Ko(R,A,F,W=1/0){let te=Hs(R),fe=Hs(A);if(W!==1/0&&ps(te,fe,F)>=W)return W;if(ql(te,fe)){if(sd(R,A))return 0}else if(sd(A,R))return 0;let pe=1/0;for(let Re of R)for(let Ke=0,ft=Re.length,Rt=ft-1;Ke<ft;Rt=Ke++){let er=Re[Rt],ur=Re[Ke];for(let vr of A)for(let kr=0,Dr=vr.length,li=Dr-1;kr<Dr;li=kr++){let pi=vr[li],vn=vr[kr];if(Kl(er,ur,pi,vn))return 0;pe=Math.min(pe,xl(er,ur,pi,vn,F))}}return pe}function Pa(R,A,F,W,te,fe){if(!fe)return;let pe=ps(Es(W,fe),te,F);pe<A&&R.push([pe,fe,[0,0]])}function of(R,A,F,W,te,fe,pe){if(!fe||!pe)return;let Re=ps(Es(W,fe),Es(te,pe),F);Re<A&&R.push([Re,fe,pe])}function Hu(R,A,F,W,te=1/0){let fe=Math.min(W.distance(R[0],F[0][0]),te);if(fe===0)return fe;let pe=new Zc([[0,[0,R.length-1],[0,0]]],$l),Re=Hs(F);for(;pe.length>0;){let Ke=pe.pop();if(Ke[0]>=fe)continue;let ft=Ke[1],Rt=A?50:100;if(fl(ft)<=Rt){if(!lc(ft,R.length))return NaN;if(A){let er=Po(R,ft,F,W);if(isNaN(er)||er===0)return er;fe=Math.min(fe,er)}else for(let er=ft[0];er<=ft[1];++er){let ur=od(R[er],F,W);if(fe=Math.min(fe,ur),fe===0)return 0}}else{let er=Fu(ft,A);Pa(pe,fe,W,R,Re,er[0]),Pa(pe,fe,W,R,Re,er[1])}}return fe}function bl(R,A,F,W,te,fe=1/0){let pe=Math.min(fe,te.distance(R[0],F[0]));if(pe===0)return pe;let Re=new Zc([[0,[0,R.length-1],[0,F.length-1]]],$l);for(;Re.length>0;){let Ke=Re.pop();if(Ke[0]>=pe)continue;let ft=Ke[1],Rt=Ke[2],er=A?50:100,ur=W?50:100;if(fl(ft)<=er&&fl(Rt)<=ur){if(!lc(ft,R.length)&&lc(Rt,F.length))return NaN;let vr;if(A&&W)vr=Gu(R,ft,F,Rt,te),pe=Math.min(pe,vr);else if(A&&!W){let kr=R.slice(ft[0],ft[1]+1);for(let Dr=Rt[0];Dr<=Rt[1];++Dr)if(vr=uc(F[Dr],kr,te),pe=Math.min(pe,vr),pe===0)return pe}else if(!A&&W){let kr=F.slice(Rt[0],Rt[1]+1);for(let Dr=ft[0];Dr<=ft[1];++Dr)if(vr=uc(R[Dr],kr,te),pe=Math.min(pe,vr),pe===0)return pe}else vr=Os(R,ft,F,Rt,te),pe=Math.min(pe,vr)}else{let vr=Fu(ft,A),kr=Fu(Rt,W);of(Re,pe,te,R,F,vr[0],kr[0]),of(Re,pe,te,R,F,vr[0],kr[1]),of(Re,pe,te,R,F,vr[1],kr[0]),of(Re,pe,te,R,F,vr[1],kr[1])}}return pe}function Hf(R){return R.type==="MultiPolygon"?R.coordinates.map(A=>({type:"Polygon",coordinates:A})):R.type==="MultiLineString"?R.coordinates.map(A=>({type:"LineString",coordinates:A})):R.type==="MultiPoint"?R.coordinates.map(A=>({type:"Point",coordinates:A})):[R]}class Ic{constructor(A,F){this.type=dt,this.geojson=A,this.geometries=F}static parse(A,F){if(A.length!==2)return F.error(`'distance' expression requires exactly one argument, but found ${A.length-1} instead.`);if(yn(A[1])){let W=A[1];if(W.type==="FeatureCollection")return new Ic(W,W.features.map(te=>Hf(te.geometry)).flat());if(W.type==="Feature")return new Ic(W,Hf(W.geometry));if("type"in W&&"coordinates"in W)return new Ic(W,Hf(W))}return F.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(A){if(A.geometry()!=null&&A.canonicalID()!=null){if(A.geometryType()==="Point")return function(F,W){let te=F.geometry(),fe=te.flat().map(Ke=>_a([Ke.x,Ke.y],F.canonical));if(te.length===0)return NaN;let pe=new Gf(fe[0][1]),Re=1/0;for(let Ke of W){switch(Ke.type){case"Point":Re=Math.min(Re,bl(fe,!1,[Ke.coordinates],!1,pe,Re));break;case"LineString":Re=Math.min(Re,bl(fe,!1,Ke.coordinates,!0,pe,Re));break;case"Polygon":Re=Math.min(Re,Hu(fe,!1,Ke.coordinates,pe,Re))}if(Re===0)return Re}return Re}(A,this.geometries);if(A.geometryType()==="LineString")return function(F,W){let te=F.geometry(),fe=te.flat().map(Ke=>_a([Ke.x,Ke.y],F.canonical));if(te.length===0)return NaN;let pe=new Gf(fe[0][1]),Re=1/0;for(let Ke of W){switch(Ke.type){case"Point":Re=Math.min(Re,bl(fe,!0,[Ke.coordinates],!1,pe,Re));break;case"LineString":Re=Math.min(Re,bl(fe,!0,Ke.coordinates,!0,pe,Re));break;case"Polygon":Re=Math.min(Re,Hu(fe,!0,Ke.coordinates,pe,Re))}if(Re===0)return Re}return Re}(A,this.geometries);if(A.geometryType()==="Polygon")return function(F,W){let te=F.geometry();if(te.length===0||te[0].length===0)return NaN;let fe=Cf(te,0).map(Ke=>Ke.map(ft=>ft.map(Rt=>_a([Rt.x,Rt.y],F.canonical)))),pe=new Gf(fe[0][0][0][1]),Re=1/0;for(let Ke of W)for(let ft of fe){switch(Ke.type){case"Point":Re=Math.min(Re,Hu([Ke.coordinates],!1,ft,pe,Re));break;case"LineString":Re=Math.min(Re,Hu(Ke.coordinates,!0,ft,pe,Re));break;case"Polygon":Re=Math.min(Re,Ko(ft,Ke.coordinates,pe,Re))}if(Re===0)return Re}return Re}(A,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let yf={"==":us,"!=":il,">":cl,"<":As,">=":zs,"<=":Ks,array:Fa,at:Sr,boolean:Fa,case:Sn,coalesce:Fs,collator:Io,format:Yl,image:Su,in:Jr,"index-of":hi,interpolate:ko,"interpolate-hcl":ko,"interpolate-lab":ko,length:nc,let:Gn,literal:ua,match:hn,number:Fa,"number-format":ls,object:Fa,slice:En,step:_n,string:Fa,"to-boolean":da,"to-color":da,"to-number":da,"to-string":da,var:Ct,within:pl,distance:Ic};class Bl{constructor(A,F,W,te){this.name=A,this.type=F,this._evaluate=W,this.args=te}evaluate(A){return this._evaluate(A,this.args)}eachChild(A){this.args.forEach(A)}outputDefined(){return!1}static parse(A,F){let W=A[0],te=Bl.definitions[W];if(!te)return F.error(`Unknown expression "${W}". If you wanted a literal array, use ["literal", [...]].`,0);let fe=Array.isArray(te)?te[0]:te.type,pe=Array.isArray(te)?[[te[1],te[2]]]:te.overloads,Re=pe.filter(([ft])=>!Array.isArray(ft)||ft.length===A.length-1),Ke=null;for(let[ft,Rt]of Re){Ke=new vo(F.registry,eh,F.path,null,F.scope);let er=[],ur=!1;for(let vr=1;vr<A.length;vr++){let kr=A[vr],Dr=Array.isArray(ft)?ft[vr-1]:ft.type,li=Ke.parse(kr,1+er.length,Dr);if(!li){ur=!0;break}er.push(li)}if(!ur)if(Array.isArray(ft)&&ft.length!==er.length)Ke.error(`Expected ${ft.length} arguments, but found ${er.length} instead.`);else{for(let vr=0;vr<er.length;vr++){let kr=Array.isArray(ft)?ft[vr]:ft.type,Dr=er[vr];Ke.concat(vr+1).checkSubtype(kr,Dr.type)}if(Ke.errors.length===0)return new Bl(W,fe,Rt,er)}}if(Re.length===1)F.errors.push(...Ke.errors);else{let ft=(Re.length?Re:pe).map(([er])=>{return ur=er,Array.isArray(ur)?`(${ur.map(Je).join(", ")})`:`(${Je(ur.type)}...)`;var ur}).join(" | "),Rt=[];for(let er=1;er<A.length;er++){let ur=F.parse(A[er],1+Rt.length);if(!ur)return null;Rt.push(Je(ur.type))}F.error(`Expected arguments of type ${ft}, but found (${Rt.join(", ")}) instead.`)}return null}static register(A,F){Bl.definitions=F;for(let W in F)A[W]=Bl}}function Ah(R,[A,F,W,te]){A=A.evaluate(R),F=F.evaluate(R),W=W.evaluate(R);let fe=te?te.evaluate(R):1,pe=fn(A,F,W,fe);if(pe)throw new ma(pe);return new ir(A/255,F/255,W/255,fe,!1)}function Qf(R,A){return R in A}function _f(R,A){let F=A[R];return F===void 0?null:F}function Yc(R){return{type:R}}function eh(R){if(R instanceof Ct)return eh(R.boundExpression);if(R instanceof Bl&&R.name==="error"||R instanceof Io||R instanceof pl||R instanceof Ic)return!1;let A=R instanceof da||R instanceof Fa,F=!0;return R.eachChild(W=>{F=A?F&&eh(W):F&&W instanceof ua}),!!F&&th(R)&&jf(R,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function th(R){if(R instanceof Bl&&(R.name==="get"&&R.args.length===1||R.name==="feature-state"||R.name==="has"&&R.args.length===1||R.name==="properties"||R.name==="geometry-type"||R.name==="id"||/^filter-/.test(R.name))||R instanceof pl||R instanceof Ic)return!1;let A=!0;return R.eachChild(F=>{A&&!th(F)&&(A=!1)}),A}function ju(R){if(R instanceof Bl&&R.name==="feature-state")return!1;let A=!0;return R.eachChild(F=>{A&&!ju(F)&&(A=!1)}),A}function jf(R,A){if(R instanceof Bl&&A.indexOf(R.name)>=0)return!1;let F=!0;return R.eachChild(W=>{F&&!jf(W,A)&&(F=!1)}),F}function cc(R){return{result:"success",value:R}}function sf(R){return{result:"error",value:R}}function Nl(R){return R["property-type"]==="data-driven"||R["property-type"]==="cross-faded-data-driven"}function Kc(R){return!!R.expression&&R.expression.parameters.indexOf("zoom")>-1}function Rc(R){return!!R.expression&&R.expression.interpolated}function gs(R){return R instanceof Number?"number":R instanceof String?"string":R instanceof Boolean?"boolean":Array.isArray(R)?"array":R===null?"null":typeof R}function Wf(R){return typeof R=="object"&&R!==null&&!Array.isArray(R)}function Wh(R){return R}function rh(R,A){let F=A.type==="color",W=R.stops&&typeof R.stops[0][0]=="object",te=W||!(W||R.property!==void 0),fe=R.type||(Rc(A)?"exponential":"interval");if(F||A.type==="padding"){let Rt=F?ir.parse:$r.parse;(R=Ae({},R)).stops&&(R.stops=R.stops.map(er=>[er[0],Rt(er[1])])),R.default=Rt(R.default?R.default:A.default)}if(R.colorSpace&&(pe=R.colorSpace)!=="rgb"&&pe!=="hcl"&&pe!=="lab")throw new Error(`Unknown color space: "${R.colorSpace}"`);var pe;let Re,Ke,ft;if(fe==="exponential")Re=ih;else if(fe==="interval")Re=Mu;else if(fe==="categorical"){Re=Sh,Ke=Object.create(null);for(let Rt of R.stops)Ke[Rt[0]]=Rt[1];ft=typeof R.stops[0][0]}else{if(fe!=="identity")throw new Error(`Unknown function type "${fe}"`);Re=js}if(W){let Rt={},er=[];for(let kr=0;kr<R.stops.length;kr++){let Dr=R.stops[kr],li=Dr[0].zoom;Rt[li]===void 0&&(Rt[li]={zoom:li,type:R.type,property:R.property,default:R.default,stops:[]},er.push(li)),Rt[li].stops.push([Dr[0].value,Dr[1]])}let ur=[];for(let kr of er)ur.push([Rt[kr].zoom,rh(Rt[kr],A)]);let vr={name:"linear"};return{kind:"composite",interpolationType:vr,interpolationFactor:ko.interpolationFactor.bind(void 0,vr),zoomStops:ur.map(kr=>kr[0]),evaluate:({zoom:kr},Dr)=>ih({stops:ur,base:R.base},A,kr).evaluate(kr,Dr)}}if(te){let Rt=fe==="exponential"?{name:"exponential",base:R.base!==void 0?R.base:1}:null;return{kind:"camera",interpolationType:Rt,interpolationFactor:ko.interpolationFactor.bind(void 0,Rt),zoomStops:R.stops.map(er=>er[0]),evaluate:({zoom:er})=>Re(R,A,er,Ke,ft)}}return{kind:"source",evaluate(Rt,er){let ur=er&&er.properties?er.properties[R.property]:void 0;return ur===void 0?lf(R.default,A.default):Re(R,A,ur,Ke,ft)}}}function lf(R,A,F){return R!==void 0?R:A!==void 0?A:F!==void 0?F:void 0}function Sh(R,A,F,W,te){return lf(typeof F===te?W[F]:void 0,R.default,A.default)}function Mu(R,A,F){if(gs(F)!=="number")return lf(R.default,A.default);let W=R.stops.length;if(W===1||F<=R.stops[0][0])return R.stops[0][1];if(F>=R.stops[W-1][0])return R.stops[W-1][1];let te=ki(R.stops.map(fe=>fe[0]),F);return R.stops[te][1]}function ih(R,A,F){let W=R.base!==void 0?R.base:1;if(gs(F)!=="number")return lf(R.default,A.default);let te=R.stops.length;if(te===1||F<=R.stops[0][0])return R.stops[0][1];if(F>=R.stops[te-1][0])return R.stops[te-1][1];let fe=ki(R.stops.map(Rt=>Rt[0]),F),pe=function(Rt,er,ur,vr){let kr=vr-ur,Dr=Rt-ur;return kr===0?0:er===1?Dr/kr:(Math.pow(er,Dr)-1)/(Math.pow(er,kr)-1)}(F,W,R.stops[fe][0],R.stops[fe+1][0]),Re=R.stops[fe][1],Ke=R.stops[fe+1][1],ft=Lo[A.type]||Wh;return typeof Re.evaluate=="function"?{evaluate(...Rt){let er=Re.evaluate.apply(void 0,Rt),ur=Ke.evaluate.apply(void 0,Rt);if(er!==void 0&&ur!==void 0)return ft(er,ur,pe,R.colorSpace)}}:ft(Re,Ke,pe,R.colorSpace)}function js(R,A,F){switch(A.type){case"color":F=ir.parse(F);break;case"formatted":F=ti.fromString(F.toString());break;case"resolvedImage":F=en.fromString(F.toString());break;case"padding":F=$r.parse(F);break;default:gs(F)===A.type||A.type==="enum"&&A.values[F]||(F=void 0)}return lf(F,R.default,A.default)}Bl.register(yf,{error:[{kind:"error"},[Et],(R,[A])=>{throw new ma(A.evaluate(R))}],typeof:[Et,[mr],(R,[A])=>Je(Mn(A.evaluate(R)))],"to-rgba":[Ge(dt,4),[jt],(R,[A])=>{let[F,W,te,fe]=A.evaluate(R).rgb;return[255*F,255*W,255*te,fe]}],rgb:[jt,[dt,dt,dt],Ah],rgba:[jt,[dt,dt,dt,dt],Ah],has:{type:pt,overloads:[[[Et],(R,[A])=>Qf(A.evaluate(R),R.properties())],[[Et,or],(R,[A,F])=>Qf(A.evaluate(R),F.evaluate(R))]]},get:{type:mr,overloads:[[[Et],(R,[A])=>_f(A.evaluate(R),R.properties())],[[Et,or],(R,[A,F])=>_f(A.evaluate(R),F.evaluate(R))]]},"feature-state":[mr,[Et],(R,[A])=>_f(A.evaluate(R),R.featureState||{})],properties:[or,[],R=>R.properties()],"geometry-type":[Et,[],R=>R.geometryType()],id:[mr,[],R=>R.id()],zoom:[dt,[],R=>R.globals.zoom],"heatmap-density":[dt,[],R=>R.globals.heatmapDensity||0],"line-progress":[dt,[],R=>R.globals.lineProgress||0],accumulated:[mr,[],R=>R.globals.accumulated===void 0?null:R.globals.accumulated],"+":[dt,Yc(dt),(R,A)=>{let F=0;for(let W of A)F+=W.evaluate(R);return F}],"*":[dt,Yc(dt),(R,A)=>{let F=1;for(let W of A)F*=W.evaluate(R);return F}],"-":{type:dt,overloads:[[[dt,dt],(R,[A,F])=>A.evaluate(R)-F.evaluate(R)],[[dt],(R,[A])=>-A.evaluate(R)]]},"/":[dt,[dt,dt],(R,[A,F])=>A.evaluate(R)/F.evaluate(R)],"%":[dt,[dt,dt],(R,[A,F])=>A.evaluate(R)%F.evaluate(R)],ln2:[dt,[],()=>Math.LN2],pi:[dt,[],()=>Math.PI],e:[dt,[],()=>Math.E],"^":[dt,[dt,dt],(R,[A,F])=>Math.pow(A.evaluate(R),F.evaluate(R))],sqrt:[dt,[dt],(R,[A])=>Math.sqrt(A.evaluate(R))],log10:[dt,[dt],(R,[A])=>Math.log(A.evaluate(R))/Math.LN10],ln:[dt,[dt],(R,[A])=>Math.log(A.evaluate(R))],log2:[dt,[dt],(R,[A])=>Math.log(A.evaluate(R))/Math.LN2],sin:[dt,[dt],(R,[A])=>Math.sin(A.evaluate(R))],cos:[dt,[dt],(R,[A])=>Math.cos(A.evaluate(R))],tan:[dt,[dt],(R,[A])=>Math.tan(A.evaluate(R))],asin:[dt,[dt],(R,[A])=>Math.asin(A.evaluate(R))],acos:[dt,[dt],(R,[A])=>Math.acos(A.evaluate(R))],atan:[dt,[dt],(R,[A])=>Math.atan(A.evaluate(R))],min:[dt,Yc(dt),(R,A)=>Math.min(...A.map(F=>F.evaluate(R)))],max:[dt,Yc(dt),(R,A)=>Math.max(...A.map(F=>F.evaluate(R)))],abs:[dt,[dt],(R,[A])=>Math.abs(A.evaluate(R))],round:[dt,[dt],(R,[A])=>{let F=A.evaluate(R);return F<0?-Math.round(-F):Math.round(F)}],floor:[dt,[dt],(R,[A])=>Math.floor(A.evaluate(R))],ceil:[dt,[dt],(R,[A])=>Math.ceil(A.evaluate(R))],"filter-==":[pt,[Et,mr],(R,[A,F])=>R.properties()[A.value]===F.value],"filter-id-==":[pt,[mr],(R,[A])=>R.id()===A.value],"filter-type-==":[pt,[Et],(R,[A])=>R.geometryType()===A.value],"filter-<":[pt,[Et,mr],(R,[A,F])=>{let W=R.properties()[A.value],te=F.value;return typeof W==typeof te&&W<te}],"filter-id-<":[pt,[mr],(R,[A])=>{let F=R.id(),W=A.value;return typeof F==typeof W&&F<W}],"filter->":[pt,[Et,mr],(R,[A,F])=>{let W=R.properties()[A.value],te=F.value;return typeof W==typeof te&&W>te}],"filter-id->":[pt,[mr],(R,[A])=>{let F=R.id(),W=A.value;return typeof F==typeof W&&F>W}],"filter-<=":[pt,[Et,mr],(R,[A,F])=>{let W=R.properties()[A.value],te=F.value;return typeof W==typeof te&&W<=te}],"filter-id-<=":[pt,[mr],(R,[A])=>{let F=R.id(),W=A.value;return typeof F==typeof W&&F<=W}],"filter->=":[pt,[Et,mr],(R,[A,F])=>{let W=R.properties()[A.value],te=F.value;return typeof W==typeof te&&W>=te}],"filter-id->=":[pt,[mr],(R,[A])=>{let F=R.id(),W=A.value;return typeof F==typeof W&&F>=W}],"filter-has":[pt,[mr],(R,[A])=>A.value in R.properties()],"filter-has-id":[pt,[],R=>R.id()!==null&&R.id()!==void 0],"filter-type-in":[pt,[Ge(Et)],(R,[A])=>A.value.indexOf(R.geometryType())>=0],"filter-id-in":[pt,[Ge(mr)],(R,[A])=>A.value.indexOf(R.id())>=0],"filter-in-small":[pt,[Et,Ge(mr)],(R,[A,F])=>F.value.indexOf(R.properties()[A.value])>=0],"filter-in-large":[pt,[Et,Ge(mr)],(R,[A,F])=>function(W,te,fe,pe){for(;fe<=pe;){let Re=fe+pe>>1;if(te[Re]===W)return!0;te[Re]>W?pe=Re-1:fe=Re+1}return!1}(R.properties()[A.value],F.value,0,F.value.length-1)],all:{type:pt,overloads:[[[pt,pt],(R,[A,F])=>A.evaluate(R)&&F.evaluate(R)],[Yc(pt),(R,A)=>{for(let F of A)if(!F.evaluate(R))return!1;return!0}]]},any:{type:pt,overloads:[[[pt,pt],(R,[A,F])=>A.evaluate(R)||F.evaluate(R)],[Yc(pt),(R,A)=>{for(let F of A)if(F.evaluate(R))return!0;return!1}]]},"!":[pt,[pt],(R,[A])=>!A.evaluate(R)],"is-supported-script":[pt,[Et],(R,[A])=>{let F=R.globals&&R.globals.isSupportedScript;return!F||F(A.evaluate(R))}],upcase:[Et,[Et],(R,[A])=>A.evaluate(R).toUpperCase()],downcase:[Et,[Et],(R,[A])=>A.evaluate(R).toLowerCase()],concat:[Et,Yc(mr),(R,A)=>A.map(F=>Ba(F.evaluate(R))).join("")],"resolved-locale":[Et,[Ar],(R,[A])=>A.evaluate(R).resolvedLocale()]});class Eu{constructor(A,F){var W;this.expression=A,this._warningHistory={},this._evaluator=new Ha,this._defaultValue=F?(W=F).type==="color"&&Wf(W.default)?new ir(0,0,0,0):W.type==="color"?ir.parse(W.default)||null:W.type==="padding"?$r.parse(W.default)||null:W.type==="variableAnchorOffsetCollection"?Zi.parse(W.default)||null:W.default===void 0?null:W.default:null,this._enumValues=F&&F.type==="enum"?F.values:null}evaluateWithoutErrorHandling(A,F,W,te,fe,pe){return this._evaluator.globals=A,this._evaluator.feature=F,this._evaluator.featureState=W,this._evaluator.canonical=te,this._evaluator.availableImages=fe||null,this._evaluator.formattedSection=pe,this.expression.evaluate(this._evaluator)}evaluate(A,F,W,te,fe,pe){this._evaluator.globals=A,this._evaluator.feature=F||null,this._evaluator.featureState=W||null,this._evaluator.canonical=te,this._evaluator.availableImages=fe||null,this._evaluator.formattedSection=pe||null;try{let Re=this.expression.evaluate(this._evaluator);if(Re==null||typeof Re=="number"&&Re!=Re)return this._defaultValue;if(this._enumValues&&!(Re in this._enumValues))throw new ma(`Expected value to be one of ${Object.keys(this._enumValues).map(Ke=>JSON.stringify(Ke)).join(", ")}, but found ${JSON.stringify(Re)} instead.`);return Re}catch(Re){return this._warningHistory[Re.message]||(this._warningHistory[Re.message]=!0,typeof console!="undefined"&&console.warn(Re.message)),this._defaultValue}}}function Dc(R){return Array.isArray(R)&&R.length>0&&typeof R[0]=="string"&&R[0]in yf}function ks(R,A){let F=new vo(yf,eh,[],A?function(te){let fe={color:jt,string:Et,number:dt,enum:Et,boolean:pt,formatted:ei,padding:qr,resolvedImage:jr,variableAnchorOffsetCollection:gt};return te.type==="array"?Ge(fe[te.value]||mr,te.length):fe[te.type]}(A):void 0),W=F.parse(R,void 0,void 0,void 0,A&&A.type==="string"?{typeAnnotation:"coerce"}:void 0);return W?cc(new Eu(W,A)):sf(F.errors)}class bc{constructor(A,F){this.kind=A,this._styleExpression=F,this.isStateDependent=A!=="constant"&&!ju(F.expression)}evaluateWithoutErrorHandling(A,F,W,te,fe,pe){return this._styleExpression.evaluateWithoutErrorHandling(A,F,W,te,fe,pe)}evaluate(A,F,W,te,fe,pe){return this._styleExpression.evaluate(A,F,W,te,fe,pe)}}class hu{constructor(A,F,W,te){this.kind=A,this.zoomStops=W,this._styleExpression=F,this.isStateDependent=A!=="camera"&&!ju(F.expression),this.interpolationType=te}evaluateWithoutErrorHandling(A,F,W,te,fe,pe){return this._styleExpression.evaluateWithoutErrorHandling(A,F,W,te,fe,pe)}evaluate(A,F,W,te,fe,pe){return this._styleExpression.evaluate(A,F,W,te,fe,pe)}interpolationFactor(A,F,W){return this.interpolationType?ko.interpolationFactor(this.interpolationType,A,F,W):0}}function _u(R,A){let F=ks(R,A);if(F.result==="error")return F;let W=F.value.expression,te=th(W);if(!te&&!Nl(A))return sf([new rt("","data expressions not supported")]);let fe=jf(W,["zoom"]);if(!fe&&!Kc(A))return sf([new rt("","zoom expressions not supported")]);let pe=nh(W);return pe||fe?pe instanceof rt?sf([pe]):pe instanceof ko&&!Rc(A)?sf([new rt("",'"interpolate" expressions cannot be used with this property')]):cc(pe?new hu(te?"camera":"composite",F.value,pe.labels,pe instanceof ko?pe.interpolation:void 0):new bc(te?"constant":"source",F.value)):sf([new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class nl{constructor(A,F){this._parameters=A,this._specification=F,Ae(this,rh(this._parameters,this._specification))}static deserialize(A){return new nl(A._parameters,A._specification)}static serialize(A){return{_parameters:A._parameters,_specification:A._specification}}}function nh(R){let A=null;if(R instanceof Gn)A=nh(R.result);else if(R instanceof Fs){for(let F of R.args)if(A=nh(F),A)break}else(R instanceof _n||R instanceof ko)&&R.input instanceof Bl&&R.input.name==="zoom"&&(A=R);return A instanceof rt||R.eachChild(F=>{let W=nh(F);W instanceof rt?A=W:!A&&W?A=new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):A&&W&&A!==W&&(A=new rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),A}function Mh(R){if(R===!0||R===!1)return!0;if(!Array.isArray(R)||R.length===0)return!1;switch(R[0]){case"has":return R.length>=2&&R[1]!=="$id"&&R[1]!=="$type";case"in":return R.length>=3&&(typeof R[1]!="string"||Array.isArray(R[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return R.length!==3||Array.isArray(R[1])||Array.isArray(R[2]);case"any":case"all":for(let A of R.slice(1))if(!Mh(A)&&typeof A!="boolean")return!1;return!0;default:return!0}}let zu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fc(R){if(R==null)return{filter:()=>!0,needGeometry:!1};Mh(R)||(R=xf(R));let A=ks(R,zu);if(A.result==="error")throw new Error(A.value.map(F=>`${F.key}: ${F.message}`).join(", "));return{filter:(F,W,te)=>A.value.evaluate(F,W,{},te),needGeometry:bd(R)}}function wc(R,A){return R<A?-1:R>A?1:0}function bd(R){if(!Array.isArray(R))return!1;if(R[0]==="within"||R[0]==="distance")return!0;for(let A=1;A<R.length;A++)if(bd(R[A]))return!0;return!1}function xf(R){if(!R)return!0;let A=R[0];return R.length<=1?A!=="any":A==="=="?Pf(R[1],R[2],"=="):A==="!="?jl(Pf(R[1],R[2],"==")):A==="<"||A===">"||A==="<="||A===">="?Pf(R[1],R[2],A):A==="any"?(F=R.slice(1),["any"].concat(F.map(xf))):A==="all"?["all"].concat(R.slice(1).map(xf)):A==="none"?["all"].concat(R.slice(1).map(xf).map(jl)):A==="in"?qu(R[1],R.slice(2)):A==="!in"?jl(qu(R[1],R.slice(2))):A==="has"?bf(R[1]):A!=="!has"||jl(bf(R[1]));var F}function Pf(R,A,F){switch(R){case"$type":return[`filter-type-${F}`,A];case"$id":return[`filter-id-${F}`,A];default:return[`filter-${F}`,R,A]}}function qu(R,A){if(A.length===0)return!1;switch(R){case"$type":return["filter-type-in",["literal",A]];case"$id":return["filter-id-in",["literal",A]];default:return A.length>200&&!A.some(F=>typeof F!=typeof A[0])?["filter-in-large",R,["literal",A.sort(wc)]]:["filter-in-small",R,["literal",A]]}}function bf(R){switch(R){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",R]}}function jl(R){return["!",R]}function uf(R){let A=typeof R;if(A==="number"||A==="boolean"||A==="string"||R==null)return JSON.stringify(R);if(Array.isArray(R)){let te="[";for(let fe of R)te+=`${uf(fe)},`;return`${te}]`}let F=Object.keys(R).sort(),W="{";for(let te=0;te<F.length;te++)W+=`${JSON.stringify(F[te])}:${uf(R[F[te]])},`;return`${W}}`}function Xh(R){let A="";for(let F of He)A+=`/${uf(R[F])}`;return A}function If(R){let A=R.value;return A?[new Ue(R.key,A,"constants have been deprecated as of v8")]:[]}function Cs(R){return R instanceof Number||R instanceof String||R instanceof Boolean?R.valueOf():R}function du(R){if(Array.isArray(R))return R.map(du);if(R instanceof Object&&!(R instanceof Number||R instanceof String||R instanceof Boolean)){let A={};for(let F in R)A[F]=du(R[F]);return A}return Cs(R)}function ku(R){let A=R.key,F=R.value,W=R.valueSpec||{},te=R.objectElementValidators||{},fe=R.style,pe=R.styleSpec,Re=R.validateSpec,Ke=[],ft=gs(F);if(ft!=="object")return[new Ue(A,F,`object expected, ${ft} found`)];for(let Rt in F){let er=Rt.split(".")[0],ur=W[er]||W["*"],vr;if(te[er])vr=te[er];else if(W[er])vr=Re;else if(te["*"])vr=te["*"];else{if(!W["*"]){Ke.push(new Ue(A,F[Rt],`unknown property "${Rt}"`));continue}vr=Re}Ke=Ke.concat(vr({key:(A&&`${A}.`)+Rt,value:F[Rt],valueSpec:ur,style:fe,styleSpec:pe,object:F,objectKey:Rt,validateSpec:Re},F))}for(let Rt in W)te[Rt]||W[Rt].required&&W[Rt].default===void 0&&F[Rt]===void 0&&Ke.push(new Ue(A,F,`missing required property "${Rt}"`));return Ke}function Xf(R){let A=R.value,F=R.valueSpec,W=R.style,te=R.styleSpec,fe=R.key,pe=R.arrayElementValidator||R.validateSpec;if(gs(A)!=="array")return[new Ue(fe,A,`array expected, ${gs(A)} found`)];if(F.length&&A.length!==F.length)return[new Ue(fe,A,`array length ${F.length} expected, length ${A.length} found`)];if(F["min-length"]&&A.length<F["min-length"])return[new Ue(fe,A,`array length at least ${F["min-length"]} expected, length ${A.length} found`)];let Re={type:F.value,values:F.values};te.$version<7&&(Re.function=F.function),gs(F.value)==="object"&&(Re=F.value);let Ke=[];for(let ft=0;ft<A.length;ft++)Ke=Ke.concat(pe({array:A,arrayIndex:ft,value:A[ft],valueSpec:Re,validateSpec:R.validateSpec,style:W,styleSpec:te,key:`${fe}[${ft}]`}));return Ke}function Us(R){let A=R.key,F=R.value,W=R.valueSpec,te=gs(F);return te==="number"&&F!=F&&(te="NaN"),te!=="number"?[new Ue(A,F,`number expected, ${te} found`)]:"minimum"in W&&F<W.minimum?[new Ue(A,F,`${F} is less than the minimum value ${W.minimum}`)]:"maximum"in W&&F>W.maximum?[new Ue(A,F,`${F} is greater than the maximum value ${W.maximum}`)]:[]}function wf(R){let A=R.valueSpec,F=Cs(R.value.type),W,te,fe,pe={},Re=F!=="categorical"&&R.value.property===void 0,Ke=!Re,ft=gs(R.value.stops)==="array"&&gs(R.value.stops[0])==="array"&&gs(R.value.stops[0][0])==="object",Rt=ku({key:R.key,value:R.value,valueSpec:R.styleSpec.function,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,objectElementValidators:{stops:function(vr){if(F==="identity")return[new Ue(vr.key,vr.value,'identity function may not have a "stops" property')];let kr=[],Dr=vr.value;return kr=kr.concat(Xf({key:vr.key,value:Dr,valueSpec:vr.valueSpec,validateSpec:vr.validateSpec,style:vr.style,styleSpec:vr.styleSpec,arrayElementValidator:er})),gs(Dr)==="array"&&Dr.length===0&&kr.push(new Ue(vr.key,Dr,"array must have at least one stop")),kr},default:function(vr){return vr.validateSpec({key:vr.key,value:vr.value,valueSpec:A,validateSpec:vr.validateSpec,style:vr.style,styleSpec:vr.styleSpec})}}});return F==="identity"&&Re&&Rt.push(new Ue(R.key,R.value,'missing required property "property"')),F==="identity"||R.value.stops||Rt.push(new Ue(R.key,R.value,'missing required property "stops"')),F==="exponential"&&R.valueSpec.expression&&!Rc(R.valueSpec)&&Rt.push(new Ue(R.key,R.value,"exponential functions not supported")),R.styleSpec.$version>=8&&(Ke&&!Nl(R.valueSpec)?Rt.push(new Ue(R.key,R.value,"property functions not supported")):Re&&!Kc(R.valueSpec)&&Rt.push(new Ue(R.key,R.value,"zoom functions not supported"))),F!=="categorical"&&!ft||R.value.property!==void 0||Rt.push(new Ue(R.key,R.value,'"property" property is required')),Rt;function er(vr){let kr=[],Dr=vr.value,li=vr.key;if(gs(Dr)!=="array")return[new Ue(li,Dr,`array expected, ${gs(Dr)} found`)];if(Dr.length!==2)return[new Ue(li,Dr,`array length 2 expected, length ${Dr.length} found`)];if(ft){if(gs(Dr[0])!=="object")return[new Ue(li,Dr,`object expected, ${gs(Dr[0])} found`)];if(Dr[0].zoom===void 0)return[new Ue(li,Dr,"object stop key must have zoom")];if(Dr[0].value===void 0)return[new Ue(li,Dr,"object stop key must have value")];if(fe&&fe>Cs(Dr[0].zoom))return[new Ue(li,Dr[0].zoom,"stop zoom values must appear in ascending order")];Cs(Dr[0].zoom)!==fe&&(fe=Cs(Dr[0].zoom),te=void 0,pe={}),kr=kr.concat(ku({key:`${li}[0]`,value:Dr[0],valueSpec:{zoom:{}},validateSpec:vr.validateSpec,style:vr.style,styleSpec:vr.styleSpec,objectElementValidators:{zoom:Us,value:ur}}))}else kr=kr.concat(ur({key:`${li}[0]`,value:Dr[0],valueSpec:{},validateSpec:vr.validateSpec,style:vr.style,styleSpec:vr.styleSpec},Dr));return Dc(du(Dr[1]))?kr.concat([new Ue(`${li}[1]`,Dr[1],"expressions are not allowed in function stops.")]):kr.concat(vr.validateSpec({key:`${li}[1]`,value:Dr[1],valueSpec:A,validateSpec:vr.validateSpec,style:vr.style,styleSpec:vr.styleSpec}))}function ur(vr,kr){let Dr=gs(vr.value),li=Cs(vr.value),pi=vr.value!==null?vr.value:kr;if(W){if(Dr!==W)return[new Ue(vr.key,pi,`${Dr} stop domain type must match previous stop domain type ${W}`)]}else W=Dr;if(Dr!=="number"&&Dr!=="string"&&Dr!=="boolean")return[new Ue(vr.key,pi,"stop domain value must be a number, string, or boolean")];if(Dr!=="number"&&F!=="categorical"){let vn=`number expected, ${Dr} found`;return Nl(A)&&F===void 0&&(vn+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ue(vr.key,pi,vn)]}return F!=="categorical"||Dr!=="number"||isFinite(li)&&Math.floor(li)===li?F!=="categorical"&&Dr==="number"&&te!==void 0&&li<te?[new Ue(vr.key,pi,"stop domain values must appear in ascending order")]:(te=li,F==="categorical"&&li in pe?[new Ue(vr.key,pi,"stop domain values must be unique")]:(pe[li]=!0,[])):[new Ue(vr.key,pi,`integer expected, found ${li}`)]}}function zc(R){let A=(R.expressionContext==="property"?_u:ks)(du(R.value),R.valueSpec);if(A.result==="error")return A.value.map(W=>new Ue(`${R.key}${W.key}`,R.value,W.message));let F=A.value.expression||A.value._styleExpression.expression;if(R.expressionContext==="property"&&R.propertyKey==="text-font"&&!F.outputDefined())return[new Ue(R.key,R.value,`Invalid data expression for "${R.propertyKey}". Output values must be contained as literals within the expression.`)];if(R.expressionContext==="property"&&R.propertyType==="layout"&&!ju(F))return[new Ue(R.key,R.value,'"feature-state" data expressions are not supported with layout properties.')];if(R.expressionContext==="filter"&&!ju(F))return[new Ue(R.key,R.value,'"feature-state" data expressions are not supported with filters.')];if(R.expressionContext&&R.expressionContext.indexOf("cluster")===0){if(!jf(F,["zoom","feature-state"]))return[new Ue(R.key,R.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(R.expressionContext==="cluster-initial"&&!th(F))return[new Ue(R.key,R.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Wu(R){let A=R.key,F=R.value,W=R.valueSpec,te=[];return Array.isArray(W.values)?W.values.indexOf(Cs(F))===-1&&te.push(new Ue(A,F,`expected one of [${W.values.join(", ")}], ${JSON.stringify(F)} found`)):Object.keys(W.values).indexOf(Cs(F))===-1&&te.push(new Ue(A,F,`expected one of [${Object.keys(W.values).join(", ")}], ${JSON.stringify(F)} found`)),te}function Rf(R){return Mh(du(R.value))?zc(Ae({},R,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Xu(R)}function Xu(R){let A=R.value,F=R.key;if(gs(A)!=="array")return[new Ue(F,A,`array expected, ${gs(A)} found`)];let W=R.styleSpec,te,fe=[];if(A.length<1)return[new Ue(F,A,"filter array must have at least 1 element")];switch(fe=fe.concat(Wu({key:`${F}[0]`,value:A[0],valueSpec:W.filter_operator,style:R.style,styleSpec:R.styleSpec})),Cs(A[0])){case"<":case"<=":case">":case">=":A.length>=2&&Cs(A[1])==="$type"&&fe.push(new Ue(F,A,`"$type" cannot be use with operator "${A[0]}"`));case"==":case"!=":A.length!==3&&fe.push(new Ue(F,A,`filter array for operator "${A[0]}" must have 3 elements`));case"in":case"!in":A.length>=2&&(te=gs(A[1]),te!=="string"&&fe.push(new Ue(`${F}[1]`,A[1],`string expected, ${te} found`)));for(let pe=2;pe<A.length;pe++)te=gs(A[pe]),Cs(A[1])==="$type"?fe=fe.concat(Wu({key:`${F}[${pe}]`,value:A[pe],valueSpec:W.geometry_type,style:R.style,styleSpec:R.styleSpec})):te!=="string"&&te!=="number"&&te!=="boolean"&&fe.push(new Ue(`${F}[${pe}]`,A[pe],`string, number, or boolean expected, ${te} found`));break;case"any":case"all":case"none":for(let pe=1;pe<A.length;pe++)fe=fe.concat(Xu({key:`${F}[${pe}]`,value:A[pe],style:R.style,styleSpec:R.styleSpec}));break;case"has":case"!has":te=gs(A[1]),A.length!==2?fe.push(new Ue(F,A,`filter array for "${A[0]}" operator must have 2 elements`)):te!=="string"&&fe.push(new Ue(`${F}[1]`,A[1],`string expected, ${te} found`))}return fe}function cf(R,A){let F=R.key,W=R.validateSpec,te=R.style,fe=R.styleSpec,pe=R.value,Re=R.objectKey,Ke=fe[`${A}_${R.layerType}`];if(!Ke)return[];let ft=Re.match(/^(.*)-transition$/);if(A==="paint"&&ft&&Ke[ft[1]]&&Ke[ft[1]].transition)return W({key:F,value:pe,valueSpec:fe.transition,style:te,styleSpec:fe});let Rt=R.valueSpec||Ke[Re];if(!Rt)return[new Ue(F,pe,`unknown property "${Re}"`)];let er;if(gs(pe)==="string"&&Nl(Rt)&&!Rt.tokens&&(er=/^{([^}]+)}$/.exec(pe)))return[new Ue(F,pe,`"${Re}" does not support interpolation syntax |
| 3228 | Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(er[1])} }\`.`)];let ur=[];return R.layerType==="symbol"&&(Re==="text-field"&&te&&!te.glyphs&&ur.push(new Ue(F,pe,'use of "text-field" requires a style "glyphs" property')),Re==="text-font"&&Wf(du(pe))&&Cs(pe.type)==="identity"&&ur.push(new Ue(F,pe,'"text-font" does not support identity functions'))),ur.concat(W({key:R.key,value:pe,valueSpec:Rt,style:te,styleSpec:fe,expressionContext:"property",propertyType:A,propertyKey:Re}))}function Zf(R){return cf(R,"paint")}function Wl(R){return cf(R,"layout")}function ah(R){let A=[],F=R.value,W=R.key,te=R.style,fe=R.styleSpec;F.type||F.ref||A.push(new Ue(W,F,'either "type" or "ref" is required'));let pe=Cs(F.type),Re=Cs(F.ref);if(F.id){let Ke=Cs(F.id);for(let ft=0;ft<R.arrayIndex;ft++){let Rt=te.layers[ft];Cs(Rt.id)===Ke&&A.push(new Ue(W,F.id,`duplicate layer id "${F.id}", previously used at line ${Rt.id.__line__}`))}}if("ref"in F){let Ke;["type","source","source-layer","filter","layout"].forEach(ft=>{ft in F&&A.push(new Ue(W,F[ft],`"${ft}" is prohibited for ref layers`))}),te.layers.forEach(ft=>{Cs(ft.id)===Re&&(Ke=ft)}),Ke?Ke.ref?A.push(new Ue(W,F.ref,"ref cannot reference another ref layer")):pe=Cs(Ke.type):A.push(new Ue(W,F.ref,`ref layer "${Re}" not found`))}else if(pe!=="background")if(F.source){let Ke=te.sources&&te.sources[F.source],ft=Ke&&Cs(Ke.type);Ke?ft==="vector"&&pe==="raster"?A.push(new Ue(W,F.source,`layer "${F.id}" requires a raster source`)):ft!=="raster-dem"&&pe==="hillshade"?A.push(new Ue(W,F.source,`layer "${F.id}" requires a raster-dem source`)):ft==="raster"&&pe!=="raster"?A.push(new Ue(W,F.source,`layer "${F.id}" requires a vector source`)):ft!=="vector"||F["source-layer"]?ft==="raster-dem"&&pe!=="hillshade"?A.push(new Ue(W,F.source,"raster-dem source can only be used with layer type 'hillshade'.")):pe!=="line"||!F.paint||!F.paint["line-gradient"]||ft==="geojson"&&Ke.lineMetrics||A.push(new Ue(W,F,`layer "${F.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):A.push(new Ue(W,F,`layer "${F.id}" must specify a "source-layer"`)):A.push(new Ue(W,F.source,`source "${F.source}" not found`))}else A.push(new Ue(W,F,'missing required property "source"'));return A=A.concat(ku({key:W,value:F,valueSpec:fe.layer,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,objectElementValidators:{"*":()=>[],type:()=>R.validateSpec({key:`${W}.type`,value:F.type,valueSpec:fe.layer.type,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,object:F,objectKey:"type"}),filter:Rf,layout:Ke=>ku({layer:F,key:Ke.key,value:Ke.value,style:Ke.style,styleSpec:Ke.styleSpec,validateSpec:Ke.validateSpec,objectElementValidators:{"*":ft=>Wl(Ae({layerType:pe},ft))}}),paint:Ke=>ku({layer:F,key:Ke.key,value:Ke.value,style:Ke.style,styleSpec:Ke.styleSpec,validateSpec:Ke.validateSpec,objectElementValidators:{"*":ft=>Zf(Ae({layerType:pe},ft))}})}})),A}function Zu(R){let A=R.value,F=R.key,W=gs(A);return W!=="string"?[new Ue(F,A,`string expected, ${W} found`)]:[]}let qc={promoteId:function({key:R,value:A}){if(gs(A)==="string")return Zu({key:R,value:A});{let F=[];for(let W in A)F.push(...Zu({key:`${R}.${W}`,value:A[W]}));return F}}};function Tc(R){let A=R.value,F=R.key,W=R.styleSpec,te=R.style,fe=R.validateSpec;if(!A.type)return[new Ue(F,A,'"type" is required')];let pe=Cs(A.type),Re;switch(pe){case"vector":case"raster":return Re=ku({key:F,value:A,valueSpec:W[`source_${pe.replace("-","_")}`],style:R.style,styleSpec:W,objectElementValidators:qc,validateSpec:fe}),Re;case"raster-dem":return Re=function(Ke){var ft;let Rt=(ft=Ke.sourceName)!==null&&ft!==void 0?ft:"",er=Ke.value,ur=Ke.styleSpec,vr=ur.source_raster_dem,kr=Ke.style,Dr=[],li=gs(er);if(er===void 0)return Dr;if(li!=="object")return Dr.push(new Ue("source_raster_dem",er,`object expected, ${li} found`)),Dr;let pi=Cs(er.encoding)==="custom",vn=["redFactor","greenFactor","blueFactor","baseShift"],zi=Ke.value.encoding?`"${Ke.value.encoding}"`:"Default";for(let ln in er)!pi&&vn.includes(ln)?Dr.push(new Ue(ln,er[ln],`In "${Rt}": "${ln}" is only valid when "encoding" is set to "custom". ${zi} encoding found`)):vr[ln]?Dr=Dr.concat(Ke.validateSpec({key:ln,value:er[ln],valueSpec:vr[ln],validateSpec:Ke.validateSpec,style:kr,styleSpec:ur})):Dr.push(new Ue(ln,er[ln],`unknown property "${ln}"`));return Dr}({sourceName:F,value:A,style:R.style,styleSpec:W,validateSpec:fe}),Re;case"geojson":if(Re=ku({key:F,value:A,valueSpec:W.source_geojson,style:te,styleSpec:W,validateSpec:fe,objectElementValidators:qc}),A.cluster)for(let Ke in A.clusterProperties){let[ft,Rt]=A.clusterProperties[Ke],er=typeof ft=="string"?[ft,["accumulated"],["get",Ke]]:ft;Re.push(...zc({key:`${F}.${Ke}.map`,value:Rt,validateSpec:fe,expressionContext:"cluster-map"})),Re.push(...zc({key:`${F}.${Ke}.reduce`,value:er,validateSpec:fe,expressionContext:"cluster-reduce"}))}return Re;case"video":return ku({key:F,value:A,valueSpec:W.source_video,style:te,validateSpec:fe,styleSpec:W});case"image":return ku({key:F,value:A,valueSpec:W.source_image,style:te,validateSpec:fe,styleSpec:W});case"canvas":return[new Ue(F,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Wu({key:`${F}.type`,value:A.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:te,validateSpec:fe,styleSpec:W})}}function wl(R){let A=R.value,F=R.styleSpec,W=F.light,te=R.style,fe=[],pe=gs(A);if(A===void 0)return fe;if(pe!=="object")return fe=fe.concat([new Ue("light",A,`object expected, ${pe} found`)]),fe;for(let Re in A){let Ke=Re.match(/^(.*)-transition$/);fe=fe.concat(Ke&&W[Ke[1]]&&W[Ke[1]].transition?R.validateSpec({key:Re,value:A[Re],valueSpec:F.transition,validateSpec:R.validateSpec,style:te,styleSpec:F}):W[Re]?R.validateSpec({key:Re,value:A[Re],valueSpec:W[Re],validateSpec:R.validateSpec,style:te,styleSpec:F}):[new Ue(Re,A[Re],`unknown property "${Re}"`)])}return fe}function vu(R){let A=R.value,F=R.styleSpec,W=F.sky,te=R.style,fe=gs(A);if(A===void 0)return[];if(fe!=="object")return[new Ue("sky",A,`object expected, ${fe} found`)];let pe=[];for(let Re in A)pe=pe.concat(W[Re]?R.validateSpec({key:Re,value:A[Re],valueSpec:W[Re],style:te,styleSpec:F}):[new Ue(Re,A[Re],`unknown property "${Re}"`)]);return pe}function Oc(R){let A=R.value,F=R.styleSpec,W=F.terrain,te=R.style,fe=[],pe=gs(A);if(A===void 0)return fe;if(pe!=="object")return fe=fe.concat([new Ue("terrain",A,`object expected, ${pe} found`)]),fe;for(let Re in A)fe=fe.concat(W[Re]?R.validateSpec({key:Re,value:A[Re],valueSpec:W[Re],validateSpec:R.validateSpec,style:te,styleSpec:F}):[new Ue(Re,A[Re],`unknown property "${Re}"`)]);return fe}function ff(R){let A=[],F=R.value,W=R.key;if(Array.isArray(F)){let te=[],fe=[];for(let pe in F)F[pe].id&&te.includes(F[pe].id)&&A.push(new Ue(W,F,`all the sprites' ids must be unique, but ${F[pe].id} is duplicated`)),te.push(F[pe].id),F[pe].url&&fe.includes(F[pe].url)&&A.push(new Ue(W,F,`all the sprites' URLs must be unique, but ${F[pe].url} is duplicated`)),fe.push(F[pe].url),A=A.concat(ku({key:`${W}[${pe}]`,value:F[pe],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:R.validateSpec}));return A}return Zu({key:W,value:F})}let fc={"*":()=>[],array:Xf,boolean:function(R){let A=R.value,F=R.key,W=gs(A);return W!=="boolean"?[new Ue(F,A,`boolean expected, ${W} found`)]:[]},number:Us,color:function(R){let A=R.key,F=R.value,W=gs(F);return W!=="string"?[new Ue(A,F,`color expected, ${W} found`)]:ir.parse(String(F))?[]:[new Ue(A,F,`color expected, "${F}" found`)]},constants:If,enum:Wu,filter:Rf,function:wf,layer:ah,object:ku,source:Tc,light:wl,sky:vu,terrain:Oc,projection:function(R){let A=R.value,F=R.styleSpec,W=F.projection,te=R.style,fe=gs(A);if(A===void 0)return[];if(fe!=="object")return[new Ue("projection",A,`object expected, ${fe} found`)];let pe=[];for(let Re in A)pe=pe.concat(W[Re]?R.validateSpec({key:Re,value:A[Re],valueSpec:W[Re],style:te,styleSpec:F}):[new Ue(Re,A[Re],`unknown property "${Re}"`)]);return pe},string:Zu,formatted:function(R){return Zu(R).length===0?[]:zc(R)},resolvedImage:function(R){return Zu(R).length===0?[]:zc(R)},padding:function(R){let A=R.key,F=R.value;if(gs(F)==="array"){if(F.length<1||F.length>4)return[new Ue(A,F,`padding requires 1 to 4 values; ${F.length} values found`)];let W={type:"number"},te=[];for(let fe=0;fe<F.length;fe++)te=te.concat(R.validateSpec({key:`${A}[${fe}]`,value:F[fe],validateSpec:R.validateSpec,valueSpec:W}));return te}return Us({key:A,value:F,valueSpec:{}})},variableAnchorOffsetCollection:function(R){let A=R.key,F=R.value,W=gs(F),te=R.styleSpec;if(W!=="array"||F.length<1||F.length%2!=0)return[new Ue(A,F,"variableAnchorOffsetCollection requires a non-empty array of even length")];let fe=[];for(let pe=0;pe<F.length;pe+=2)fe=fe.concat(Wu({key:`${A}[${pe}]`,value:F[pe],valueSpec:te.layout_symbol["text-anchor"]})),fe=fe.concat(Xf({key:`${A}[${pe+1}]`,value:F[pe+1],valueSpec:{length:2,value:"number"},validateSpec:R.validateSpec,style:R.style,styleSpec:te}));return fe},sprite:ff};function Bc(R){let A=R.value,F=R.valueSpec,W=R.styleSpec;return R.validateSpec=Bc,F.expression&&Wf(Cs(A))?wf(R):F.expression&&Dc(du(A))?zc(R):F.type&&fc[F.type]?fc[F.type](R):ku(Ae({},R,{valueSpec:F.type?W[F.type]:F}))}function kt(R){let A=R.value,F=R.key,W=Zu(R);return W.length||(A.indexOf("{fontstack}")===-1&&W.push(new Ue(F,A,'"glyphs" url must include a "{fontstack}" token')),A.indexOf("{range}")===-1&&W.push(new Ue(F,A,'"glyphs" url must include a "{range}" token'))),W}function Zt(R,A=ce){let F=[];return F=F.concat(Bc({key:"",value:R,valueSpec:A.$root,styleSpec:A,style:R,validateSpec:Bc,objectElementValidators:{glyphs:kt,"*":()=>[]}})),R.constants&&(F=F.concat(If({key:"constants",value:R.constants,style:R,styleSpec:A,validateSpec:Bc}))),xr(F)}function Er(R){return function(A){return R(j1(_g({},A),{validateSpec:Bc}))}}function xr(R){return[].concat(R).sort((A,F)=>A.line-F.line)}function Kr(R){return function(...A){return xr(R.apply(this,A))}}Zt.source=Kr(Er(Tc)),Zt.sprite=Kr(Er(ff)),Zt.glyphs=Kr(Er(kt)),Zt.light=Kr(Er(wl)),Zt.sky=Kr(Er(vu)),Zt.terrain=Kr(Er(Oc)),Zt.layer=Kr(Er(ah)),Zt.filter=Kr(Er(Rf)),Zt.paintProperty=Kr(Er(Zf)),Zt.layoutProperty=Kr(Er(Wl));let Mi=Zt,Wi=Mi.light,dn=Mi.sky,wn=Mi.paintProperty,On=Mi.layoutProperty;function Yi(R,A){let F=!1;if(A&&A.length)for(let W of A)R.fire(new me(new Error(W.message))),F=!0;return F}class $i{constructor(A,F,W){let te=this.cells=[];if(A instanceof ArrayBuffer){this.arrayBuffer=A;let pe=new Int32Array(this.arrayBuffer);A=pe[0],this.d=(F=pe[1])+2*(W=pe[2]);for(let Ke=0;Ke<this.d*this.d;Ke++){let ft=pe[3+Ke],Rt=pe[3+Ke+1];te.push(ft===Rt?null:pe.subarray(ft,Rt))}let Re=pe[3+te.length+1];this.keys=pe.subarray(pe[3+te.length],Re),this.bboxes=pe.subarray(Re),this.insert=this._insertReadonly}else{this.d=F+2*W;for(let pe=0;pe<this.d*this.d;pe++)te.push([]);this.keys=[],this.bboxes=[]}this.n=F,this.extent=A,this.padding=W,this.scale=F/A,this.uid=0;let fe=W/F*A;this.min=-fe,this.max=A+fe}insert(A,F,W,te,fe){this._forEachCell(F,W,te,fe,this._insertCell,this.uid++,void 0,void 0),this.keys.push(A),this.bboxes.push(F),this.bboxes.push(W),this.bboxes.push(te),this.bboxes.push(fe)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(A,F,W,te,fe,pe){this.cells[fe].push(pe)}query(A,F,W,te,fe){let pe=this.min,Re=this.max;if(A<=pe&&F<=pe&&Re<=W&&Re<=te&&!fe)return Array.prototype.slice.call(this.keys);{let Ke=[];return this._forEachCell(A,F,W,te,this._queryCell,Ke,{},fe),Ke}}_queryCell(A,F,W,te,fe,pe,Re,Ke){let ft=this.cells[fe];if(ft!==null){let Rt=this.keys,er=this.bboxes;for(let ur=0;ur<ft.length;ur++){let vr=ft[ur];if(Re[vr]===void 0){let kr=4*vr;(Ke?Ke(er[kr+0],er[kr+1],er[kr+2],er[kr+3]):A<=er[kr+2]&&F<=er[kr+3]&&W>=er[kr+0]&&te>=er[kr+1])?(Re[vr]=!0,pe.push(Rt[vr])):Re[vr]=!1}}}}_forEachCell(A,F,W,te,fe,pe,Re,Ke){let ft=this._convertToCellCoord(A),Rt=this._convertToCellCoord(F),er=this._convertToCellCoord(W),ur=this._convertToCellCoord(te);for(let vr=ft;vr<=er;vr++)for(let kr=Rt;kr<=ur;kr++){let Dr=this.d*kr+vr;if((!Ke||Ke(this._convertFromCellCoord(vr),this._convertFromCellCoord(kr),this._convertFromCellCoord(vr+1),this._convertFromCellCoord(kr+1)))&&fe.call(this,A,F,W,te,Dr,pe,Re,Ke))return}}_convertFromCellCoord(A){return(A-this.padding)/this.scale}_convertToCellCoord(A){return Math.max(0,Math.min(this.d-1,Math.floor(A*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let A=this.cells,F=3+this.cells.length+1+1,W=0;for(let pe=0;pe<this.cells.length;pe++)W+=this.cells[pe].length;let te=new Int32Array(F+W+this.keys.length+this.bboxes.length);te[0]=this.extent,te[1]=this.n,te[2]=this.padding;let fe=F;for(let pe=0;pe<A.length;pe++){let Re=A[pe];te[3+pe]=fe,te.set(Re,fe),fe+=Re.length}return te[3+A.length]=fe,te.set(this.keys,fe),fe+=this.keys.length,te[3+A.length+1]=fe,te.set(this.bboxes,fe),fe+=this.bboxes.length,te.buffer}static serialize(A,F){let W=A.toArrayBuffer();return F&&F.push(W),{buffer:W}}static deserialize(A){return new $i(A.buffer)}}let an={};function Fi(R,A,F={}){if(an[R])throw new Error(`${R} is already registered.`);Object.defineProperty(A,"_classRegistryKey",{value:R,writeable:!1}),an[R]={klass:A,omit:F.omit||[],shallow:F.shallow||[]}}Fi("Object",Object),Fi("TransferableGridIndex",$i),Fi("Color",ir),Fi("Error",Error),Fi("AJAXError",ge),Fi("ResolvedImage",en),Fi("StylePropertyFunction",nl),Fi("StyleExpression",Eu,{omit:["_evaluator"]}),Fi("ZoomDependentExpression",hu),Fi("ZoomConstantExpression",bc),Fi("CompoundExpression",Bl,{omit:["_evaluate"]});for(let R in yf)yf[R]._classRegistryKey||Fi(`Expression_${R}`,yf[R]);function ta(R){return R&&typeof ArrayBuffer!="undefined"&&(R instanceof ArrayBuffer||R.constructor&&R.constructor.name==="ArrayBuffer")}function Ca(R){return R.$name||R.constructor._classRegistryKey}function Ra(R){return!function(A){if(A===null||typeof A!="object")return!1;let F=Ca(A);return!(!F||F==="Object")}(R)&&(R==null||typeof R=="boolean"||typeof R=="number"||typeof R=="string"||R instanceof Boolean||R instanceof Number||R instanceof String||R instanceof Date||R instanceof RegExp||R instanceof Blob||R instanceof Error||ta(R)||G(R)||ArrayBuffer.isView(R)||R instanceof ImageData)}function La(R,A){if(Ra(R))return(ta(R)||G(R))&&A&&A.push(R),ArrayBuffer.isView(R)&&A&&A.push(R.buffer),R instanceof ImageData&&A&&A.push(R.data.buffer),R;if(Array.isArray(R)){let fe=[];for(let pe of R)fe.push(La(pe,A));return fe}if(typeof R!="object")throw new Error("can't serialize object of type "+typeof R);let F=Ca(R);if(!F)throw new Error(`can't serialize object of unregistered class ${R.constructor.name}`);if(!an[F])throw new Error(`${F} is not registered.`);let{klass:W}=an[F],te=W.serialize?W.serialize(R,A):{};if(W.serialize){if(A&&te===A[A.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let fe in R){if(!R.hasOwnProperty(fe)||an[F].omit.indexOf(fe)>=0)continue;let pe=R[fe];te[fe]=an[F].shallow.indexOf(fe)>=0?pe:La(pe,A)}R instanceof Error&&(te.message=R.message)}if(te.$name)throw new Error("$name property is reserved for worker serialization logic.");return F!=="Object"&&(te.$name=F),te}function Ua(R){if(Ra(R))return R;if(Array.isArray(R))return R.map(Ua);if(typeof R!="object")throw new Error("can't deserialize object of type "+typeof R);let A=Ca(R)||"Object";if(!an[A])throw new Error(`can't deserialize unregistered class ${A}`);let{klass:F}=an[A];if(!F)throw new Error(`can't deserialize unregistered class ${A}`);if(F.deserialize)return F.deserialize(R);let W=Object.create(F.prototype);for(let te of Object.keys(R)){if(te==="$name")continue;let fe=R[te];W[te]=an[A].shallow.indexOf(te)>=0?fe:Ua(fe)}return W}class Zn{constructor(){this.first=!0}update(A,F){let W=Math.floor(A);return this.first?(this.first=!1,this.lastIntegerZoom=W,this.lastIntegerZoomTime=0,this.lastZoom=A,this.lastFloorZoom=W,!0):(this.lastFloorZoom>W?(this.lastIntegerZoom=W+1,this.lastIntegerZoomTime=F):this.lastFloorZoom<W&&(this.lastIntegerZoom=W,this.lastIntegerZoomTime=F),A!==this.lastZoom&&(this.lastZoom=A,this.lastFloorZoom=W,!0))}}let Dn={"Latin-1 Supplement":R=>R>=128&&R<=255,"Hangul Jamo":R=>R>=4352&&R<=4607,Khmer:R=>R>=6016&&R<=6143,"General Punctuation":R=>R>=8192&&R<=8303,"Letterlike Symbols":R=>R>=8448&&R<=8527,"Number Forms":R=>R>=8528&&R<=8591,"Miscellaneous Technical":R=>R>=8960&&R<=9215,"Control Pictures":R=>R>=9216&&R<=9279,"Optical Character Recognition":R=>R>=9280&&R<=9311,"Enclosed Alphanumerics":R=>R>=9312&&R<=9471,"Geometric Shapes":R=>R>=9632&&R<=9727,"Miscellaneous Symbols":R=>R>=9728&&R<=9983,"Miscellaneous Symbols and Arrows":R=>R>=11008&&R<=11263,"Ideographic Description Characters":R=>R>=12272&&R<=12287,"CJK Symbols and Punctuation":R=>R>=12288&&R<=12351,Katakana:R=>R>=12448&&R<=12543,Kanbun:R=>R>=12688&&R<=12703,"CJK Strokes":R=>R>=12736&&R<=12783,"Enclosed CJK Letters and Months":R=>R>=12800&&R<=13055,"CJK Compatibility":R=>R>=13056&&R<=13311,"Yijing Hexagram Symbols":R=>R>=19904&&R<=19967,"Private Use Area":R=>R>=57344&&R<=63743,"Vertical Forms":R=>R>=65040&&R<=65055,"CJK Compatibility Forms":R=>R>=65072&&R<=65103,"Small Form Variants":R=>R>=65104&&R<=65135,"Halfwidth and Fullwidth Forms":R=>R>=65280&&R<=65519};function Ka(R){for(let A of R)if(Ho(A.charCodeAt(0)))return!0;return!1}function bo(R){for(let A of R)if(!as(A.charCodeAt(0)))return!1;return!0}function Zo(R){let A=R.map(F=>{try{return new RegExp(`\\p{sc=${F}}`,"u").source}catch(W){return null}}).filter(F=>F);return new RegExp(A.join("|"),"u")}let Ss=Zo(["Arab","Dupl","Mong","Ougr","Syrc"]);function as(R){return!Ss.test(String.fromCodePoint(R))}let ws=Zo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Ho(R){return!(R!==746&&R!==747&&(R<4352||!(Dn["CJK Compatibility Forms"](R)&&!(R>=65097&&R<=65103)||Dn["CJK Compatibility"](R)||Dn["CJK Strokes"](R)||!(!Dn["CJK Symbols and Punctuation"](R)||R>=12296&&R<=12305||R>=12308&&R<=12319||R===12336)||Dn["Enclosed CJK Letters and Months"](R)||Dn["Ideographic Description Characters"](R)||Dn.Kanbun(R)||Dn.Katakana(R)&&R!==12540||!(!Dn["Halfwidth and Fullwidth Forms"](R)||R===65288||R===65289||R===65293||R>=65306&&R<=65310||R===65339||R===65341||R===65343||R>=65371&&R<=65503||R===65507||R>=65512&&R<=65519)||!(!Dn["Small Form Variants"](R)||R>=65112&&R<=65118||R>=65123&&R<=65126)||Dn["Vertical Forms"](R)||Dn["Yijing Hexagram Symbols"](R)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(R))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(R))||ws.test(String.fromCodePoint(R)))))}function ml(R){return!(Ho(R)||function(A){return!!(Dn["Latin-1 Supplement"](A)&&(A===167||A===169||A===174||A===177||A===188||A===189||A===190||A===215||A===247)||Dn["General Punctuation"](A)&&(A===8214||A===8224||A===8225||A===8240||A===8241||A===8251||A===8252||A===8258||A===8263||A===8264||A===8265||A===8273)||Dn["Letterlike Symbols"](A)||Dn["Number Forms"](A)||Dn["Miscellaneous Technical"](A)&&(A>=8960&&A<=8967||A>=8972&&A<=8991||A>=8996&&A<=9e3||A===9003||A>=9085&&A<=9114||A>=9150&&A<=9165||A===9167||A>=9169&&A<=9179||A>=9186&&A<=9215)||Dn["Control Pictures"](A)&&A!==9251||Dn["Optical Character Recognition"](A)||Dn["Enclosed Alphanumerics"](A)||Dn["Geometric Shapes"](A)||Dn["Miscellaneous Symbols"](A)&&!(A>=9754&&A<=9759)||Dn["Miscellaneous Symbols and Arrows"](A)&&(A>=11026&&A<=11055||A>=11088&&A<=11097||A>=11192&&A<=11243)||Dn["CJK Symbols and Punctuation"](A)||Dn.Katakana(A)||Dn["Private Use Area"](A)||Dn["CJK Compatibility Forms"](A)||Dn["Small Form Variants"](A)||Dn["Halfwidth and Fullwidth Forms"](A)||A===8734||A===8756||A===8757||A>=9984&&A<=10087||A>=10102&&A<=10131||A===65532||A===65533)}(R))}let Ws=Zo(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ls(R){return Ws.test(String.fromCodePoint(R))}function va(R,A){return!(!A&&Ls(R)||R>=2304&&R<=3583||R>=3840&&R<=4255||Dn.Khmer(R))}function no(R){for(let A of R)if(Ls(A.charCodeAt(0)))return!0;return!1}let ys=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(R){this.pluginStatus=R.pluginStatus,this.pluginURL=R.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(R){this.applyArabicShaping=R.applyArabicShaping,this.processBidirectionalText=R.processBidirectionalText,this.processStyledBidirectionalText=R.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class rs{constructor(A,F){this.zoom=A,F?(this.now=F.now,this.fadeDuration=F.fadeDuration,this.zoomHistory=F.zoomHistory,this.transition=F.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Zn,this.transition={})}isSupportedScript(A){return function(F,W){for(let te of F)if(!va(te.charCodeAt(0),W))return!1;return!0}(A,ys.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let A=this.zoom,F=A-Math.floor(A),W=this.crossFadingFactor();return A>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:F+(1-F)*W}:{fromScale:.5,toScale:1,t:1-(1-W)*F}}}class Ql{constructor(A,F){this.property=A,this.value=F,this.expression=function(W,te){if(Wf(W))return new nl(W,te);if(Dc(W)){let fe=_u(W,te);if(fe.result==="error")throw new Error(fe.value.map(pe=>`${pe.key}: ${pe.message}`).join(", "));return fe.value}{let fe=W;return te.type==="color"&&typeof W=="string"?fe=ir.parse(W):te.type!=="padding"||typeof W!="number"&&!Array.isArray(W)?te.type==="variableAnchorOffsetCollection"&&Array.isArray(W)&&(fe=Zi.parse(W)):fe=$r.parse(W),{kind:"constant",evaluate:()=>fe}}}(F===void 0?A.specification.default:F,A.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(A,F,W){return this.property.possiblyEvaluate(this,A,F,W)}}class Cu{constructor(A){this.property=A,this.value=new Ql(A,void 0)}transitioned(A,F){return new Nc(this.property,this.value,F,L({},A.transition,this.transition),A.now)}untransitioned(){return new Nc(this.property,this.value,null,{},0)}}class Yu{constructor(A){this._properties=A,this._values=Object.create(A.defaultTransitionablePropertyValues)}getValue(A){return g(this._values[A].value.value)}setValue(A,F){Object.prototype.hasOwnProperty.call(this._values,A)||(this._values[A]=new Cu(this._values[A].property)),this._values[A].value=new Ql(this._values[A].property,F===null?void 0:g(F))}getTransition(A){return g(this._values[A].transition)}setTransition(A,F){Object.prototype.hasOwnProperty.call(this._values,A)||(this._values[A]=new Cu(this._values[A].property)),this._values[A].transition=g(F)||void 0}serialize(){let A={};for(let F of Object.keys(this._values)){let W=this.getValue(F);W!==void 0&&(A[F]=W);let te=this.getTransition(F);te!==void 0&&(A[`${F}-transition`]=te)}return A}transitioned(A,F){let W=new pu(this._properties);for(let te of Object.keys(this._values))W._values[te]=this._values[te].transitioned(A,F._values[te]);return W}untransitioned(){let A=new pu(this._properties);for(let F of Object.keys(this._values))A._values[F]=this._values[F].untransitioned();return A}}class Nc{constructor(A,F,W,te,fe){this.property=A,this.value=F,this.begin=fe+te.delay||0,this.end=this.begin+te.duration||0,A.specification.transition&&(te.delay||te.duration)&&(this.prior=W)}possiblyEvaluate(A,F,W){let te=A.now||0,fe=this.value.possiblyEvaluate(A,F,W),pe=this.prior;if(pe){if(te>this.end)return this.prior=null,fe;if(this.value.isDataDriven())return this.prior=null,fe;if(te<this.begin)return pe.possiblyEvaluate(A,F,W);{let Re=(te-this.begin)/(this.end-this.begin);return this.property.interpolate(pe.possiblyEvaluate(A,F,W),fe,function(Ke){if(Ke<=0)return 0;if(Ke>=1)return 1;let ft=Ke*Ke,Rt=ft*Ke;return 4*(Ke<.5?Rt:3*(Ke-ft)+Rt-.75)}(Re))}}return fe}}class pu{constructor(A){this._properties=A,this._values=Object.create(A.defaultTransitioningPropertyValues)}possiblyEvaluate(A,F,W){let te=new Ac(this._properties);for(let fe of Object.keys(this._values))te._values[fe]=this._values[fe].possiblyEvaluate(A,F,W);return te}hasTransition(){for(let A of Object.keys(this._values))if(this._values[A].prior)return!0;return!1}}class Uc{constructor(A){this._properties=A,this._values=Object.create(A.defaultPropertyValues)}hasValue(A){return this._values[A].value!==void 0}getValue(A){return g(this._values[A].value)}setValue(A,F){this._values[A]=new Ql(this._values[A].property,F===null?void 0:g(F))}serialize(){let A={};for(let F of Object.keys(this._values)){let W=this.getValue(F);W!==void 0&&(A[F]=W)}return A}possiblyEvaluate(A,F,W){let te=new Ac(this._properties);for(let fe of Object.keys(this._values))te._values[fe]=this._values[fe].possiblyEvaluate(A,F,W);return te}}class xu{constructor(A,F,W){this.property=A,this.value=F,this.parameters=W}isConstant(){return this.value.kind==="constant"}constantOr(A){return this.value.kind==="constant"?this.value.value:A}evaluate(A,F,W,te){return this.property.evaluate(this.value,this.parameters,A,F,W,te)}}class Ac{constructor(A){this._properties=A,this._values=Object.create(A.defaultPossiblyEvaluatedValues)}get(A){return this._values[A]}}class Va{constructor(A){this.specification=A}possiblyEvaluate(A,F){if(A.isDataDriven())throw new Error("Value should not be data driven");return A.expression.evaluate(F)}interpolate(A,F,W){let te=Lo[this.specification.type];return te?te(A,F,W):A}}class oo{constructor(A,F){this.specification=A,this.overrides=F}possiblyEvaluate(A,F,W,te){return new xu(this,A.expression.kind==="constant"||A.expression.kind==="camera"?{kind:"constant",value:A.expression.evaluate(F,null,{},W,te)}:A.expression,F)}interpolate(A,F,W){if(A.value.kind!=="constant"||F.value.kind!=="constant")return A;if(A.value.value===void 0||F.value.value===void 0)return new xu(this,{kind:"constant",value:void 0},A.parameters);let te=Lo[this.specification.type];if(te){let fe=te(A.value.value,F.value.value,W);return new xu(this,{kind:"constant",value:fe},A.parameters)}return A}evaluate(A,F,W,te,fe,pe){return A.kind==="constant"?A.value:A.evaluate(F,W,te,fe,pe)}}class Vc extends oo{possiblyEvaluate(A,F,W,te){if(A.value===void 0)return new xu(this,{kind:"constant",value:void 0},F);if(A.expression.kind==="constant"){let fe=A.expression.evaluate(F,null,{},W,te),pe=A.property.specification.type==="resolvedImage"&&typeof fe!="string"?fe.name:fe,Re=this._calculate(pe,pe,pe,F);return new xu(this,{kind:"constant",value:Re},F)}if(A.expression.kind==="camera"){let fe=this._calculate(A.expression.evaluate({zoom:F.zoom-1}),A.expression.evaluate({zoom:F.zoom}),A.expression.evaluate({zoom:F.zoom+1}),F);return new xu(this,{kind:"constant",value:fe},F)}return new xu(this,A.expression,F)}evaluate(A,F,W,te,fe,pe){if(A.kind==="source"){let Re=A.evaluate(F,W,te,fe,pe);return this._calculate(Re,Re,Re,F)}return A.kind==="composite"?this._calculate(A.evaluate({zoom:Math.floor(F.zoom)-1},W,te),A.evaluate({zoom:Math.floor(F.zoom)},W,te),A.evaluate({zoom:Math.floor(F.zoom)+1},W,te),F):A.value}_calculate(A,F,W,te){return te.zoom>te.zoomHistory.lastIntegerZoom?{from:A,to:F}:{from:W,to:F}}interpolate(A){return A}}class hc{constructor(A){this.specification=A}possiblyEvaluate(A,F,W,te){if(A.value!==void 0){if(A.expression.kind==="constant"){let fe=A.expression.evaluate(F,null,{},W,te);return this._calculate(fe,fe,fe,F)}return this._calculate(A.expression.evaluate(new rs(Math.floor(F.zoom-1),F)),A.expression.evaluate(new rs(Math.floor(F.zoom),F)),A.expression.evaluate(new rs(Math.floor(F.zoom+1),F)),F)}}_calculate(A,F,W,te){return te.zoom>te.zoomHistory.lastIntegerZoom?{from:A,to:F}:{from:W,to:F}}interpolate(A){return A}}class Ku{constructor(A){this.specification=A}possiblyEvaluate(A,F,W,te){return!!A.expression.evaluate(F,null,{},W,te)}interpolate(){return!1}}class ue{constructor(A){this.properties=A,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let F in A){let W=A[F];W.specification.overridable&&this.overridableProperties.push(F);let te=this.defaultPropertyValues[F]=new Ql(W,void 0),fe=this.defaultTransitionablePropertyValues[F]=new Cu(W);this.defaultTransitioningPropertyValues[F]=fe.untransitioned(),this.defaultPossiblyEvaluatedValues[F]=te.possiblyEvaluate({})}}}Fi("DataDrivenProperty",oo),Fi("DataConstantProperty",Va),Fi("CrossFadedDataDrivenProperty",Vc),Fi("CrossFadedProperty",hc),Fi("ColorRampProperty",Ku);let w="-transition";class B extends Pe{constructor(A,F){if(super(),this.id=A.id,this.type=A.type,this._featureFilter={filter:()=>!0,needGeometry:!1},A.type!=="custom"&&(this.metadata=A.metadata,this.minzoom=A.minzoom,this.maxzoom=A.maxzoom,A.type!=="background"&&(this.source=A.source,this.sourceLayer=A["source-layer"],this.filter=A.filter),F.layout&&(this._unevaluatedLayout=new Uc(F.layout)),F.paint)){this._transitionablePaint=new Yu(F.paint);for(let W in A.paint)this.setPaintProperty(W,A.paint[W],{validate:!1});for(let W in A.layout)this.setLayoutProperty(W,A.layout[W],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ac(F.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(A){return A==="visibility"?this.visibility:this._unevaluatedLayout.getValue(A)}setLayoutProperty(A,F,W={}){F!=null&&this._validate(On,`layers.${this.id}.layout.${A}`,A,F,W)||(A!=="visibility"?this._unevaluatedLayout.setValue(A,F):this.visibility=F)}getPaintProperty(A){return A.endsWith(w)?this._transitionablePaint.getTransition(A.slice(0,-11)):this._transitionablePaint.getValue(A)}setPaintProperty(A,F,W={}){if(F!=null&&this._validate(wn,`layers.${this.id}.paint.${A}`,A,F,W))return!1;if(A.endsWith(w))return this._transitionablePaint.setTransition(A.slice(0,-11),F||void 0),!1;{let te=this._transitionablePaint._values[A],fe=te.property.specification["property-type"]==="cross-faded-data-driven",pe=te.value.isDataDriven(),Re=te.value;this._transitionablePaint.setValue(A,F),this._handleSpecialPaintPropertyUpdate(A);let Ke=this._transitionablePaint._values[A].value;return Ke.isDataDriven()||pe||fe||this._handleOverridablePaintPropertyUpdate(A,Re,Ke)}}_handleSpecialPaintPropertyUpdate(A){}_handleOverridablePaintPropertyUpdate(A,F,W){return!1}isHidden(A){return!!(this.minzoom&&A<this.minzoom)||!!(this.maxzoom&&A>=this.maxzoom)||this.visibility==="none"}updateTransitions(A){this._transitioningPaint=this._transitionablePaint.transitioned(A,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(A,F){A.getCrossfadeParameters&&(this._crossfadeParameters=A.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(A,void 0,F)),this.paint=this._transitioningPaint.possiblyEvaluate(A,void 0,F)}serialize(){let A={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(A.layout=A.layout||{},A.layout.visibility=this.visibility),S(A,(F,W)=>!(F===void 0||W==="layout"&&!Object.keys(F).length||W==="paint"&&!Object.keys(F).length))}_validate(A,F,W,te,fe={}){return(!fe||fe.validate!==!1)&&Yi(this,A.call(Mi,{key:F,layerType:this.type,objectKey:W,value:te,styleSpec:ce,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let A in this.paint._values){let F=this.paint.get(A);if(F instanceof xu&&Nl(F.property.specification)&&(F.value.kind==="source"||F.value.kind==="composite")&&F.value.isStateDependent)return!0}return!1}}let Q={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ee{constructor(A,F){this._structArray=A,this._pos1=F*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class le{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(A,F){return A._trim(),F&&(A.isTransferred=!0,F.push(A.arrayBuffer)),{length:A.length,arrayBuffer:A.arrayBuffer}}static deserialize(A){let F=Object.create(this.prototype);return F.arrayBuffer=A.arrayBuffer,F.length=A.length,F.capacity=A.arrayBuffer.byteLength/F.bytesPerElement,F._refreshViews(),F}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(A){this.reserve(A),this.length=A}reserve(A){if(A>this.capacity){this.capacity=Math.max(A,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let F=this.uint8;this._refreshViews(),F&&this.uint8.set(F)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Fe(R,A=1){let F=0,W=0;return{members:R.map(te=>{let fe=Q[te.type].BYTES_PER_ELEMENT,pe=F=Ze(F,Math.max(A,fe)),Re=te.components||1;return W=Math.max(W,fe),F+=fe*Re,{name:te.name,type:te.type,components:Re,offset:pe}}),size:Ze(F,Math.max(W,A)),alignment:A}}function Ze(R,A){return Math.ceil(R/A)*A}class ut extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F){let W=this.length;return this.resize(W+1),this.emplace(W,A,F)}emplace(A,F,W){let te=2*A;return this.int16[te+0]=F,this.int16[te+1]=W,A}}ut.prototype.bytesPerElement=4,Fi("StructArrayLayout2i4",ut);class Mt extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F,W){let te=this.length;return this.resize(te+1),this.emplace(te,A,F,W)}emplace(A,F,W,te){let fe=3*A;return this.int16[fe+0]=F,this.int16[fe+1]=W,this.int16[fe+2]=te,A}}Mt.prototype.bytesPerElement=6,Fi("StructArrayLayout3i6",Mt);class Jt extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F,W,te){let fe=this.length;return this.resize(fe+1),this.emplace(fe,A,F,W,te)}emplace(A,F,W,te,fe){let pe=4*A;return this.int16[pe+0]=F,this.int16[pe+1]=W,this.int16[pe+2]=te,this.int16[pe+3]=fe,A}}Jt.prototype.bytesPerElement=8,Fi("StructArrayLayout4i8",Jt);class $t extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe){let Re=this.length;return this.resize(Re+1),this.emplace(Re,A,F,W,te,fe,pe)}emplace(A,F,W,te,fe,pe,Re){let Ke=6*A;return this.int16[Ke+0]=F,this.int16[Ke+1]=W,this.int16[Ke+2]=te,this.int16[Ke+3]=fe,this.int16[Ke+4]=pe,this.int16[Ke+5]=Re,A}}$t.prototype.bytesPerElement=12,Fi("StructArrayLayout2i4i12",$t);class yr extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe){let Re=this.length;return this.resize(Re+1),this.emplace(Re,A,F,W,te,fe,pe)}emplace(A,F,W,te,fe,pe,Re){let Ke=4*A,ft=8*A;return this.int16[Ke+0]=F,this.int16[Ke+1]=W,this.uint8[ft+4]=te,this.uint8[ft+5]=fe,this.uint8[ft+6]=pe,this.uint8[ft+7]=Re,A}}yr.prototype.bytesPerElement=8,Fi("StructArrayLayout2i4ub8",yr);class Cr extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(A,F){let W=this.length;return this.resize(W+1),this.emplace(W,A,F)}emplace(A,F,W){let te=2*A;return this.float32[te+0]=F,this.float32[te+1]=W,A}}Cr.prototype.bytesPerElement=8,Fi("StructArrayLayout2f8",Cr);class ve extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe,Re,Ke,ft,Rt){let er=this.length;return this.resize(er+1),this.emplace(er,A,F,W,te,fe,pe,Re,Ke,ft,Rt)}emplace(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er){let ur=10*A;return this.uint16[ur+0]=F,this.uint16[ur+1]=W,this.uint16[ur+2]=te,this.uint16[ur+3]=fe,this.uint16[ur+4]=pe,this.uint16[ur+5]=Re,this.uint16[ur+6]=Ke,this.uint16[ur+7]=ft,this.uint16[ur+8]=Rt,this.uint16[ur+9]=er,A}}ve.prototype.bytesPerElement=20,Fi("StructArrayLayout10ui20",ve);class xe extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur){let vr=this.length;return this.resize(vr+1),this.emplace(vr,A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur)}emplace(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr){let kr=12*A;return this.int16[kr+0]=F,this.int16[kr+1]=W,this.int16[kr+2]=te,this.int16[kr+3]=fe,this.uint16[kr+4]=pe,this.uint16[kr+5]=Re,this.uint16[kr+6]=Ke,this.uint16[kr+7]=ft,this.int16[kr+8]=Rt,this.int16[kr+9]=er,this.int16[kr+10]=ur,this.int16[kr+11]=vr,A}}xe.prototype.bytesPerElement=24,Fi("StructArrayLayout4i4ui4i24",xe);class Ie extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(A,F,W){let te=this.length;return this.resize(te+1),this.emplace(te,A,F,W)}emplace(A,F,W,te){let fe=3*A;return this.float32[fe+0]=F,this.float32[fe+1]=W,this.float32[fe+2]=te,A}}Ie.prototype.bytesPerElement=12,Fi("StructArrayLayout3f12",Ie);class ze extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(A){let F=this.length;return this.resize(F+1),this.emplace(F,A)}emplace(A,F){return this.uint32[1*A+0]=F,A}}ze.prototype.bytesPerElement=4,Fi("StructArrayLayout1ul4",ze);class Qe extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe,Re,Ke,ft){let Rt=this.length;return this.resize(Rt+1),this.emplace(Rt,A,F,W,te,fe,pe,Re,Ke,ft)}emplace(A,F,W,te,fe,pe,Re,Ke,ft,Rt){let er=10*A,ur=5*A;return this.int16[er+0]=F,this.int16[er+1]=W,this.int16[er+2]=te,this.int16[er+3]=fe,this.int16[er+4]=pe,this.int16[er+5]=Re,this.uint32[ur+3]=Ke,this.uint16[er+8]=ft,this.uint16[er+9]=Rt,A}}Qe.prototype.bytesPerElement=20,Fi("StructArrayLayout6i1ul2ui20",Qe);class Xe extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe){let Re=this.length;return this.resize(Re+1),this.emplace(Re,A,F,W,te,fe,pe)}emplace(A,F,W,te,fe,pe,Re){let Ke=6*A;return this.int16[Ke+0]=F,this.int16[Ke+1]=W,this.int16[Ke+2]=te,this.int16[Ke+3]=fe,this.int16[Ke+4]=pe,this.int16[Ke+5]=Re,A}}Xe.prototype.bytesPerElement=12,Fi("StructArrayLayout2i2i2i12",Xe);class nt extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe){let pe=this.length;return this.resize(pe+1),this.emplace(pe,A,F,W,te,fe)}emplace(A,F,W,te,fe,pe){let Re=4*A,Ke=8*A;return this.float32[Re+0]=F,this.float32[Re+1]=W,this.float32[Re+2]=te,this.int16[Ke+6]=fe,this.int16[Ke+7]=pe,A}}nt.prototype.bytesPerElement=16,Fi("StructArrayLayout2f1f2i16",nt);class qt extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe){let Re=this.length;return this.resize(Re+1),this.emplace(Re,A,F,W,te,fe,pe)}emplace(A,F,W,te,fe,pe,Re){let Ke=16*A,ft=4*A,Rt=8*A;return this.uint8[Ke+0]=F,this.uint8[Ke+1]=W,this.float32[ft+1]=te,this.float32[ft+2]=fe,this.int16[Rt+6]=pe,this.int16[Rt+7]=Re,A}}qt.prototype.bytesPerElement=16,Fi("StructArrayLayout2ub2f2i16",qt);class Wt extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(A,F,W){let te=this.length;return this.resize(te+1),this.emplace(te,A,F,W)}emplace(A,F,W,te){let fe=3*A;return this.uint16[fe+0]=F,this.uint16[fe+1]=W,this.uint16[fe+2]=te,A}}Wt.prototype.bytesPerElement=6,Fi("StructArrayLayout3ui6",Wt);class nr extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr,Dr,li,pi){let vn=this.length;return this.resize(vn+1),this.emplace(vn,A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr,Dr,li,pi)}emplace(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr,Dr,li,pi,vn){let zi=24*A,ln=12*A,Tn=48*A;return this.int16[zi+0]=F,this.int16[zi+1]=W,this.uint16[zi+2]=te,this.uint16[zi+3]=fe,this.uint32[ln+2]=pe,this.uint32[ln+3]=Re,this.uint32[ln+4]=Ke,this.uint16[zi+10]=ft,this.uint16[zi+11]=Rt,this.uint16[zi+12]=er,this.float32[ln+7]=ur,this.float32[ln+8]=vr,this.uint8[Tn+36]=kr,this.uint8[Tn+37]=Dr,this.uint8[Tn+38]=li,this.uint32[ln+10]=pi,this.int16[zi+22]=vn,A}}nr.prototype.bytesPerElement=48,Fi("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",nr);class fr extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr,Dr,li,pi,vn,zi,ln,Tn,pa,ro,Vo,Xa,la,Mo,fo){let lo=this.length;return this.resize(lo+1),this.emplace(lo,A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr,Dr,li,pi,vn,zi,ln,Tn,pa,ro,Vo,Xa,la,Mo,fo)}emplace(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr,Dr,li,pi,vn,zi,ln,Tn,pa,ro,Vo,Xa,la,Mo,fo,lo){let Wn=32*A,Ro=16*A;return this.int16[Wn+0]=F,this.int16[Wn+1]=W,this.int16[Wn+2]=te,this.int16[Wn+3]=fe,this.int16[Wn+4]=pe,this.int16[Wn+5]=Re,this.int16[Wn+6]=Ke,this.int16[Wn+7]=ft,this.uint16[Wn+8]=Rt,this.uint16[Wn+9]=er,this.uint16[Wn+10]=ur,this.uint16[Wn+11]=vr,this.uint16[Wn+12]=kr,this.uint16[Wn+13]=Dr,this.uint16[Wn+14]=li,this.uint16[Wn+15]=pi,this.uint16[Wn+16]=vn,this.uint16[Wn+17]=zi,this.uint16[Wn+18]=ln,this.uint16[Wn+19]=Tn,this.uint16[Wn+20]=pa,this.uint16[Wn+21]=ro,this.uint16[Wn+22]=Vo,this.uint32[Ro+12]=Xa,this.float32[Ro+13]=la,this.float32[Ro+14]=Mo,this.uint16[Wn+30]=fo,this.uint16[Wn+31]=lo,A}}fr.prototype.bytesPerElement=64,Fi("StructArrayLayout8i15ui1ul2f2ui64",fr);class br extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(A){let F=this.length;return this.resize(F+1),this.emplace(F,A)}emplace(A,F){return this.float32[1*A+0]=F,A}}br.prototype.bytesPerElement=4,Fi("StructArrayLayout1f4",br);class Fr extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(A,F,W){let te=this.length;return this.resize(te+1),this.emplace(te,A,F,W)}emplace(A,F,W,te){let fe=3*A;return this.uint16[6*A+0]=F,this.float32[fe+1]=W,this.float32[fe+2]=te,A}}Fr.prototype.bytesPerElement=12,Fi("StructArrayLayout1ui2f12",Fr);class Hr extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(A,F,W){let te=this.length;return this.resize(te+1),this.emplace(te,A,F,W)}emplace(A,F,W,te){let fe=4*A;return this.uint32[2*A+0]=F,this.uint16[fe+2]=W,this.uint16[fe+3]=te,A}}Hr.prototype.bytesPerElement=8,Fi("StructArrayLayout1ul2ui8",Hr);class ri extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(A,F){let W=this.length;return this.resize(W+1),this.emplace(W,A,F)}emplace(A,F,W){let te=2*A;return this.uint16[te+0]=F,this.uint16[te+1]=W,A}}ri.prototype.bytesPerElement=4,Fi("StructArrayLayout2ui4",ri);class Ci extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(A){let F=this.length;return this.resize(F+1),this.emplace(F,A)}emplace(A,F){return this.uint16[1*A+0]=F,A}}Ci.prototype.bytesPerElement=2,Fi("StructArrayLayout1ui2",Ci);class cn extends le{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(A,F,W,te){let fe=this.length;return this.resize(fe+1),this.emplace(fe,A,F,W,te)}emplace(A,F,W,te,fe){let pe=4*A;return this.float32[pe+0]=F,this.float32[pe+1]=W,this.float32[pe+2]=te,this.float32[pe+3]=fe,A}}cn.prototype.bytesPerElement=16,Fi("StructArrayLayout4f16",cn);class sn extends ee{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new u(this.anchorPointX,this.anchorPointY)}}sn.prototype.size=20;class Ln extends Qe{get(A){return new sn(this,A)}}Fi("CollisionBoxArray",Ln);class Yn extends ee{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(A){this._structArray.uint8[this._pos1+37]=A}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(A){this._structArray.uint8[this._pos1+38]=A}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(A){this._structArray.uint32[this._pos4+10]=A}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Yn.prototype.size=48;class Aa extends nr{get(A){return new Yn(this,A)}}Fi("PlacedSymbolArray",Aa);class fa extends ee{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(A){this._structArray.uint32[this._pos4+12]=A}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}fa.prototype.size=64;class $a extends fr{get(A){return new fa(this,A)}}Fi("SymbolInstanceArray",$a);class Co extends br{getoffsetX(A){return this.float32[1*A+0]}}Fi("GlyphOffsetArray",Co);class Qa extends Mt{getx(A){return this.int16[3*A+0]}gety(A){return this.int16[3*A+1]}gettileUnitDistanceFromAnchor(A){return this.int16[3*A+2]}}Fi("SymbolLineVertexArray",Qa);class mo extends ee{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}mo.prototype.size=12;class Bo extends Fr{get(A){return new mo(this,A)}}Fi("TextAnchorOffsetArray",Bo);class Ps extends ee{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Ps.prototype.size=8;class Ts extends Hr{get(A){return new Ps(this,A)}}Fi("FeatureIndexArray",Ts);class wo extends ut{}class To extends ut{}class hl extends ut{}class Ul extends $t{}class Lu extends yr{}class au extends Cr{}class Js extends ve{}class eu extends xe{}class dc extends Ie{}class Tl extends ze{}class Al extends Xe{}class X extends qt{}class se extends Wt{}class Te extends ri{}let qe=Fe([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ve}=qe;class Ye{constructor(A=[]){this.segments=A}prepareSegment(A,F,W,te){let fe=this.segments[this.segments.length-1];return A>Ye.MAX_VERTEX_ARRAY_LENGTH&&E(`Max vertices per segment is ${Ye.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${A}`),(!fe||fe.vertexLength+A>Ye.MAX_VERTEX_ARRAY_LENGTH||fe.sortKey!==te)&&(fe={vertexOffset:F.length,primitiveOffset:W.length,vertexLength:0,primitiveLength:0},te!==void 0&&(fe.sortKey=te),this.segments.push(fe)),fe}get(){return this.segments}destroy(){for(let A of this.segments)for(let F in A.vaos)A.vaos[F].destroy()}static simpleSegment(A,F,W,te){return new Ye([{vertexOffset:A,primitiveOffset:F,vertexLength:W,primitiveLength:te,vaos:{},sortKey:0}])}}function Pt(R,A){return 256*(R=M(Math.floor(R),0,255))+M(Math.floor(A),0,255)}Ye.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fi("SegmentVector",Ye);let ot=Fe([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Xt={exports:{}},dr={exports:{}};dr.exports=function(R,A){var F,W,te,fe,pe,Re,Ke,ft;for(W=R.length-(F=3&R.length),te=A,pe=3432918353,Re=461845907,ft=0;ft<W;)Ke=255&R.charCodeAt(ft)|(255&R.charCodeAt(++ft))<<8|(255&R.charCodeAt(++ft))<<16|(255&R.charCodeAt(++ft))<<24,++ft,te=27492+(65535&(fe=5*(65535&(te=(te^=Ke=(65535&(Ke=(Ke=(65535&Ke)*pe+(((Ke>>>16)*pe&65535)<<16)&4294967295)<<15|Ke>>>17))*Re+(((Ke>>>16)*Re&65535)<<16)&4294967295)<<13|te>>>19))+((5*(te>>>16)&65535)<<16)&4294967295))+((58964+(fe>>>16)&65535)<<16);switch(Ke=0,F){case 3:Ke^=(255&R.charCodeAt(ft+2))<<16;case 2:Ke^=(255&R.charCodeAt(ft+1))<<8;case 1:te^=Ke=(65535&(Ke=(Ke=(65535&(Ke^=255&R.charCodeAt(ft)))*pe+(((Ke>>>16)*pe&65535)<<16)&4294967295)<<15|Ke>>>17))*Re+(((Ke>>>16)*Re&65535)<<16)&4294967295}return te^=R.length,te=2246822507*(65535&(te^=te>>>16))+((2246822507*(te>>>16)&65535)<<16)&4294967295,te=3266489909*(65535&(te^=te>>>13))+((3266489909*(te>>>16)&65535)<<16)&4294967295,(te^=te>>>16)>>>0};var pr=dr.exports,Ur={exports:{}};Ur.exports=function(R,A){for(var F,W=R.length,te=A^W,fe=0;W>=4;)F=1540483477*(65535&(F=255&R.charCodeAt(fe)|(255&R.charCodeAt(++fe))<<8|(255&R.charCodeAt(++fe))<<16|(255&R.charCodeAt(++fe))<<24))+((1540483477*(F>>>16)&65535)<<16),te=1540483477*(65535&te)+((1540483477*(te>>>16)&65535)<<16)^(F=1540483477*(65535&(F^=F>>>24))+((1540483477*(F>>>16)&65535)<<16)),W-=4,++fe;switch(W){case 3:te^=(255&R.charCodeAt(fe+2))<<16;case 2:te^=(255&R.charCodeAt(fe+1))<<8;case 1:te=1540483477*(65535&(te^=255&R.charCodeAt(fe)))+((1540483477*(te>>>16)&65535)<<16)}return te=1540483477*(65535&(te^=te>>>13))+((1540483477*(te>>>16)&65535)<<16),(te^=te>>>15)>>>0};var zr=pr,gi=Ur.exports;Xt.exports=zr,Xt.exports.murmur3=zr,Xt.exports.murmur2=gi;var xi=o(Xt.exports);class Wr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(A,F,W,te){this.ids.push(ii(A)),this.positions.push(F,W,te)}getPositions(A){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let F=ii(A),W=0,te=this.ids.length-1;for(;W<te;){let pe=W+te>>1;this.ids[pe]>=F?te=pe:W=pe+1}let fe=[];for(;this.ids[W]===F;)fe.push({index:this.positions[3*W],start:this.positions[3*W+1],end:this.positions[3*W+2]}),W++;return fe}static serialize(A,F){let W=new Float64Array(A.ids),te=new Uint32Array(A.positions);return di(W,te,0,W.length-1),F&&F.push(W.buffer,te.buffer),{ids:W,positions:te}}static deserialize(A){let F=new Wr;return F.ids=A.ids,F.positions=A.positions,F.indexed=!0,F}}function ii(R){let A=+R;return!isNaN(A)&&A<=Number.MAX_SAFE_INTEGER?A:xi(String(R))}function di(R,A,F,W){for(;F<W;){let te=R[F+W>>1],fe=F-1,pe=W+1;for(;;){do fe++;while(R[fe]<te);do pe--;while(R[pe]>te);if(fe>=pe)break;Li(R,fe,pe),Li(A,3*fe,3*pe),Li(A,3*fe+1,3*pe+1),Li(A,3*fe+2,3*pe+2)}pe-F<W-pe?(di(R,A,F,pe),F=pe+1):(di(R,A,pe+1,W),W=pe)}}function Li(R,A,F){let W=R[A];R[A]=R[F],R[F]=W}Fi("FeaturePositionMap",Wr);class Ti{constructor(A,F){this.gl=A.gl,this.location=F}}class Qr extends Ti{constructor(A,F){super(A,F),this.current=0}set(A){this.current!==A&&(this.current=A,this.gl.uniform1f(this.location,A))}}class Pn extends Ti{constructor(A,F){super(A,F),this.current=[0,0,0,0]}set(A){A[0]===this.current[0]&&A[1]===this.current[1]&&A[2]===this.current[2]&&A[3]===this.current[3]||(this.current=A,this.gl.uniform4f(this.location,A[0],A[1],A[2],A[3]))}}class kn extends Ti{constructor(A,F){super(A,F),this.current=ir.transparent}set(A){A.r===this.current.r&&A.g===this.current.g&&A.b===this.current.b&&A.a===this.current.a||(this.current=A,this.gl.uniform4f(this.location,A.r,A.g,A.b,A.a))}}let Bn=new Float32Array(16);function na(R){return[Pt(255*R.r,255*R.g),Pt(255*R.b,255*R.a)]}class Ea{constructor(A,F,W){this.value=A,this.uniformNames=F.map(te=>`u_${te}`),this.type=W}setUniform(A,F,W){A.set(W.constantOr(this.value))}getBinding(A,F,W){return this.type==="color"?new kn(A,F):new Qr(A,F)}}class Ia{constructor(A,F){this.uniformNames=F.map(W=>`u_${W}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(A,F){this.pixelRatioFrom=F.pixelRatio,this.pixelRatioTo=A.pixelRatio,this.patternFrom=F.tlbr,this.patternTo=A.tlbr}setUniform(A,F,W,te){let fe=te==="u_pattern_to"?this.patternTo:te==="u_pattern_from"?this.patternFrom:te==="u_pixel_ratio_to"?this.pixelRatioTo:te==="u_pixel_ratio_from"?this.pixelRatioFrom:null;fe&&A.set(fe)}getBinding(A,F,W){return W.substr(0,9)==="u_pattern"?new Pn(A,F):new Qr(A,F)}}class yo{constructor(A,F,W,te){this.expression=A,this.type=W,this.maxValue=0,this.paintVertexAttributes=F.map(fe=>({name:`a_${fe}`,type:"Float32",components:W==="color"?2:1,offset:0})),this.paintVertexArray=new te}populatePaintArray(A,F,W,te,fe){let pe=this.paintVertexArray.length,Re=this.expression.evaluate(new rs(0),F,{},te,[],fe);this.paintVertexArray.resize(A),this._setPaintValue(pe,A,Re)}updatePaintArray(A,F,W,te){let fe=this.expression.evaluate({zoom:0},W,te);this._setPaintValue(A,F,fe)}_setPaintValue(A,F,W){if(this.type==="color"){let te=na(W);for(let fe=A;fe<F;fe++)this.paintVertexArray.emplace(fe,te[0],te[1])}else{for(let te=A;te<F;te++)this.paintVertexArray.emplace(te,W);this.maxValue=Math.max(this.maxValue,Math.abs(W))}}upload(A){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=A.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Da{constructor(A,F,W,te,fe,pe){this.expression=A,this.uniformNames=F.map(Re=>`u_${Re}_t`),this.type=W,this.useIntegerZoom=te,this.zoom=fe,this.maxValue=0,this.paintVertexAttributes=F.map(Re=>({name:`a_${Re}`,type:"Float32",components:W==="color"?4:2,offset:0})),this.paintVertexArray=new pe}populatePaintArray(A,F,W,te,fe){let pe=this.expression.evaluate(new rs(this.zoom),F,{},te,[],fe),Re=this.expression.evaluate(new rs(this.zoom+1),F,{},te,[],fe),Ke=this.paintVertexArray.length;this.paintVertexArray.resize(A),this._setPaintValue(Ke,A,pe,Re)}updatePaintArray(A,F,W,te){let fe=this.expression.evaluate({zoom:this.zoom},W,te),pe=this.expression.evaluate({zoom:this.zoom+1},W,te);this._setPaintValue(A,F,fe,pe)}_setPaintValue(A,F,W,te){if(this.type==="color"){let fe=na(W),pe=na(te);for(let Re=A;Re<F;Re++)this.paintVertexArray.emplace(Re,fe[0],fe[1],pe[0],pe[1])}else{for(let fe=A;fe<F;fe++)this.paintVertexArray.emplace(fe,W,te);this.maxValue=Math.max(this.maxValue,Math.abs(W),Math.abs(te))}}upload(A){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=A.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(A,F){let W=this.useIntegerZoom?Math.floor(F.zoom):F.zoom,te=M(this.expression.interpolationFactor(W,this.zoom,this.zoom+1),0,1);A.set(te)}getBinding(A,F,W){return new Qr(A,F)}}class go{constructor(A,F,W,te,fe,pe){this.expression=A,this.type=F,this.useIntegerZoom=W,this.zoom=te,this.layerId=pe,this.zoomInPaintVertexArray=new fe,this.zoomOutPaintVertexArray=new fe}populatePaintArray(A,F,W){let te=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(A),this.zoomOutPaintVertexArray.resize(A),this._setPaintValues(te,A,F.patterns&&F.patterns[this.layerId],W)}updatePaintArray(A,F,W,te,fe){this._setPaintValues(A,F,W.patterns&&W.patterns[this.layerId],fe)}_setPaintValues(A,F,W,te){if(!te||!W)return;let{min:fe,mid:pe,max:Re}=W,Ke=te[fe],ft=te[pe],Rt=te[Re];if(Ke&&ft&&Rt)for(let er=A;er<F;er++)this.zoomInPaintVertexArray.emplace(er,ft.tl[0],ft.tl[1],ft.br[0],ft.br[1],Ke.tl[0],Ke.tl[1],Ke.br[0],Ke.br[1],ft.pixelRatio,Ke.pixelRatio),this.zoomOutPaintVertexArray.emplace(er,ft.tl[0],ft.tl[1],ft.br[0],ft.br[1],Rt.tl[0],Rt.tl[1],Rt.br[0],Rt.br[1],ft.pixelRatio,Rt.pixelRatio)}upload(A){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=A.createVertexBuffer(this.zoomInPaintVertexArray,ot.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=A.createVertexBuffer(this.zoomOutPaintVertexArray,ot.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Is{constructor(A,F,W){this.binders={},this._buffers=[];let te=[];for(let fe in A.paint._values){if(!W(fe))continue;let pe=A.paint.get(fe);if(!(pe instanceof xu&&Nl(pe.property.specification)))continue;let Re=Xs(fe,A.type),Ke=pe.value,ft=pe.property.specification.type,Rt=pe.property.useIntegerZoom,er=pe.property.specification["property-type"],ur=er==="cross-faded"||er==="cross-faded-data-driven";if(Ke.kind==="constant")this.binders[fe]=ur?new Ia(Ke.value,Re):new Ea(Ke.value,Re,ft),te.push(`/u_${fe}`);else if(Ke.kind==="source"||ur){let vr=Un(fe,ft,"source");this.binders[fe]=ur?new go(Ke,ft,Rt,F,vr,A.id):new yo(Ke,Re,ft,vr),te.push(`/a_${fe}`)}else{let vr=Un(fe,ft,"composite");this.binders[fe]=new Da(Ke,Re,ft,Rt,F,vr),te.push(`/z_${fe}`)}}this.cacheKey=te.sort().join("")}getMaxValue(A){let F=this.binders[A];return F instanceof yo||F instanceof Da?F.maxValue:0}populatePaintArrays(A,F,W,te,fe){for(let pe in this.binders){let Re=this.binders[pe];(Re instanceof yo||Re instanceof Da||Re instanceof go)&&Re.populatePaintArray(A,F,W,te,fe)}}setConstantPatternPositions(A,F){for(let W in this.binders){let te=this.binders[W];te instanceof Ia&&te.setConstantPatternPositions(A,F)}}updatePaintArrays(A,F,W,te,fe){let pe=!1;for(let Re in A){let Ke=F.getPositions(Re);for(let ft of Ke){let Rt=W.feature(ft.index);for(let er in this.binders){let ur=this.binders[er];if((ur instanceof yo||ur instanceof Da||ur instanceof go)&&ur.expression.isStateDependent===!0){let vr=te.paint.get(er);ur.expression=vr.value,ur.updatePaintArray(ft.start,ft.end,Rt,A[Re],fe),pe=!0}}}}return pe}defines(){let A=[];for(let F in this.binders){let W=this.binders[F];(W instanceof Ea||W instanceof Ia)&&A.push(...W.uniformNames.map(te=>`#define HAS_UNIFORM_${te}`))}return A}getBinderAttributes(){let A=[];for(let F in this.binders){let W=this.binders[F];if(W instanceof yo||W instanceof Da)for(let te=0;te<W.paintVertexAttributes.length;te++)A.push(W.paintVertexAttributes[te].name);else if(W instanceof go)for(let te=0;te<ot.members.length;te++)A.push(ot.members[te].name)}return A}getBinderUniforms(){let A=[];for(let F in this.binders){let W=this.binders[F];if(W instanceof Ea||W instanceof Ia||W instanceof Da)for(let te of W.uniformNames)A.push(te)}return A}getPaintVertexBuffers(){return this._buffers}getUniforms(A,F){let W=[];for(let te in this.binders){let fe=this.binders[te];if(fe instanceof Ea||fe instanceof Ia||fe instanceof Da){for(let pe of fe.uniformNames)if(F[pe]){let Re=fe.getBinding(A,F[pe],pe);W.push({name:pe,property:te,binding:Re})}}}return W}setUniforms(A,F,W,te){for(let{name:fe,property:pe,binding:Re}of F)this.binders[pe].setUniform(Re,te,W.get(pe),fe)}updatePaintBuffers(A){this._buffers=[];for(let F in this.binders){let W=this.binders[F];if(A&&W instanceof go){let te=A.fromScale===2?W.zoomInPaintVertexBuffer:W.zoomOutPaintVertexBuffer;te&&this._buffers.push(te)}else(W instanceof yo||W instanceof Da)&&W.paintVertexBuffer&&this._buffers.push(W.paintVertexBuffer)}}upload(A){for(let F in this.binders){let W=this.binders[F];(W instanceof yo||W instanceof Da||W instanceof go)&&W.upload(A)}this.updatePaintBuffers()}destroy(){for(let A in this.binders){let F=this.binders[A];(F instanceof yo||F instanceof Da||F instanceof go)&&F.destroy()}}}class Ms{constructor(A,F,W=()=>!0){this.programConfigurations={};for(let te of A)this.programConfigurations[te.id]=new Is(te,F,W);this.needsUpload=!1,this._featureMap=new Wr,this._bufferOffset=0}populatePaintArrays(A,F,W,te,fe,pe){for(let Re in this.programConfigurations)this.programConfigurations[Re].populatePaintArrays(A,F,te,fe,pe);F.id!==void 0&&this._featureMap.add(F.id,W,this._bufferOffset,A),this._bufferOffset=A,this.needsUpload=!0}updatePaintArrays(A,F,W,te){for(let fe of W)this.needsUpload=this.programConfigurations[fe.id].updatePaintArrays(A,this._featureMap,F,fe,te)||this.needsUpload}get(A){return this.programConfigurations[A]}upload(A){if(this.needsUpload){for(let F in this.programConfigurations)this.programConfigurations[F].upload(A);this.needsUpload=!1}}destroy(){for(let A in this.programConfigurations)this.programConfigurations[A].destroy()}}function Xs(R,A){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[R]||[R.replace(`${A}-`,"").replace(/-/g,"_")]}function Un(R,A,F){let W={color:{source:Cr,composite:cn},number:{source:br,composite:Cr}},te=function(fe){return{"line-pattern":{source:Js,composite:Js},"fill-pattern":{source:Js,composite:Js},"fill-extrusion-pattern":{source:Js,composite:Js}}[fe]}(R);return te&&te[F]||W[A][F]}Fi("ConstantBinder",Ea),Fi("CrossFadedConstantBinder",Ia),Fi("SourceExpressionBinder",yo),Fi("CrossFadedCompositeBinder",go),Fi("CompositeExpressionBinder",Da),Fi("ProgramConfiguration",Is,{omit:["_buffers"]}),Fi("ProgramConfigurationSet",Ms);let ja=8192,Fo=Math.pow(2,14)-1,Uo=-Fo-1;function $s(R){let A=ja/R.extent,F=R.loadGeometry();for(let W=0;W<F.length;W++){let te=F[W];for(let fe=0;fe<te.length;fe++){let pe=te[fe],Re=Math.round(pe.x*A),Ke=Math.round(pe.y*A);pe.x=M(Re,Uo,Fo),pe.y=M(Ke,Uo,Fo),(Re<pe.x||Re>pe.x+1||Ke<pe.y||Ke>pe.y+1)&&E("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return F}function Sl(R,A){return{type:R.type,id:R.id,properties:R.properties,geometry:A?$s(R):[]}}function bu(R,A,F,W,te){R.emplaceBack(2*A+(W+1)/2,2*F+(te+1)/2)}class dl{constructor(A){this.zoom=A.zoom,this.overscaling=A.overscaling,this.layers=A.layers,this.layerIds=this.layers.map(F=>F.id),this.index=A.index,this.hasPattern=!1,this.layoutVertexArray=new To,this.indexArray=new se,this.segments=new Ye,this.programConfigurations=new Ms(A.layers,A.zoom),this.stateDependentLayerIds=this.layers.filter(F=>F.isStateDependent()).map(F=>F.id)}populate(A,F,W){let te=this.layers[0],fe=[],pe=null,Re=!1;te.type==="circle"&&(pe=te.layout.get("circle-sort-key"),Re=!pe.isConstant());for(let{feature:Ke,id:ft,index:Rt,sourceLayerIndex:er}of A){let ur=this.layers[0]._featureFilter.needGeometry,vr=Sl(Ke,ur);if(!this.layers[0]._featureFilter.filter(new rs(this.zoom),vr,W))continue;let kr=Re?pe.evaluate(vr,{},W):void 0,Dr={id:ft,properties:Ke.properties,type:Ke.type,sourceLayerIndex:er,index:Rt,geometry:ur?vr.geometry:$s(Ke),patterns:{},sortKey:kr};fe.push(Dr)}Re&&fe.sort((Ke,ft)=>Ke.sortKey-ft.sortKey);for(let Ke of fe){let{geometry:ft,index:Rt,sourceLayerIndex:er}=Ke,ur=A[Rt].feature;this.addFeature(Ke,ft,Rt,W),F.featureIndex.insert(ur,ft,Rt,er,this.index)}}update(A,F,W){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(A,F,this.stateDependentLayers,W)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(A){this.uploaded||(this.layoutVertexBuffer=A.createVertexBuffer(this.layoutVertexArray,Ve),this.indexBuffer=A.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(A),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(A,F,W,te){for(let fe of F)for(let pe of fe){let Re=pe.x,Ke=pe.y;if(Re<0||Re>=ja||Ke<0||Ke>=ja)continue;let ft=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,A.sortKey),Rt=ft.vertexLength;bu(this.layoutVertexArray,Re,Ke,-1,-1),bu(this.layoutVertexArray,Re,Ke,1,-1),bu(this.layoutVertexArray,Re,Ke,1,1),bu(this.layoutVertexArray,Re,Ke,-1,1),this.indexArray.emplaceBack(Rt,Rt+1,Rt+2),this.indexArray.emplaceBack(Rt,Rt+3,Rt+2),ft.vertexLength+=4,ft.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,A,W,{},te)}}function Sc(R,A){for(let F=0;F<R.length;F++)if(Ni(A,R[F]))return!0;for(let F=0;F<A.length;F++)if(Ni(R,A[F]))return!0;return!!Lr(R,A)}function Me(R,A,F){return!!Ni(R,A)||!!Or(A,R,F)}function bt(R,A){if(R.length===1)return vi(A,R[0]);for(let F=0;F<A.length;F++){let W=A[F];for(let te=0;te<W.length;te++)if(Ni(R,W[te]))return!0}for(let F=0;F<R.length;F++)if(vi(A,R[F]))return!0;for(let F=0;F<A.length;F++)if(Lr(R,A[F]))return!0;return!1}function Ot(R,A,F){if(R.length>1){if(Lr(R,A))return!0;for(let W=0;W<A.length;W++)if(Or(A[W],R,F))return!0}for(let W=0;W<R.length;W++)if(Or(R[W],A,F))return!0;return!1}function Lr(R,A){if(R.length===0||A.length===0)return!1;for(let F=0;F<R.length-1;F++){let W=R[F],te=R[F+1];for(let fe=0;fe<A.length-1;fe++)if(Vr(W,te,A[fe],A[fe+1]))return!0}return!1}function Vr(R,A,F,W){return z(R,F,W)!==z(A,F,W)&&z(R,A,F)!==z(R,A,W)}function Or(R,A,F){let W=F*F;if(A.length===1)return R.distSqr(A[0])<W;for(let te=1;te<A.length;te++)if(Nr(R,A[te-1],A[te])<W)return!0;return!1}function Nr(R,A,F){let W=A.distSqr(F);if(W===0)return R.distSqr(A);let te=((R.x-A.x)*(F.x-A.x)+(R.y-A.y)*(F.y-A.y))/W;return R.distSqr(te<0?A:te>1?F:F.sub(A)._mult(te)._add(A))}function vi(R,A){let F,W,te,fe=!1;for(let pe=0;pe<R.length;pe++){F=R[pe];for(let Re=0,Ke=F.length-1;Re<F.length;Ke=Re++)W=F[Re],te=F[Ke],W.y>A.y!=te.y>A.y&&A.x<(te.x-W.x)*(A.y-W.y)/(te.y-W.y)+W.x&&(fe=!fe)}return fe}function Ni(R,A){let F=!1;for(let W=0,te=R.length-1;W<R.length;te=W++){let fe=R[W],pe=R[te];fe.y>A.y!=pe.y>A.y&&A.x<(pe.x-fe.x)*(A.y-fe.y)/(pe.y-fe.y)+fe.x&&(F=!F)}return F}function qi(R,A,F){let W=F[0],te=F[2];if(R.x<W.x&&A.x<W.x||R.x>te.x&&A.x>te.x||R.y<W.y&&A.y<W.y||R.y>te.y&&A.y>te.y)return!1;let fe=z(R,A,F[0]);return fe!==z(R,A,F[1])||fe!==z(R,A,F[2])||fe!==z(R,A,F[3])}function Si(R,A,F){let W=A.paint.get(R).value;return W.kind==="constant"?W.value:F.programConfigurations.get(A.id).getMaxValue(R)}function Vn(R){return Math.sqrt(R[0]*R[0]+R[1]*R[1])}function Qi(R,A,F,W,te){if(!A[0]&&!A[1])return R;let fe=u.convert(A)._mult(te);F==="viewport"&&fe._rotate(-W);let pe=[];for(let Re=0;Re<R.length;Re++)pe.push(R[Re].sub(fe));return pe}let ji,oi;Fi("CircleBucket",dl,{omit:["layers"]});var Tr={get paint(){return oi=oi||new ue({"circle-radius":new oo(ce.paint_circle["circle-radius"]),"circle-color":new oo(ce.paint_circle["circle-color"]),"circle-blur":new oo(ce.paint_circle["circle-blur"]),"circle-opacity":new oo(ce.paint_circle["circle-opacity"]),"circle-translate":new Va(ce.paint_circle["circle-translate"]),"circle-translate-anchor":new Va(ce.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Va(ce.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Va(ce.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new oo(ce.paint_circle["circle-stroke-width"]),"circle-stroke-color":new oo(ce.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new oo(ce.paint_circle["circle-stroke-opacity"])})},get layout(){return ji=ji||new ue({"circle-sort-key":new oo(ce.layout_circle["circle-sort-key"])})}},Zr=1e-6,yi=typeof Float32Array!="undefined"?Float32Array:Array;function Ii(R){return R[0]=1,R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[5]=1,R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[10]=1,R[11]=0,R[12]=0,R[13]=0,R[14]=0,R[15]=1,R}function ui(R,A,F){var W=A[0],te=A[1],fe=A[2],pe=A[3],Re=A[4],Ke=A[5],ft=A[6],Rt=A[7],er=A[8],ur=A[9],vr=A[10],kr=A[11],Dr=A[12],li=A[13],pi=A[14],vn=A[15],zi=F[0],ln=F[1],Tn=F[2],pa=F[3];return R[0]=zi*W+ln*Re+Tn*er+pa*Dr,R[1]=zi*te+ln*Ke+Tn*ur+pa*li,R[2]=zi*fe+ln*ft+Tn*vr+pa*pi,R[3]=zi*pe+ln*Rt+Tn*kr+pa*vn,R[4]=(zi=F[4])*W+(ln=F[5])*Re+(Tn=F[6])*er+(pa=F[7])*Dr,R[5]=zi*te+ln*Ke+Tn*ur+pa*li,R[6]=zi*fe+ln*ft+Tn*vr+pa*pi,R[7]=zi*pe+ln*Rt+Tn*kr+pa*vn,R[8]=(zi=F[8])*W+(ln=F[9])*Re+(Tn=F[10])*er+(pa=F[11])*Dr,R[9]=zi*te+ln*Ke+Tn*ur+pa*li,R[10]=zi*fe+ln*ft+Tn*vr+pa*pi,R[11]=zi*pe+ln*Rt+Tn*kr+pa*vn,R[12]=(zi=F[12])*W+(ln=F[13])*Re+(Tn=F[14])*er+(pa=F[15])*Dr,R[13]=zi*te+ln*Ke+Tn*ur+pa*li,R[14]=zi*fe+ln*ft+Tn*vr+pa*pi,R[15]=zi*pe+ln*Rt+Tn*kr+pa*vn,R}Math.hypot||(Math.hypot=function(){for(var R=0,A=arguments.length;A--;)R+=arguments[A]*arguments[A];return Math.sqrt(R)});var nn,Xi=ui;function qn(R,A,F){var W=A[0],te=A[1],fe=A[2],pe=A[3];return R[0]=F[0]*W+F[4]*te+F[8]*fe+F[12]*pe,R[1]=F[1]*W+F[5]*te+F[9]*fe+F[13]*pe,R[2]=F[2]*W+F[6]*te+F[10]*fe+F[14]*pe,R[3]=F[3]*W+F[7]*te+F[11]*fe+F[15]*pe,R}nn=new yi(4),yi!=Float32Array&&(nn[0]=0,nn[1]=0,nn[2]=0,nn[3]=0);class fi extends B{constructor(A){super(A,Tr)}createBucket(A){return new dl(A)}queryRadius(A){let F=A;return Si("circle-radius",this,F)+Si("circle-stroke-width",this,F)+Vn(this.paint.get("circle-translate"))}queryIntersectsFeature(A,F,W,te,fe,pe,Re,Ke){let ft=Qi(A,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),pe.angle,Re),Rt=this.paint.get("circle-radius").evaluate(F,W)+this.paint.get("circle-stroke-width").evaluate(F,W),er=this.paint.get("circle-pitch-alignment")==="map",ur=er?ft:function(kr,Dr){return kr.map(li=>si(li,Dr))}(ft,Ke),vr=er?Rt*Re:Rt;for(let kr of te)for(let Dr of kr){let li=er?Dr:si(Dr,Ke),pi=vr,vn=qn([],[Dr.x,Dr.y,0,1],Ke);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?pi*=vn[3]/pe.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(pi*=pe.cameraToCenterDistance/vn[3]),Me(ur,li,pi))return!0}return!1}}function si(R,A){let F=qn([],[R.x,R.y,0,1],A);return new u(F[0]/F[3],F[1]/F[3])}class mn extends dl{}let Ji;Fi("HeatmapBucket",mn,{omit:["layers"]});var Ui={get paint(){return Ji=Ji||new ue({"heatmap-radius":new oo(ce.paint_heatmap["heatmap-radius"]),"heatmap-weight":new oo(ce.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Va(ce.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ku(ce.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Va(ce.paint_heatmap["heatmap-opacity"])})}};function Bi(R,{width:A,height:F},W,te){if(te){if(te instanceof Uint8ClampedArray)te=new Uint8Array(te.buffer);else if(te.length!==A*F*W)throw new RangeError(`mismatched image size. expected: ${te.length} but got: ${A*F*W}`)}else te=new Uint8Array(A*F*W);return R.width=A,R.height=F,R.data=te,R}function pn(R,{width:A,height:F},W){if(A===R.width&&F===R.height)return;let te=Bi({},{width:A,height:F},W);Nn(R,te,{x:0,y:0},{x:0,y:0},{width:Math.min(R.width,A),height:Math.min(R.height,F)},W),R.width=A,R.height=F,R.data=te.data}function Nn(R,A,F,W,te,fe){if(te.width===0||te.height===0)return A;if(te.width>R.width||te.height>R.height||F.x>R.width-te.width||F.y>R.height-te.height)throw new RangeError("out of range source coordinates for image copy");if(te.width>A.width||te.height>A.height||W.x>A.width-te.width||W.y>A.height-te.height)throw new RangeError("out of range destination coordinates for image copy");let pe=R.data,Re=A.data;if(pe===Re)throw new Error("srcData equals dstData, so image is already copied");for(let Ke=0;Ke<te.height;Ke++){let ft=((F.y+Ke)*R.width+F.x)*fe,Rt=((W.y+Ke)*A.width+W.x)*fe;for(let er=0;er<te.width*fe;er++)Re[Rt+er]=pe[ft+er]}return A}class aa{constructor(A,F){Bi(this,A,1,F)}resize(A){pn(this,A,1)}clone(){return new aa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(A,F,W,te,fe){Nn(A,F,W,te,fe,1)}}class Ki{constructor(A,F){Bi(this,A,4,F)}resize(A){pn(this,A,4)}replace(A,F){F?this.data.set(A):this.data=A instanceof Uint8ClampedArray?new Uint8Array(A.buffer):A}clone(){return new Ki({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(A,F,W,te,fe){Nn(A,F,W,te,fe,4)}}function Cn(R){let A={},F=R.resolution||256,W=R.clips?R.clips.length:1,te=R.image||new Ki({width:F,height:W});if(Math.log(F)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${F}`);let fe=(pe,Re,Ke)=>{A[R.evaluationKey]=Ke;let ft=R.expression.evaluate(A);te.data[pe+Re+0]=Math.floor(255*ft.r/ft.a),te.data[pe+Re+1]=Math.floor(255*ft.g/ft.a),te.data[pe+Re+2]=Math.floor(255*ft.b/ft.a),te.data[pe+Re+3]=Math.floor(255*ft.a)};if(R.clips)for(let pe=0,Re=0;pe<W;++pe,Re+=4*F)for(let Ke=0,ft=0;Ke<F;Ke++,ft+=4){let Rt=Ke/(F-1),{start:er,end:ur}=R.clips[pe];fe(Re,ft,er*(1-Rt)+ur*Rt)}else for(let pe=0,Re=0;pe<F;pe++,Re+=4)fe(0,Re,pe/(F-1));return te}Fi("AlphaImage",aa),Fi("RGBAImage",Ki);let ia="big-fb";class sa extends B{createBucket(A){return new mn(A)}constructor(A){super(A,Ui),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(A){A==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cn({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(ia)&&this.heatmapFbos.delete(ia)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let ba;var is={get paint(){return ba=ba||new ue({"hillshade-illumination-direction":new Va(ce.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Va(ce.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Va(ce.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Va(ce.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Va(ce.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Va(ce.paint_hillshade["hillshade-accent-color"])})}};class Zs extends B{constructor(A){super(A,is)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let Ga=Fe([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ml}=Ga;function zo(R,A,F=2){let W=A&&A.length,te=W?A[0]*F:R.length,fe=Qs(R,0,te,F,!0),pe=[];if(!fe||fe.next===fe.prev)return pe;let Re,Ke,ft;if(W&&(fe=function(Rt,er,ur,vr){let kr=[];for(let Dr=0,li=er.length;Dr<li;Dr++){let pi=Qs(Rt,er[Dr]*vr,Dr<li-1?er[Dr+1]*vr:Rt.length,vr,!1);pi===pi.next&&(pi.steiner=!0),kr.push(J(pi))}kr.sort(ol);for(let Dr=0;Dr<kr.length;Dr++)ur=io(kr[Dr],ur);return ur}(R,A,fe,F)),R.length>80*F){Re=1/0,Ke=1/0;let Rt=-1/0,er=-1/0;for(let ur=F;ur<te;ur+=F){let vr=R[ur],kr=R[ur+1];vr<Re&&(Re=vr),kr<Ke&&(Ke=kr),vr>Rt&&(Rt=vr),kr>er&&(er=kr)}ft=Math.max(Rt-Re,er-Ke),ft=ft!==0?32767/ft:0}return Vl(fe,pe,F,Re,Ke,ft,0),pe}function Qs(R,A,F,W,te){let fe;if(te===function(pe,Re,Ke,ft){let Rt=0;for(let er=Re,ur=Ke-ft;er<Ke;er+=ft)Rt+=(pe[ur]-pe[er])*(pe[er+1]+pe[ur+1]),ur=er;return Rt}(R,A,F,W)>0)for(let pe=A;pe<F;pe+=W)fe=Nt(pe/W|0,R[pe],R[pe+1],fe);else for(let pe=F-W;pe>=A;pe-=W)fe=Nt(pe/W|0,R[pe],R[pe+1],fe);return fe&&ne(fe,fe.next)&&(Ne(fe),fe=fe.next),fe}function al(R,A){if(!R)return R;A||(A=R);let F,W=R;do if(F=!1,W.steiner||!ne(W,W.next)&&de(W.prev,W,W.next)!==0)W=W.next;else{if(Ne(W),W=A=W.prev,W===W.next)break;F=!0}while(F||W!==A);return A}function Vl(R,A,F,W,te,fe,pe){if(!R)return;!pe&&fe&&function(Ke,ft,Rt,er){let ur=Ke;do ur.z===0&&(ur.z=D(ur.x,ur.y,ft,Rt,er)),ur.prevZ=ur.prev,ur.nextZ=ur.next,ur=ur.next;while(ur!==Ke);ur.prevZ.nextZ=null,ur.prevZ=null,function(vr){let kr,Dr=1;do{let li,pi=vr;vr=null;let vn=null;for(kr=0;pi;){kr++;let zi=pi,ln=0;for(let pa=0;pa<Dr&&(ln++,zi=zi.nextZ,zi);pa++);let Tn=Dr;for(;ln>0||Tn>0&&zi;)ln!==0&&(Tn===0||!zi||pi.z<=zi.z)?(li=pi,pi=pi.nextZ,ln--):(li=zi,zi=zi.nextZ,Tn--),vn?vn.nextZ=li:vr=li,li.prevZ=vn,vn=li;pi=zi}vn.nextZ=null,Dr*=2}while(kr>1)}(ur)}(R,W,te,fe);let Re=R;for(;R.prev!==R.next;){let Ke=R.prev,ft=R.next;if(fe?Vs(R,W,te,fe):ss(R))A.push(Ke.i,R.i,ft.i),Ne(R),R=ft.next,Re=ft.next;else if((R=ft)===Re){pe?pe===1?Vl(R=Ys(al(R),A),A,F,W,te,fe,2):pe===2&&wa(R,A,F,W,te,fe):Vl(al(R),A,F,W,te,fe,1);break}}}function ss(R){let A=R.prev,F=R,W=R.next;if(de(A,F,W)>=0)return!1;let te=A.x,fe=F.x,pe=W.x,Re=A.y,Ke=F.y,ft=W.y,Rt=te<fe?te<pe?te:pe:fe<pe?fe:pe,er=Re<Ke?Re<ft?Re:ft:Ke<ft?Ke:ft,ur=te>fe?te>pe?te:pe:fe>pe?fe:pe,vr=Re>Ke?Re>ft?Re:ft:Ke>ft?Ke:ft,kr=W.next;for(;kr!==A;){if(kr.x>=Rt&&kr.x<=ur&&kr.y>=er&&kr.y<=vr&&O(te,Re,fe,Ke,pe,ft,kr.x,kr.y)&&de(kr.prev,kr,kr.next)>=0)return!1;kr=kr.next}return!0}function Vs(R,A,F,W){let te=R.prev,fe=R,pe=R.next;if(de(te,fe,pe)>=0)return!1;let Re=te.x,Ke=fe.x,ft=pe.x,Rt=te.y,er=fe.y,ur=pe.y,vr=Re<Ke?Re<ft?Re:ft:Ke<ft?Ke:ft,kr=Rt<er?Rt<ur?Rt:ur:er<ur?er:ur,Dr=Re>Ke?Re>ft?Re:ft:Ke>ft?Ke:ft,li=Rt>er?Rt>ur?Rt:ur:er>ur?er:ur,pi=D(vr,kr,A,F,W),vn=D(Dr,li,A,F,W),zi=R.prevZ,ln=R.nextZ;for(;zi&&zi.z>=pi&&ln&&ln.z<=vn;){if(zi.x>=vr&&zi.x<=Dr&&zi.y>=kr&&zi.y<=li&&zi!==te&&zi!==pe&&O(Re,Rt,Ke,er,ft,ur,zi.x,zi.y)&&de(zi.prev,zi,zi.next)>=0||(zi=zi.prevZ,ln.x>=vr&&ln.x<=Dr&&ln.y>=kr&&ln.y<=li&&ln!==te&&ln!==pe&&O(Re,Rt,Ke,er,ft,ur,ln.x,ln.y)&&de(ln.prev,ln,ln.next)>=0))return!1;ln=ln.nextZ}for(;zi&&zi.z>=pi;){if(zi.x>=vr&&zi.x<=Dr&&zi.y>=kr&&zi.y<=li&&zi!==te&&zi!==pe&&O(Re,Rt,Ke,er,ft,ur,zi.x,zi.y)&&de(zi.prev,zi,zi.next)>=0)return!1;zi=zi.prevZ}for(;ln&&ln.z<=vn;){if(ln.x>=vr&&ln.x<=Dr&&ln.y>=kr&&ln.y<=li&&ln!==te&&ln!==pe&&O(Re,Rt,Ke,er,ft,ur,ln.x,ln.y)&&de(ln.prev,ln,ln.next)>=0)return!1;ln=ln.nextZ}return!0}function Ys(R,A){let F=R;do{let W=F.prev,te=F.next.next;!ne(W,te)&&we(W,F,F.next,te)&&Yt(W,te)&&Yt(te,W)&&(A.push(W.i,F.i,te.i),Ne(F),Ne(F.next),F=R=te),F=F.next}while(F!==R);return al(F)}function wa(R,A,F,W,te,fe){let pe=R;do{let Re=pe.next.next;for(;Re!==pe.prev;){if(pe.i!==Re.i&&K(pe,Re)){let Ke=cr(pe,Re);return pe=al(pe,pe.next),Ke=al(Ke,Ke.next),Vl(pe,A,F,W,te,fe,0),void Vl(Ke,A,F,W,te,fe,0)}Re=Re.next}pe=pe.next}while(pe!==R)}function ol(R,A){return R.x-A.x}function io(R,A){let F=function(te,fe){let pe=fe,Re=te.x,Ke=te.y,ft,Rt=-1/0;do{if(Ke<=pe.y&&Ke>=pe.next.y&&pe.next.y!==pe.y){let Dr=pe.x+(Ke-pe.y)*(pe.next.x-pe.x)/(pe.next.y-pe.y);if(Dr<=Re&&Dr>Rt&&(Rt=Dr,ft=pe.x<pe.next.x?pe:pe.next,Dr===Re))return ft}pe=pe.next}while(pe!==fe);if(!ft)return null;let er=ft,ur=ft.x,vr=ft.y,kr=1/0;pe=ft;do{if(Re>=pe.x&&pe.x>=ur&&Re!==pe.x&&O(Ke<vr?Re:Rt,Ke,ur,vr,Ke<vr?Rt:Re,Ke,pe.x,pe.y)){let Dr=Math.abs(Ke-pe.y)/(Re-pe.x);Yt(pe,te)&&(Dr<kr||Dr===kr&&(pe.x>ft.x||pe.x===ft.x&&Y(ft,pe)))&&(ft=pe,kr=Dr)}pe=pe.next}while(pe!==er);return ft}(R,A);if(!F)return A;let W=cr(F,R);return al(W,W.next),al(F,F.next)}function Y(R,A){return de(R.prev,R,A.prev)<0&&de(A.next,R,R.next)<0}function D(R,A,F,W,te){return(R=1431655765&((R=858993459&((R=252645135&((R=16711935&((R=(R-F)*te|0)|R<<8))|R<<4))|R<<2))|R<<1))|(A=1431655765&((A=858993459&((A=252645135&((A=16711935&((A=(A-W)*te|0)|A<<8))|A<<4))|A<<2))|A<<1))<<1}function J(R){let A=R,F=R;do(A.x<F.x||A.x===F.x&&A.y<F.y)&&(F=A),A=A.next;while(A!==R);return F}function O(R,A,F,W,te,fe,pe,Re){return(te-pe)*(A-Re)>=(R-pe)*(fe-Re)&&(R-pe)*(W-Re)>=(F-pe)*(A-Re)&&(F-pe)*(fe-Re)>=(te-pe)*(W-Re)}function K(R,A){return R.next.i!==A.i&&R.prev.i!==A.i&&!function(F,W){let te=F;do{if(te.i!==F.i&&te.next.i!==F.i&&te.i!==W.i&&te.next.i!==W.i&&we(te,te.next,F,W))return!0;te=te.next}while(te!==F);return!1}(R,A)&&(Yt(R,A)&&Yt(A,R)&&function(F,W){let te=F,fe=!1,pe=(F.x+W.x)/2,Re=(F.y+W.y)/2;do te.y>Re!=te.next.y>Re&&te.next.y!==te.y&&pe<(te.next.x-te.x)*(Re-te.y)/(te.next.y-te.y)+te.x&&(fe=!fe),te=te.next;while(te!==F);return fe}(R,A)&&(de(R.prev,R,A.prev)||de(R,A.prev,A))||ne(R,A)&&de(R.prev,R,R.next)>0&&de(A.prev,A,A.next)>0)}function de(R,A,F){return(A.y-R.y)*(F.x-A.x)-(A.x-R.x)*(F.y-A.y)}function ne(R,A){return R.x===A.x&&R.y===A.y}function we(R,A,F,W){let te=ht(de(R,A,F)),fe=ht(de(R,A,W)),pe=ht(de(F,W,R)),Re=ht(de(F,W,A));return te!==fe&&pe!==Re||!(te!==0||!Oe(R,F,A))||!(fe!==0||!Oe(R,W,A))||!(pe!==0||!Oe(F,R,W))||!(Re!==0||!Oe(F,A,W))}function Oe(R,A,F){return A.x<=Math.max(R.x,F.x)&&A.x>=Math.min(R.x,F.x)&&A.y<=Math.max(R.y,F.y)&&A.y>=Math.min(R.y,F.y)}function ht(R){return R>0?1:R<0?-1:0}function Yt(R,A){return de(R.prev,R,R.next)<0?de(R,A,R.next)>=0&&de(R,R.prev,A)>=0:de(R,A,R.prev)<0||de(R,R.next,A)<0}function cr(R,A){let F=$e(R.i,R.x,R.y),W=$e(A.i,A.x,A.y),te=R.next,fe=A.prev;return R.next=A,A.prev=R,F.next=te,te.prev=F,W.next=F,F.prev=W,fe.next=W,W.prev=fe,W}function Nt(R,A,F,W){let te=$e(R,A,F);return W?(te.next=W.next,te.prev=W,W.next.prev=te,W.next=te):(te.prev=te,te.next=te),te}function Ne(R){R.next.prev=R.prev,R.prev.next=R.next,R.prevZ&&(R.prevZ.nextZ=R.nextZ),R.nextZ&&(R.nextZ.prevZ=R.prevZ)}function $e(R,A,F){return{i:R,x:A,y:F,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function st(R,A,F){let W=F.patternDependencies,te=!1;for(let fe of A){let pe=fe.paint.get(`${R}-pattern`);pe.isConstant()||(te=!0);let Re=pe.constantOr(null);Re&&(te=!0,W[Re.to]=!0,W[Re.from]=!0)}return te}function It(R,A,F,W,te){let fe=te.patternDependencies;for(let pe of A){let Re=pe.paint.get(`${R}-pattern`).value;if(Re.kind!=="constant"){let Ke=Re.evaluate({zoom:W-1},F,{},te.availableImages),ft=Re.evaluate({zoom:W},F,{},te.availableImages),Rt=Re.evaluate({zoom:W+1},F,{},te.availableImages);Ke=Ke&&Ke.name?Ke.name:Ke,ft=ft&&ft.name?ft.name:ft,Rt=Rt&&Rt.name?Rt.name:Rt,fe[Ke]=!0,fe[ft]=!0,fe[Rt]=!0,F.patterns[pe.id]={min:Ke,mid:ft,max:Rt}}}return F}class Bt{constructor(A){this.zoom=A.zoom,this.overscaling=A.overscaling,this.layers=A.layers,this.layerIds=this.layers.map(F=>F.id),this.index=A.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new hl,this.indexArray=new se,this.indexArray2=new Te,this.programConfigurations=new Ms(A.layers,A.zoom),this.segments=new Ye,this.segments2=new Ye,this.stateDependentLayerIds=this.layers.filter(F=>F.isStateDependent()).map(F=>F.id)}populate(A,F,W){this.hasPattern=st("fill",this.layers,F);let te=this.layers[0].layout.get("fill-sort-key"),fe=!te.isConstant(),pe=[];for(let{feature:Re,id:Ke,index:ft,sourceLayerIndex:Rt}of A){let er=this.layers[0]._featureFilter.needGeometry,ur=Sl(Re,er);if(!this.layers[0]._featureFilter.filter(new rs(this.zoom),ur,W))continue;let vr=fe?te.evaluate(ur,{},W,F.availableImages):void 0,kr={id:Ke,properties:Re.properties,type:Re.type,sourceLayerIndex:Rt,index:ft,geometry:er?ur.geometry:$s(Re),patterns:{},sortKey:vr};pe.push(kr)}fe&&pe.sort((Re,Ke)=>Re.sortKey-Ke.sortKey);for(let Re of pe){let{geometry:Ke,index:ft,sourceLayerIndex:Rt}=Re;if(this.hasPattern){let er=It("fill",this.layers,Re,this.zoom,F);this.patternFeatures.push(er)}else this.addFeature(Re,Ke,ft,W,{});F.featureIndex.insert(A[ft].feature,Ke,ft,Rt,this.index)}}update(A,F,W){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(A,F,this.stateDependentLayers,W)}addFeatures(A,F,W){for(let te of this.patternFeatures)this.addFeature(te,te.geometry,te.index,F,W)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(A){this.uploaded||(this.layoutVertexBuffer=A.createVertexBuffer(this.layoutVertexArray,Ml),this.indexBuffer=A.createIndexBuffer(this.indexArray),this.indexBuffer2=A.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(A),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(A,F,W,te,fe){for(let pe of Cf(F,500)){let Re=0;for(let vr of pe)Re+=vr.length;let Ke=this.segments.prepareSegment(Re,this.layoutVertexArray,this.indexArray),ft=Ke.vertexLength,Rt=[],er=[];for(let vr of pe){if(vr.length===0)continue;vr!==pe[0]&&er.push(Rt.length/2);let kr=this.segments2.prepareSegment(vr.length,this.layoutVertexArray,this.indexArray2),Dr=kr.vertexLength;this.layoutVertexArray.emplaceBack(vr[0].x,vr[0].y),this.indexArray2.emplaceBack(Dr+vr.length-1,Dr),Rt.push(vr[0].x),Rt.push(vr[0].y);for(let li=1;li<vr.length;li++)this.layoutVertexArray.emplaceBack(vr[li].x,vr[li].y),this.indexArray2.emplaceBack(Dr+li-1,Dr+li),Rt.push(vr[li].x),Rt.push(vr[li].y);kr.vertexLength+=vr.length,kr.primitiveLength+=vr.length}let ur=zo(Rt,er);for(let vr=0;vr<ur.length;vr+=3)this.indexArray.emplaceBack(ft+ur[vr],ft+ur[vr+1],ft+ur[vr+2]);Ke.vertexLength+=Re,Ke.primitiveLength+=ur.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,A,W,fe,te)}}let Ft,Ut;Fi("FillBucket",Bt,{omit:["layers","patternFeatures"]});var zt={get paint(){return Ut=Ut||new ue({"fill-antialias":new Va(ce.paint_fill["fill-antialias"]),"fill-opacity":new oo(ce.paint_fill["fill-opacity"]),"fill-color":new oo(ce.paint_fill["fill-color"]),"fill-outline-color":new oo(ce.paint_fill["fill-outline-color"]),"fill-translate":new Va(ce.paint_fill["fill-translate"]),"fill-translate-anchor":new Va(ce.paint_fill["fill-translate-anchor"]),"fill-pattern":new Vc(ce.paint_fill["fill-pattern"])})},get layout(){return Ft=Ft||new ue({"fill-sort-key":new oo(ce.layout_fill["fill-sort-key"])})}};class _t extends B{constructor(A){super(A,zt)}recalculate(A,F){super.recalculate(A,F);let W=this.paint._values["fill-outline-color"];W.value.kind==="constant"&&W.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(A){return new Bt(A)}queryRadius(){return Vn(this.paint.get("fill-translate"))}queryIntersectsFeature(A,F,W,te,fe,pe,Re){return bt(Qi(A,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),pe.angle,Re),te)}isTileClipped(){return!0}}let Dt=Fe([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),vt=Fe([{name:"a_centroid",components:2,type:"Int16"}],4),{members:lr}=Dt;var _r={},Br=s,Di=ci;function ci(R,A,F,W,te){this.properties={},this.extent=F,this.type=0,this._pbf=R,this._geometry=-1,this._keys=W,this._values=te,R.readFields(bi,this,A)}function bi(R,A,F){R==1?A.id=F.readVarint():R==2?function(W,te){for(var fe=W.readVarint()+W.pos;W.pos<fe;){var pe=te._keys[W.readVarint()],Re=te._values[W.readVarint()];te.properties[pe]=Re}}(F,A):R==3?A.type=F.readVarint():R==4&&(A._geometry=F.pos)}function gn(R){for(var A,F,W=0,te=0,fe=R.length,pe=fe-1;te<fe;pe=te++)W+=((F=R[pe]).x-(A=R[te]).x)*(A.y+F.y);return W}ci.types=["Unknown","Point","LineString","Polygon"],ci.prototype.loadGeometry=function(){var R=this._pbf;R.pos=this._geometry;for(var A,F=R.readVarint()+R.pos,W=1,te=0,fe=0,pe=0,Re=[];R.pos<F;){if(te<=0){var Ke=R.readVarint();W=7&Ke,te=Ke>>3}if(te--,W===1||W===2)fe+=R.readSVarint(),pe+=R.readSVarint(),W===1&&(A&&Re.push(A),A=[]),A.push(new Br(fe,pe));else{if(W!==7)throw new Error("unknown command "+W);A&&A.push(A[0].clone())}}return A&&Re.push(A),Re},ci.prototype.bbox=function(){var R=this._pbf;R.pos=this._geometry;for(var A=R.readVarint()+R.pos,F=1,W=0,te=0,fe=0,pe=1/0,Re=-1/0,Ke=1/0,ft=-1/0;R.pos<A;){if(W<=0){var Rt=R.readVarint();F=7&Rt,W=Rt>>3}if(W--,F===1||F===2)(te+=R.readSVarint())<pe&&(pe=te),te>Re&&(Re=te),(fe+=R.readSVarint())<Ke&&(Ke=fe),fe>ft&&(ft=fe);else if(F!==7)throw new Error("unknown command "+F)}return[pe,Ke,Re,ft]},ci.prototype.toGeoJSON=function(R,A,F){var W,te,fe=this.extent*Math.pow(2,F),pe=this.extent*R,Re=this.extent*A,Ke=this.loadGeometry(),ft=ci.types[this.type];function Rt(vr){for(var kr=0;kr<vr.length;kr++){var Dr=vr[kr];vr[kr]=[360*(Dr.x+pe)/fe-180,360/Math.PI*Math.atan(Math.exp((180-360*(Dr.y+Re)/fe)*Math.PI/180))-90]}}switch(this.type){case 1:var er=[];for(W=0;W<Ke.length;W++)er[W]=Ke[W][0];Rt(Ke=er);break;case 2:for(W=0;W<Ke.length;W++)Rt(Ke[W]);break;case 3:for(Ke=function(vr){var kr=vr.length;if(kr<=1)return[vr];for(var Dr,li,pi=[],vn=0;vn<kr;vn++){var zi=gn(vr[vn]);zi!==0&&(li===void 0&&(li=zi<0),li===zi<0?(Dr&&pi.push(Dr),Dr=[vr[vn]]):Dr.push(vr[vn]))}return Dr&&pi.push(Dr),pi}(Ke),W=0;W<Ke.length;W++)for(te=0;te<Ke[W].length;te++)Rt(Ke[W][te])}Ke.length===1?Ke=Ke[0]:ft="Multi"+ft;var ur={type:"Feature",geometry:{type:ft,coordinates:Ke},properties:this.properties};return"id"in this&&(ur.id=this.id),ur};var tn=Di,Ei=Oi;function Oi(R,A){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=R,this._keys=[],this._values=[],this._features=[],R.readFields(Gi,this,A),this.length=this._features.length}function Gi(R,A,F){R===15?A.version=F.readVarint():R===1?A.name=F.readString():R===5?A.extent=F.readVarint():R===2?A._features.push(F.pos):R===3?A._keys.push(F.readString()):R===4&&A._values.push(function(W){for(var te=null,fe=W.readVarint()+W.pos;W.pos<fe;){var pe=W.readVarint()>>3;te=pe===1?W.readString():pe===2?W.readFloat():pe===3?W.readDouble():pe===4?W.readVarint64():pe===5?W.readVarint():pe===6?W.readSVarint():pe===7?W.readBoolean():null}return te}(F))}Oi.prototype.feature=function(R){if(R<0||R>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[R];var A=this._pbf.readVarint()+this._pbf.pos;return new tn(this._pbf,A,this.extent,this._keys,this._values)};var on=Ei;function zn(R,A,F){if(R===3){var W=new on(F,F.readVarint()+F.pos);W.length&&(A[W.name]=W)}}_r.VectorTile=function(R,A){this.layers=R.readFields(zn,{},A)},_r.VectorTileFeature=Di,_r.VectorTileLayer=Ei;let Ja=_r.VectorTileFeature.types,co=Math.pow(2,13);function ts(R,A,F,W,te,fe,pe,Re){R.emplaceBack(A,F,2*Math.floor(W*co)+pe,te*co*2,fe*co*2,Math.round(Re))}class so{constructor(A){this.zoom=A.zoom,this.overscaling=A.overscaling,this.layers=A.layers,this.layerIds=this.layers.map(F=>F.id),this.index=A.index,this.hasPattern=!1,this.layoutVertexArray=new Ul,this.centroidVertexArray=new wo,this.indexArray=new se,this.programConfigurations=new Ms(A.layers,A.zoom),this.segments=new Ye,this.stateDependentLayerIds=this.layers.filter(F=>F.isStateDependent()).map(F=>F.id)}populate(A,F,W){this.features=[],this.hasPattern=st("fill-extrusion",this.layers,F);for(let{feature:te,id:fe,index:pe,sourceLayerIndex:Re}of A){let Ke=this.layers[0]._featureFilter.needGeometry,ft=Sl(te,Ke);if(!this.layers[0]._featureFilter.filter(new rs(this.zoom),ft,W))continue;let Rt={id:fe,sourceLayerIndex:Re,index:pe,geometry:Ke?ft.geometry:$s(te),properties:te.properties,type:te.type,patterns:{}};this.hasPattern?this.features.push(It("fill-extrusion",this.layers,Rt,this.zoom,F)):this.addFeature(Rt,Rt.geometry,pe,W,{}),F.featureIndex.insert(te,Rt.geometry,pe,Re,this.index,!0)}}addFeatures(A,F,W){for(let te of this.features){let{geometry:fe}=te;this.addFeature(te,fe,te.index,F,W)}}update(A,F,W){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(A,F,this.stateDependentLayers,W)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(A){this.uploaded||(this.layoutVertexBuffer=A.createVertexBuffer(this.layoutVertexArray,lr),this.centroidVertexBuffer=A.createVertexBuffer(this.centroidVertexArray,vt.members,!0),this.indexBuffer=A.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(A),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(A,F,W,te,fe){for(let pe of Cf(F,500)){let Re={x:0,y:0,vertexCount:0},Ke=0;for(let kr of pe)Ke+=kr.length;let ft=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let kr of pe){if(kr.length===0||ms(kr))continue;let Dr=0;for(let li=0;li<kr.length;li++){let pi=kr[li];if(li>=1){let vn=kr[li-1];if(!Yo(pi,vn)){ft.vertexLength+4>Ye.MAX_VERTEX_ARRAY_LENGTH&&(ft=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let zi=pi.sub(vn)._perp()._unit(),ln=vn.dist(pi);Dr+ln>32768&&(Dr=0),ts(this.layoutVertexArray,pi.x,pi.y,zi.x,zi.y,0,0,Dr),ts(this.layoutVertexArray,pi.x,pi.y,zi.x,zi.y,0,1,Dr),Re.x+=2*pi.x,Re.y+=2*pi.y,Re.vertexCount+=2,Dr+=ln,ts(this.layoutVertexArray,vn.x,vn.y,zi.x,zi.y,0,0,Dr),ts(this.layoutVertexArray,vn.x,vn.y,zi.x,zi.y,0,1,Dr),Re.x+=2*vn.x,Re.y+=2*vn.y,Re.vertexCount+=2;let Tn=ft.vertexLength;this.indexArray.emplaceBack(Tn,Tn+2,Tn+1),this.indexArray.emplaceBack(Tn+1,Tn+2,Tn+3),ft.vertexLength+=4,ft.primitiveLength+=2}}}}if(ft.vertexLength+Ke>Ye.MAX_VERTEX_ARRAY_LENGTH&&(ft=this.segments.prepareSegment(Ke,this.layoutVertexArray,this.indexArray)),Ja[A.type]!=="Polygon")continue;let Rt=[],er=[],ur=ft.vertexLength;for(let kr of pe)if(kr.length!==0){kr!==pe[0]&&er.push(Rt.length/2);for(let Dr=0;Dr<kr.length;Dr++){let li=kr[Dr];ts(this.layoutVertexArray,li.x,li.y,0,0,1,1,0),Re.x+=li.x,Re.y+=li.y,Re.vertexCount+=1,Rt.push(li.x),Rt.push(li.y)}}let vr=zo(Rt,er);for(let kr=0;kr<vr.length;kr+=3)this.indexArray.emplaceBack(ur+vr[kr],ur+vr[kr+2],ur+vr[kr+1]);ft.primitiveLength+=vr.length/3,ft.vertexLength+=Ke;for(let kr=0;kr<Re.vertexCount;kr++){let Dr=Math.floor(Re.x/Re.vertexCount),li=Math.floor(Re.y/Re.vertexCount);this.centroidVertexArray.emplaceBack(Dr,li)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,A,W,fe,te)}}function Yo(R,A){return R.x===A.x&&(R.x<0||R.x>ja)||R.y===A.y&&(R.y<0||R.y>ja)}function ms(R){return R.every(A=>A.x<0)||R.every(A=>A.x>ja)||R.every(A=>A.y<0)||R.every(A=>A.y>ja)}let ou;Fi("FillExtrusionBucket",so,{omit:["layers","features"]});var Cv={get paint(){return ou=ou||new ue({"fill-extrusion-opacity":new Va(ce["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new oo(ce["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Va(ce["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Va(ce["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Vc(ce["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new oo(ce["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new oo(ce["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Va(ce["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Lv extends B{constructor(A){super(A,Cv)}createBucket(A){return new so(A)}queryRadius(){return Vn(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(A,F,W,te,fe,pe,Re,Ke){let ft=Qi(A,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),pe.angle,Re),Rt=this.paint.get("fill-extrusion-height").evaluate(F,W),er=this.paint.get("fill-extrusion-base").evaluate(F,W),ur=function(kr,Dr,li,pi){let vn=[];for(let zi of kr){let ln=[zi.x,zi.y,0,1];qn(ln,ln,Dr),vn.push(new u(ln[0]/ln[3],ln[1]/ln[3]))}return vn}(ft,Ke),vr=function(kr,Dr,li,pi){let vn=[],zi=[],ln=pi[8]*Dr,Tn=pi[9]*Dr,pa=pi[10]*Dr,ro=pi[11]*Dr,Vo=pi[8]*li,Xa=pi[9]*li,la=pi[10]*li,Mo=pi[11]*li;for(let fo of kr){let lo=[],Wn=[];for(let Ro of fo){let uo=Ro.x,$o=Ro.y,Ju=pi[0]*uo+pi[4]*$o+pi[12],Ou=pi[1]*uo+pi[5]*$o+pi[13],kh=pi[2]*uo+pi[6]*$o+pi[14],Qv=pi[3]*uo+pi[7]*$o+pi[15],ud=kh+pa,Ch=Qv+ro,Gd=Ju+Vo,Hd=Ou+Xa,jd=kh+la,Af=Qv+Mo,Lh=new u((Ju+ln)/Ch,(Ou+Tn)/Ch);Lh.z=ud/Ch,lo.push(Lh);let Ed=new u(Gd/Af,Hd/Af);Ed.z=jd/Af,Wn.push(Ed)}vn.push(lo),zi.push(Wn)}return[vn,zi]}(te,er,Rt,Ke);return function(kr,Dr,li){let pi=1/0;bt(li,Dr)&&(pi=Kv(li,Dr[0]));for(let vn=0;vn<Dr.length;vn++){let zi=Dr[vn],ln=kr[vn];for(let Tn=0;Tn<zi.length-1;Tn++){let pa=zi[Tn],ro=[pa,zi[Tn+1],ln[Tn+1],ln[Tn],pa];Sc(li,ro)&&(pi=Math.min(pi,Kv(li,ro)))}}return pi!==1/0&&pi}(vr[0],vr[1],ur)}}function wd(R,A){return R.x*A.x+R.y*A.y}function Kv(R,A){if(R.length===1){let F=0,W=A[F++],te;for(;!te||W.equals(te);)if(te=A[F++],!te)return 1/0;for(;F<A.length;F++){let fe=A[F],pe=R[0],Re=te.sub(W),Ke=fe.sub(W),ft=pe.sub(W),Rt=wd(Re,Re),er=wd(Re,Ke),ur=wd(Ke,Ke),vr=wd(ft,Re),kr=wd(ft,Ke),Dr=Rt*ur-er*er,li=(ur*vr-er*kr)/Dr,pi=(Rt*kr-er*vr)/Dr,vn=W.z*(1-li-pi)+te.z*li+fe.z*pi;if(isFinite(vn))return vn}return 1/0}{let F=1/0;for(let W of A)F=Math.min(F,W.z);return F}}let hg=Fe([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:gp}=hg,Td=Fe([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:mp}=Td,Vd=_r.VectorTileFeature.types,Ad=Math.cos(Math.PI/180*37.5),Pv=Math.pow(2,14)/.5;class Jv{constructor(A){this.zoom=A.zoom,this.overscaling=A.overscaling,this.layers=A.layers,this.layerIds=this.layers.map(F=>F.id),this.index=A.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(F=>{this.gradients[F.id]={}}),this.layoutVertexArray=new Lu,this.layoutVertexArray2=new au,this.indexArray=new se,this.programConfigurations=new Ms(A.layers,A.zoom),this.segments=new Ye,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(F=>F.isStateDependent()).map(F=>F.id)}populate(A,F,W){this.hasPattern=st("line",this.layers,F);let te=this.layers[0].layout.get("line-sort-key"),fe=!te.isConstant(),pe=[];for(let{feature:Re,id:Ke,index:ft,sourceLayerIndex:Rt}of A){let er=this.layers[0]._featureFilter.needGeometry,ur=Sl(Re,er);if(!this.layers[0]._featureFilter.filter(new rs(this.zoom),ur,W))continue;let vr=fe?te.evaluate(ur,{},W):void 0,kr={id:Ke,properties:Re.properties,type:Re.type,sourceLayerIndex:Rt,index:ft,geometry:er?ur.geometry:$s(Re),patterns:{},sortKey:vr};pe.push(kr)}fe&&pe.sort((Re,Ke)=>Re.sortKey-Ke.sortKey);for(let Re of pe){let{geometry:Ke,index:ft,sourceLayerIndex:Rt}=Re;if(this.hasPattern){let er=It("line",this.layers,Re,this.zoom,F);this.patternFeatures.push(er)}else this.addFeature(Re,Ke,ft,W,{});F.featureIndex.insert(A[ft].feature,Ke,ft,Rt,this.index)}}update(A,F,W){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(A,F,this.stateDependentLayers,W)}addFeatures(A,F,W){for(let te of this.patternFeatures)this.addFeature(te,te.geometry,te.index,F,W)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(A){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=A.createVertexBuffer(this.layoutVertexArray2,mp)),this.layoutVertexBuffer=A.createVertexBuffer(this.layoutVertexArray,gp),this.indexBuffer=A.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(A),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(A){if(A.properties&&Object.prototype.hasOwnProperty.call(A.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(A.properties,"mapbox_clip_end"))return{start:+A.properties.mapbox_clip_start,end:+A.properties.mapbox_clip_end}}addFeature(A,F,W,te,fe){let pe=this.layers[0].layout,Re=pe.get("line-join").evaluate(A,{}),Ke=pe.get("line-cap"),ft=pe.get("line-miter-limit"),Rt=pe.get("line-round-limit");this.lineClips=this.lineFeatureClips(A);for(let er of F)this.addLine(er,A,Re,Ke,ft,Rt);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,A,W,fe,te)}addLine(A,F,W,te,fe,pe){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let pi=0;pi<A.length-1;pi++)this.totalDistance+=A[pi].dist(A[pi+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let Re=Vd[F.type]==="Polygon",Ke=A.length;for(;Ke>=2&&A[Ke-1].equals(A[Ke-2]);)Ke--;let ft=0;for(;ft<Ke-1&&A[ft].equals(A[ft+1]);)ft++;if(Ke<(Re?3:2))return;W==="bevel"&&(fe=1.05);let Rt=this.overscaling<=16?15*ja/(512*this.overscaling):0,er=this.segments.prepareSegment(10*Ke,this.layoutVertexArray,this.indexArray),ur,vr,kr,Dr,li;this.e1=this.e2=-1,Re&&(ur=A[Ke-2],li=A[ft].sub(ur)._unit()._perp());for(let pi=ft;pi<Ke;pi++){if(kr=pi===Ke-1?Re?A[ft+1]:void 0:A[pi+1],kr&&A[pi].equals(kr))continue;li&&(Dr=li),ur&&(vr=ur),ur=A[pi],li=kr?kr.sub(ur)._unit()._perp():Dr,Dr=Dr||li;let vn=Dr.add(li);vn.x===0&&vn.y===0||vn._unit();let zi=Dr.x*li.x+Dr.y*li.y,ln=vn.x*li.x+vn.y*li.y,Tn=ln!==0?1/ln:1/0,pa=2*Math.sqrt(2-2*ln),ro=ln<Ad&&vr&&kr,Vo=Dr.x*li.y-Dr.y*li.x>0;if(ro&&pi>ft){let Mo=ur.dist(vr);if(Mo>2*Rt){let fo=ur.sub(ur.sub(vr)._mult(Rt/Mo)._round());this.updateDistance(vr,fo),this.addCurrentVertex(fo,Dr,0,0,er),vr=fo}}let Xa=vr&&kr,la=Xa?W:Re?"butt":te;if(Xa&&la==="round"&&(Tn<pe?la="miter":Tn<=2&&(la="fakeround")),la==="miter"&&Tn>fe&&(la="bevel"),la==="bevel"&&(Tn>2&&(la="flipbevel"),Tn<fe&&(la="miter")),vr&&this.updateDistance(vr,ur),la==="miter")vn._mult(Tn),this.addCurrentVertex(ur,vn,0,0,er);else if(la==="flipbevel"){if(Tn>100)vn=li.mult(-1);else{let Mo=Tn*Dr.add(li).mag()/Dr.sub(li).mag();vn._perp()._mult(Mo*(Vo?-1:1))}this.addCurrentVertex(ur,vn,0,0,er),this.addCurrentVertex(ur,vn.mult(-1),0,0,er)}else if(la==="bevel"||la==="fakeround"){let Mo=-Math.sqrt(Tn*Tn-1),fo=Vo?Mo:0,lo=Vo?0:Mo;if(vr&&this.addCurrentVertex(ur,Dr,fo,lo,er),la==="fakeround"){let Wn=Math.round(180*pa/Math.PI/20);for(let Ro=1;Ro<Wn;Ro++){let uo=Ro/Wn;if(uo!==.5){let Ju=uo-.5;uo+=uo*Ju*(uo-1)*((1.0904+zi*(zi*(3.55645-1.43519*zi)-3.2452))*Ju*Ju+(.848013+zi*(.215638*zi-1.06021)))}let $o=li.sub(Dr)._mult(uo)._add(Dr)._unit()._mult(Vo?-1:1);this.addHalfVertex(ur,$o.x,$o.y,!1,Vo,0,er)}}kr&&this.addCurrentVertex(ur,li,-fo,-lo,er)}else if(la==="butt")this.addCurrentVertex(ur,vn,0,0,er);else if(la==="square"){let Mo=vr?1:-1;this.addCurrentVertex(ur,vn,Mo,Mo,er)}else la==="round"&&(vr&&(this.addCurrentVertex(ur,Dr,0,0,er),this.addCurrentVertex(ur,Dr,1,1,er,!0)),kr&&(this.addCurrentVertex(ur,li,-1,-1,er,!0),this.addCurrentVertex(ur,li,0,0,er)));if(ro&&pi<Ke-1){let Mo=ur.dist(kr);if(Mo>2*Rt){let fo=ur.add(kr.sub(ur)._mult(Rt/Mo)._round());this.updateDistance(ur,fo),this.addCurrentVertex(fo,li,0,0,er),ur=fo}}}}addCurrentVertex(A,F,W,te,fe,pe=!1){let Re=F.y*te-F.x,Ke=-F.y-F.x*te;this.addHalfVertex(A,F.x+F.y*W,F.y-F.x*W,pe,!1,W,fe),this.addHalfVertex(A,Re,Ke,pe,!0,-te,fe),this.distance>Pv/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(A,F,W,te,fe,pe))}addHalfVertex({x:A,y:F},W,te,fe,pe,Re,Ke){let ft=.5*(this.lineClips?this.scaledDistance*(Pv-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((A<<1)+(fe?1:0),(F<<1)+(pe?1:0),Math.round(63*W)+128,Math.round(63*te)+128,1+(Re===0?0:Re<0?-1:1)|(63&ft)<<2,ft>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let Rt=Ke.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,Rt),Ke.primitiveLength++),pe?this.e2=Rt:this.e1=Rt}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(A,F){this.distance+=A.dist(F),this.updateScaledDistance()}}let Iv,hy;Fi("LineBucket",Jv,{omit:["layers","patternFeatures"]});var dg={get paint(){return hy=hy||new ue({"line-opacity":new oo(ce.paint_line["line-opacity"]),"line-color":new oo(ce.paint_line["line-color"]),"line-translate":new Va(ce.paint_line["line-translate"]),"line-translate-anchor":new Va(ce.paint_line["line-translate-anchor"]),"line-width":new oo(ce.paint_line["line-width"]),"line-gap-width":new oo(ce.paint_line["line-gap-width"]),"line-offset":new oo(ce.paint_line["line-offset"]),"line-blur":new oo(ce.paint_line["line-blur"]),"line-dasharray":new hc(ce.paint_line["line-dasharray"]),"line-pattern":new Vc(ce.paint_line["line-pattern"]),"line-gradient":new Ku(ce.paint_line["line-gradient"])})},get layout(){return Iv=Iv||new ue({"line-cap":new Va(ce.layout_line["line-cap"]),"line-join":new oo(ce.layout_line["line-join"]),"line-miter-limit":new Va(ce.layout_line["line-miter-limit"]),"line-round-limit":new Va(ce.layout_line["line-round-limit"]),"line-sort-key":new oo(ce.layout_line["line-sort-key"])})}};class oh extends oo{possiblyEvaluate(A,F){return F=new rs(Math.floor(F.zoom),{now:F.now,fadeDuration:F.fadeDuration,zoomHistory:F.zoomHistory,transition:F.transition}),super.possiblyEvaluate(A,F)}evaluate(A,F,W,te){return F=L({},F,{zoom:Math.floor(F.zoom)}),super.evaluate(A,F,W,te)}}let vg;class dy extends B{constructor(A){super(A,dg),this.gradientVersion=0,vg||(vg=new oh(dg.paint.properties["line-width"].specification),vg.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(A){if(A==="line-gradient"){let F=this.gradientExpression();this.stepInterpolant=!!function(W){return W._styleExpression!==void 0}(F)&&F._styleExpression.expression instanceof _n,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(A,F){super.recalculate(A,F),this.paint._values["line-floorwidth"]=vg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,A)}createBucket(A){return new Jv(A)}queryRadius(A){let F=A,W=Zh(Si("line-width",this,F),Si("line-gap-width",this,F)),te=Si("line-offset",this,F);return W/2+Math.abs(te)+Vn(this.paint.get("line-translate"))}queryIntersectsFeature(A,F,W,te,fe,pe,Re){let Ke=Qi(A,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),pe.angle,Re),ft=Re/2*Zh(this.paint.get("line-width").evaluate(F,W),this.paint.get("line-gap-width").evaluate(F,W)),Rt=this.paint.get("line-offset").evaluate(F,W);return Rt&&(te=function(er,ur){let vr=[];for(let kr=0;kr<er.length;kr++){let Dr=er[kr],li=[];for(let pi=0;pi<Dr.length;pi++){let vn=Dr[pi-1],zi=Dr[pi],ln=Dr[pi+1],Tn=pi===0?new u(0,0):zi.sub(vn)._unit()._perp(),pa=pi===Dr.length-1?new u(0,0):ln.sub(zi)._unit()._perp(),ro=Tn._add(pa)._unit(),Vo=ro.x*pa.x+ro.y*pa.y;Vo!==0&&ro._mult(1/Vo),li.push(ro._mult(ur)._add(zi))}vr.push(li)}return vr}(te,Rt*Re)),function(er,ur,vr){for(let kr=0;kr<ur.length;kr++){let Dr=ur[kr];if(er.length>=3){for(let li=0;li<Dr.length;li++)if(Ni(er,Dr[li]))return!0}if(Ot(er,Dr,vr))return!0}return!1}(Ke,te,ft)}isTileClipped(){return!0}}function Zh(R,A){return A>0?A+2*R:R}let am=Fe([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),k1=Fe([{name:"a_projected_pos",components:3,type:"Float32"}],4);Fe([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let C1=Fe([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Fe([{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"}]);let vy=Fe([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),om=Fe([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function sm(R,A,F){return R.sections.forEach(W=>{W.text=function(te,fe,pe){let Re=fe.layout.get("text-transform").evaluate(pe,{});return Re==="uppercase"?te=te.toLocaleUpperCase():Re==="lowercase"&&(te=te.toLocaleLowerCase()),ys.applyArabicShaping&&(te=ys.applyArabicShaping(te)),te}(W.text,A,F)}),R}Fe([{name:"triangle",components:3,type:"Uint16"}]),Fe([{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"},{type:"Int16",name:"associatedIconIndex"}]),Fe([{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:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{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:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Fe([{type:"Float32",name:"offsetX"}]),Fe([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Fe([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let vc={"!":"\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"};var tu=24,Sd=wu,py=function(R,A,F,W,te){var fe,pe,Re=8*te-W-1,Ke=(1<<Re)-1,ft=Ke>>1,Rt=-7,er=F?te-1:0,ur=F?-1:1,vr=R[A+er];for(er+=ur,fe=vr&(1<<-Rt)-1,vr>>=-Rt,Rt+=Re;Rt>0;fe=256*fe+R[A+er],er+=ur,Rt-=8);for(pe=fe&(1<<-Rt)-1,fe>>=-Rt,Rt+=W;Rt>0;pe=256*pe+R[A+er],er+=ur,Rt-=8);if(fe===0)fe=1-ft;else{if(fe===Ke)return pe?NaN:1/0*(vr?-1:1);pe+=Math.pow(2,W),fe-=ft}return(vr?-1:1)*pe*Math.pow(2,fe-W)},L1=function(R,A,F,W,te,fe){var pe,Re,Ke,ft=8*fe-te-1,Rt=(1<<ft)-1,er=Rt>>1,ur=te===23?Math.pow(2,-24)-Math.pow(2,-77):0,vr=W?0:fe-1,kr=W?1:-1,Dr=A<0||A===0&&1/A<0?1:0;for(A=Math.abs(A),isNaN(A)||A===1/0?(Re=isNaN(A)?1:0,pe=Rt):(pe=Math.floor(Math.log(A)/Math.LN2),A*(Ke=Math.pow(2,-pe))<1&&(pe--,Ke*=2),(A+=pe+er>=1?ur/Ke:ur*Math.pow(2,1-er))*Ke>=2&&(pe++,Ke/=2),pe+er>=Rt?(Re=0,pe=Rt):pe+er>=1?(Re=(A*Ke-1)*Math.pow(2,te),pe+=er):(Re=A*Math.pow(2,er-1)*Math.pow(2,te),pe=0));te>=8;R[F+vr]=255&Re,vr+=kr,Re/=256,te-=8);for(pe=pe<<te|Re,ft+=te;ft>0;R[F+vr]=255&pe,vr+=kr,pe/=256,ft-=8);R[F+vr-kr]|=128*Dr};function wu(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}wu.Varint=0,wu.Fixed64=1,wu.Bytes=2,wu.Fixed32=5;var Kx=4294967296,lm=1/Kx,Bw=typeof TextDecoder=="undefined"?null:new TextDecoder("utf-8");function Rv(R){return R.type===wu.Bytes?R.readVarint()+R.pos:R.pos+1}function um(R,A,F){return F?4294967296*A+(R>>>0):4294967296*(A>>>0)+(R>>>0)}function Nw(R,A,F){var W=A<=16383?1:A<=2097151?2:A<=268435455?3:Math.floor(Math.log(A)/(7*Math.LN2));F.realloc(W);for(var te=F.pos-1;te>=R;te--)F.buf[te+W]=F.buf[te]}function Jx(R,A){for(var F=0;F<R.length;F++)A.writeVarint(R[F])}function H9(R,A){for(var F=0;F<R.length;F++)A.writeSVarint(R[F])}function j9(R,A){for(var F=0;F<R.length;F++)A.writeFloat(R[F])}function W9(R,A){for(var F=0;F<R.length;F++)A.writeDouble(R[F])}function X9(R,A){for(var F=0;F<R.length;F++)A.writeBoolean(R[F])}function OQ(R,A){for(var F=0;F<R.length;F++)A.writeFixed32(R[F])}function Z9(R,A){for(var F=0;F<R.length;F++)A.writeSFixed32(R[F])}function Y9(R,A){for(var F=0;F<R.length;F++)A.writeFixed64(R[F])}function K9(R,A){for(var F=0;F<R.length;F++)A.writeSFixed64(R[F])}function gy(R,A){return(R[A]|R[A+1]<<8|R[A+2]<<16)+16777216*R[A+3]}function $x(R,A,F){R[F]=A,R[F+1]=A>>>8,R[F+2]=A>>>16,R[F+3]=A>>>24}function MC(R,A){return(R[A]|R[A+1]<<8|R[A+2]<<16)+(R[A+3]<<24)}wu.prototype={destroy:function(){this.buf=null},readFields:function(R,A,F){for(F=F||this.length;this.pos<F;){var W=this.readVarint(),te=W>>3,fe=this.pos;this.type=7&W,R(te,A,this),this.pos===fe&&this.skip(W)}return A},readMessage:function(R,A){return this.readFields(R,A,this.readVarint()+this.pos)},readFixed32:function(){var R=gy(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=MC(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=gy(this.buf,this.pos)+gy(this.buf,this.pos+4)*Kx;return this.pos+=8,R},readSFixed64:function(){var R=gy(this.buf,this.pos)+MC(this.buf,this.pos+4)*Kx;return this.pos+=8,R},readFloat:function(){var R=py(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=py(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var A,F,W=this.buf;return A=127&(F=W[this.pos++]),F<128?A:(A|=(127&(F=W[this.pos++]))<<7,F<128?A:(A|=(127&(F=W[this.pos++]))<<14,F<128?A:(A|=(127&(F=W[this.pos++]))<<21,F<128?A:function(te,fe,pe){var Re,Ke,ft=pe.buf;if(Re=(112&(Ke=ft[pe.pos++]))>>4,Ke<128||(Re|=(127&(Ke=ft[pe.pos++]))<<3,Ke<128)||(Re|=(127&(Ke=ft[pe.pos++]))<<10,Ke<128)||(Re|=(127&(Ke=ft[pe.pos++]))<<17,Ke<128)||(Re|=(127&(Ke=ft[pe.pos++]))<<24,Ke<128)||(Re|=(1&(Ke=ft[pe.pos++]))<<31,Ke<128))return um(te,Re,fe);throw new Error("Expected varint not more than 10 bytes")}(A|=(15&(F=W[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,A=this.pos;return this.pos=R,R-A>=12&&Bw?function(F,W,te){return Bw.decode(F.subarray(W,te))}(this.buf,A,R):function(F,W,te){for(var fe="",pe=W;pe<te;){var Re,Ke,ft,Rt=F[pe],er=null,ur=Rt>239?4:Rt>223?3:Rt>191?2:1;if(pe+ur>te)break;ur===1?Rt<128&&(er=Rt):ur===2?(192&(Re=F[pe+1]))==128&&(er=(31&Rt)<<6|63&Re)<=127&&(er=null):ur===3?(Ke=F[pe+2],(192&(Re=F[pe+1]))==128&&(192&Ke)==128&&((er=(15&Rt)<<12|(63&Re)<<6|63&Ke)<=2047||er>=55296&&er<=57343)&&(er=null)):ur===4&&(Ke=F[pe+2],ft=F[pe+3],(192&(Re=F[pe+1]))==128&&(192&Ke)==128&&(192&ft)==128&&((er=(15&Rt)<<18|(63&Re)<<12|(63&Ke)<<6|63&ft)<=65535||er>=1114112)&&(er=null)),er===null?(er=65533,ur=1):er>65535&&(er-=65536,fe+=String.fromCharCode(er>>>10&1023|55296),er=56320|1023&er),fe+=String.fromCharCode(er),pe+=ur}return fe}(this.buf,A,R)},readBytes:function(){var R=this.readVarint()+this.pos,A=this.buf.subarray(this.pos,R);return this.pos=R,A},readPackedVarint:function(R,A){if(this.type!==wu.Bytes)return R.push(this.readVarint(A));var F=Rv(this);for(R=R||[];this.pos<F;)R.push(this.readVarint(A));return R},readPackedSVarint:function(R){if(this.type!==wu.Bytes)return R.push(this.readSVarint());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==wu.Bytes)return R.push(this.readBoolean());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==wu.Bytes)return R.push(this.readFloat());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==wu.Bytes)return R.push(this.readDouble());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==wu.Bytes)return R.push(this.readFixed32());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==wu.Bytes)return R.push(this.readSFixed32());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==wu.Bytes)return R.push(this.readFixed64());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==wu.Bytes)return R.push(this.readSFixed64());var A=Rv(this);for(R=R||[];this.pos<A;)R.push(this.readSFixed64());return R},skip:function(R){var A=7&R;if(A===wu.Varint)for(;this.buf[this.pos++]>127;);else if(A===wu.Bytes)this.pos=this.readVarint()+this.pos;else if(A===wu.Fixed32)this.pos+=4;else{if(A!==wu.Fixed64)throw new Error("Unimplemented type: "+A);this.pos+=8}},writeTag:function(R,A){this.writeVarint(R<<3|A)},realloc:function(R){for(var A=this.length||16;A<this.pos+R;)A*=2;if(A!==this.length){var F=new Uint8Array(A);F.set(this.buf),this.buf=F,this.length=A}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),$x(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),$x(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),$x(this.buf,-1&R,this.pos),$x(this.buf,Math.floor(R*lm),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),$x(this.buf,-1&R,this.pos),$x(this.buf,Math.floor(R*lm),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(A,F){var W,te;if(A>=0?(W=A%4294967296|0,te=A/4294967296|0):(te=~(-A/4294967296),4294967295^(W=~(-A%4294967296))?W=W+1|0:(W=0,te=te+1|0)),A>=18446744073709552e3||A<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");F.realloc(10),function(fe,pe,Re){Re.buf[Re.pos++]=127&fe|128,fe>>>=7,Re.buf[Re.pos++]=127&fe|128,fe>>>=7,Re.buf[Re.pos++]=127&fe|128,fe>>>=7,Re.buf[Re.pos++]=127&fe|128,Re.buf[Re.pos]=127&(fe>>>=7)}(W,0,F),function(fe,pe){var Re=(7&fe)<<4;pe.buf[pe.pos++]|=Re|((fe>>>=3)?128:0),fe&&(pe.buf[pe.pos++]=127&fe|((fe>>>=7)?128:0),fe&&(pe.buf[pe.pos++]=127&fe|((fe>>>=7)?128:0),fe&&(pe.buf[pe.pos++]=127&fe|((fe>>>=7)?128:0),fe&&(pe.buf[pe.pos++]=127&fe|((fe>>>=7)?128:0),fe&&(pe.buf[pe.pos++]=127&fe)))))}(te,F)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var A=this.pos;this.pos=function(W,te,fe){for(var pe,Re,Ke=0;Ke<te.length;Ke++){if((pe=te.charCodeAt(Ke))>55295&&pe<57344){if(!Re){pe>56319||Ke+1===te.length?(W[fe++]=239,W[fe++]=191,W[fe++]=189):Re=pe;continue}if(pe<56320){W[fe++]=239,W[fe++]=191,W[fe++]=189,Re=pe;continue}pe=Re-55296<<10|pe-56320|65536,Re=null}else Re&&(W[fe++]=239,W[fe++]=191,W[fe++]=189,Re=null);pe<128?W[fe++]=pe:(pe<2048?W[fe++]=pe>>6|192:(pe<65536?W[fe++]=pe>>12|224:(W[fe++]=pe>>18|240,W[fe++]=pe>>12&63|128),W[fe++]=pe>>6&63|128),W[fe++]=63&pe|128)}return fe}(this.buf,R,this.pos);var F=this.pos-A;F>=128&&Nw(A,F,this),this.pos=A-1,this.writeVarint(F),this.pos+=F},writeFloat:function(R){this.realloc(4),L1(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),L1(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var A=R.length;this.writeVarint(A),this.realloc(A);for(var F=0;F<A;F++)this.buf[this.pos++]=R[F]},writeRawMessage:function(R,A){this.pos++;var F=this.pos;R(A,this);var W=this.pos-F;W>=128&&Nw(F,W,this),this.pos=F-1,this.writeVarint(W),this.pos+=W},writeMessage:function(R,A,F){this.writeTag(R,wu.Bytes),this.writeRawMessage(A,F)},writePackedVarint:function(R,A){A.length&&this.writeMessage(R,Jx,A)},writePackedSVarint:function(R,A){A.length&&this.writeMessage(R,H9,A)},writePackedBoolean:function(R,A){A.length&&this.writeMessage(R,X9,A)},writePackedFloat:function(R,A){A.length&&this.writeMessage(R,j9,A)},writePackedDouble:function(R,A){A.length&&this.writeMessage(R,W9,A)},writePackedFixed32:function(R,A){A.length&&this.writeMessage(R,OQ,A)},writePackedSFixed32:function(R,A){A.length&&this.writeMessage(R,Z9,A)},writePackedFixed64:function(R,A){A.length&&this.writeMessage(R,Y9,A)},writePackedSFixed64:function(R,A){A.length&&this.writeMessage(R,K9,A)},writeBytesField:function(R,A){this.writeTag(R,wu.Bytes),this.writeBytes(A)},writeFixed32Field:function(R,A){this.writeTag(R,wu.Fixed32),this.writeFixed32(A)},writeSFixed32Field:function(R,A){this.writeTag(R,wu.Fixed32),this.writeSFixed32(A)},writeFixed64Field:function(R,A){this.writeTag(R,wu.Fixed64),this.writeFixed64(A)},writeSFixed64Field:function(R,A){this.writeTag(R,wu.Fixed64),this.writeSFixed64(A)},writeVarintField:function(R,A){this.writeTag(R,wu.Varint),this.writeVarint(A)},writeSVarintField:function(R,A){this.writeTag(R,wu.Varint),this.writeSVarint(A)},writeStringField:function(R,A){this.writeTag(R,wu.Bytes),this.writeString(A)},writeFloatField:function(R,A){this.writeTag(R,wu.Fixed32),this.writeFloat(A)},writeDoubleField:function(R,A){this.writeTag(R,wu.Fixed64),this.writeDouble(A)},writeBooleanField:function(R,A){this.writeVarintField(R,!!A)}};var uS=o(Sd);let cS=3;function BQ(R,A,F){R===1&&F.readMessage(J9,A)}function J9(R,A,F){if(R===3){let{id:W,bitmap:te,width:fe,height:pe,left:Re,top:Ke,advance:ft}=F.readMessage(EC,{});A.push({id:W,bitmap:new aa({width:fe+2*cS,height:pe+2*cS},te),metrics:{width:fe,height:pe,left:Re,top:Ke,advance:ft}})}}function EC(R,A,F){R===1?A.id=F.readVarint():R===2?A.bitmap=F.readBytes():R===3?A.width=F.readVarint():R===4?A.height=F.readVarint():R===5?A.left=F.readSVarint():R===6?A.top=F.readSVarint():R===7&&(A.advance=F.readVarint())}let kC=cS;function fS(R){let A=0,F=0;for(let pe of R)A+=pe.w*pe.h,F=Math.max(F,pe.w);R.sort((pe,Re)=>Re.h-pe.h);let W=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(A/.95)),F),h:1/0}],te=0,fe=0;for(let pe of R)for(let Re=W.length-1;Re>=0;Re--){let Ke=W[Re];if(!(pe.w>Ke.w||pe.h>Ke.h)){if(pe.x=Ke.x,pe.y=Ke.y,fe=Math.max(fe,pe.y+pe.h),te=Math.max(te,pe.x+pe.w),pe.w===Ke.w&&pe.h===Ke.h){let ft=W.pop();Re<W.length&&(W[Re]=ft)}else pe.h===Ke.h?(Ke.x+=pe.w,Ke.w-=pe.w):pe.w===Ke.w?(Ke.y+=pe.h,Ke.h-=pe.h):(W.push({x:Ke.x+pe.w,y:Ke.y,w:Ke.w-pe.w,h:pe.h}),Ke.y+=pe.h,Ke.h-=pe.h);break}}return{w:te,h:fe,fill:A/(te*fe)||0}}let Md=1;class Uw{constructor(A,{pixelRatio:F,version:W,stretchX:te,stretchY:fe,content:pe,textFitWidth:Re,textFitHeight:Ke}){this.paddedRect=A,this.pixelRatio=F,this.stretchX=te,this.stretchY=fe,this.content=pe,this.version=W,this.textFitWidth=Re,this.textFitHeight=Ke}get tl(){return[this.paddedRect.x+Md,this.paddedRect.y+Md]}get br(){return[this.paddedRect.x+this.paddedRect.w-Md,this.paddedRect.y+this.paddedRect.h-Md]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Md)/this.pixelRatio,(this.paddedRect.h-2*Md)/this.pixelRatio]}}class Vw{constructor(A,F){let W={},te={};this.haveRenderCallbacks=[];let fe=[];this.addImages(A,W,fe),this.addImages(F,te,fe);let{w:pe,h:Re}=fS(fe),Ke=new Ki({width:pe||1,height:Re||1});for(let ft in A){let Rt=A[ft],er=W[ft].paddedRect;Ki.copy(Rt.data,Ke,{x:0,y:0},{x:er.x+Md,y:er.y+Md},Rt.data)}for(let ft in F){let Rt=F[ft],er=te[ft].paddedRect,ur=er.x+Md,vr=er.y+Md,kr=Rt.data.width,Dr=Rt.data.height;Ki.copy(Rt.data,Ke,{x:0,y:0},{x:ur,y:vr},Rt.data),Ki.copy(Rt.data,Ke,{x:0,y:Dr-1},{x:ur,y:vr-1},{width:kr,height:1}),Ki.copy(Rt.data,Ke,{x:0,y:0},{x:ur,y:vr+Dr},{width:kr,height:1}),Ki.copy(Rt.data,Ke,{x:kr-1,y:0},{x:ur-1,y:vr},{width:1,height:Dr}),Ki.copy(Rt.data,Ke,{x:0,y:0},{x:ur+kr,y:vr},{width:1,height:Dr})}this.image=Ke,this.iconPositions=W,this.patternPositions=te}addImages(A,F,W){for(let te in A){let fe=A[te],pe={x:0,y:0,w:fe.data.width+2*Md,h:fe.data.height+2*Md};W.push(pe),F[te]=new Uw(pe,fe),fe.hasRenderCallback&&this.haveRenderCallbacks.push(te)}}patchUpdatedImages(A,F){A.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let W in A.updatedImages)this.patchUpdatedImage(this.iconPositions[W],A.getImage(W),F),this.patchUpdatedImage(this.patternPositions[W],A.getImage(W),F)}patchUpdatedImage(A,F,W){if(!A||!F||A.version===F.version)return;A.version=F.version;let[te,fe]=A.tl;W.update(F.data,void 0,{x:te,y:fe})}}var Dv;Fi("ImagePosition",Uw),Fi("ImageAtlas",Vw),i.ah=void 0,(Dv=i.ah||(i.ah={}))[Dv.none=0]="none",Dv[Dv.horizontal=1]="horizontal",Dv[Dv.vertical=2]="vertical",Dv[Dv.horizontalOnly=3]="horizontalOnly";let Eh=-17;class Qx{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(A,F){let W=new Qx;return W.scale=A||1,W.fontStack=F,W}static forImage(A){let F=new Qx;return F.imageName=A,F}}class P1{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(A,F){let W=new P1;for(let te=0;te<A.sections.length;te++){let fe=A.sections[te];fe.image?W.addImageSection(fe):W.addTextSection(fe,F)}return W}length(){return this.text.length}getSection(A){return this.sections[this.sectionIndex[A]]}getSectionIndex(A){return this.sectionIndex[A]}getCharCode(A){return this.text.charCodeAt(A)}verticalizePunctuation(){this.text=function(A){let F="";for(let W=0;W<A.length;W++){let te=A.charCodeAt(W+1)||null,fe=A.charCodeAt(W-1)||null;F+=te&&ml(te)&&!vc[A[W+1]]||fe&&ml(fe)&&!vc[A[W-1]]||!vc[A[W]]?A[W]:vc[A[W]]}return F}(this.text)}trim(){let A=0;for(let W=0;W<this.text.length&&Gw[this.text.charCodeAt(W)];W++)A++;let F=this.text.length;for(let W=this.text.length-1;W>=0&&W>=A&&Gw[this.text.charCodeAt(W)];W--)F--;this.text=this.text.substring(A,F),this.sectionIndex=this.sectionIndex.slice(A,F)}substring(A,F){let W=new P1;return W.text=this.text.substring(A,F),W.sectionIndex=this.sectionIndex.slice(A,F),W.sections=this.sections,W}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((A,F)=>Math.max(A,this.sections[F].scale),0)}addTextSection(A,F){this.text+=A.text,this.sections.push(Qx.forText(A.scale,A.fontStack||F));let W=this.sections.length-1;for(let te=0;te<A.text.length;++te)this.sectionIndex.push(W)}addImageSection(A){let F=A.image?A.image.name:"";if(F.length===0)return void E("Can't add FormattedSection with an empty image.");let W=this.getNextImageSectionCharCode();W?(this.text+=String.fromCharCode(W),this.sections.push(Qx.forImage(F)),this.sectionIndex.push(this.sections.length-1)):E("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function eb(R,A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr){let Dr=P1.fromFeature(R,te),li;er===i.ah.vertical&&Dr.verticalizePunctuation();let{processBidirectionalText:pi,processStyledBidirectionalText:vn}=ys;if(pi&&Dr.sections.length===1){li=[];let Tn=pi(Dr.toString(),I1(Dr,ft,fe,A,W,vr));for(let pa of Tn){let ro=new P1;ro.text=pa,ro.sections=Dr.sections;for(let Vo=0;Vo<pa.length;Vo++)ro.sectionIndex.push(0);li.push(ro)}}else if(vn){li=[];let Tn=vn(Dr.text,Dr.sectionIndex,I1(Dr,ft,fe,A,W,vr));for(let pa of Tn){let ro=new P1;ro.text=pa[0],ro.sectionIndex=pa[1],ro.sections=Dr.sections,li.push(ro)}}else li=function(Tn,pa){let ro=[],Vo=Tn.text,Xa=0;for(let la of pa)ro.push(Tn.substring(Xa,la)),Xa=la;return Xa<Vo.length&&ro.push(Tn.substring(Xa,Vo.length)),ro}(Dr,I1(Dr,ft,fe,A,W,vr));let zi=[],ln={positionedLines:zi,text:Dr.toString(),top:Rt[1],bottom:Rt[1],left:Rt[0],right:Rt[0],writingMode:er,iconsInText:!1,verticalizable:!1};return function(Tn,pa,ro,Vo,Xa,la,Mo,fo,lo,Wn,Ro,uo){let $o=0,Ju=Eh,Ou=0,kh=0,Qv=fo==="right"?1:fo==="left"?0:.5,ud=0;for(let Af of Xa){Af.trim();let Lh=Af.getMaxScale(),Ed=(Lh-1)*tu,cd={positionedGlyphs:[],lineOffset:0};Tn.positionedLines[ud]=cd;let Yh=cd.positionedGlyphs,Df=0;if(!Af.length()){Ju+=la,++ud;continue}for(let uv=0;uv<Af.length();uv++){let ru=Af.getSection(uv),pc=Af.getSectionIndex(uv),$u=Af.getCharCode(uv),zv=0,hf=null,O1=null,p0=null,Gp=tu,ep=!(lo===i.ah.horizontal||!Ro&&!Ho($u)||Ro&&(Gw[$u]||(Ch=$u,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(Ch)))));if(ru.imageName){let Gc=Vo[ru.imageName];if(!Gc)continue;p0=ru.imageName,Tn.iconsInText=Tn.iconsInText||!0,O1=Gc.paddedRect;let Yf=Gc.displaySize;ru.scale=ru.scale*tu/uo,hf={width:Yf[0],height:Yf[1],left:Md,top:-kC,advance:ep?Yf[1]:Yf[0]},zv=Ed+(tu-Yf[1]*ru.scale),Gp=hf.advance;let tp=ep?Yf[0]*ru.scale-tu*Lh:Yf[1]*ru.scale-tu*Lh;tp>0&&tp>Df&&(Df=tp)}else{let Gc=ro[ru.fontStack],Yf=Gc&&Gc[$u];if(Yf&&Yf.rect)O1=Yf.rect,hf=Yf.metrics;else{let tp=pa[ru.fontStack],yg=tp&&tp[$u];if(!yg)continue;hf=yg.metrics}zv=(Lh-ru.scale)*tu}ep?(Tn.verticalizable=!0,Yh.push({glyph:$u,imageName:p0,x:$o,y:Ju+zv,vertical:ep,scale:ru.scale,fontStack:ru.fontStack,sectionIndex:pc,metrics:hf,rect:O1}),$o+=Gp*ru.scale+Wn):(Yh.push({glyph:$u,imageName:p0,x:$o,y:Ju+zv,vertical:ep,scale:ru.scale,fontStack:ru.fontStack,sectionIndex:pc,metrics:hf,rect:O1}),$o+=hf.advance*ru.scale+Wn)}Yh.length!==0&&(Ou=Math.max($o-Wn,Ou),cm(Yh,0,Yh.length-1,Qv,Df)),$o=0;let Fv=la*Lh+Df;cd.lineOffset=Math.max(Df,Ed),Ju+=Fv,kh=Math.max(Fv,kh),++ud}var Ch;let Gd=Ju-Eh,{horizontalAlign:Hd,verticalAlign:jd}=jw(Mo);(function(Af,Lh,Ed,cd,Yh,Df,Fv,uv,ru){let pc=(Lh-Ed)*Yh,$u=0;$u=Df!==Fv?-uv*cd-Eh:(-cd*ru+.5)*Fv;for(let zv of Af)for(let hf of zv.positionedGlyphs)hf.x+=pc,hf.y+=$u})(Tn.positionedLines,Qv,Hd,jd,Ou,kh,la,Gd,Xa.length),Tn.top+=-jd*Gd,Tn.bottom=Tn.top+Gd,Tn.left+=-Hd*Ou,Tn.right=Tn.left+Ou}(ln,A,F,W,li,pe,Re,Ke,er,ft,ur,kr),!function(Tn){for(let pa of Tn)if(pa.positionedGlyphs.length!==0)return!1;return!0}(zi)&&ln}let Gw={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},$9={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Q9={40:!0};function CC(R,A,F,W,te,fe){if(A.imageName){let pe=W[A.imageName];return pe?pe.displaySize[0]*A.scale*tu/fe+te:0}{let pe=F[A.fontStack],Re=pe&&pe[R];return Re?Re.metrics.advance*A.scale+te:0}}function LC(R,A,F,W){let te=Math.pow(R-A,2);return W?R<A?te/2:2*te:te+Math.abs(F)*F}function eq(R,A,F){let W=0;return R===10&&(W-=1e4),F&&(W+=150),R!==40&&R!==65288||(W+=50),A!==41&&A!==65289||(W+=50),W}function Hw(R,A,F,W,te,fe){let pe=null,Re=LC(A,F,te,fe);for(let Ke of W){let ft=LC(A-Ke.x,F,te,fe)+Ke.badness;ft<=Re&&(pe=Ke,Re=ft)}return{index:R,x:A,priorBreak:pe,badness:Re}}function PC(R){return R?PC(R.priorBreak).concat(R.index):[]}function I1(R,A,F,W,te,fe){if(!R)return[];let pe=[],Re=function(er,ur,vr,kr,Dr,li){let pi=0;for(let vn=0;vn<er.length();vn++){let zi=er.getSection(vn);pi+=CC(er.getCharCode(vn),zi,kr,Dr,ur,li)}return pi/Math.max(1,Math.ceil(pi/vr))}(R,A,F,W,te,fe),Ke=R.text.indexOf("\u200B")>=0,ft=0;for(let er=0;er<R.length();er++){let ur=R.getSection(er),vr=R.getCharCode(er);if(Gw[vr]||(ft+=CC(vr,ur,W,te,A,fe)),er<R.length()-1){let kr=!((Rt=vr)<11904)&&(!!Dn["CJK Compatibility Forms"](Rt)||!!Dn["CJK Compatibility"](Rt)||!!Dn["CJK Strokes"](Rt)||!!Dn["CJK Symbols and Punctuation"](Rt)||!!Dn["Enclosed CJK Letters and Months"](Rt)||!!Dn["Halfwidth and Fullwidth Forms"](Rt)||!!Dn["Ideographic Description Characters"](Rt)||!!Dn["Vertical Forms"](Rt)||ws.test(String.fromCodePoint(Rt)));($9[vr]||kr||ur.imageName||er!==R.length()-2&&Q9[R.getCharCode(er+1)])&&pe.push(Hw(er+1,ft,Re,pe,eq(vr,R.getCharCode(er+1),kr&&Ke),!1))}}var Rt;return PC(Hw(R.length(),ft,Re,pe,0,!0))}function jw(R){let A=.5,F=.5;switch(R){case"right":case"top-right":case"bottom-right":A=1;break;case"left":case"top-left":case"bottom-left":A=0}switch(R){case"bottom":case"bottom-right":case"bottom-left":F=1;break;case"top":case"top-right":case"top-left":F=0}return{horizontalAlign:A,verticalAlign:F}}function cm(R,A,F,W,te){if(!W&&!te)return;let fe=R[F],pe=(R[F].x+fe.metrics.advance*fe.scale)*W;for(let Re=A;Re<=F;Re++)R[Re].x-=pe,R[Re].y+=te}function tb(R,A,F){let{horizontalAlign:W,verticalAlign:te}=jw(F),fe=A[0]-R.displaySize[0]*W,pe=A[1]-R.displaySize[1]*te;return{image:R,top:pe,bottom:pe+R.displaySize[1],left:fe,right:fe+R.displaySize[0]}}function IC(R){var A,F;let W=R.left,te=R.top,fe=R.right-W,pe=R.bottom-te,Re=(A=R.image.textFitWidth)!==null&&A!==void 0?A:"stretchOrShrink",Ke=(F=R.image.textFitHeight)!==null&&F!==void 0?F:"stretchOrShrink",ft=(R.image.content[2]-R.image.content[0])/(R.image.content[3]-R.image.content[1]);if(Ke==="proportional"){if(Re==="stretchOnly"&&fe/pe<ft||Re==="proportional"){let Rt=Math.ceil(pe*ft);W*=Rt/fe,fe=Rt}}else if(Re==="proportional"&&Ke==="stretchOnly"&&ft!==0&&fe/pe>ft){let Rt=Math.ceil(fe/ft);te*=Rt/pe,pe=Rt}return{x1:W,y1:te,x2:W+fe,y2:te+pe}}function RC(R,A,F,W,te,fe){let pe=R.image,Re;if(pe.content){let li=pe.content,pi=pe.pixelRatio||1;Re=[li[0]/pi,li[1]/pi,pe.displaySize[0]-li[2]/pi,pe.displaySize[1]-li[3]/pi]}let Ke=A.left*fe,ft=A.right*fe,Rt,er,ur,vr;F==="width"||F==="both"?(vr=te[0]+Ke-W[3],er=te[0]+ft+W[1]):(vr=te[0]+(Ke+ft-pe.displaySize[0])/2,er=vr+pe.displaySize[0]);let kr=A.top*fe,Dr=A.bottom*fe;return F==="height"||F==="both"?(Rt=te[1]+kr-W[0],ur=te[1]+Dr+W[2]):(Rt=te[1]+(kr+Dr-pe.displaySize[1])/2,ur=Rt+pe.displaySize[1]),{image:pe,top:Rt,right:er,bottom:ur,left:vr,collisionPadding:Re}}let rb=255,v0=128,fm=rb*v0;function DC(R,A){let{expression:F}=A;if(F.kind==="constant")return{kind:"constant",layoutSize:F.evaluate(new rs(R+1))};if(F.kind==="source")return{kind:"source"};{let{zoomStops:W,interpolationType:te}=F,fe=0;for(;fe<W.length&&W[fe]<=R;)fe++;fe=Math.max(0,fe-1);let pe=fe;for(;pe<W.length&&W[pe]<R+1;)pe++;pe=Math.min(W.length-1,pe);let Re=W[fe],Ke=W[pe];return F.kind==="composite"?{kind:"composite",minZoom:Re,maxZoom:Ke,interpolationType:te}:{kind:"camera",minZoom:Re,maxZoom:Ke,minSize:F.evaluate(new rs(Re)),maxSize:F.evaluate(new rs(Ke)),interpolationType:te}}}function hS(R,A,F){let W="never",te=R.get(A);return te?W=te:R.get(F)&&(W="always"),W}let tq=_r.VectorTileFeature.types,rq=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ww(R,A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur){let vr=Re?Math.min(fm,Math.round(Re[0])):0,kr=Re?Math.min(fm,Math.round(Re[1])):0;R.emplaceBack(A,F,Math.round(32*W),Math.round(32*te),fe,pe,(vr<<1)+(Ke?1:0),kr,16*ft,16*Rt,256*er,256*ur)}function dS(R,A,F){R.emplaceBack(A.x,A.y,F),R.emplaceBack(A.x,A.y,F),R.emplaceBack(A.x,A.y,F),R.emplaceBack(A.x,A.y,F)}function vS(R){for(let A of R.sections)if(no(A.text))return!0;return!1}class pS{constructor(A){this.layoutVertexArray=new eu,this.indexArray=new se,this.programConfigurations=A,this.segments=new Ye,this.dynamicLayoutVertexArray=new dc,this.opacityVertexArray=new Tl,this.hasVisibleVertices=!1,this.placedSymbolArray=new Aa}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(A,F,W,te){this.isEmpty()||(W&&(this.layoutVertexBuffer=A.createVertexBuffer(this.layoutVertexArray,am.members),this.indexBuffer=A.createIndexBuffer(this.indexArray,F),this.dynamicLayoutVertexBuffer=A.createVertexBuffer(this.dynamicLayoutVertexArray,k1.members,!0),this.opacityVertexBuffer=A.createVertexBuffer(this.opacityVertexArray,rq,!0),this.opacityVertexBuffer.itemSize=1),(W||te)&&this.programConfigurations.upload(A))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Fi("SymbolBuffers",pS);class hm{constructor(A,F,W){this.layoutVertexArray=new A,this.layoutAttributes=F,this.indexArray=new W,this.segments=new Ye,this.collisionVertexArray=new X}upload(A){this.layoutVertexBuffer=A.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=A.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=A.createVertexBuffer(this.collisionVertexArray,C1.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fi("CollisionBuffers",hm);class R1{constructor(A){this.collisionBoxArray=A.collisionBoxArray,this.zoom=A.zoom,this.overscaling=A.overscaling,this.layers=A.layers,this.layerIds=this.layers.map(pe=>pe.id),this.index=A.index,this.pixelRatio=A.pixelRatio,this.sourceLayerIndex=A.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ii([]),this.placementViewportMatrix=Ii([]);let F=this.layers[0]._unevaluatedLayout._values;this.textSizeData=DC(this.zoom,F["text-size"]),this.iconSizeData=DC(this.zoom,F["icon-size"]);let W=this.layers[0].layout,te=W.get("symbol-sort-key"),fe=W.get("symbol-z-order");this.canOverlap=hS(W,"text-overlap","text-allow-overlap")!=="never"||hS(W,"icon-overlap","icon-allow-overlap")!=="never"||W.get("text-ignore-placement")||W.get("icon-ignore-placement"),this.sortFeaturesByKey=fe!=="viewport-y"&&!te.isConstant(),this.sortFeaturesByY=(fe==="viewport-y"||fe==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,W.get("symbol-placement")==="point"&&(this.writingModes=W.get("text-writing-mode").map(pe=>i.ah[pe])),this.stateDependentLayerIds=this.layers.filter(pe=>pe.isStateDependent()).map(pe=>pe.id),this.sourceID=A.sourceID}createArrays(){this.text=new pS(new Ms(this.layers,this.zoom,A=>/^text/.test(A))),this.icon=new pS(new Ms(this.layers,this.zoom,A=>/^icon/.test(A))),this.glyphOffsetArray=new Co,this.lineVertexArray=new Qa,this.symbolInstances=new $a,this.textAnchorOffsets=new Bo}calculateGlyphDependencies(A,F,W,te,fe){for(let pe=0;pe<A.length;pe++)if(F[A.charCodeAt(pe)]=!0,(W||te)&&fe){let Re=vc[A.charAt(pe)];Re&&(F[Re.charCodeAt(0)]=!0)}}populate(A,F,W){let te=this.layers[0],fe=te.layout,pe=fe.get("text-font"),Re=fe.get("text-field"),Ke=fe.get("icon-image"),ft=(Re.value.kind!=="constant"||Re.value.value instanceof ti&&!Re.value.value.isEmpty()||Re.value.value.toString().length>0)&&(pe.value.kind!=="constant"||pe.value.value.length>0),Rt=Ke.value.kind!=="constant"||!!Ke.value.value||Object.keys(Ke.parameters).length>0,er=fe.get("symbol-sort-key");if(this.features=[],!ft&&!Rt)return;let ur=F.iconDependencies,vr=F.glyphDependencies,kr=F.availableImages,Dr=new rs(this.zoom);for(let{feature:li,id:pi,index:vn,sourceLayerIndex:zi}of A){let ln=te._featureFilter.needGeometry,Tn=Sl(li,ln);if(!te._featureFilter.filter(Dr,Tn,W))continue;let pa,ro;if(ln||(Tn.geometry=$s(li)),ft){let Xa=te.getValueAndResolveTokens("text-field",Tn,W,kr),la=ti.factory(Xa),Mo=this.hasRTLText=this.hasRTLText||vS(la);(!Mo||ys.getRTLTextPluginStatus()==="unavailable"||Mo&&ys.isParsed())&&(pa=sm(la,te,Tn))}if(Rt){let Xa=te.getValueAndResolveTokens("icon-image",Tn,W,kr);ro=Xa instanceof en?Xa:en.fromString(Xa)}if(!pa&&!ro)continue;let Vo=this.sortFeaturesByKey?er.evaluate(Tn,{},W):void 0;if(this.features.push({id:pi,text:pa,icon:ro,index:vn,sourceLayerIndex:zi,geometry:Tn.geometry,properties:li.properties,type:tq[li.type],sortKey:Vo}),ro&&(ur[ro.name]=!0),pa){let Xa=pe.evaluate(Tn,{},W).join(","),la=fe.get("text-rotation-alignment")!=="viewport"&&fe.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(i.ah.vertical)>=0;for(let Mo of pa.sections)if(Mo.image)ur[Mo.image.name]=!0;else{let fo=Ka(pa.toString()),lo=Mo.fontStack||Xa,Wn=vr[lo]=vr[lo]||{};this.calculateGlyphDependencies(Mo.text,Wn,la,this.allowVerticalPlacement,fo)}}}fe.get("symbol-placement")==="line"&&(this.features=function(li){let pi={},vn={},zi=[],ln=0;function Tn(Xa){zi.push(li[Xa]),ln++}function pa(Xa,la,Mo){let fo=vn[Xa];return delete vn[Xa],vn[la]=fo,zi[fo].geometry[0].pop(),zi[fo].geometry[0]=zi[fo].geometry[0].concat(Mo[0]),fo}function ro(Xa,la,Mo){let fo=pi[la];return delete pi[la],pi[Xa]=fo,zi[fo].geometry[0].shift(),zi[fo].geometry[0]=Mo[0].concat(zi[fo].geometry[0]),fo}function Vo(Xa,la,Mo){let fo=Mo?la[0][la[0].length-1]:la[0][0];return`${Xa}:${fo.x}:${fo.y}`}for(let Xa=0;Xa<li.length;Xa++){let la=li[Xa],Mo=la.geometry,fo=la.text?la.text.toString():null;if(!fo){Tn(Xa);continue}let lo=Vo(fo,Mo),Wn=Vo(fo,Mo,!0);if(lo in vn&&Wn in pi&&vn[lo]!==pi[Wn]){let Ro=ro(lo,Wn,Mo),uo=pa(lo,Wn,zi[Ro].geometry);delete pi[lo],delete vn[Wn],vn[Vo(fo,zi[uo].geometry,!0)]=uo,zi[Ro].geometry=null}else lo in vn?pa(lo,Wn,Mo):Wn in pi?ro(lo,Wn,Mo):(Tn(Xa),pi[lo]=ln-1,vn[Wn]=ln-1)}return zi.filter(Xa=>Xa.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((li,pi)=>li.sortKey-pi.sortKey)}update(A,F,W){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(A,F,this.layers,W),this.icon.programConfigurations.updatePaintArrays(A,F,this.layers,W))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(A){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(A),this.iconCollisionBox.upload(A)),this.text.upload(A,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(A,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(A,F){let W=this.lineVertexArray.length;if(A.segment!==void 0){let te=A.dist(F[A.segment+1]),fe=A.dist(F[A.segment]),pe={};for(let Re=A.segment+1;Re<F.length;Re++)pe[Re]={x:F[Re].x,y:F[Re].y,tileUnitDistanceFromAnchor:te},Re<F.length-1&&(te+=F[Re+1].dist(F[Re]));for(let Re=A.segment||0;Re>=0;Re--)pe[Re]={x:F[Re].x,y:F[Re].y,tileUnitDistanceFromAnchor:fe},Re>0&&(fe+=F[Re-1].dist(F[Re]));for(let Re=0;Re<F.length;Re++){let Ke=pe[Re];this.lineVertexArray.emplaceBack(Ke.x,Ke.y,Ke.tileUnitDistanceFromAnchor)}}return{lineStartIndex:W,lineLength:this.lineVertexArray.length-W}}addSymbols(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur){let vr=A.indexArray,kr=A.layoutVertexArray,Dr=A.segments.prepareSegment(4*F.length,kr,vr,this.canOverlap?pe.sortKey:void 0),li=this.glyphOffsetArray.length,pi=Dr.vertexLength,vn=this.allowVerticalPlacement&&Re===i.ah.vertical?Math.PI/2:0,zi=pe.text&&pe.text.sections;for(let ln=0;ln<F.length;ln++){let{tl:Tn,tr:pa,bl:ro,br:Vo,tex:Xa,pixelOffsetTL:la,pixelOffsetBR:Mo,minFontScaleX:fo,minFontScaleY:lo,glyphOffset:Wn,isSDF:Ro,sectionIndex:uo}=F[ln],$o=Dr.vertexLength,Ju=Wn[1];Ww(kr,Ke.x,Ke.y,Tn.x,Ju+Tn.y,Xa.x,Xa.y,W,Ro,la.x,la.y,fo,lo),Ww(kr,Ke.x,Ke.y,pa.x,Ju+pa.y,Xa.x+Xa.w,Xa.y,W,Ro,Mo.x,la.y,fo,lo),Ww(kr,Ke.x,Ke.y,ro.x,Ju+ro.y,Xa.x,Xa.y+Xa.h,W,Ro,la.x,Mo.y,fo,lo),Ww(kr,Ke.x,Ke.y,Vo.x,Ju+Vo.y,Xa.x+Xa.w,Xa.y+Xa.h,W,Ro,Mo.x,Mo.y,fo,lo),dS(A.dynamicLayoutVertexArray,Ke,vn),vr.emplaceBack($o,$o+1,$o+2),vr.emplaceBack($o+1,$o+2,$o+3),Dr.vertexLength+=4,Dr.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Wn[0]),ln!==F.length-1&&uo===F[ln+1].sectionIndex||A.programConfigurations.populatePaintArrays(kr.length,pe,pe.index,{},ur,zi&&zi[uo])}A.placedSymbolArray.emplaceBack(Ke.x,Ke.y,li,this.glyphOffsetArray.length-li,pi,ft,Rt,Ke.segment,W?W[0]:0,W?W[1]:0,te[0],te[1],Re,0,!1,0,er)}_addCollisionDebugVertex(A,F,W,te,fe,pe){return F.emplaceBack(0,0),A.emplaceBack(W.x,W.y,te,fe,Math.round(pe.x),Math.round(pe.y))}addCollisionDebugVertices(A,F,W,te,fe,pe,Re){let Ke=fe.segments.prepareSegment(4,fe.layoutVertexArray,fe.indexArray),ft=Ke.vertexLength,Rt=fe.layoutVertexArray,er=fe.collisionVertexArray,ur=Re.anchorX,vr=Re.anchorY;this._addCollisionDebugVertex(Rt,er,pe,ur,vr,new u(A,F)),this._addCollisionDebugVertex(Rt,er,pe,ur,vr,new u(W,F)),this._addCollisionDebugVertex(Rt,er,pe,ur,vr,new u(W,te)),this._addCollisionDebugVertex(Rt,er,pe,ur,vr,new u(A,te)),Ke.vertexLength+=4;let kr=fe.indexArray;kr.emplaceBack(ft,ft+1),kr.emplaceBack(ft+1,ft+2),kr.emplaceBack(ft+2,ft+3),kr.emplaceBack(ft+3,ft),Ke.primitiveLength+=4}addDebugCollisionBoxes(A,F,W,te){for(let fe=A;fe<F;fe++){let pe=this.collisionBoxArray.get(fe);this.addCollisionDebugVertices(pe.x1,pe.y1,pe.x2,pe.y2,te?this.textCollisionBox:this.iconCollisionBox,pe.anchorPoint,W)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new hm(Al,vy.members,Te),this.iconCollisionBox=new hm(Al,vy.members,Te);for(let A=0;A<this.symbolInstances.length;A++){let F=this.symbolInstances.get(A);this.addDebugCollisionBoxes(F.textBoxStartIndex,F.textBoxEndIndex,F,!0),this.addDebugCollisionBoxes(F.verticalTextBoxStartIndex,F.verticalTextBoxEndIndex,F,!0),this.addDebugCollisionBoxes(F.iconBoxStartIndex,F.iconBoxEndIndex,F,!1),this.addDebugCollisionBoxes(F.verticalIconBoxStartIndex,F.verticalIconBoxEndIndex,F,!1)}}_deserializeCollisionBoxesForSymbol(A,F,W,te,fe,pe,Re,Ke,ft){let Rt={};for(let er=F;er<W;er++){let ur=A.get(er);Rt.textBox={x1:ur.x1,y1:ur.y1,x2:ur.x2,y2:ur.y2,anchorPointX:ur.anchorPointX,anchorPointY:ur.anchorPointY},Rt.textFeatureIndex=ur.featureIndex;break}for(let er=te;er<fe;er++){let ur=A.get(er);Rt.verticalTextBox={x1:ur.x1,y1:ur.y1,x2:ur.x2,y2:ur.y2,anchorPointX:ur.anchorPointX,anchorPointY:ur.anchorPointY},Rt.verticalTextFeatureIndex=ur.featureIndex;break}for(let er=pe;er<Re;er++){let ur=A.get(er);Rt.iconBox={x1:ur.x1,y1:ur.y1,x2:ur.x2,y2:ur.y2,anchorPointX:ur.anchorPointX,anchorPointY:ur.anchorPointY},Rt.iconFeatureIndex=ur.featureIndex;break}for(let er=Ke;er<ft;er++){let ur=A.get(er);Rt.verticalIconBox={x1:ur.x1,y1:ur.y1,x2:ur.x2,y2:ur.y2,anchorPointX:ur.anchorPointX,anchorPointY:ur.anchorPointY},Rt.verticalIconFeatureIndex=ur.featureIndex;break}return Rt}deserializeCollisionBoxes(A){this.collisionArrays=[];for(let F=0;F<this.symbolInstances.length;F++){let W=this.symbolInstances.get(F);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(A,W.textBoxStartIndex,W.textBoxEndIndex,W.verticalTextBoxStartIndex,W.verticalTextBoxEndIndex,W.iconBoxStartIndex,W.iconBoxEndIndex,W.verticalIconBoxStartIndex,W.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(A,F){let W=A.placedSymbolArray.get(F),te=W.vertexStartIndex+4*W.numGlyphs;for(let fe=W.vertexStartIndex;fe<te;fe+=4)A.indexArray.emplaceBack(fe,fe+1,fe+2),A.indexArray.emplaceBack(fe+1,fe+2,fe+3)}getSortedSymbolIndexes(A){if(this.sortedAngle===A&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let F=Math.sin(A),W=Math.cos(A),te=[],fe=[],pe=[];for(let Re=0;Re<this.symbolInstances.length;++Re){pe.push(Re);let Ke=this.symbolInstances.get(Re);te.push(0|Math.round(F*Ke.anchorX+W*Ke.anchorY)),fe.push(Ke.featureIndex)}return pe.sort((Re,Ke)=>te[Re]-te[Ke]||fe[Ke]-fe[Re]),pe}addToSortKeyRanges(A,F){let W=this.sortKeyRanges[this.sortKeyRanges.length-1];W&&W.sortKey===F?W.symbolInstanceEnd=A+1:this.sortKeyRanges.push({sortKey:F,symbolInstanceStart:A,symbolInstanceEnd:A+1})}sortFeatures(A){if(this.sortFeaturesByY&&this.sortedAngle!==A&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(A),this.sortedAngle=A,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let F of this.symbolInstanceIndexes){let W=this.symbolInstances.get(F);this.featureSortOrder.push(W.featureIndex),[W.rightJustifiedTextSymbolIndex,W.centerJustifiedTextSymbolIndex,W.leftJustifiedTextSymbolIndex].forEach((te,fe,pe)=>{te>=0&&pe.indexOf(te)===fe&&this.addIndicesForPlacedSymbol(this.text,te)}),W.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,W.verticalPlacedTextSymbolIndex),W.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,W.placedIconSymbolIndex),W.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,W.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Tf,ib;Fi("SymbolBucket",R1,{omit:["layers","collisionBoxArray","features","compareText"]}),R1.MAX_GLYPHS=65535,R1.addDynamicAttributes=dS;var Xw={get paint(){return ib=ib||new ue({"icon-opacity":new oo(ce.paint_symbol["icon-opacity"]),"icon-color":new oo(ce.paint_symbol["icon-color"]),"icon-halo-color":new oo(ce.paint_symbol["icon-halo-color"]),"icon-halo-width":new oo(ce.paint_symbol["icon-halo-width"]),"icon-halo-blur":new oo(ce.paint_symbol["icon-halo-blur"]),"icon-translate":new Va(ce.paint_symbol["icon-translate"]),"icon-translate-anchor":new Va(ce.paint_symbol["icon-translate-anchor"]),"text-opacity":new oo(ce.paint_symbol["text-opacity"]),"text-color":new oo(ce.paint_symbol["text-color"],{runtimeType:jt,getOverride:R=>R.textColor,hasOverride:R=>!!R.textColor}),"text-halo-color":new oo(ce.paint_symbol["text-halo-color"]),"text-halo-width":new oo(ce.paint_symbol["text-halo-width"]),"text-halo-blur":new oo(ce.paint_symbol["text-halo-blur"]),"text-translate":new Va(ce.paint_symbol["text-translate"]),"text-translate-anchor":new Va(ce.paint_symbol["text-translate-anchor"])})},get layout(){return Tf=Tf||new ue({"symbol-placement":new Va(ce.layout_symbol["symbol-placement"]),"symbol-spacing":new Va(ce.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Va(ce.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new oo(ce.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Va(ce.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Va(ce.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Va(ce.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Va(ce.layout_symbol["icon-ignore-placement"]),"icon-optional":new Va(ce.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Va(ce.layout_symbol["icon-rotation-alignment"]),"icon-size":new oo(ce.layout_symbol["icon-size"]),"icon-text-fit":new Va(ce.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Va(ce.layout_symbol["icon-text-fit-padding"]),"icon-image":new oo(ce.layout_symbol["icon-image"]),"icon-rotate":new oo(ce.layout_symbol["icon-rotate"]),"icon-padding":new oo(ce.layout_symbol["icon-padding"]),"icon-keep-upright":new Va(ce.layout_symbol["icon-keep-upright"]),"icon-offset":new oo(ce.layout_symbol["icon-offset"]),"icon-anchor":new oo(ce.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Va(ce.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Va(ce.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Va(ce.layout_symbol["text-rotation-alignment"]),"text-field":new oo(ce.layout_symbol["text-field"]),"text-font":new oo(ce.layout_symbol["text-font"]),"text-size":new oo(ce.layout_symbol["text-size"]),"text-max-width":new oo(ce.layout_symbol["text-max-width"]),"text-line-height":new Va(ce.layout_symbol["text-line-height"]),"text-letter-spacing":new oo(ce.layout_symbol["text-letter-spacing"]),"text-justify":new oo(ce.layout_symbol["text-justify"]),"text-radial-offset":new oo(ce.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Va(ce.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new oo(ce.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new oo(ce.layout_symbol["text-anchor"]),"text-max-angle":new Va(ce.layout_symbol["text-max-angle"]),"text-writing-mode":new Va(ce.layout_symbol["text-writing-mode"]),"text-rotate":new oo(ce.layout_symbol["text-rotate"]),"text-padding":new Va(ce.layout_symbol["text-padding"]),"text-keep-upright":new Va(ce.layout_symbol["text-keep-upright"]),"text-transform":new oo(ce.layout_symbol["text-transform"]),"text-offset":new oo(ce.layout_symbol["text-offset"]),"text-allow-overlap":new Va(ce.layout_symbol["text-allow-overlap"]),"text-overlap":new Va(ce.layout_symbol["text-overlap"]),"text-ignore-placement":new Va(ce.layout_symbol["text-ignore-placement"]),"text-optional":new Va(ce.layout_symbol["text-optional"])})}};class nb{constructor(A){if(A.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=A.property.overrides?A.property.overrides.runtimeType:Tt,this.defaultValue=A}evaluate(A){if(A.formattedSection){let F=this.defaultValue.property.overrides;if(F&&F.hasOverride(A.formattedSection))return F.getOverride(A.formattedSection)}return A.feature&&A.featureState?this.defaultValue.evaluate(A.feature,A.featureState):this.defaultValue.property.specification.default}eachChild(A){this.defaultValue.isConstant()||A(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Fi("FormatSectionOverride",nb,{omit:["defaultValue"]});class my extends B{constructor(A){super(A,Xw)}recalculate(A,F){if(super.recalculate(A,F),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let W=this.layout.get("text-writing-mode");if(W){let te=[];for(let fe of W)te.indexOf(fe)<0&&te.push(fe);this.layout._values["text-writing-mode"]=te}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(A,F,W,te){let fe=this.layout.get(A).evaluate(F,{},W,te),pe=this._unevaluatedLayout._values[A];return pe.isDataDriven()||Dc(pe.value)||!fe?fe:function(Re,Ke){return Ke.replace(/{([^{}]+)}/g,(ft,Rt)=>Re&&Rt in Re?String(Re[Rt]):"")}(F.properties,fe)}createBucket(A){return new R1(A)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let A of Xw.paint.overridableProperties){if(!my.hasPaintOverride(this.layout,A))continue;let F=this.paint.get(A),W=new nb(F),te=new Eu(W,F.property.specification),fe=null;fe=F.value.kind==="constant"||F.value.kind==="source"?new bc("source",te):new hu("composite",te,F.value.zoomStops),this.paint._values[A]=new xu(F.property,fe,F.parameters)}}_handleOverridablePaintPropertyUpdate(A,F,W){return!(!this.layout||F.isDataDriven()||W.isDataDriven())&&my.hasPaintOverride(this.layout,A)}static hasPaintOverride(A,F){let W=A.get("text-field"),te=Xw.paint.properties[F],fe=!1,pe=Re=>{for(let Ke of Re)if(te.overrides&&te.overrides.hasOverride(Ke))return void(fe=!0)};if(W.value.kind==="constant"&&W.value.value instanceof ti)pe(W.value.value.sections);else if(W.value.kind==="source"){let Re=ft=>{fe||(ft instanceof ua&&Mn(ft.value)===ei?pe(ft.value.sections):ft instanceof Yl?pe(ft.sections):ft.eachChild(Re))},Ke=W.value;Ke._styleExpression&&Re(Ke._styleExpression.expression)}return fe}}let FC;var ab={get paint(){return FC=FC||new ue({"background-color":new Va(ce.paint_background["background-color"]),"background-pattern":new hc(ce.paint_background["background-pattern"]),"background-opacity":new Va(ce.paint_background["background-opacity"])})}};class iq extends B{constructor(A){super(A,ab)}}let gS;var zC={get paint(){return gS=gS||new ue({"raster-opacity":new Va(ce.paint_raster["raster-opacity"]),"raster-hue-rotate":new Va(ce.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Va(ce.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Va(ce.paint_raster["raster-brightness-max"]),"raster-saturation":new Va(ce.paint_raster["raster-saturation"]),"raster-contrast":new Va(ce.paint_raster["raster-contrast"]),"raster-resampling":new Va(ce.paint_raster["raster-resampling"]),"raster-fade-duration":new Va(ce.paint_raster["raster-fade-duration"])})}};class ob extends B{constructor(A){super(A,zC)}}class mS extends B{constructor(A){super(A,{}),this.onAdd=F=>{this.implementation.onAdd&&this.implementation.onAdd(F,F.painter.context.gl)},this.onRemove=F=>{this.implementation.onRemove&&this.implementation.onRemove(F,F.painter.context.gl)},this.implementation=A}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class yS{constructor(A){this._methodToThrottle=A,this._triggered=!1,typeof MessageChannel!="undefined"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let _S=63710088e-1;class pg{constructor(A,F){if(isNaN(A)||isNaN(F))throw new Error(`Invalid LngLat object: (${A}, ${F})`);if(this.lng=+A,this.lat=+F,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pg(T(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(A){let F=Math.PI/180,W=this.lat*F,te=A.lat*F,fe=Math.sin(W)*Math.sin(te)+Math.cos(W)*Math.cos(te)*Math.cos((A.lng-this.lng)*F);return _S*Math.acos(Math.min(fe,1))}static convert(A){if(A instanceof pg)return A;if(Array.isArray(A)&&(A.length===2||A.length===3))return new pg(Number(A[0]),Number(A[1]));if(!Array.isArray(A)&&typeof A=="object"&&A!==null)return new pg(Number("lng"in A?A.lng:A.lon),Number(A.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}let D1=2*Math.PI*_S;function qC(R){return D1*Math.cos(R*Math.PI/180)}function Zw(R){return(180+R)/360}function OC(R){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+R*Math.PI/360)))/360}function Yw(R,A){return R/qC(A)}function sb(R){return 360/Math.PI*Math.atan(Math.exp((180-360*R)*Math.PI/180))-90}class lb{constructor(A,F,W=0){this.x=+A,this.y=+F,this.z=+W}static fromLngLat(A,F=0){let W=pg.convert(A);return new lb(Zw(W.lng),OC(W.lat),Yw(F,W.lat))}toLngLat(){return new pg(360*this.x-180,sb(this.y))}toAltitude(){return this.z*qC(sb(this.y))}meterInMercatorCoordinateUnits(){return 1/D1*(A=sb(this.y),1/Math.cos(A*Math.PI/180));var A}}function yp(R,A,F){var W=2*Math.PI*6378137/256/Math.pow(2,F);return[R*W-2*Math.PI*6378137/2,A*W-2*Math.PI*6378137/2]}class xS{constructor(A,F,W){if(!function(te,fe,pe){return!(te<0||te>25||pe<0||pe>=Math.pow(2,te)||fe<0||fe>=Math.pow(2,te))}(A,F,W))throw new Error(`x=${F}, y=${W}, z=${A} outside of bounds. 0<=x<${Math.pow(2,A)}, 0<=y<${Math.pow(2,A)} 0<=z<=25 `);this.z=A,this.x=F,this.y=W,this.key=ub(0,A,A,F,W)}equals(A){return this.z===A.z&&this.x===A.x&&this.y===A.y}url(A,F,W){let te=(pe=this.y,Re=this.z,Ke=yp(256*(fe=this.x),256*(pe=Math.pow(2,Re)-pe-1),Re),ft=yp(256*(fe+1),256*(pe+1),Re),Ke[0]+","+Ke[1]+","+ft[0]+","+ft[1]);var fe,pe,Re,Ke,ft;let Rt=function(er,ur,vr){let kr,Dr="";for(let li=er;li>0;li--)kr=1<<li-1,Dr+=(ur&kr?1:0)+(vr&kr?2:0);return Dr}(this.z,this.x,this.y);return A[(this.x+this.y)%A.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(W==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,F>1?"@2x":"").replace(/{quadkey}/g,Rt).replace(/{bbox-epsg-3857}/g,te)}isChildOf(A){let F=this.z-A.z;return F>0&&A.x===this.x>>F&&A.y===this.y>>F}getTilePoint(A){let F=Math.pow(2,this.z);return new u((A.x*F-this.x)*ja,(A.y*F-this.y)*ja)}toString(){return`${this.z}/${this.x}/${this.y}`}}class BC{constructor(A,F){this.wrap=A,this.canonical=F,this.key=ub(A,F.z,F.z,F.x,F.y)}}class $v{constructor(A,F,W,te,fe){if(A<W)throw new Error(`overscaledZ should be >= z; overscaledZ = ${A}; z = ${W}`);this.overscaledZ=A,this.wrap=F,this.canonical=new xS(W,+te,+fe),this.key=ub(F,A,W,te,fe)}clone(){return new $v(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(A){return this.overscaledZ===A.overscaledZ&&this.wrap===A.wrap&&this.canonical.equals(A.canonical)}scaledTo(A){if(A>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${A}; overscaledZ = ${this.overscaledZ}`);let F=this.canonical.z-A;return A>this.canonical.z?new $v(A,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new $v(A,this.wrap,A,this.canonical.x>>F,this.canonical.y>>F)}calculateScaledKey(A,F){if(A>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${A}; overscaledZ = ${this.overscaledZ}`);let W=this.canonical.z-A;return A>this.canonical.z?ub(this.wrap*+F,A,this.canonical.z,this.canonical.x,this.canonical.y):ub(this.wrap*+F,A,A,this.canonical.x>>W,this.canonical.y>>W)}isChildOf(A){if(A.wrap!==this.wrap)return!1;let F=this.canonical.z-A.canonical.z;return A.overscaledZ===0||A.overscaledZ<this.overscaledZ&&A.canonical.x===this.canonical.x>>F&&A.canonical.y===this.canonical.y>>F}children(A){if(this.overscaledZ>=A)return[new $v(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let F=this.canonical.z+1,W=2*this.canonical.x,te=2*this.canonical.y;return[new $v(F,this.wrap,F,W,te),new $v(F,this.wrap,F,W+1,te),new $v(F,this.wrap,F,W,te+1),new $v(F,this.wrap,F,W+1,te+1)]}isLessThan(A){return this.wrap<A.wrap||!(this.wrap>A.wrap)&&(this.overscaledZ<A.overscaledZ||!(this.overscaledZ>A.overscaledZ)&&(this.canonical.x<A.canonical.x||!(this.canonical.x>A.canonical.x)&&this.canonical.y<A.canonical.y))}wrapped(){return new $v(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(A){return new $v(this.overscaledZ,A,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new BC(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(A){return this.canonical.getTilePoint(new lb(A.x-this.wrap,A.y))}}function ub(R,A,F,W,te){(R*=2)<0&&(R=-1*R-1);let fe=1<<F;return(fe*fe*R+fe*te+W).toString(36)+F.toString(36)+A.toString(36)}Fi("CanonicalTileID",xS),Fi("OverscaledTileID",$v,{omit:["posMatrix"]});class NC{constructor(A,F,W,te=1,fe=1,pe=1,Re=0){if(this.uid=A,F.height!==F.width)throw new RangeError("DEM tiles must be square");if(W&&!["mapbox","terrarium","custom"].includes(W))return void E(`"${W}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=F.height;let Ke=this.dim=F.height-2;switch(this.data=new Uint32Array(F.data.buffer),W){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=te,this.greenFactor=fe,this.blueFactor=pe,this.baseShift=Re;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let ft=0;ft<Ke;ft++)this.data[this._idx(-1,ft)]=this.data[this._idx(0,ft)],this.data[this._idx(Ke,ft)]=this.data[this._idx(Ke-1,ft)],this.data[this._idx(ft,-1)]=this.data[this._idx(ft,0)],this.data[this._idx(ft,Ke)]=this.data[this._idx(ft,Ke-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(Ke,-1)]=this.data[this._idx(Ke-1,0)],this.data[this._idx(-1,Ke)]=this.data[this._idx(0,Ke-1)],this.data[this._idx(Ke,Ke)]=this.data[this._idx(Ke-1,Ke-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let ft=0;ft<Ke;ft++)for(let Rt=0;Rt<Ke;Rt++){let er=this.get(ft,Rt);er>this.max&&(this.max=er),er<this.min&&(this.min=er)}}get(A,F){let W=new Uint8Array(this.data.buffer),te=4*this._idx(A,F);return this.unpack(W[te],W[te+1],W[te+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(A,F){if(A<-1||A>=this.dim+1||F<-1||F>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(F+1)*this.stride+(A+1)}unpack(A,F,W){return A*this.redFactor+F*this.greenFactor+W*this.blueFactor-this.baseShift}getPixels(){return new Ki({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(A,F,W){if(this.dim!==A.dim)throw new Error("dem dimension mismatch");let te=F*this.dim,fe=F*this.dim+this.dim,pe=W*this.dim,Re=W*this.dim+this.dim;switch(F){case-1:te=fe-1;break;case 1:fe=te+1}switch(W){case-1:pe=Re-1;break;case 1:Re=pe+1}let Ke=-F*this.dim,ft=-W*this.dim;for(let Rt=pe;Rt<Re;Rt++)for(let er=te;er<fe;er++)this.data[this._idx(er,Rt)]=A.data[this._idx(er+Ke,Rt+ft)]}}Fi("DEMData",NC);class UC{constructor(A){this._stringToNumber={},this._numberToString=[];for(let F=0;F<A.length;F++){let W=A[F];this._stringToNumber[W]=F,this._numberToString[F]=W}}encode(A){return this._stringToNumber[A]}decode(A){if(A>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${A} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[A]}}class bS{constructor(A,F,W,te,fe){this.type="Feature",this._vectorTileFeature=A,A._z=F,A._x=W,A._y=te,this.properties=A.properties,this.id=fe}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(A){this._geometry=A}toJSON(){let A={geometry:this.geometry};for(let F in this)F!=="_geometry"&&F!=="_vectorTileFeature"&&(A[F]=this[F]);return A}}class yy{constructor(A,F){this.tileID=A,this.x=A.canonical.x,this.y=A.canonical.y,this.z=A.canonical.z,this.grid=new $i(ja,16,0),this.grid3D=new $i(ja,16,0),this.featureIndexArray=new Ts,this.promoteId=F}insert(A,F,W,te,fe,pe){let Re=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(W,te,fe);let Ke=pe?this.grid3D:this.grid;for(let ft=0;ft<F.length;ft++){let Rt=F[ft],er=[1/0,1/0,-1/0,-1/0];for(let ur=0;ur<Rt.length;ur++){let vr=Rt[ur];er[0]=Math.min(er[0],vr.x),er[1]=Math.min(er[1],vr.y),er[2]=Math.max(er[2],vr.x),er[3]=Math.max(er[3],vr.y)}er[0]<ja&&er[1]<ja&&er[2]>=0&&er[3]>=0&&Ke.insert(Re,er[0],er[1],er[2],er[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new _r.VectorTile(new uS(this.rawTileData)).layers,this.sourceLayerCoder=new UC(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(A,F,W,te){this.loadVTLayers();let fe=A.params||{},pe=ja/A.tileSize/A.scale,Re=Fc(fe.filter),Ke=A.queryGeometry,ft=A.queryPadding*pe,Rt=GC(Ke),er=this.grid.query(Rt.minX-ft,Rt.minY-ft,Rt.maxX+ft,Rt.maxY+ft),ur=GC(A.cameraQueryGeometry),vr=this.grid3D.query(ur.minX-ft,ur.minY-ft,ur.maxX+ft,ur.maxY+ft,(li,pi,vn,zi)=>function(ln,Tn,pa,ro,Vo){for(let la of ln)if(Tn<=la.x&&pa<=la.y&&ro>=la.x&&Vo>=la.y)return!0;let Xa=[new u(Tn,pa),new u(Tn,Vo),new u(ro,Vo),new u(ro,pa)];if(ln.length>2){for(let la of Xa)if(Ni(ln,la))return!0}for(let la=0;la<ln.length-1;la++)if(qi(ln[la],ln[la+1],Xa))return!0;return!1}(A.cameraQueryGeometry,li-ft,pi-ft,vn+ft,zi+ft));for(let li of vr)er.push(li);er.sort(nq);let kr={},Dr;for(let li=0;li<er.length;li++){let pi=er[li];if(pi===Dr)continue;Dr=pi;let vn=this.featureIndexArray.get(pi),zi=null;this.loadMatchingFeature(kr,vn.bucketIndex,vn.sourceLayerIndex,vn.featureIndex,Re,fe.layers,fe.availableImages,F,W,te,(ln,Tn,pa)=>(zi||(zi=$s(ln)),Tn.queryIntersectsFeature(Ke,ln,pa,zi,this.z,A.transform,pe,A.pixelPosMatrix)))}return kr}loadMatchingFeature(A,F,W,te,fe,pe,Re,Ke,ft,Rt,er){let ur=this.bucketLayerIDs[F];if(pe&&!function(li,pi){for(let vn=0;vn<li.length;vn++)if(pi.indexOf(li[vn])>=0)return!0;return!1}(pe,ur))return;let vr=this.sourceLayerCoder.decode(W),kr=this.vtLayers[vr].feature(te);if(fe.needGeometry){let li=Sl(kr,!0);if(!fe.filter(new rs(this.tileID.overscaledZ),li,this.tileID.canonical))return}else if(!fe.filter(new rs(this.tileID.overscaledZ),kr))return;let Dr=this.getId(kr,vr);for(let li=0;li<ur.length;li++){let pi=ur[li];if(pe&&pe.indexOf(pi)<0)continue;let vn=Ke[pi];if(!vn)continue;let zi={};Dr&&Rt&&(zi=Rt.getState(vn.sourceLayer||"_geojsonTileLayer",Dr));let ln=L({},ft[pi]);ln.paint=VC(ln.paint,vn.paint,kr,zi,Re),ln.layout=VC(ln.layout,vn.layout,kr,zi,Re);let Tn=!er||er(kr,vn,zi);if(!Tn)continue;let pa=new bS(kr,this.z,this.x,this.y,Dr);pa.layer=ln;let ro=A[pi];ro===void 0&&(ro=A[pi]=[]),ro.push({featureIndex:te,feature:pa,intersectionZ:Tn})}}lookupSymbolFeatures(A,F,W,te,fe,pe,Re,Ke){let ft={};this.loadVTLayers();let Rt=Fc(fe);for(let er of A)this.loadMatchingFeature(ft,W,te,er,Rt,pe,Re,Ke,F);return ft}hasLayer(A){for(let F of this.bucketLayerIDs)for(let W of F)if(A===W)return!0;return!1}getId(A,F){let W=A.id;return this.promoteId&&(W=A.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[F]],typeof W=="boolean"&&(W=Number(W))),W}}function VC(R,A,F,W,te){return C(R,(fe,pe)=>{let Re=A instanceof Ac?A.get(pe):null;return Re&&Re.evaluate?Re.evaluate(F,W,te):Re})}function GC(R){let A=1/0,F=1/0,W=-1/0,te=-1/0;for(let fe of R)A=Math.min(A,fe.x),F=Math.min(F,fe.y),W=Math.max(W,fe.x),te=Math.max(te,fe.y);return{minX:A,minY:F,maxX:W,maxY:te}}function nq(R,A){return A-R}function HC(R,A,F,W,te){let fe=[];for(let pe=0;pe<R.length;pe++){let Re=R[pe],Ke;for(let ft=0;ft<Re.length-1;ft++){let Rt=Re[ft],er=Re[ft+1];Rt.x<A&&er.x<A||(Rt.x<A?Rt=new u(A,Rt.y+(A-Rt.x)/(er.x-Rt.x)*(er.y-Rt.y))._round():er.x<A&&(er=new u(A,Rt.y+(A-Rt.x)/(er.x-Rt.x)*(er.y-Rt.y))._round()),Rt.y<F&&er.y<F||(Rt.y<F?Rt=new u(Rt.x+(F-Rt.y)/(er.y-Rt.y)*(er.x-Rt.x),F)._round():er.y<F&&(er=new u(Rt.x+(F-Rt.y)/(er.y-Rt.y)*(er.x-Rt.x),F)._round()),Rt.x>=W&&er.x>=W||(Rt.x>=W?Rt=new u(W,Rt.y+(W-Rt.x)/(er.x-Rt.x)*(er.y-Rt.y))._round():er.x>=W&&(er=new u(W,Rt.y+(W-Rt.x)/(er.x-Rt.x)*(er.y-Rt.y))._round()),Rt.y>=te&&er.y>=te||(Rt.y>=te?Rt=new u(Rt.x+(te-Rt.y)/(er.y-Rt.y)*(er.x-Rt.x),te)._round():er.y>=te&&(er=new u(Rt.x+(te-Rt.y)/(er.y-Rt.y)*(er.x-Rt.x),te)._round()),Ke&&Rt.equals(Ke[Ke.length-1])||(Ke=[Rt],fe.push(Ke)),Ke.push(er)))))}}return fe}Fi("FeatureIndex",yy,{omit:["rawTileData","sourceLayerCoder"]});class gg extends u{constructor(A,F,W,te){super(A,F),this.angle=W,te!==void 0&&(this.segment=te)}clone(){return new gg(this.x,this.y,this.angle,this.segment)}}function wS(R,A,F,W,te){if(A.segment===void 0||F===0)return!0;let fe=A,pe=A.segment+1,Re=0;for(;Re>-F/2;){if(pe--,pe<0)return!1;Re-=R[pe].dist(fe),fe=R[pe]}Re+=R[pe].dist(R[pe+1]),pe++;let Ke=[],ft=0;for(;Re<F/2;){let Rt=R[pe],er=R[pe+1];if(!er)return!1;let ur=R[pe-1].angleTo(Rt)-Rt.angleTo(er);for(ur=Math.abs((ur+3*Math.PI)%(2*Math.PI)-Math.PI),Ke.push({distance:Re,angleDelta:ur}),ft+=ur;Re-Ke[0].distance>W;)ft-=Ke.shift().angleDelta;if(ft>te)return!1;pe++,Re+=Rt.dist(er)}return!0}function jC(R){let A=0;for(let F=0;F<R.length-1;F++)A+=R[F].dist(R[F+1]);return A}function WC(R,A,F){return R?.6*A*F:0}function XC(R,A){return Math.max(R?R.right-R.left:0,A?A.right-A.left:0)}function aq(R,A,F,W,te,fe){let pe=WC(F,te,fe),Re=XC(F,W)*fe,Ke=0,ft=jC(R)/2;for(let Rt=0;Rt<R.length-1;Rt++){let er=R[Rt],ur=R[Rt+1],vr=er.dist(ur);if(Ke+vr>ft){let kr=(ft-Ke)/vr,Dr=Lo.number(er.x,ur.x,kr),li=Lo.number(er.y,ur.y,kr),pi=new gg(Dr,li,ur.angleTo(er),Rt);return pi._round(),!pe||wS(R,pi,Re,pe,A)?pi:void 0}Ke+=vr}}function oq(R,A,F,W,te,fe,pe,Re,Ke){let ft=WC(W,fe,pe),Rt=XC(W,te),er=Rt*pe,ur=R[0].x===0||R[0].x===Ke||R[0].y===0||R[0].y===Ke;return A-er<A/4&&(A=er+A/4),ZC(R,ur?A/2*Re%A:(Rt/2+2*fe)*pe*Re%A,A,ft,F,er,ur,!1,Ke)}function ZC(R,A,F,W,te,fe,pe,Re,Ke){let ft=fe/2,Rt=jC(R),er=0,ur=A-F,vr=[];for(let kr=0;kr<R.length-1;kr++){let Dr=R[kr],li=R[kr+1],pi=Dr.dist(li),vn=li.angleTo(Dr);for(;ur+F<er+pi;){ur+=F;let zi=(ur-er)/pi,ln=Lo.number(Dr.x,li.x,zi),Tn=Lo.number(Dr.y,li.y,zi);if(ln>=0&&ln<Ke&&Tn>=0&&Tn<Ke&&ur-ft>=0&&ur+ft<=Rt){let pa=new gg(ln,Tn,vn,kr);pa._round(),W&&!wS(R,pa,fe,W,te)||vr.push(pa)}}er+=pi}return Re||vr.length||pe||(vr=ZC(R,er/2,F,W,te,fe,pe,!0,Ke)),vr}Fi("Anchor",gg);let F1=Md;function YC(R,A,F,W){let te=[],fe=R.image,pe=fe.pixelRatio,Re=fe.paddedRect.w-2*F1,Ke=fe.paddedRect.h-2*F1,ft={x1:R.left,y1:R.top,x2:R.right,y2:R.bottom},Rt=fe.stretchX||[[0,Re]],er=fe.stretchY||[[0,Ke]],ur=(Wn,Ro)=>Wn+Ro[1]-Ro[0],vr=Rt.reduce(ur,0),kr=er.reduce(ur,0),Dr=Re-vr,li=Ke-kr,pi=0,vn=vr,zi=0,ln=kr,Tn=0,pa=Dr,ro=0,Vo=li;if(fe.content&&W){let Wn=fe.content,Ro=Wn[2]-Wn[0],uo=Wn[3]-Wn[1];(fe.textFitWidth||fe.textFitHeight)&&(ft=IC(R)),pi=mg(Rt,0,Wn[0]),zi=mg(er,0,Wn[1]),vn=mg(Rt,Wn[0],Wn[2]),ln=mg(er,Wn[1],Wn[3]),Tn=Wn[0]-pi,ro=Wn[1]-zi,pa=Ro-vn,Vo=uo-ln}let Xa=ft.x1,la=ft.y1,Mo=ft.x2-Xa,fo=ft.y2-la,lo=(Wn,Ro,uo,$o)=>{let Ju=Kw(Wn.stretch-pi,vn,Mo,Xa),Ou=z1(Wn.fixed-Tn,pa,Wn.stretch,vr),kh=Kw(Ro.stretch-zi,ln,fo,la),Qv=z1(Ro.fixed-ro,Vo,Ro.stretch,kr),ud=Kw(uo.stretch-pi,vn,Mo,Xa),Ch=z1(uo.fixed-Tn,pa,uo.stretch,vr),Gd=Kw($o.stretch-zi,ln,fo,la),Hd=z1($o.fixed-ro,Vo,$o.stretch,kr),jd=new u(Ju,kh),Af=new u(ud,kh),Lh=new u(ud,Gd),Ed=new u(Ju,Gd),cd=new u(Ou/pe,Qv/pe),Yh=new u(Ch/pe,Hd/pe),Df=A*Math.PI/180;if(Df){let ru=Math.sin(Df),pc=Math.cos(Df),$u=[pc,-ru,ru,pc];jd._matMult($u),Af._matMult($u),Ed._matMult($u),Lh._matMult($u)}let Fv=Wn.stretch+Wn.fixed,uv=Ro.stretch+Ro.fixed;return{tl:jd,tr:Af,bl:Ed,br:Lh,tex:{x:fe.paddedRect.x+F1+Fv,y:fe.paddedRect.y+F1+uv,w:uo.stretch+uo.fixed-Fv,h:$o.stretch+$o.fixed-uv},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:cd,pixelOffsetBR:Yh,minFontScaleX:pa/pe/Mo,minFontScaleY:Vo/pe/fo,isSDF:F}};if(W&&(fe.stretchX||fe.stretchY)){let Wn=KC(Rt,Dr,vr),Ro=KC(er,li,kr);for(let uo=0;uo<Wn.length-1;uo++){let $o=Wn[uo],Ju=Wn[uo+1];for(let Ou=0;Ou<Ro.length-1;Ou++)te.push(lo($o,Ro[Ou],Ju,Ro[Ou+1]))}}else te.push(lo({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:Re+1},{fixed:0,stretch:Ke+1}));return te}function mg(R,A,F){let W=0;for(let te of R)W+=Math.max(A,Math.min(F,te[1]))-Math.max(A,Math.min(F,te[0]));return W}function KC(R,A,F){let W=[{fixed:-F1,stretch:0}];for(let[te,fe]of R){let pe=W[W.length-1];W.push({fixed:te-pe.stretch,stretch:pe.stretch}),W.push({fixed:te-pe.stretch,stretch:pe.stretch+(fe-te)})}return W.push({fixed:A+F1,stretch:F}),W}function Kw(R,A,F,W){return R/A*F+W}function z1(R,A,F,W){return R-A*F/W}class dm{constructor(A,F,W,te,fe,pe,Re,Ke,ft,Rt){var er;if(this.boxStartIndex=A.length,ft){let ur=pe.top,vr=pe.bottom,kr=pe.collisionPadding;kr&&(ur-=kr[1],vr+=kr[3]);let Dr=vr-ur;Dr>0&&(Dr=Math.max(10,Dr),this.circleDiameter=Dr)}else{let ur=!((er=pe.image)===null||er===void 0)&&er.content&&(pe.image.textFitWidth||pe.image.textFitHeight)?IC(pe):{x1:pe.left,y1:pe.top,x2:pe.right,y2:pe.bottom};ur.y1=ur.y1*Re-Ke[0],ur.y2=ur.y2*Re+Ke[2],ur.x1=ur.x1*Re-Ke[3],ur.x2=ur.x2*Re+Ke[1];let vr=pe.collisionPadding;if(vr&&(ur.x1-=vr[0]*Re,ur.y1-=vr[1]*Re,ur.x2+=vr[2]*Re,ur.y2+=vr[3]*Re),Rt){let kr=new u(ur.x1,ur.y1),Dr=new u(ur.x2,ur.y1),li=new u(ur.x1,ur.y2),pi=new u(ur.x2,ur.y2),vn=Rt*Math.PI/180;kr._rotate(vn),Dr._rotate(vn),li._rotate(vn),pi._rotate(vn),ur.x1=Math.min(kr.x,Dr.x,li.x,pi.x),ur.x2=Math.max(kr.x,Dr.x,li.x,pi.x),ur.y1=Math.min(kr.y,Dr.y,li.y,pi.y),ur.y2=Math.max(kr.y,Dr.y,li.y,pi.y)}A.emplaceBack(F.x,F.y,ur.x1,ur.y1,ur.x2,ur.y2,W,te,fe)}this.boxEndIndex=A.length}}class Vp{constructor(A=[],F=(W,te)=>W<te?-1:W>te?1:0){if(this.data=A,this.length=this.data.length,this.compare=F,this.length>0)for(let W=(this.length>>1)-1;W>=0;W--)this._down(W)}push(A){this.data.push(A),this._up(this.length++)}pop(){if(this.length===0)return;let A=this.data[0],F=this.data.pop();return--this.length>0&&(this.data[0]=F,this._down(0)),A}peek(){return this.data[0]}_up(A){let{data:F,compare:W}=this,te=F[A];for(;A>0;){let fe=A-1>>1,pe=F[fe];if(W(te,pe)>=0)break;F[A]=pe,A=fe}F[A]=te}_down(A){let{data:F,compare:W}=this,te=this.length>>1,fe=F[A];for(;A<te;){let pe=1+(A<<1),Re=pe+1;if(Re<this.length&&W(F[Re],F[pe])<0&&(pe=Re),W(F[pe],fe)>=0)break;F[A]=F[pe],A=pe}F[A]=fe}}function sq(R,A=1,F=!1){let W=1/0,te=1/0,fe=-1/0,pe=-1/0,Re=R[0];for(let vr=0;vr<Re.length;vr++){let kr=Re[vr];(!vr||kr.x<W)&&(W=kr.x),(!vr||kr.y<te)&&(te=kr.y),(!vr||kr.x>fe)&&(fe=kr.x),(!vr||kr.y>pe)&&(pe=kr.y)}let Ke=Math.min(fe-W,pe-te),ft=Ke/2,Rt=new Vp([],lq);if(Ke===0)return new u(W,te);for(let vr=W;vr<fe;vr+=Ke)for(let kr=te;kr<pe;kr+=Ke)Rt.push(new q1(vr+ft,kr+ft,ft,R));let er=function(vr){let kr=0,Dr=0,li=0,pi=vr[0];for(let vn=0,zi=pi.length,ln=zi-1;vn<zi;ln=vn++){let Tn=pi[vn],pa=pi[ln],ro=Tn.x*pa.y-pa.x*Tn.y;Dr+=(Tn.x+pa.x)*ro,li+=(Tn.y+pa.y)*ro,kr+=3*ro}return new q1(Dr/kr,li/kr,0,vr)}(R),ur=Rt.length;for(;Rt.length;){let vr=Rt.pop();(vr.d>er.d||!er.d)&&(er=vr,F&&console.log("found best %d after %d probes",Math.round(1e4*vr.d)/1e4,ur)),vr.max-er.d<=A||(ft=vr.h/2,Rt.push(new q1(vr.p.x-ft,vr.p.y-ft,ft,R)),Rt.push(new q1(vr.p.x+ft,vr.p.y-ft,ft,R)),Rt.push(new q1(vr.p.x-ft,vr.p.y+ft,ft,R)),Rt.push(new q1(vr.p.x+ft,vr.p.y+ft,ft,R)),ur+=4)}return F&&(console.log(`num probes: ${ur}`),console.log(`best distance: ${er.d}`)),er.p}function lq(R,A){return A.max-R.max}function q1(R,A,F,W){this.p=new u(R,A),this.h=F,this.d=function(te,fe){let pe=!1,Re=1/0;for(let Ke=0;Ke<fe.length;Ke++){let ft=fe[Ke];for(let Rt=0,er=ft.length,ur=er-1;Rt<er;ur=Rt++){let vr=ft[Rt],kr=ft[ur];vr.y>te.y!=kr.y>te.y&&te.x<(kr.x-vr.x)*(te.y-vr.y)/(kr.y-vr.y)+vr.x&&(pe=!pe),Re=Math.min(Re,Nr(te,vr,kr))}}return(pe?1:-1)*Math.sqrt(Re)}(this.p,W),this.max=this.d+this.h*Math.SQRT2}var ld;i.aq=void 0,(ld=i.aq||(i.aq={}))[ld.center=1]="center",ld[ld.left=2]="left",ld[ld.right=3]="right",ld[ld.top=4]="top",ld[ld.bottom=5]="bottom",ld[ld["top-left"]=6]="top-left",ld[ld["top-right"]=7]="top-right",ld[ld["bottom-left"]=8]="bottom-left",ld[ld["bottom-right"]=9]="bottom-right";let vm=7,_y=Number.POSITIVE_INFINITY;function TS(R,A){return A[1]!==_y?function(F,W,te){let fe=0,pe=0;switch(W=Math.abs(W),te=Math.abs(te),F){case"top-right":case"top-left":case"top":pe=te-vm;break;case"bottom-right":case"bottom-left":case"bottom":pe=-te+vm}switch(F){case"top-right":case"bottom-right":case"right":fe=-W;break;case"top-left":case"bottom-left":case"left":fe=W}return[fe,pe]}(R,A[0],A[1]):function(F,W){let te=0,fe=0;W<0&&(W=0);let pe=W/Math.SQRT2;switch(F){case"top-right":case"top-left":fe=pe-vm;break;case"bottom-right":case"bottom-left":fe=-pe+vm;break;case"bottom":fe=-W+vm;break;case"top":fe=W-vm}switch(F){case"top-right":case"bottom-right":te=-pe;break;case"top-left":case"bottom-left":te=pe;break;case"left":te=W;break;case"right":te=-W}return[te,fe]}(R,A[0])}function JC(R,A,F){var W;let te=R.layout,fe=(W=te.get("text-variable-anchor-offset"))===null||W===void 0?void 0:W.evaluate(A,{},F);if(fe){let Re=fe.values,Ke=[];for(let ft=0;ft<Re.length;ft+=2){let Rt=Ke[ft]=Re[ft],er=Re[ft+1].map(ur=>ur*tu);Rt.startsWith("top")?er[1]-=vm:Rt.startsWith("bottom")&&(er[1]+=vm),Ke[ft+1]=er}return new Zi(Ke)}let pe=te.get("text-variable-anchor");if(pe){let Re;Re=R._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[te.get("text-radial-offset").evaluate(A,{},F)*tu,_y]:te.get("text-offset").evaluate(A,{},F).map(ft=>ft*tu);let Ke=[];for(let ft of pe)Ke.push(ft,TS(ft,Re));return new Zi(Ke)}return null}function AS(R){switch(R){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function uq(R,A,F,W,te,fe,pe,Re,Ke,ft,Rt){let er=fe.textMaxSize.evaluate(A,{});er===void 0&&(er=pe);let ur=R.layers[0].layout,vr=ur.get("icon-offset").evaluate(A,{},Rt),kr=QC(F.horizontal),Dr=pe/24,li=R.tilePixelRatio*Dr,pi=R.tilePixelRatio*er/24,vn=R.tilePixelRatio*Re,zi=R.tilePixelRatio*ur.get("symbol-spacing"),ln=ur.get("text-padding")*R.tilePixelRatio,Tn=function(Wn,Ro,uo,$o=1){let Ju=Wn.get("icon-padding").evaluate(Ro,{},uo),Ou=Ju&&Ju.values;return[Ou[0]*$o,Ou[1]*$o,Ou[2]*$o,Ou[3]*$o]}(ur,A,Rt,R.tilePixelRatio),pa=ur.get("text-max-angle")/180*Math.PI,ro=ur.get("text-rotation-alignment")!=="viewport"&&ur.get("symbol-placement")!=="point",Vo=ur.get("icon-rotation-alignment")==="map"&&ur.get("symbol-placement")!=="point",Xa=ur.get("symbol-placement"),la=zi/2,Mo=ur.get("icon-text-fit"),fo;W&&Mo!=="none"&&(R.allowVerticalPlacement&&F.vertical&&(fo=RC(W,F.vertical,Mo,ur.get("icon-text-fit-padding"),vr,Dr)),kr&&(W=RC(W,kr,Mo,ur.get("icon-text-fit-padding"),vr,Dr)));let lo=(Wn,Ro)=>{Ro.x<0||Ro.x>=ja||Ro.y<0||Ro.y>=ja||function(uo,$o,Ju,Ou,kh,Qv,ud,Ch,Gd,Hd,jd,Af,Lh,Ed,cd,Yh,Df,Fv,uv,ru,pc,$u,zv,hf,O1){let p0=uo.addToLineVertexArray($o,Ju),Gp,ep,Gc,Yf,tp=0,yg=0,cv=0,B1=0,CS=-1,e3=-1,g0={},xy=xi("");if(uo.allowVerticalPlacement&&Ou.vertical){let kd=Ch.layout.get("text-rotate").evaluate(pc,{},hf)+90;Gc=new dm(Gd,$o,Hd,jd,Af,Ou.vertical,Lh,Ed,cd,kd),ud&&(Yf=new dm(Gd,$o,Hd,jd,Af,ud,Df,Fv,cd,kd))}if(kh){let kd=Ch.layout.get("icon-rotate").evaluate(pc,{}),rp=Ch.layout.get("icon-text-fit")!=="none",pm=YC(kh,kd,zv,rp),Wd=ud?YC(ud,kd,zv,rp):void 0;ep=new dm(Gd,$o,Hd,jd,Af,kh,Df,Fv,!1,kd),tp=4*pm.length;let Cd=uo.iconSizeData,xp=null;Cd.kind==="source"?(xp=[v0*Ch.layout.get("icon-size").evaluate(pc,{})],xp[0]>fm&&E(`${uo.layerIds[0]}: Value for "icon-size" is >= ${rb}. Reduce your "icon-size".`)):Cd.kind==="composite"&&(xp=[v0*$u.compositeIconSizes[0].evaluate(pc,{},hf),v0*$u.compositeIconSizes[1].evaluate(pc,{},hf)],(xp[0]>fm||xp[1]>fm)&&E(`${uo.layerIds[0]}: Value for "icon-size" is >= ${rb}. Reduce your "icon-size".`)),uo.addSymbols(uo.icon,pm,xp,ru,uv,pc,i.ah.none,$o,p0.lineStartIndex,p0.lineLength,-1,hf),CS=uo.icon.placedSymbolArray.length-1,Wd&&(yg=4*Wd.length,uo.addSymbols(uo.icon,Wd,xp,ru,uv,pc,i.ah.vertical,$o,p0.lineStartIndex,p0.lineLength,-1,hf),e3=uo.icon.placedSymbolArray.length-1)}let Kh=Object.keys(Ou.horizontal);for(let kd of Kh){let rp=Ou.horizontal[kd];if(!Gp){xy=xi(rp.text);let Wd=Ch.layout.get("text-rotate").evaluate(pc,{},hf);Gp=new dm(Gd,$o,Hd,jd,Af,rp,Lh,Ed,cd,Wd)}let pm=rp.positionedLines.length===1;if(cv+=$C(uo,$o,rp,Qv,Ch,cd,pc,Yh,p0,Ou.vertical?i.ah.horizontal:i.ah.horizontalOnly,pm?Kh:[kd],g0,CS,$u,hf),pm)break}Ou.vertical&&(B1+=$C(uo,$o,Ou.vertical,Qv,Ch,cd,pc,Yh,p0,i.ah.vertical,["vertical"],g0,e3,$u,hf));let hq=Gp?Gp.boxStartIndex:uo.collisionBoxArray.length,t3=Gp?Gp.boxEndIndex:uo.collisionBoxArray.length,m0=Gc?Gc.boxStartIndex:uo.collisionBoxArray.length,fv=Gc?Gc.boxEndIndex:uo.collisionBoxArray.length,i6=ep?ep.boxStartIndex:uo.collisionBoxArray.length,dq=ep?ep.boxEndIndex:uo.collisionBoxArray.length,n6=Yf?Yf.boxStartIndex:uo.collisionBoxArray.length,vq=Yf?Yf.boxEndIndex:uo.collisionBoxArray.length,_p=-1,hb=(kd,rp)=>kd&&kd.circleDiameter?Math.max(kd.circleDiameter,rp):rp;_p=hb(Gp,_p),_p=hb(Gc,_p),_p=hb(ep,_p),_p=hb(Yf,_p);let r3=_p>-1?1:0;r3&&(_p*=O1/tu),uo.glyphOffsetArray.length>=R1.MAX_GLYPHS&&E("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pc.sortKey!==void 0&&uo.addToSortKeyRanges(uo.symbolInstances.length,pc.sortKey);let LS=JC(Ch,pc,hf),[pq,gq]=function(kd,rp){let pm=kd.length,Wd=rp==null?void 0:rp.values;if((Wd==null?void 0:Wd.length)>0)for(let Cd=0;Cd<Wd.length;Cd+=2){let xp=Wd[Cd+1];kd.emplaceBack(i.aq[Wd[Cd]],xp[0],xp[1])}return[pm,kd.length]}(uo.textAnchorOffsets,LS);uo.symbolInstances.emplaceBack($o.x,$o.y,g0.right>=0?g0.right:-1,g0.center>=0?g0.center:-1,g0.left>=0?g0.left:-1,g0.vertical||-1,CS,e3,xy,hq,t3,m0,fv,i6,dq,n6,vq,Hd,cv,B1,tp,yg,r3,0,Lh,_p,pq,gq)}(R,Ro,Wn,F,W,te,fo,R.layers[0],R.collisionBoxArray,A.index,A.sourceLayerIndex,R.index,li,[ln,ln,ln,ln],ro,Ke,vn,Tn,Vo,vr,A,fe,ft,Rt,pe)};if(Xa==="line")for(let Wn of HC(A.geometry,0,0,ja,ja)){let Ro=oq(Wn,zi,pa,F.vertical||kr,W,24,pi,R.overscaling,ja);for(let uo of Ro)kr&&cq(R,kr.text,la,uo)||lo(Wn,uo)}else if(Xa==="line-center"){for(let Wn of A.geometry)if(Wn.length>1){let Ro=aq(Wn,pa,F.vertical||kr,W,24,pi);Ro&&lo(Wn,Ro)}}else if(A.type==="Polygon")for(let Wn of Cf(A.geometry,0)){let Ro=sq(Wn,16);lo(Wn[0],new gg(Ro.x,Ro.y,0))}else if(A.type==="LineString")for(let Wn of A.geometry)lo(Wn,new gg(Wn[0].x,Wn[0].y,0));else if(A.type==="Point")for(let Wn of A.geometry)for(let Ro of Wn)lo([Ro],new gg(Ro.x,Ro.y,0))}function $C(R,A,F,W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr){let Dr=function(vn,zi,ln,Tn,pa,ro,Vo,Xa){let la=Tn.layout.get("text-rotate").evaluate(ro,{})*Math.PI/180,Mo=[];for(let fo of zi.positionedLines)for(let lo of fo.positionedGlyphs){if(!lo.rect)continue;let Wn=lo.rect||{},Ro=kC+1,uo=!0,$o=1,Ju=0,Ou=(pa||Xa)&&lo.vertical,kh=lo.metrics.advance*lo.scale/2;if(Xa&&zi.verticalizable&&(Ju=fo.lineOffset/2-(lo.imageName?-(tu-lo.metrics.width*lo.scale)/2:(lo.scale-1)*tu)),lo.imageName){let ru=Vo[lo.imageName];uo=ru.sdf,$o=ru.pixelRatio,Ro=Md/$o}let Qv=pa?[lo.x+kh,lo.y]:[0,0],ud=pa?[0,0]:[lo.x+kh+ln[0],lo.y+ln[1]-Ju],Ch=[0,0];Ou&&(Ch=ud,ud=[0,0]);let Gd=lo.metrics.isDoubleResolution?2:1,Hd=(lo.metrics.left-Ro)*lo.scale-kh+ud[0],jd=(-lo.metrics.top-Ro)*lo.scale+ud[1],Af=Hd+Wn.w/Gd*lo.scale/$o,Lh=jd+Wn.h/Gd*lo.scale/$o,Ed=new u(Hd,jd),cd=new u(Af,jd),Yh=new u(Hd,Lh),Df=new u(Af,Lh);if(Ou){let ru=new u(-kh,kh-Eh),pc=-Math.PI/2,$u=tu/2-kh,zv=new u(5-Eh-$u,-(lo.imageName?$u:0)),hf=new u(...Ch);Ed._rotateAround(pc,ru)._add(zv)._add(hf),cd._rotateAround(pc,ru)._add(zv)._add(hf),Yh._rotateAround(pc,ru)._add(zv)._add(hf),Df._rotateAround(pc,ru)._add(zv)._add(hf)}if(la){let ru=Math.sin(la),pc=Math.cos(la),$u=[pc,-ru,ru,pc];Ed._matMult($u),cd._matMult($u),Yh._matMult($u),Df._matMult($u)}let Fv=new u(0,0),uv=new u(0,0);Mo.push({tl:Ed,tr:cd,bl:Yh,br:Df,tex:Wn,writingMode:zi.writingMode,glyphOffset:Qv,sectionIndex:lo.sectionIndex,isSDF:uo,pixelOffsetTL:Fv,pixelOffsetBR:uv,minFontScaleX:0,minFontScaleY:0})}return Mo}(0,F,Re,te,fe,pe,W,R.allowVerticalPlacement),li=R.textSizeData,pi=null;li.kind==="source"?(pi=[v0*te.layout.get("text-size").evaluate(pe,{})],pi[0]>fm&&E(`${R.layerIds[0]}: Value for "text-size" is >= ${rb}. Reduce your "text-size".`)):li.kind==="composite"&&(pi=[v0*vr.compositeTextSizes[0].evaluate(pe,{},kr),v0*vr.compositeTextSizes[1].evaluate(pe,{},kr)],(pi[0]>fm||pi[1]>fm)&&E(`${R.layerIds[0]}: Value for "text-size" is >= ${rb}. Reduce your "text-size".`)),R.addSymbols(R.text,Dr,pi,Re,fe,pe,ft,A,Ke.lineStartIndex,Ke.lineLength,ur,kr);for(let vn of Rt)er[vn]=R.text.placedSymbolArray.length-1;return 4*Dr.length}function QC(R){for(let A in R)return R[A];return null}function cq(R,A,F,W){let te=R.compareText;if(A in te){let fe=te[A];for(let pe=fe.length-1;pe>=0;pe--)if(W.dist(fe[pe])<F)return!0}else te[A]=[];return te[A].push(W),!1}let e6=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class SS{static from(A){if(!(A instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[F,W]=new Uint8Array(A,0,2);if(F!==219)throw new Error("Data does not appear to be in a KDBush format.");let te=W>>4;if(te!==1)throw new Error(`Got v${te} data when expected v1.`);let fe=e6[15&W];if(!fe)throw new Error("Unrecognized array type.");let[pe]=new Uint16Array(A,2,1),[Re]=new Uint32Array(A,4,1);return new SS(Re,pe,fe,A)}constructor(A,F=64,W=Float64Array,te){if(isNaN(A)||A<0)throw new Error(`Unpexpected numItems value: ${A}.`);this.numItems=+A,this.nodeSize=Math.min(Math.max(+F,2),65535),this.ArrayType=W,this.IndexArrayType=A<65536?Uint16Array:Uint32Array;let fe=e6.indexOf(this.ArrayType),pe=2*A*this.ArrayType.BYTES_PER_ELEMENT,Re=A*this.IndexArrayType.BYTES_PER_ELEMENT,Ke=(8-Re%8)%8;if(fe<0)throw new Error(`Unexpected typed array class: ${W}.`);te&&te instanceof ArrayBuffer?(this.data=te,this.ids=new this.IndexArrayType(this.data,8,A),this.coords=new this.ArrayType(this.data,8+Re+Ke,2*A),this._pos=2*A,this._finished=!0):(this.data=new ArrayBuffer(8+pe+Re+Ke),this.ids=new this.IndexArrayType(this.data,8,A),this.coords=new this.ArrayType(this.data,8+Re+Ke,2*A),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+fe]),new Uint16Array(this.data,2,1)[0]=F,new Uint32Array(this.data,4,1)[0]=A)}add(A,F){let W=this._pos>>1;return this.ids[W]=W,this.coords[this._pos++]=A,this.coords[this._pos++]=F,W}finish(){let A=this._pos>>1;if(A!==this.numItems)throw new Error(`Added ${A} items when expected ${this.numItems}.`);return Jw(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(A,F,W,te){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:fe,coords:pe,nodeSize:Re}=this,Ke=[0,fe.length-1,0],ft=[];for(;Ke.length;){let Rt=Ke.pop()||0,er=Ke.pop()||0,ur=Ke.pop()||0;if(er-ur<=Re){for(let li=ur;li<=er;li++){let pi=pe[2*li],vn=pe[2*li+1];pi>=A&&pi<=W&&vn>=F&&vn<=te&&ft.push(fe[li])}continue}let vr=ur+er>>1,kr=pe[2*vr],Dr=pe[2*vr+1];kr>=A&&kr<=W&&Dr>=F&&Dr<=te&&ft.push(fe[vr]),(Rt===0?A<=kr:F<=Dr)&&(Ke.push(ur),Ke.push(vr-1),Ke.push(1-Rt)),(Rt===0?W>=kr:te>=Dr)&&(Ke.push(vr+1),Ke.push(er),Ke.push(1-Rt))}return ft}within(A,F,W){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:te,coords:fe,nodeSize:pe}=this,Re=[0,te.length-1,0],Ke=[],ft=W*W;for(;Re.length;){let Rt=Re.pop()||0,er=Re.pop()||0,ur=Re.pop()||0;if(er-ur<=pe){for(let li=ur;li<=er;li++)r6(fe[2*li],fe[2*li+1],A,F)<=ft&&Ke.push(te[li]);continue}let vr=ur+er>>1,kr=fe[2*vr],Dr=fe[2*vr+1];r6(kr,Dr,A,F)<=ft&&Ke.push(te[vr]),(Rt===0?A-W<=kr:F-W<=Dr)&&(Re.push(ur),Re.push(vr-1),Re.push(1-Rt)),(Rt===0?A+W>=kr:F+W>=Dr)&&(Re.push(vr+1),Re.push(er),Re.push(1-Rt))}return Ke}}function Jw(R,A,F,W,te,fe){if(te-W<=F)return;let pe=W+te>>1;t6(R,A,pe,W,te,fe),Jw(R,A,F,W,pe-1,1-fe),Jw(R,A,F,pe+1,te,1-fe)}function t6(R,A,F,W,te,fe){for(;te>W;){if(te-W>600){let ft=te-W+1,Rt=F-W+1,er=Math.log(ft),ur=.5*Math.exp(2*er/3),vr=.5*Math.sqrt(er*ur*(ft-ur)/ft)*(Rt-ft/2<0?-1:1);t6(R,A,F,Math.max(W,Math.floor(F-Rt*ur/ft+vr)),Math.min(te,Math.floor(F+(ft-Rt)*ur/ft+vr)),fe)}let pe=A[2*F+fe],Re=W,Ke=te;for(cb(R,A,W,F),A[2*te+fe]>pe&&cb(R,A,W,te);Re<Ke;){for(cb(R,A,Re,Ke),Re++,Ke--;A[2*Re+fe]<pe;)Re++;for(;A[2*Ke+fe]>pe;)Ke--}A[2*W+fe]===pe?cb(R,A,W,Ke):(Ke++,cb(R,A,Ke,te)),Ke<=F&&(W=Ke+1),F<=Ke&&(te=Ke-1)}}function cb(R,A,F,W){MS(R,F,W),MS(A,2*F,2*W),MS(A,2*F+1,2*W+1)}function MS(R,A,F){let W=R[A];R[A]=R[F],R[F]=W}function r6(R,A,F,W){let te=R-F,fe=A-W;return te*te+fe*fe}var $w;i.bg=void 0,($w=i.bg||(i.bg={})).create="create",$w.load="load",$w.fullLoad="fullLoad";let fb=null,sh=[],ES=1e3/60,kS="loadTime",Qw="fullLoadTime",fq={mark(R){performance.mark(R)},frame(R){let A=R;fb!=null&&sh.push(A-fb),fb=A},clearMetrics(){fb=null,sh=[],performance.clearMeasures(kS),performance.clearMeasures(Qw);for(let R in i.bg)performance.clearMarks(i.bg[R])},getPerformanceMetrics(){performance.measure(kS,i.bg.create,i.bg.load),performance.measure(Qw,i.bg.create,i.bg.fullLoad);let R=performance.getEntriesByName(kS)[0].duration,A=performance.getEntriesByName(Qw)[0].duration,F=sh.length,W=1/(sh.reduce((fe,pe)=>fe+pe,0)/F/1e3),te=sh.filter(fe=>fe>ES).reduce((fe,pe)=>fe+(pe-ES)/ES,0);return{loadTime:R,fullLoadTime:A,fps:W,percentDroppedFrames:te/(F+te)*100,totalFrames:F}}};i.$=class extends Jt{},i.A=yi,i.B=dn,i.C=function(R){if(V==null){let A=R.navigator?R.navigator.userAgent:null;V=!!R.safari||!(!A||!(/\b(iPad|iPhone|iPod)\b/.test(A)||A.match("Safari")&&!A.match("Chrome")))}return V},i.D=Va,i.E=Pe,i.F=class{constructor(R,A){this.target=R,this.mapId=A,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new yS(()=>this.process()),this.subscription=function(F,W,te,fe){return F.addEventListener(W,te,!1),{unsubscribe:()=>{F.removeEventListener(W,te,!1)}}}(this.target,"message",F=>this.receive(F)),this.globalScope=q(self)?R:window}registerMessageHandler(R,A){this.messageHandlers[R]=A}sendAsync(R,A){return new Promise((F,W)=>{let te=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[te]={resolve:F,reject:W},A&&A.signal.addEventListener("abort",()=>{delete this.resolveRejects[te];let Re={id:te,type:"<cancel>",origin:location.origin,targetMapId:R.targetMapId,sourceMapId:this.mapId};this.target.postMessage(Re)},{once:!0});let fe=[],pe=Object.assign(Object.assign({},R),{id:te,sourceMapId:this.mapId,origin:location.origin,data:La(R.data,fe)});this.target.postMessage(pe,{transfer:fe})})}receive(R){let A=R.data,F=A.id;if(!(A.origin!=="file://"&&location.origin!=="file://"&&A.origin!=="resource://android"&&location.origin!=="resource://android"&&A.origin!==location.origin||A.targetMapId&&this.mapId!==A.targetMapId)){if(A.type==="<cancel>"){delete this.tasks[F];let W=this.abortControllers[F];return delete this.abortControllers[F],void(W&&W.abort())}if(q(self)||A.mustQueue)return this.tasks[F]=A,this.taskQueue.push(F),void this.invoker.trigger();this.processTask(F,A)}}process(){if(this.taskQueue.length===0)return;let R=this.taskQueue.shift(),A=this.tasks[R];delete this.tasks[R],this.taskQueue.length>0&&this.invoker.trigger(),A&&this.processTask(R,A)}processTask(R,A){return a(this,void 0,void 0,function*(){if(A.type==="<response>"){let te=this.resolveRejects[R];return delete this.resolveRejects[R],te?void(A.error?te.reject(Ua(A.error)):te.resolve(Ua(A.data))):void 0}if(!this.messageHandlers[A.type])return void this.completeTask(R,new Error(`Could not find a registered handler for ${A.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let F=Ua(A.data),W=new AbortController;this.abortControllers[R]=W;try{let te=yield this.messageHandlers[A.type](A.sourceMapId,F,W);this.completeTask(R,null,te)}catch(te){this.completeTask(R,te)}})}completeTask(R,A,F){let W=[];delete this.abortControllers[R];let te={id:R,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:A?La(A):null,data:La(F,W)};this.target.postMessage(te,{transfer:W})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},i.G=Ce,i.H=function(){var R=new yi(16);return yi!=Float32Array&&(R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[11]=0,R[12]=0,R[13]=0,R[14]=0),R[0]=1,R[5]=1,R[10]=1,R[15]=1,R},i.I=Uw,i.J=function(R,A,F){var W,te,fe,pe,Re,Ke,ft,Rt,er,ur,vr,kr,Dr=F[0],li=F[1],pi=F[2];return A===R?(R[12]=A[0]*Dr+A[4]*li+A[8]*pi+A[12],R[13]=A[1]*Dr+A[5]*li+A[9]*pi+A[13],R[14]=A[2]*Dr+A[6]*li+A[10]*pi+A[14],R[15]=A[3]*Dr+A[7]*li+A[11]*pi+A[15]):(te=A[1],fe=A[2],pe=A[3],Re=A[4],Ke=A[5],ft=A[6],Rt=A[7],er=A[8],ur=A[9],vr=A[10],kr=A[11],R[0]=W=A[0],R[1]=te,R[2]=fe,R[3]=pe,R[4]=Re,R[5]=Ke,R[6]=ft,R[7]=Rt,R[8]=er,R[9]=ur,R[10]=vr,R[11]=kr,R[12]=W*Dr+Re*li+er*pi+A[12],R[13]=te*Dr+Ke*li+ur*pi+A[13],R[14]=fe*Dr+ft*li+vr*pi+A[14],R[15]=pe*Dr+Rt*li+kr*pi+A[15]),R},i.K=function(R,A,F){var W=F[0],te=F[1],fe=F[2];return R[0]=A[0]*W,R[1]=A[1]*W,R[2]=A[2]*W,R[3]=A[3]*W,R[4]=A[4]*te,R[5]=A[5]*te,R[6]=A[6]*te,R[7]=A[7]*te,R[8]=A[8]*fe,R[9]=A[9]*fe,R[10]=A[10]*fe,R[11]=A[11]*fe,R[12]=A[12],R[13]=A[13],R[14]=A[14],R[15]=A[15],R},i.L=ui,i.M=function(R,A){let F={};for(let W=0;W<A.length;W++){let te=A[W];te in R&&(F[te]=R[te])}return F},i.N=pg,i.O=Zw,i.P=u,i.Q=OC,i.R=Ki,i.S=$v,i.T=Yu,i.U=m,i.V=b,i.W=j,i.X=ja,i.Y=Fe,i.Z=lb,i._=a,i.a=_e,i.a$=function(R,A){var F=R[0],W=R[1],te=R[2],fe=R[3],pe=R[4],Re=R[5],Ke=R[6],ft=R[7],Rt=R[8],er=R[9],ur=R[10],vr=R[11],kr=R[12],Dr=R[13],li=R[14],pi=R[15],vn=A[0],zi=A[1],ln=A[2],Tn=A[3],pa=A[4],ro=A[5],Vo=A[6],Xa=A[7],la=A[8],Mo=A[9],fo=A[10],lo=A[11],Wn=A[12],Ro=A[13],uo=A[14],$o=A[15];return Math.abs(F-vn)<=Zr*Math.max(1,Math.abs(F),Math.abs(vn))&&Math.abs(W-zi)<=Zr*Math.max(1,Math.abs(W),Math.abs(zi))&&Math.abs(te-ln)<=Zr*Math.max(1,Math.abs(te),Math.abs(ln))&&Math.abs(fe-Tn)<=Zr*Math.max(1,Math.abs(fe),Math.abs(Tn))&&Math.abs(pe-pa)<=Zr*Math.max(1,Math.abs(pe),Math.abs(pa))&&Math.abs(Re-ro)<=Zr*Math.max(1,Math.abs(Re),Math.abs(ro))&&Math.abs(Ke-Vo)<=Zr*Math.max(1,Math.abs(Ke),Math.abs(Vo))&&Math.abs(ft-Xa)<=Zr*Math.max(1,Math.abs(ft),Math.abs(Xa))&&Math.abs(Rt-la)<=Zr*Math.max(1,Math.abs(Rt),Math.abs(la))&&Math.abs(er-Mo)<=Zr*Math.max(1,Math.abs(er),Math.abs(Mo))&&Math.abs(ur-fo)<=Zr*Math.max(1,Math.abs(ur),Math.abs(fo))&&Math.abs(vr-lo)<=Zr*Math.max(1,Math.abs(vr),Math.abs(lo))&&Math.abs(kr-Wn)<=Zr*Math.max(1,Math.abs(kr),Math.abs(Wn))&&Math.abs(Dr-Ro)<=Zr*Math.max(1,Math.abs(Dr),Math.abs(Ro))&&Math.abs(li-uo)<=Zr*Math.max(1,Math.abs(li),Math.abs(uo))&&Math.abs(pi-$o)<=Zr*Math.max(1,Math.abs(pi),Math.abs($o))},i.a0=Ye,i.a1=xS,i.a2=Ue,i.a3=R=>{let A=window.document.createElement("video");return A.muted=!0,new Promise(F=>{A.onloadstart=()=>{F(A)};for(let W of R){let te=window.document.createElement("source");ke(W)||(A.crossOrigin="Anonymous"),te.src=W,A.appendChild(te)}})},i.a4=function(){return x++},i.a5=Ln,i.a6=R1,i.a7=Fc,i.a8=Sl,i.a9=bS,i.aA=function(R){if(R.type==="custom")return new mS(R);switch(R.type){case"background":return new iq(R);case"circle":return new fi(R);case"fill":return new _t(R);case"fill-extrusion":return new Lv(R);case"heatmap":return new sa(R);case"hillshade":return new Zs(R);case"line":return new dy(R);case"raster":return new ob(R);case"symbol":return new my(R)}},i.aB=g,i.aC=function(R,A){if(!R)return[{command:"setStyle",args:[A]}];let F=[];try{if(!mt(R.version,A.version))return[{command:"setStyle",args:[A]}];mt(R.center,A.center)||F.push({command:"setCenter",args:[A.center]}),mt(R.zoom,A.zoom)||F.push({command:"setZoom",args:[A.zoom]}),mt(R.bearing,A.bearing)||F.push({command:"setBearing",args:[A.bearing]}),mt(R.pitch,A.pitch)||F.push({command:"setPitch",args:[A.pitch]}),mt(R.sprite,A.sprite)||F.push({command:"setSprite",args:[A.sprite]}),mt(R.glyphs,A.glyphs)||F.push({command:"setGlyphs",args:[A.glyphs]}),mt(R.transition,A.transition)||F.push({command:"setTransition",args:[A.transition]}),mt(R.light,A.light)||F.push({command:"setLight",args:[A.light]}),mt(R.terrain,A.terrain)||F.push({command:"setTerrain",args:[A.terrain]}),mt(R.sky,A.sky)||F.push({command:"setSky",args:[A.sky]}),mt(R.projection,A.projection)||F.push({command:"setProjection",args:[A.projection]});let W={},te=[];(function(pe,Re,Ke,ft){let Rt;for(Rt in Re=Re||{},pe=pe||{})Object.prototype.hasOwnProperty.call(pe,Rt)&&(Object.prototype.hasOwnProperty.call(Re,Rt)||ct(Rt,Ke,ft));for(Rt in Re)Object.prototype.hasOwnProperty.call(Re,Rt)&&(Object.prototype.hasOwnProperty.call(pe,Rt)?mt(pe[Rt],Re[Rt])||(pe[Rt].type==="geojson"&&Re[Rt].type==="geojson"&&Vt(pe,Re,Rt)?Ht(Ke,{command:"setGeoJSONSourceData",args:[Rt,Re[Rt].data]}):ar(Rt,Re,Ke,ft)):at(Rt,Re,Ke))})(R.sources,A.sources,te,W);let fe=[];R.layers&&R.layers.forEach(pe=>{"source"in pe&&W[pe.source]?F.push({command:"removeLayer",args:[pe.id]}):fe.push(pe)}),F=F.concat(te),function(pe,Re,Ke){Re=Re||[];let ft=(pe=pe||[]).map(tt),Rt=Re.map(tt),er=pe.reduce(je,{}),ur=Re.reduce(je,{}),vr=ft.slice(),kr=Object.create(null),Dr,li,pi,vn,zi;for(let ln=0,Tn=0;ln<ft.length;ln++)Dr=ft[ln],Object.prototype.hasOwnProperty.call(ur,Dr)?Tn++:(Ht(Ke,{command:"removeLayer",args:[Dr]}),vr.splice(vr.indexOf(Dr,Tn),1));for(let ln=0,Tn=0;ln<Rt.length;ln++)Dr=Rt[Rt.length-1-ln],vr[vr.length-1-ln]!==Dr&&(Object.prototype.hasOwnProperty.call(er,Dr)?(Ht(Ke,{command:"removeLayer",args:[Dr]}),vr.splice(vr.lastIndexOf(Dr,vr.length-Tn),1)):Tn++,vn=vr[vr.length-ln],Ht(Ke,{command:"addLayer",args:[ur[Dr],vn]}),vr.splice(vr.length-ln,0,Dr),kr[Dr]=!0);for(let ln=0;ln<Rt.length;ln++)if(Dr=Rt[ln],li=er[Dr],pi=ur[Dr],!kr[Dr]&&!mt(li,pi))if(mt(li.source,pi.source)&&mt(li["source-layer"],pi["source-layer"])&&mt(li.type,pi.type)){for(zi in rr(li.layout,pi.layout,Ke,Dr,null,"setLayoutProperty"),rr(li.paint,pi.paint,Ke,Dr,null,"setPaintProperty"),mt(li.filter,pi.filter)||Ht(Ke,{command:"setFilter",args:[Dr,pi.filter]}),mt(li.minzoom,pi.minzoom)&&mt(li.maxzoom,pi.maxzoom)||Ht(Ke,{command:"setLayerZoomRange",args:[Dr,pi.minzoom,pi.maxzoom]}),li)Object.prototype.hasOwnProperty.call(li,zi)&&zi!=="layout"&&zi!=="paint"&&zi!=="filter"&&zi!=="metadata"&&zi!=="minzoom"&&zi!=="maxzoom"&&(zi.indexOf("paint.")===0?rr(li[zi],pi[zi],Ke,Dr,zi.slice(6),"setPaintProperty"):mt(li[zi],pi[zi])||Ht(Ke,{command:"setLayerProperty",args:[Dr,zi,pi[zi]]}));for(zi in pi)Object.prototype.hasOwnProperty.call(pi,zi)&&!Object.prototype.hasOwnProperty.call(li,zi)&&zi!=="layout"&&zi!=="paint"&&zi!=="filter"&&zi!=="metadata"&&zi!=="minzoom"&&zi!=="maxzoom"&&(zi.indexOf("paint.")===0?rr(li[zi],pi[zi],Ke,Dr,zi.slice(6),"setPaintProperty"):mt(li[zi],pi[zi])||Ht(Ke,{command:"setLayerProperty",args:[Dr,zi,pi[zi]]}))}else Ht(Ke,{command:"removeLayer",args:[Dr]}),vn=vr[vr.lastIndexOf(Dr)+1],Ht(Ke,{command:"addLayer",args:[pi,vn]})}(fe,A.layers,F)}catch(W){console.warn("Unable to compute style diff:",W),F=[{command:"setStyle",args:[A]}]}return F},i.aD=function(R){let A=[],F=R.id;return F===void 0&&A.push({message:`layers.${F}: missing required property "id"`}),R.render===void 0&&A.push({message:`layers.${F}: missing required method "render"`}),R.renderingMode&&R.renderingMode!=="2d"&&R.renderingMode!=="3d"&&A.push({message:`layers.${F}: property "renderingMode" must be either "2d" or "3d"`}),A},i.aE=function R(A,F){if(Array.isArray(A)){if(!Array.isArray(F)||A.length!==F.length)return!1;for(let W=0;W<A.length;W++)if(!R(A[W],F[W]))return!1;return!0}if(typeof A=="object"&&A!==null&&F!==null){if(typeof F!="object"||Object.keys(A).length!==Object.keys(F).length)return!1;for(let W in A)if(!R(A[W],F[W]))return!1;return!0}return A===F},i.aF=C,i.aG=S,i.aH=class extends Ti{constructor(R,A){super(R,A),this.current=0}set(R){this.current!==R&&(this.current=R,this.gl.uniform1i(this.location,R))}},i.aI=Qr,i.aJ=class extends Ti{constructor(R,A){super(R,A),this.current=Bn}set(R){if(R[12]!==this.current[12]||R[0]!==this.current[0])return this.current=R,void this.gl.uniformMatrix4fv(this.location,!1,R);for(let A=1;A<16;A++)if(R[A]!==this.current[A]){this.current=R,this.gl.uniformMatrix4fv(this.location,!1,R);break}}},i.aK=Pn,i.aL=kn,i.aM=ir,i.aN=class extends Ti{constructor(R,A){super(R,A),this.current=[0,0,0]}set(R){R[0]===this.current[0]&&R[1]===this.current[1]&&R[2]===this.current[2]||(this.current=R,this.gl.uniform3f(this.location,R[0],R[1],R[2]))}},i.aO=class extends Ti{constructor(R,A){super(R,A),this.current=[0,0]}set(R){R[0]===this.current[0]&&R[1]===this.current[1]||(this.current=R,this.gl.uniform2f(this.location,R[0],R[1]))}},i.aP=function(R,A,F,W,te,fe,pe){var Re=1/(A-F),Ke=1/(W-te),ft=1/(fe-pe);return R[0]=-2*Re,R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[5]=-2*Ke,R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[10]=2*ft,R[11]=0,R[12]=(A+F)*Re,R[13]=(te+W)*Ke,R[14]=(pe+fe)*ft,R[15]=1,R},i.aQ=Xi,i.aR=class extends nt{},i.aS=om,i.aT=class extends Wt{},i.aU=ia,i.aV=function(R){return R<=1?1:Math.pow(2,Math.ceil(Math.log(R)/Math.LN2))},i.aW=Cn,i.aX=wo,i.aY=se,i.aZ=class extends Ci{},i.a_=function(R,A){return R[0]===A[0]&&R[1]===A[1]&&R[2]===A[2]&&R[3]===A[3]&&R[4]===A[4]&&R[5]===A[5]&&R[6]===A[6]&&R[7]===A[7]&&R[8]===A[8]&&R[9]===A[9]&&R[10]===A[10]&&R[11]===A[11]&&R[12]===A[12]&&R[13]===A[13]&&R[14]===A[14]&&R[15]===A[15]},i.aa=function(R){let A={};if(R.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(F,W,te,fe)=>{let pe=te||fe;return A[W]=!pe||pe.toLowerCase(),""}),A["max-age"]){let F=parseInt(A["max-age"],10);isNaN(F)?delete A["max-age"]:A["max-age"]=F}return A},i.ab=function(R,A){let F=[];for(let W in R)W in A||F.push(W);return F},i.ac=M,i.ad=function(R,A,F){var W=Math.sin(F),te=Math.cos(F),fe=A[0],pe=A[1],Re=A[2],Ke=A[3],ft=A[4],Rt=A[5],er=A[6],ur=A[7];return A!==R&&(R[8]=A[8],R[9]=A[9],R[10]=A[10],R[11]=A[11],R[12]=A[12],R[13]=A[13],R[14]=A[14],R[15]=A[15]),R[0]=fe*te+ft*W,R[1]=pe*te+Rt*W,R[2]=Re*te+er*W,R[3]=Ke*te+ur*W,R[4]=ft*te-fe*W,R[5]=Rt*te-pe*W,R[6]=er*te-Re*W,R[7]=ur*te-Ke*W,R},i.ae=function(R){var A=new yi(16);return A[0]=R[0],A[1]=R[1],A[2]=R[2],A[3]=R[3],A[4]=R[4],A[5]=R[5],A[6]=R[6],A[7]=R[7],A[8]=R[8],A[9]=R[9],A[10]=R[10],A[11]=R[11],A[12]=R[12],A[13]=R[13],A[14]=R[14],A[15]=R[15],A},i.af=qn,i.ag=function(R,A){let F=0,W=0;if(R.kind==="constant")W=R.layoutSize;else if(R.kind!=="source"){let{interpolationType:te,minZoom:fe,maxZoom:pe}=R,Re=te?M(ko.interpolationFactor(te,A,fe,pe),0,1):0;R.kind==="camera"?W=Lo.number(R.minSize,R.maxSize,Re):F=Re}return{uSizeT:F,uSize:W}},i.ai=function(R,{uSize:A,uSizeT:F},{lowerSize:W,upperSize:te}){return R.kind==="source"?W/v0:R.kind==="composite"?Lo.number(W/v0,te/v0,F):A},i.aj=dS,i.ak=function(R,A,F,W){let te=A.y-R.y,fe=A.x-R.x,pe=W.y-F.y,Re=W.x-F.x,Ke=pe*fe-Re*te;if(Ke===0)return null;let ft=(Re*(R.y-F.y)-pe*(R.x-F.x))/Ke;return new u(R.x+ft*fe,R.y+ft*te)},i.al=HC,i.am=Sc,i.an=Ii,i.ao=function(R){let A=1/0,F=1/0,W=-1/0,te=-1/0;for(let fe of R)A=Math.min(A,fe.x),F=Math.min(F,fe.y),W=Math.max(W,fe.x),te=Math.max(te,fe.y);return[A,F,W,te]},i.ap=tu,i.ar=hS,i.as=function(R,A){var F=A[0],W=A[1],te=A[2],fe=A[3],pe=A[4],Re=A[5],Ke=A[6],ft=A[7],Rt=A[8],er=A[9],ur=A[10],vr=A[11],kr=A[12],Dr=A[13],li=A[14],pi=A[15],vn=F*Re-W*pe,zi=F*Ke-te*pe,ln=F*ft-fe*pe,Tn=W*Ke-te*Re,pa=W*ft-fe*Re,ro=te*ft-fe*Ke,Vo=Rt*Dr-er*kr,Xa=Rt*li-ur*kr,la=Rt*pi-vr*kr,Mo=er*li-ur*Dr,fo=er*pi-vr*Dr,lo=ur*pi-vr*li,Wn=vn*lo-zi*fo+ln*Mo+Tn*la-pa*Xa+ro*Vo;return Wn?(R[0]=(Re*lo-Ke*fo+ft*Mo)*(Wn=1/Wn),R[1]=(te*fo-W*lo-fe*Mo)*Wn,R[2]=(Dr*ro-li*pa+pi*Tn)*Wn,R[3]=(ur*pa-er*ro-vr*Tn)*Wn,R[4]=(Ke*la-pe*lo-ft*Xa)*Wn,R[5]=(F*lo-te*la+fe*Xa)*Wn,R[6]=(li*ln-kr*ro-pi*zi)*Wn,R[7]=(Rt*ro-ur*ln+vr*zi)*Wn,R[8]=(pe*fo-Re*la+ft*Vo)*Wn,R[9]=(W*la-F*fo-fe*Vo)*Wn,R[10]=(kr*pa-Dr*ln+pi*vn)*Wn,R[11]=(er*ln-Rt*pa-vr*vn)*Wn,R[12]=(Re*Xa-pe*Mo-Ke*Vo)*Wn,R[13]=(F*Mo-W*Xa+te*Vo)*Wn,R[14]=(Dr*zi-kr*Tn-li*vn)*Wn,R[15]=(Rt*Tn-er*zi+ur*vn)*Wn,R):null},i.at=AS,i.au=jw,i.av=SS,i.aw=function(){let R={},A=ce.$version;for(let F in ce.$root){let W=ce.$root[F];if(W.required){let te=null;te=F==="version"?A:W.type==="array"?[]:{},te!=null&&(R[F]=te)}}return R},i.ax=Zn,i.ay=re,i.az=function(R){R=R.slice();let A=Object.create(null);for(let F=0;F<R.length;F++)A[R[F].id]=R[F];for(let F=0;F<R.length;F++)"ref"in R[F]&&(R[F]=lt(R[F],A[R[F].ref]));return R},i.b=G,i.b0=function(R,A){return R[0]=A[0],R[1]=A[1],R[2]=A[2],R[3]=A[3],R[4]=A[4],R[5]=A[5],R[6]=A[6],R[7]=A[7],R[8]=A[8],R[9]=A[9],R[10]=A[10],R[11]=A[11],R[12]=A[12],R[13]=A[13],R[14]=A[14],R[15]=A[15],R},i.b1=function(R,A,F){return R[0]=A[0]*F[0],R[1]=A[1]*F[1],R[2]=A[2]*F[2],R[3]=A[3]*F[3],R},i.b2=function(R,A){return R[0]*A[0]+R[1]*A[1]+R[2]*A[2]+R[3]*A[3]},i.b3=T,i.b4=BC,i.b5=Yw,i.b6=function(R,A,F,W,te){var fe,pe=1/Math.tan(A/2);return R[0]=pe/F,R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[5]=pe,R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[11]=-1,R[12]=0,R[13]=0,R[15]=0,te!=null&&te!==1/0?(R[10]=(te+W)*(fe=1/(W-te)),R[14]=2*te*W*fe):(R[10]=-1,R[14]=-2*W),R},i.b7=function(R,A,F){var W=Math.sin(F),te=Math.cos(F),fe=A[4],pe=A[5],Re=A[6],Ke=A[7],ft=A[8],Rt=A[9],er=A[10],ur=A[11];return A!==R&&(R[0]=A[0],R[1]=A[1],R[2]=A[2],R[3]=A[3],R[12]=A[12],R[13]=A[13],R[14]=A[14],R[15]=A[15]),R[4]=fe*te+ft*W,R[5]=pe*te+Rt*W,R[6]=Re*te+er*W,R[7]=Ke*te+ur*W,R[8]=ft*te-fe*W,R[9]=Rt*te-pe*W,R[10]=er*te-Re*W,R[11]=ur*te-Ke*W,R},i.b8=p,i.b9=k,i.bA=Sd,i.bB=function(R){return R.message===ie},i.bC=ks,i.bD=ys,i.ba=function(R){return R*Math.PI/180},i.bb=function(R,A){let{x:F,y:W}=lb.fromLngLat(A);return!(R<0||R>25||W<0||W>=1||F<0||F>=1)},i.bc=function(R,A){return R[0]=A[0],R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[5]=A[1],R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[10]=A[2],R[11]=0,R[12]=0,R[13]=0,R[14]=0,R[15]=1,R},i.bd=class extends Mt{},i.be=_S,i.bf=fq,i.bh=ge,i.bi=function(R,A){_e.REGISTERED_PROTOCOLS[R]=A},i.bj=function(R){delete _e.REGISTERED_PROTOCOLS[R]},i.bk=function(R,A){let F={};for(let te=0;te<R.length;te++){let fe=A&&A[R[te].id]||Xh(R[te]);A&&(A[R[te].id]=fe);let pe=F[fe];pe||(pe=F[fe]=[]),pe.push(R[te])}let W=[];for(let te in F)W.push(F[te]);return W},i.bl=Fi,i.bm=UC,i.bn=yy,i.bo=Vw,i.bp=function(R){R.bucket.createArrays(),R.bucket.tilePixelRatio=ja/(512*R.bucket.overscaling),R.bucket.compareText={},R.bucket.iconsNeedLinear=!1;let A=R.bucket.layers[0],F=A.layout,W=A._unevaluatedLayout._values,te={layoutIconSize:W["icon-size"].possiblyEvaluate(new rs(R.bucket.zoom+1),R.canonical),layoutTextSize:W["text-size"].possiblyEvaluate(new rs(R.bucket.zoom+1),R.canonical),textMaxSize:W["text-size"].possiblyEvaluate(new rs(18))};if(R.bucket.textSizeData.kind==="composite"){let{minZoom:ft,maxZoom:Rt}=R.bucket.textSizeData;te.compositeTextSizes=[W["text-size"].possiblyEvaluate(new rs(ft),R.canonical),W["text-size"].possiblyEvaluate(new rs(Rt),R.canonical)]}if(R.bucket.iconSizeData.kind==="composite"){let{minZoom:ft,maxZoom:Rt}=R.bucket.iconSizeData;te.compositeIconSizes=[W["icon-size"].possiblyEvaluate(new rs(ft),R.canonical),W["icon-size"].possiblyEvaluate(new rs(Rt),R.canonical)]}let fe=F.get("text-line-height")*tu,pe=F.get("text-rotation-alignment")!=="viewport"&&F.get("symbol-placement")!=="point",Re=F.get("text-keep-upright"),Ke=F.get("text-size");for(let ft of R.bucket.features){let Rt=F.get("text-font").evaluate(ft,{},R.canonical).join(","),er=Ke.evaluate(ft,{},R.canonical),ur=te.layoutTextSize.evaluate(ft,{},R.canonical),vr=te.layoutIconSize.evaluate(ft,{},R.canonical),kr={horizontal:{},vertical:void 0},Dr=ft.text,li,pi=[0,0];if(Dr){let ln=Dr.toString(),Tn=F.get("text-letter-spacing").evaluate(ft,{},R.canonical)*tu,pa=bo(ln)?Tn:0,ro=F.get("text-anchor").evaluate(ft,{},R.canonical),Vo=JC(A,ft,R.canonical);if(!Vo){let fo=F.get("text-radial-offset").evaluate(ft,{},R.canonical);pi=fo?TS(ro,[fo*tu,_y]):F.get("text-offset").evaluate(ft,{},R.canonical).map(lo=>lo*tu)}let Xa=pe?"center":F.get("text-justify").evaluate(ft,{},R.canonical),la=F.get("symbol-placement")==="point"?F.get("text-max-width").evaluate(ft,{},R.canonical)*tu:1/0,Mo=()=>{R.bucket.allowVerticalPlacement&&Ka(ln)&&(kr.vertical=eb(Dr,R.glyphMap,R.glyphPositions,R.imagePositions,Rt,la,fe,ro,"left",pa,pi,i.ah.vertical,!0,ur,er))};if(!pe&&Vo){let fo=new Set;if(Xa==="auto")for(let Wn=0;Wn<Vo.values.length;Wn+=2)fo.add(AS(Vo.values[Wn]));else fo.add(Xa);let lo=!1;for(let Wn of fo)if(!kr.horizontal[Wn])if(lo)kr.horizontal[Wn]=kr.horizontal[0];else{let Ro=eb(Dr,R.glyphMap,R.glyphPositions,R.imagePositions,Rt,la,fe,"center",Wn,pa,pi,i.ah.horizontal,!1,ur,er);Ro&&(kr.horizontal[Wn]=Ro,lo=Ro.positionedLines.length===1)}Mo()}else{Xa==="auto"&&(Xa=AS(ro));let fo=eb(Dr,R.glyphMap,R.glyphPositions,R.imagePositions,Rt,la,fe,ro,Xa,pa,pi,i.ah.horizontal,!1,ur,er);fo&&(kr.horizontal[Xa]=fo),Mo(),Ka(ln)&&pe&&Re&&(kr.vertical=eb(Dr,R.glyphMap,R.glyphPositions,R.imagePositions,Rt,la,fe,ro,Xa,pa,pi,i.ah.vertical,!1,ur,er))}}let vn=!1;if(ft.icon&&ft.icon.name){let ln=R.imageMap[ft.icon.name];ln&&(li=tb(R.imagePositions[ft.icon.name],F.get("icon-offset").evaluate(ft,{},R.canonical),F.get("icon-anchor").evaluate(ft,{},R.canonical)),vn=!!ln.sdf,R.bucket.sdfIcons===void 0?R.bucket.sdfIcons=vn:R.bucket.sdfIcons!==vn&&E("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ln.pixelRatio!==R.bucket.pixelRatio||F.get("icon-rotate").constantOr(1)!==0)&&(R.bucket.iconsNeedLinear=!0))}let zi=QC(kr.horizontal)||kr.vertical;R.bucket.iconsInText=!!zi&&zi.iconsInText,(zi||li)&&uq(R.bucket,ft,kr,li,R.imageMap,te,ur,vr,pi,vn,R.canonical)}R.showCollisionBoxes&&R.bucket.generateCollisionDebugBuffers()},i.bq=Jv,i.br=Bt,i.bs=so,i.bt=_r,i.bu=uS,i.bv=class{constructor(R){this._marks={start:[R.url,"start"].join("#"),end:[R.url,"end"].join("#"),measure:R.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let R=performance.getEntriesByName(this._marks.measure);return R.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),R=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),R}},i.bw=function(R,A,F,W,te){return a(this,void 0,void 0,function*(){if(b())try{return yield j(R,A,F,W,te)}catch(fe){}return function(fe,pe,Re,Ke,ft){let Rt=fe.width,er=fe.height;N&&H||(N=new OffscreenCanvas(Rt,er),H=N.getContext("2d",{willReadFrequently:!0})),N.width=Rt,N.height=er,H.drawImage(fe,0,0,Rt,er);let ur=H.getImageData(pe,Re,Ke,ft);return H.clearRect(0,0,Rt,er),ur.data}(R,A,F,W,te)})},i.bx=NC,i.by=o,i.bz=s,i.c=ae,i.d=R=>a(void 0,void 0,void 0,function*(){if(R.byteLength===0)return createImageBitmap(new ImageData(1,1));let A=new Blob([new Uint8Array(R)],{type:"image/png"});try{return createImageBitmap(A)}catch(F){throw new Error(`Could not load image because of ${F.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),i.e=L,i.f=R=>new Promise((A,F)=>{let W=new Image;W.onload=()=>{A(W),URL.revokeObjectURL(W.src),W.onload=null,window.requestAnimationFrame(()=>{W.src=Z})},W.onerror=()=>F(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let te=new Blob([new Uint8Array(R)],{type:"image/png"});W.src=R.byteLength?URL.createObjectURL(te):Z}),i.g=Ee,i.h=(R,A)=>Se(L(R,{type:"json"}),A),i.i=q,i.j=me,i.k=Le,i.l=(R,A)=>Se(L(R,{type:"arrayBuffer"}),A),i.m=Se,i.n=function(R){return new uS(R).readFields(BQ,[])},i.o=aa,i.p=fS,i.q=ue,i.r=Wi,i.s=ke,i.t=Yi,i.u=Mi,i.v=ce,i.w=E,i.x=function([R,A,F]){return A+=90,A*=Math.PI/180,F*=Math.PI/180,{x:R*Math.cos(A)*Math.sin(F),y:R*Math.sin(A)*Math.sin(F),z:R*Math.cos(F)}},i.y=Lo,i.z=rs}),r("worker",["./shared"],function(i){"use strict";class a{constructor(Ge){this.keyCache={},Ge&&this.replace(Ge)}replace(Ge){this._layerConfigs={},this._layers={},this.update(Ge,[])}update(Ge,Je){for(let et of Ge){this._layerConfigs[et.id]=et;let xt=this._layers[et.id]=i.aA(et);xt._featureFilter=i.a7(xt.filter),this.keyCache[et.id]&&delete this.keyCache[et.id]}for(let et of Je)delete this.keyCache[et],delete this._layerConfigs[et],delete this._layers[et];this.familiesBySource={};let We=i.bk(Object.values(this._layerConfigs),this.keyCache);for(let et of We){let xt=et.map(Ir=>this._layers[Ir.id]),At=xt[0];if(At.visibility==="none")continue;let Kt=At.source||"",Qt=this.familiesBySource[Kt];Qt||(Qt=this.familiesBySource[Kt]={});let Mr=At.sourceLayer||"_geojsonTileLayer",Gr=Qt[Mr];Gr||(Gr=Qt[Mr]=[]),Gr.push(xt)}}}class o{constructor(Ge){let Je={},We=[];for(let Kt in Ge){let Qt=Ge[Kt],Mr=Je[Kt]={};for(let Gr in Qt){let Ir=Qt[+Gr];if(!Ir||Ir.bitmap.width===0||Ir.bitmap.height===0)continue;let Yr={x:0,y:0,w:Ir.bitmap.width+2,h:Ir.bitmap.height+2};We.push(Yr),Mr[Gr]={rect:Yr,metrics:Ir.metrics}}}let{w:et,h:xt}=i.p(We),At=new i.o({width:et||1,height:xt||1});for(let Kt in Ge){let Qt=Ge[Kt];for(let Mr in Qt){let Gr=Qt[+Mr];if(!Gr||Gr.bitmap.width===0||Gr.bitmap.height===0)continue;let Ir=Je[Kt][Mr].rect;i.o.copy(Gr.bitmap,At,{x:0,y:0},{x:Ir.x+1,y:Ir.y+1},Gr.bitmap)}}this.image=At,this.positions=Je}}i.bl("GlyphAtlas",o);class s{constructor(Ge){this.tileID=new i.S(Ge.tileID.overscaledZ,Ge.tileID.wrap,Ge.tileID.canonical.z,Ge.tileID.canonical.x,Ge.tileID.canonical.y),this.uid=Ge.uid,this.zoom=Ge.zoom,this.pixelRatio=Ge.pixelRatio,this.tileSize=Ge.tileSize,this.source=Ge.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Ge.showCollisionBoxes,this.collectResourceTiming=!!Ge.collectResourceTiming,this.returnDependencies=!!Ge.returnDependencies,this.promoteId=Ge.promoteId,this.inFlightDependencies=[]}parse(Ge,Je,We,et){return i._(this,void 0,void 0,function*(){this.status="parsing",this.data=Ge,this.collisionBoxArray=new i.a5;let xt=new i.bm(Object.keys(Ge.layers).sort()),At=new i.bn(this.tileID,this.promoteId);At.bucketLayerIDs=[];let Kt={},Qt={featureIndex:At,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:We},Mr=Je.familiesBySource[this.source];for(let Qn in Mr){let Vi=Ge.layers[Qn];if(!Vi)continue;Vi.version===1&&i.w(`Vector tile source "${this.source}" layer "${Qn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Kn=xt.encode(Qn),Jn=[];for(let Gt=0;Gt<Vi.length;Gt++){let wt=Vi.feature(Gt),tr=At.getId(wt,Qn);Jn.push({feature:wt,id:tr,index:Gt,sourceLayerIndex:Kn})}for(let Gt of Mr[Qn]){let wt=Gt[0];wt.source!==this.source&&i.w(`layer.source = ${wt.source} does not equal this.source = ${this.source}`),wt.minzoom&&this.zoom<Math.floor(wt.minzoom)||wt.maxzoom&&this.zoom>=wt.maxzoom||wt.visibility!=="none"&&(l(Gt,this.zoom,We),(Kt[wt.id]=wt.createBucket({index:At.bucketLayerIDs.length,layers:Gt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Kn,sourceID:this.source})).populate(Jn,Qt,this.tileID.canonical),At.bucketLayerIDs.push(Gt.map(tr=>tr.id)))}}let Gr=i.aF(Qt.glyphDependencies,Qn=>Object.keys(Qn).map(Number));this.inFlightDependencies.forEach(Qn=>Qn==null?void 0:Qn.abort()),this.inFlightDependencies=[];let Ir=Promise.resolve({});if(Object.keys(Gr).length){let Qn=new AbortController;this.inFlightDependencies.push(Qn),Ir=et.sendAsync({type:"GG",data:{stacks:Gr,source:this.source,tileID:this.tileID,type:"glyphs"}},Qn)}let Yr=Object.keys(Qt.iconDependencies),_i=Promise.resolve({});if(Yr.length){let Qn=new AbortController;this.inFlightDependencies.push(Qn),_i=et.sendAsync({type:"GI",data:{icons:Yr,source:this.source,tileID:this.tileID,type:"icons"}},Qn)}let Pi=Object.keys(Qt.patternDependencies),ai=Promise.resolve({});if(Pi.length){let Qn=new AbortController;this.inFlightDependencies.push(Qn),ai=et.sendAsync({type:"GI",data:{icons:Pi,source:this.source,tileID:this.tileID,type:"patterns"}},Qn)}let[mi,un,Fn]=yield Promise.all([Ir,_i,ai]),An=new o(mi),Hn=new i.bo(un,Fn);for(let Qn in Kt){let Vi=Kt[Qn];Vi instanceof i.a6?(l(Vi.layers,this.zoom,We),i.bp({bucket:Vi,glyphMap:mi,glyphPositions:An.positions,imageMap:un,imagePositions:Hn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Vi.hasPattern&&(Vi instanceof i.bq||Vi instanceof i.br||Vi instanceof i.bs)&&(l(Vi.layers,this.zoom,We),Vi.addFeatures(Qt,this.tileID.canonical,Hn.patternPositions))}return this.status="done",{buckets:Object.values(Kt).filter(Qn=>!Qn.isEmpty()),featureIndex:At,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:An.image,imageAtlas:Hn,glyphMap:this.returnDependencies?mi:null,iconMap:this.returnDependencies?un:null,glyphPositions:this.returnDependencies?An.positions:null}})}}function l(gt,Ge,Je){let We=new i.z(Ge);for(let et of gt)et.recalculate(We,Je)}class u{constructor(Ge,Je,We){this.actor=Ge,this.layerIndex=Je,this.availableImages=We,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Ge,Je){return i._(this,void 0,void 0,function*(){let We=yield i.l(Ge.request,Je);try{return{vectorTile:new i.bt.VectorTile(new i.bu(We.data)),rawData:We.data,cacheControl:We.cacheControl,expires:We.expires}}catch(et){let xt=new Uint8Array(We.data),At=`Unable to parse the tile at ${Ge.request.url}, `;throw At+=xt[0]===31&&xt[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${et.message}`,new Error(At)}})}loadTile(Ge){return i._(this,void 0,void 0,function*(){let Je=Ge.uid,We=!!(Ge&&Ge.request&&Ge.request.collectResourceTiming)&&new i.bv(Ge.request),et=new s(Ge);this.loading[Je]=et;let xt=new AbortController;et.abort=xt;try{let At=yield this.loadVectorTile(Ge,xt);if(delete this.loading[Je],!At)return null;let Kt=At.rawData,Qt={};At.expires&&(Qt.expires=At.expires),At.cacheControl&&(Qt.cacheControl=At.cacheControl);let Mr={};if(We){let Ir=We.finish();Ir&&(Mr.resourceTiming=JSON.parse(JSON.stringify(Ir)))}et.vectorTile=At.vectorTile;let Gr=et.parse(At.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[Je]=et,this.fetching[Je]={rawTileData:Kt,cacheControl:Qt,resourceTiming:Mr};try{let Ir=yield Gr;return i.e({rawTileData:Kt.slice(0)},Ir,Qt,Mr)}finally{delete this.fetching[Je]}}catch(At){throw delete this.loading[Je],et.status="done",this.loaded[Je]=et,At}})}reloadTile(Ge){return i._(this,void 0,void 0,function*(){let Je=Ge.uid;if(!this.loaded||!this.loaded[Je])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let We=this.loaded[Je];if(We.showCollisionBoxes=Ge.showCollisionBoxes,We.status==="parsing"){let et=yield We.parse(We.vectorTile,this.layerIndex,this.availableImages,this.actor),xt;if(this.fetching[Je]){let{rawTileData:At,cacheControl:Kt,resourceTiming:Qt}=this.fetching[Je];delete this.fetching[Je],xt=i.e({rawTileData:At.slice(0)},et,Kt,Qt)}else xt=et;return xt}if(We.status==="done"&&We.vectorTile)return We.parse(We.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(Ge){return i._(this,void 0,void 0,function*(){let Je=this.loading,We=Ge.uid;Je&&Je[We]&&Je[We].abort&&(Je[We].abort.abort(),delete Je[We])})}removeTile(Ge){return i._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Ge.uid]&&delete this.loaded[Ge.uid]})}}class c{constructor(){this.loaded={}}loadTile(Ge){return i._(this,void 0,void 0,function*(){let{uid:Je,encoding:We,rawImageData:et,redFactor:xt,greenFactor:At,blueFactor:Kt,baseShift:Qt}=Ge,Mr=et.width+2,Gr=et.height+2,Ir=i.b(et)?new i.R({width:Mr,height:Gr},yield i.bw(et,-1,-1,Mr,Gr)):et,Yr=new i.bx(Je,Ir,We,xt,At,Kt,Qt);return this.loaded=this.loaded||{},this.loaded[Je]=Yr,Yr})}removeTile(Ge){let Je=this.loaded,We=Ge.uid;Je&&Je[We]&&delete Je[We]}}function f(gt,Ge){if(gt.length!==0){h(gt[0],Ge);for(var Je=1;Je<gt.length;Je++)h(gt[Je],!Ge)}}function h(gt,Ge){for(var Je=0,We=0,et=0,xt=gt.length,At=xt-1;et<xt;At=et++){var Kt=(gt[et][0]-gt[At][0])*(gt[At][1]+gt[et][1]),Qt=Je+Kt;We+=Math.abs(Je)>=Math.abs(Kt)?Je-Qt+Kt:Kt-Qt+Je,Je=Qt}Je+We>=0!=!!Ge&>.reverse()}var d=i.by(function gt(Ge,Je){var We,et=Ge&&Ge.type;if(et==="FeatureCollection")for(We=0;We<Ge.features.length;We++)gt(Ge.features[We],Je);else if(et==="GeometryCollection")for(We=0;We<Ge.geometries.length;We++)gt(Ge.geometries[We],Je);else if(et==="Feature")gt(Ge.geometry,Je);else if(et==="Polygon")f(Ge.coordinates,Je);else if(et==="MultiPolygon")for(We=0;We<Ge.coordinates.length;We++)f(Ge.coordinates[We],Je);return Ge});let v=i.bt.VectorTileFeature.prototype.toGeoJSON;var m={exports:{}},b=i.bz,p=i.bt.VectorTileFeature,k=M;function M(gt,Ge){this.options=Ge||{},this.features=gt,this.length=gt.length}function T(gt,Ge){this.id=typeof gt.id=="number"?gt.id:void 0,this.type=gt.type,this.rawGeometry=gt.type===1?[gt.geometry]:gt.geometry,this.properties=gt.tags,this.extent=Ge||4096}M.prototype.feature=function(gt){return new T(this.features[gt],this.options.extent)},T.prototype.loadGeometry=function(){var gt=this.rawGeometry;this.geometry=[];for(var Ge=0;Ge<gt.length;Ge++){for(var Je=gt[Ge],We=[],et=0;et<Je.length;et++)We.push(new b(Je[et][0],Je[et][1]));this.geometry.push(We)}return this.geometry},T.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var gt=this.geometry,Ge=1/0,Je=-1/0,We=1/0,et=-1/0,xt=0;xt<gt.length;xt++)for(var At=gt[xt],Kt=0;Kt<At.length;Kt++){var Qt=At[Kt];Ge=Math.min(Ge,Qt.x),Je=Math.max(Je,Qt.x),We=Math.min(We,Qt.y),et=Math.max(et,Qt.y)}return[Ge,We,Je,et]},T.prototype.toGeoJSON=p.prototype.toGeoJSON;var L=i.bA,x=k;function C(gt){var Ge=new L;return function(Je,We){for(var et in Je.layers)We.writeMessage(3,S,Je.layers[et])}(gt,Ge),Ge.finish()}function S(gt,Ge){var Je;Ge.writeVarintField(15,gt.version||1),Ge.writeStringField(1,gt.name||""),Ge.writeVarintField(5,gt.extent||4096);var We={keys:[],values:[],keycache:{},valuecache:{}};for(Je=0;Je<gt.length;Je++)We.feature=gt.feature(Je),Ge.writeMessage(2,g,We);var et=We.keys;for(Je=0;Je<et.length;Je++)Ge.writeStringField(3,et[Je]);var xt=We.values;for(Je=0;Je<xt.length;Je++)Ge.writeMessage(4,V,xt[Je])}function g(gt,Ge){var Je=gt.feature;Je.id!==void 0&&Ge.writeVarintField(1,Je.id),Ge.writeMessage(2,P,gt),Ge.writeVarintField(3,Je.type),Ge.writeMessage(4,q,Je)}function P(gt,Ge){var Je=gt.feature,We=gt.keys,et=gt.values,xt=gt.keycache,At=gt.valuecache;for(var Kt in Je.properties){var Qt=Je.properties[Kt],Mr=xt[Kt];if(Qt!==null){Mr===void 0&&(We.push(Kt),xt[Kt]=Mr=We.length-1),Ge.writeVarint(Mr);var Gr=typeof Qt;Gr!=="string"&&Gr!=="boolean"&&Gr!=="number"&&(Qt=JSON.stringify(Qt));var Ir=Gr+":"+Qt,Yr=At[Ir];Yr===void 0&&(et.push(Qt),At[Ir]=Yr=et.length-1),Ge.writeVarint(Yr)}}}function E(gt,Ge){return(Ge<<3)+(7>)}function z(gt){return gt<<1^gt>>31}function q(gt,Ge){for(var Je=gt.loadGeometry(),We=gt.type,et=0,xt=0,At=Je.length,Kt=0;Kt<At;Kt++){var Qt=Je[Kt],Mr=1;We===1&&(Mr=Qt.length),Ge.writeVarint(E(1,Mr));for(var Gr=We===3?Qt.length-1:Qt.length,Ir=0;Ir<Gr;Ir++){Ir===1&&We!==1&&Ge.writeVarint(E(2,Gr-1));var Yr=Qt[Ir].x-et,_i=Qt[Ir].y-xt;Ge.writeVarint(z(Yr)),Ge.writeVarint(z(_i)),et+=Yr,xt+=_i}We===3&&Ge.writeVarint(E(7,1))}}function V(gt,Ge){var Je=typeof gt;Je==="string"?Ge.writeStringField(1,gt):Je==="boolean"?Ge.writeBooleanField(7,gt):Je==="number"&&(gt%1!=0?Ge.writeDoubleField(3,gt):gt<0?Ge.writeSVarintField(6,gt):Ge.writeVarintField(5,gt))}m.exports=C,m.exports.fromVectorTileJs=C,m.exports.fromGeojsonVt=function(gt,Ge){Ge=Ge||{};var Je={};for(var We in gt)Je[We]=new x(gt[We].features,Ge),Je[We].name=We,Je[We].version=Ge.version,Je[We].extent=Ge.extent;return C({layers:Je})},m.exports.GeoJSONWrapper=x;var G=i.by(m.exports);let Z={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:gt=>gt},j=Math.fround||(N=new Float32Array(1),gt=>(N[0]=+gt,N[0]));var N;let H=3,ie=5,ae=6;class _e{constructor(Ge){this.options=Object.assign(Object.create(Z),Ge),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Ge){let{log:Je,minZoom:We,maxZoom:et}=this.options;Je&&console.time("total time");let xt=`prepare ${Ge.length} points`;Je&&console.time(xt),this.points=Ge;let At=[];for(let Qt=0;Qt<Ge.length;Qt++){let Mr=Ge[Qt];if(!Mr.geometry)continue;let[Gr,Ir]=Mr.geometry.coordinates,Yr=j(ge(Gr)),_i=j(re(Ir));At.push(Yr,_i,1/0,Qt,-1,1),this.options.reduce&&At.push(0)}let Kt=this.trees[et+1]=this._createTree(At);Je&&console.timeEnd(xt);for(let Qt=et;Qt>=We;Qt--){let Mr=+Date.now();Kt=this.trees[Qt]=this._createTree(this._cluster(Kt,Qt)),Je&&console.log("z%d: %d clusters in %dms",Qt,Kt.numItems,+Date.now()-Mr)}return Je&&console.timeEnd("total time"),this}getClusters(Ge,Je){let We=((Ge[0]+180)%360+360)%360-180,et=Math.max(-90,Math.min(90,Ge[1])),xt=Ge[2]===180?180:((Ge[2]+180)%360+360)%360-180,At=Math.max(-90,Math.min(90,Ge[3]));if(Ge[2]-Ge[0]>=360)We=-180,xt=180;else if(We>xt){let Ir=this.getClusters([We,et,180,At],Je),Yr=this.getClusters([-180,et,xt,At],Je);return Ir.concat(Yr)}let Kt=this.trees[this._limitZoom(Je)],Qt=Kt.range(ge(We),re(At),ge(xt),re(et)),Mr=Kt.data,Gr=[];for(let Ir of Qt){let Yr=this.stride*Ir;Gr.push(Mr[Yr+ie]>1?Ee(Mr,Yr,this.clusterProps):this.points[Mr[Yr+H]])}return Gr}getChildren(Ge){let Je=this._getOriginId(Ge),We=this._getOriginZoom(Ge),et="No cluster with the specified id.",xt=this.trees[We];if(!xt)throw new Error(et);let At=xt.data;if(Je*this.stride>=At.length)throw new Error(et);let Kt=this.options.radius/(this.options.extent*Math.pow(2,We-1)),Qt=xt.within(At[Je*this.stride],At[Je*this.stride+1],Kt),Mr=[];for(let Gr of Qt){let Ir=Gr*this.stride;At[Ir+4]===Ge&&Mr.push(At[Ir+ie]>1?Ee(At,Ir,this.clusterProps):this.points[At[Ir+H]])}if(Mr.length===0)throw new Error(et);return Mr}getLeaves(Ge,Je,We){let et=[];return this._appendLeaves(et,Ge,Je=Je||10,We=We||0,0),et}getTile(Ge,Je,We){let et=this.trees[this._limitZoom(Ge)],xt=Math.pow(2,Ge),{extent:At,radius:Kt}=this.options,Qt=Kt/At,Mr=(We-Qt)/xt,Gr=(We+1+Qt)/xt,Ir={features:[]};return this._addTileFeatures(et.range((Je-Qt)/xt,Mr,(Je+1+Qt)/xt,Gr),et.data,Je,We,xt,Ir),Je===0&&this._addTileFeatures(et.range(1-Qt/xt,Mr,1,Gr),et.data,xt,We,xt,Ir),Je===xt-1&&this._addTileFeatures(et.range(0,Mr,Qt/xt,Gr),et.data,-1,We,xt,Ir),Ir.features.length?Ir:null}getClusterExpansionZoom(Ge){let Je=this._getOriginZoom(Ge)-1;for(;Je<=this.options.maxZoom;){let We=this.getChildren(Ge);if(Je++,We.length!==1)break;Ge=We[0].properties.cluster_id}return Je}_appendLeaves(Ge,Je,We,et,xt){let At=this.getChildren(Je);for(let Kt of At){let Qt=Kt.properties;if(Qt&&Qt.cluster?xt+Qt.point_count<=et?xt+=Qt.point_count:xt=this._appendLeaves(Ge,Qt.cluster_id,We,et,xt):xt<et?xt++:Ge.push(Kt),Ge.length===We)break}return xt}_createTree(Ge){let Je=new i.av(Ge.length/this.stride|0,this.options.nodeSize,Float32Array);for(let We=0;We<Ge.length;We+=this.stride)Je.add(Ge[We],Ge[We+1]);return Je.finish(),Je.data=Ge,Je}_addTileFeatures(Ge,Je,We,et,xt,At){for(let Kt of Ge){let Qt=Kt*this.stride,Mr=Je[Qt+ie]>1,Gr,Ir,Yr;if(Mr)Gr=Ce(Je,Qt,this.clusterProps),Ir=Je[Qt],Yr=Je[Qt+1];else{let ai=this.points[Je[Qt+H]];Gr=ai.properties;let[mi,un]=ai.geometry.coordinates;Ir=ge(mi),Yr=re(un)}let _i={type:1,geometry:[[Math.round(this.options.extent*(Ir*xt-We)),Math.round(this.options.extent*(Yr*xt-et))]],tags:Gr},Pi;Pi=Mr||this.options.generateId?Je[Qt+H]:this.points[Je[Qt+H]].id,Pi!==void 0&&(_i.id=Pi),At.features.push(_i)}}_limitZoom(Ge){return Math.max(this.options.minZoom,Math.min(Math.floor(+Ge),this.options.maxZoom+1))}_cluster(Ge,Je){let{radius:We,extent:et,reduce:xt,minPoints:At}=this.options,Kt=We/(et*Math.pow(2,Je)),Qt=Ge.data,Mr=[],Gr=this.stride;for(let Ir=0;Ir<Qt.length;Ir+=Gr){if(Qt[Ir+2]<=Je)continue;Qt[Ir+2]=Je;let Yr=Qt[Ir],_i=Qt[Ir+1],Pi=Ge.within(Qt[Ir],Qt[Ir+1],Kt),ai=Qt[Ir+ie],mi=ai;for(let un of Pi){let Fn=un*Gr;Qt[Fn+2]>Je&&(mi+=Qt[Fn+ie])}if(mi>ai&&mi>=At){let un,Fn=Yr*ai,An=_i*ai,Hn=-1,Qn=((Ir/Gr|0)<<5)+(Je+1)+this.points.length;for(let Vi of Pi){let Kn=Vi*Gr;if(Qt[Kn+2]<=Je)continue;Qt[Kn+2]=Je;let Jn=Qt[Kn+ie];Fn+=Qt[Kn]*Jn,An+=Qt[Kn+1]*Jn,Qt[Kn+4]=Qn,xt&&(un||(un=this._map(Qt,Ir,!0),Hn=this.clusterProps.length,this.clusterProps.push(un)),xt(un,this._map(Qt,Kn)))}Qt[Ir+4]=Qn,Mr.push(Fn/mi,An/mi,1/0,Qn,-1,mi),xt&&Mr.push(Hn)}else{for(let un=0;un<Gr;un++)Mr.push(Qt[Ir+un]);if(mi>1)for(let un of Pi){let Fn=un*Gr;if(!(Qt[Fn+2]<=Je)){Qt[Fn+2]=Je;for(let An=0;An<Gr;An++)Mr.push(Qt[Fn+An])}}}}return Mr}_getOriginId(Ge){return Ge-this.points.length>>5}_getOriginZoom(Ge){return(Ge-this.points.length)%32}_map(Ge,Je,We){if(Ge[Je+ie]>1){let At=this.clusterProps[Ge[Je+ae]];return We?Object.assign({},At):At}let et=this.points[Ge[Je+H]].properties,xt=this.options.map(et);return We&&xt===et?Object.assign({},xt):xt}}function Ee(gt,Ge,Je){return{type:"Feature",id:gt[Ge+H],properties:Ce(gt,Ge,Je),geometry:{type:"Point",coordinates:[(We=gt[Ge],360*(We-.5)),Se(gt[Ge+1])]}};var We}function Ce(gt,Ge,Je){let We=gt[Ge+ie],et=We>=1e4?`${Math.round(We/1e3)}k`:We>=1e3?Math.round(We/100)/10+"k":We,xt=gt[Ge+ae],At=xt===-1?{}:Object.assign({},Je[xt]);return Object.assign(At,{cluster:!0,cluster_id:gt[Ge+H],point_count:We,point_count_abbreviated:et})}function ge(gt){return gt/360+.5}function re(gt){let Ge=Math.sin(gt*Math.PI/180),Je=.5-.25*Math.log((1+Ge)/(1-Ge))/Math.PI;return Je<0?0:Je>1?1:Je}function Se(gt){let Ge=(180-360*gt)*Math.PI/180;return 360*Math.atan(Math.exp(Ge))/Math.PI-90}function ke(gt,Ge,Je,We){let et=We,xt=Ge+(Je-Ge>>1),At,Kt=Je-Ge,Qt=gt[Ge],Mr=gt[Ge+1],Gr=gt[Je],Ir=gt[Je+1];for(let Yr=Ge+3;Yr<Je;Yr+=3){let _i=be(gt[Yr],gt[Yr+1],Qt,Mr,Gr,Ir);if(_i>et)At=Yr,et=_i;else if(_i===et){let Pi=Math.abs(Yr-xt);Pi<Kt&&(At=Yr,Kt=Pi)}}et>We&&(At-Ge>3&&ke(gt,Ge,At,We),gt[At+2]=et,Je-At>3&&ke(gt,At,Je,We))}function be(gt,Ge,Je,We,et,xt){let At=et-Je,Kt=xt-We;if(At!==0||Kt!==0){let Qt=((gt-Je)*At+(Ge-We)*Kt)/(At*At+Kt*Kt);Qt>1?(Je=et,We=xt):Qt>0&&(Je+=At*Qt,We+=Kt*Qt)}return At=gt-Je,Kt=Ge-We,At*At+Kt*Kt}function Be(gt,Ge,Je,We){let et={id:gt==null?null:gt,type:Ge,geometry:Je,tags:We,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Ge==="Point"||Ge==="MultiPoint"||Ge==="LineString")Le(et,Je);else if(Ge==="Polygon")Le(et,Je[0]);else if(Ge==="MultiLineString")for(let xt of Je)Le(et,xt);else if(Ge==="MultiPolygon")for(let xt of Je)Le(et,xt[0]);return et}function Le(gt,Ge){for(let Je=0;Je<Ge.length;Je+=3)gt.minX=Math.min(gt.minX,Ge[Je]),gt.minY=Math.min(gt.minY,Ge[Je+1]),gt.maxX=Math.max(gt.maxX,Ge[Je]),gt.maxY=Math.max(gt.maxY,Ge[Je+1])}function me(gt,Ge,Je,We){if(!Ge.geometry)return;let et=Ge.geometry.coordinates;if(et&&et.length===0)return;let xt=Ge.geometry.type,At=Math.pow(Je.tolerance/((1<<Je.maxZoom)*Je.extent),2),Kt=[],Qt=Ge.id;if(Je.promoteId?Qt=Ge.properties[Je.promoteId]:Je.generateId&&(Qt=We||0),xt==="Point")Pe(et,Kt);else if(xt==="MultiPoint")for(let Mr of et)Pe(Mr,Kt);else if(xt==="LineString")ce(et,Kt,At,!1);else if(xt==="MultiLineString"){if(Je.lineMetrics){for(let Mr of et)Kt=[],ce(Mr,Kt,At,!1),gt.push(Be(Qt,"LineString",Kt,Ge.properties));return}He(et,Kt,At,!1)}else if(xt==="Polygon")He(et,Kt,At,!0);else{if(xt!=="MultiPolygon"){if(xt==="GeometryCollection"){for(let Mr of Ge.geometry.geometries)me(gt,{id:Qt,geometry:Mr,properties:Ge.properties},Je,We);return}throw new Error("Input data is not a valid GeoJSON object.")}for(let Mr of et){let Gr=[];He(Mr,Gr,At,!0),Kt.push(Gr)}}gt.push(Be(Qt,xt,Kt,Ge.properties))}function Pe(gt,Ge){Ge.push(lt(gt[0]),mt(gt[1]),0)}function ce(gt,Ge,Je,We){let et,xt,At=0;for(let Qt=0;Qt<gt.length;Qt++){let Mr=lt(gt[Qt][0]),Gr=mt(gt[Qt][1]);Ge.push(Mr,Gr,0),Qt>0&&(At+=We?(et*Gr-Mr*xt)/2:Math.sqrt(Math.pow(Mr-et,2)+Math.pow(Gr-xt,2))),et=Mr,xt=Gr}let Kt=Ge.length-3;Ge[2]=1,ke(Ge,0,Kt,Je),Ge[Kt+2]=1,Ge.size=Math.abs(At),Ge.start=0,Ge.end=Ge.size}function He(gt,Ge,Je,We){for(let et=0;et<gt.length;et++){let xt=[];ce(gt[et],xt,Je,We),Ge.push(xt)}}function lt(gt){return gt/360+.5}function mt(gt){let Ge=Math.sin(gt*Math.PI/180),Je=.5-.25*Math.log((1+Ge)/(1-Ge))/Math.PI;return Je<0?0:Je>1?1:Je}function Ht(gt,Ge,Je,We,et,xt,At,Kt){if(We/=Ge,xt>=(Je/=Ge)&&At<We)return gt;if(At<Je||xt>=We)return null;let Qt=[];for(let Mr of gt){let Gr=Mr.geometry,Ir=Mr.type,Yr=et===0?Mr.minX:Mr.minY,_i=et===0?Mr.maxX:Mr.maxY;if(Yr>=Je&&_i<We){Qt.push(Mr);continue}if(_i<Je||Yr>=We)continue;let Pi=[];if(Ir==="Point"||Ir==="MultiPoint")at(Gr,Pi,Je,We,et);else if(Ir==="LineString")ct(Gr,Pi,Je,We,et,!1,Kt.lineMetrics);else if(Ir==="MultiLineString")Vt(Gr,Pi,Je,We,et,!1);else if(Ir==="Polygon")Vt(Gr,Pi,Je,We,et,!0);else if(Ir==="MultiPolygon")for(let ai of Gr){let mi=[];Vt(ai,mi,Je,We,et,!0),mi.length&&Pi.push(mi)}if(Pi.length){if(Kt.lineMetrics&&Ir==="LineString"){for(let ai of Pi)Qt.push(Be(Mr.id,Ir,ai,Mr.tags));continue}Ir!=="LineString"&&Ir!=="MultiLineString"||(Pi.length===1?(Ir="LineString",Pi=Pi[0]):Ir="MultiLineString"),Ir!=="Point"&&Ir!=="MultiPoint"||(Ir=Pi.length===3?"Point":"MultiPoint"),Qt.push(Be(Mr.id,Ir,Pi,Mr.tags))}}return Qt.length?Qt:null}function at(gt,Ge,Je,We,et){for(let xt=0;xt<gt.length;xt+=3){let At=gt[xt+et];At>=Je&&At<=We&&rr(Ge,gt[xt],gt[xt+1],gt[xt+2])}}function ct(gt,Ge,Je,We,et,xt,At){let Kt=ar(gt),Qt=et===0?tt:je,Mr,Gr,Ir=gt.start;for(let mi=0;mi<gt.length-3;mi+=3){let un=gt[mi],Fn=gt[mi+1],An=gt[mi+2],Hn=gt[mi+3],Qn=gt[mi+4],Vi=et===0?un:Fn,Kn=et===0?Hn:Qn,Jn=!1;At&&(Mr=Math.sqrt(Math.pow(un-Hn,2)+Math.pow(Fn-Qn,2))),Vi<Je?Kn>Je&&(Gr=Qt(Kt,un,Fn,Hn,Qn,Je),At&&(Kt.start=Ir+Mr*Gr)):Vi>We?Kn<We&&(Gr=Qt(Kt,un,Fn,Hn,Qn,We),At&&(Kt.start=Ir+Mr*Gr)):rr(Kt,un,Fn,An),Kn<Je&&Vi>=Je&&(Gr=Qt(Kt,un,Fn,Hn,Qn,Je),Jn=!0),Kn>We&&Vi<=We&&(Gr=Qt(Kt,un,Fn,Hn,Qn,We),Jn=!0),!xt&&Jn&&(At&&(Kt.end=Ir+Mr*Gr),Ge.push(Kt),Kt=ar(gt)),At&&(Ir+=Mr)}let Yr=gt.length-3,_i=gt[Yr],Pi=gt[Yr+1],ai=et===0?_i:Pi;ai>=Je&&ai<=We&&rr(Kt,_i,Pi,gt[Yr+2]),Yr=Kt.length-3,xt&&Yr>=3&&(Kt[Yr]!==Kt[0]||Kt[Yr+1]!==Kt[1])&&rr(Kt,Kt[0],Kt[1],Kt[2]),Kt.length&&Ge.push(Kt)}function ar(gt){let Ge=[];return Ge.size=gt.size,Ge.start=gt.start,Ge.end=gt.end,Ge}function Vt(gt,Ge,Je,We,et,xt){for(let At of gt)ct(At,Ge,Je,We,et,xt,!1)}function rr(gt,Ge,Je,We){gt.push(Ge,Je,We)}function tt(gt,Ge,Je,We,et,xt){let At=(xt-Ge)/(We-Ge);return rr(gt,xt,Je+(et-Je)*At,1),At}function je(gt,Ge,Je,We,et,xt){let At=(xt-Je)/(et-Je);return rr(gt,Ge+(We-Ge)*At,xt,1),At}function Ue(gt,Ge){let Je=[];for(let We=0;We<gt.length;We++){let et=gt[We],xt=et.type,At;if(xt==="Point"||xt==="MultiPoint"||xt==="LineString")At=Ae(et.geometry,Ge);else if(xt==="MultiLineString"||xt==="Polygon"){At=[];for(let Kt of et.geometry)At.push(Ae(Kt,Ge))}else if(xt==="MultiPolygon"){At=[];for(let Kt of et.geometry){let Qt=[];for(let Mr of Kt)Qt.push(Ae(Mr,Ge));At.push(Qt)}}Je.push(Be(et.id,xt,At,et.tags))}return Je}function Ae(gt,Ge){let Je=[];Je.size=gt.size,gt.start!==void 0&&(Je.start=gt.start,Je.end=gt.end);for(let We=0;We<gt.length;We+=3)Je.push(gt[We]+Ge,gt[We+1],gt[We+2]);return Je}function rt(gt,Ge){if(gt.transformed)return gt;let Je=1<<gt.z,We=gt.x,et=gt.y;for(let xt of gt.features){let At=xt.geometry,Kt=xt.type;if(xt.geometry=[],Kt===1)for(let Qt=0;Qt<At.length;Qt+=2)xt.geometry.push(St(At[Qt],At[Qt+1],Ge,Je,We,et));else for(let Qt=0;Qt<At.length;Qt++){let Mr=[];for(let Gr=0;Gr<At[Qt].length;Gr+=2)Mr.push(St(At[Qt][Gr],At[Qt][Gr+1],Ge,Je,We,et));xt.geometry.push(Mr)}}return gt.transformed=!0,gt}function St(gt,Ge,Je,We,et,xt){return[Math.round(Je*(gt*We-et)),Math.round(Je*(Ge*We-xt))]}function Tt(gt,Ge,Je,We,et){let xt=Ge===et.maxZoom?0:et.tolerance/((1<<Ge)*et.extent),At={features:[],numPoints:0,numSimplified:0,numFeatures:gt.length,source:null,x:Je,y:We,z:Ge,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let Kt of gt)dt(At,Kt,xt,et);return At}function dt(gt,Ge,Je,We){let et=Ge.geometry,xt=Ge.type,At=[];if(gt.minX=Math.min(gt.minX,Ge.minX),gt.minY=Math.min(gt.minY,Ge.minY),gt.maxX=Math.max(gt.maxX,Ge.maxX),gt.maxY=Math.max(gt.maxY,Ge.maxY),xt==="Point"||xt==="MultiPoint")for(let Kt=0;Kt<et.length;Kt+=3)At.push(et[Kt],et[Kt+1]),gt.numPoints++,gt.numSimplified++;else if(xt==="LineString")Et(At,et,gt,Je,!1,!1);else if(xt==="MultiLineString"||xt==="Polygon")for(let Kt=0;Kt<et.length;Kt++)Et(At,et[Kt],gt,Je,xt==="Polygon",Kt===0);else if(xt==="MultiPolygon")for(let Kt=0;Kt<et.length;Kt++){let Qt=et[Kt];for(let Mr=0;Mr<Qt.length;Mr++)Et(At,Qt[Mr],gt,Je,!0,Mr===0)}if(At.length){let Kt=Ge.tags||null;if(xt==="LineString"&&We.lineMetrics){Kt={};for(let Mr in Ge.tags)Kt[Mr]=Ge.tags[Mr];Kt.mapbox_clip_start=et.start/et.size,Kt.mapbox_clip_end=et.end/et.size}let Qt={geometry:At,type:xt==="Polygon"||xt==="MultiPolygon"?3:xt==="LineString"||xt==="MultiLineString"?2:1,tags:Kt};Ge.id!==null&&(Qt.id=Ge.id),gt.features.push(Qt)}}function Et(gt,Ge,Je,We,et,xt){let At=We*We;if(We>0&&Ge.size<(et?At:We))return void(Je.numPoints+=Ge.length/3);let Kt=[];for(let Qt=0;Qt<Ge.length;Qt+=3)(We===0||Ge[Qt+2]>At)&&(Je.numSimplified++,Kt.push(Ge[Qt],Ge[Qt+1])),Je.numPoints++;et&&function(Qt,Mr){let Gr=0;for(let Ir=0,Yr=Qt.length,_i=Yr-2;Ir<Yr;_i=Ir,Ir+=2)Gr+=(Qt[Ir]-Qt[_i])*(Qt[Ir+1]+Qt[_i+1]);if(Gr>0===Mr)for(let Ir=0,Yr=Qt.length;Ir<Yr/2;Ir+=2){let _i=Qt[Ir],Pi=Qt[Ir+1];Qt[Ir]=Qt[Yr-2-Ir],Qt[Ir+1]=Qt[Yr-1-Ir],Qt[Yr-2-Ir]=_i,Qt[Yr-1-Ir]=Pi}}(Kt,xt),gt.push(Kt)}let pt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class jt{constructor(Ge,Je){let We=(Je=this.options=function(xt,At){for(let Kt in At)xt[Kt]=At[Kt];return xt}(Object.create(pt),Je)).debug;if(We&&console.time("preprocess data"),Je.maxZoom<0||Je.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Je.promoteId&&Je.generateId)throw new Error("promoteId and generateId cannot be used together.");let et=function(xt,At){let Kt=[];if(xt.type==="FeatureCollection")for(let Qt=0;Qt<xt.features.length;Qt++)me(Kt,xt.features[Qt],At,Qt);else me(Kt,xt.type==="Feature"?xt:{geometry:xt},At);return Kt}(Ge,Je);this.tiles={},this.tileCoords=[],We&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Je.indexMaxZoom,Je.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),et=function(xt,At){let Kt=At.buffer/At.extent,Qt=xt,Mr=Ht(xt,1,-1-Kt,Kt,0,-1,2,At),Gr=Ht(xt,1,1-Kt,2+Kt,0,-1,2,At);return(Mr||Gr)&&(Qt=Ht(xt,1,-Kt,1+Kt,0,-1,2,At)||[],Mr&&(Qt=Ue(Mr,1).concat(Qt)),Gr&&(Qt=Qt.concat(Ue(Gr,-1)))),Qt}(et,Je),et.length&&this.splitTile(et,0,0,0),We&&(et.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(Ge,Je,We,et,xt,At,Kt){let Qt=[Ge,Je,We,et],Mr=this.options,Gr=Mr.debug;for(;Qt.length;){et=Qt.pop(),We=Qt.pop(),Je=Qt.pop(),Ge=Qt.pop();let Ir=1<<Je,Yr=or(Je,We,et),_i=this.tiles[Yr];if(!_i&&(Gr>1&&console.time("creation"),_i=this.tiles[Yr]=Tt(Ge,Je,We,et,Mr),this.tileCoords.push({z:Je,x:We,y:et}),Gr)){Gr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Je,We,et,_i.numFeatures,_i.numPoints,_i.numSimplified),console.timeEnd("creation"));let Jn=`z${Je}`;this.stats[Jn]=(this.stats[Jn]||0)+1,this.total++}if(_i.source=Ge,xt==null){if(Je===Mr.indexMaxZoom||_i.numPoints<=Mr.indexMaxPoints)continue}else{if(Je===Mr.maxZoom||Je===xt)continue;if(xt!=null){let Jn=xt-Je;if(We!==At>>Jn||et!==Kt>>Jn)continue}}if(_i.source=null,Ge.length===0)continue;Gr>1&&console.time("clipping");let Pi=.5*Mr.buffer/Mr.extent,ai=.5-Pi,mi=.5+Pi,un=1+Pi,Fn=null,An=null,Hn=null,Qn=null,Vi=Ht(Ge,Ir,We-Pi,We+mi,0,_i.minX,_i.maxX,Mr),Kn=Ht(Ge,Ir,We+ai,We+un,0,_i.minX,_i.maxX,Mr);Ge=null,Vi&&(Fn=Ht(Vi,Ir,et-Pi,et+mi,1,_i.minY,_i.maxY,Mr),An=Ht(Vi,Ir,et+ai,et+un,1,_i.minY,_i.maxY,Mr),Vi=null),Kn&&(Hn=Ht(Kn,Ir,et-Pi,et+mi,1,_i.minY,_i.maxY,Mr),Qn=Ht(Kn,Ir,et+ai,et+un,1,_i.minY,_i.maxY,Mr),Kn=null),Gr>1&&console.timeEnd("clipping"),Qt.push(Fn||[],Je+1,2*We,2*et),Qt.push(An||[],Je+1,2*We,2*et+1),Qt.push(Hn||[],Je+1,2*We+1,2*et),Qt.push(Qn||[],Je+1,2*We+1,2*et+1)}}getTile(Ge,Je,We){Ge=+Ge,Je=+Je,We=+We;let et=this.options,{extent:xt,debug:At}=et;if(Ge<0||Ge>24)return null;let Kt=1<<Ge,Qt=or(Ge,Je=Je+Kt&Kt-1,We);if(this.tiles[Qt])return rt(this.tiles[Qt],xt);At>1&&console.log("drilling down to z%d-%d-%d",Ge,Je,We);let Mr,Gr=Ge,Ir=Je,Yr=We;for(;!Mr&&Gr>0;)Gr--,Ir>>=1,Yr>>=1,Mr=this.tiles[or(Gr,Ir,Yr)];return Mr&&Mr.source?(At>1&&(console.log("found parent tile z%d-%d-%d",Gr,Ir,Yr),console.time("drilling down")),this.splitTile(Mr.source,Gr,Ir,Yr,Ge,Je,We),At>1&&console.timeEnd("drilling down"),this.tiles[Qt]?rt(this.tiles[Qt],xt):null):null}}function or(gt,Ge,Je){return 32*((1<<gt)*Je+Ge)+gt}function mr(gt,Ge){return Ge?gt.properties[Ge]:gt.id}function Ar(gt,Ge){if(gt==null)return!0;if(gt.type==="Feature")return mr(gt,Ge)!=null;if(gt.type==="FeatureCollection"){let Je=new Set;for(let We of gt.features){let et=mr(We,Ge);if(et==null||Je.has(et))return!1;Je.add(et)}return!0}return!1}function ei(gt,Ge){let Je=new Map;if(gt!=null)if(gt.type==="Feature")Je.set(mr(gt,Ge),gt);else for(let We of gt.features)Je.set(mr(We,Ge),We);return Je}class qr extends u{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(Ge,Je){return i._(this,void 0,void 0,function*(){let We=Ge.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let et=this._geoJSONIndex.getTile(We.z,We.x,We.y);if(!et)return null;let xt=new class{constructor(Kt){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.X,this.length=Kt.length,this._features=Kt}feature(Kt){return new class{constructor(Qt){this._feature=Qt,this.extent=i.X,this.type=Qt.type,this.properties=Qt.tags,"id"in Qt&&!isNaN(Qt.id)&&(this.id=parseInt(Qt.id,10))}loadGeometry(){if(this._feature.type===1){let Qt=[];for(let Mr of this._feature.geometry)Qt.push([new i.P(Mr[0],Mr[1])]);return Qt}{let Qt=[];for(let Mr of this._feature.geometry){let Gr=[];for(let Ir of Mr)Gr.push(new i.P(Ir[0],Ir[1]));Qt.push(Gr)}return Qt}}toGeoJSON(Qt,Mr,Gr){return v.call(this,Qt,Mr,Gr)}}(this._features[Kt])}}(et.features),At=G(xt);return At.byteOffset===0&&At.byteLength===At.buffer.byteLength||(At=new Uint8Array(At)),{vectorTile:xt,rawData:At.buffer}})}loadData(Ge){return i._(this,void 0,void 0,function*(){var Je;(Je=this._pendingRequest)===null||Je===void 0||Je.abort();let We=!!(Ge&&Ge.request&&Ge.request.collectResourceTiming)&&new i.bv(Ge.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(Ge,this._pendingRequest),this._geoJSONIndex=Ge.cluster?new _e(function({superclusterOptions:At,clusterProperties:Kt}){if(!Kt||!At)return At;let Qt={},Mr={},Gr={accumulated:null,zoom:0},Ir={properties:null},Yr=Object.keys(Kt);for(let _i of Yr){let[Pi,ai]=Kt[_i],mi=i.bC(ai),un=i.bC(typeof Pi=="string"?[Pi,["accumulated"],["get",_i]]:Pi);Qt[_i]=mi.value,Mr[_i]=un.value}return At.map=_i=>{Ir.properties=_i;let Pi={};for(let ai of Yr)Pi[ai]=Qt[ai].evaluate(Gr,Ir);return Pi},At.reduce=(_i,Pi)=>{Ir.properties=Pi;for(let ai of Yr)Gr.accumulated=_i[ai],_i[ai]=Mr[ai].evaluate(Gr,Ir)},At}(Ge)).load((yield this._pendingData).features):(et=yield this._pendingData,new jt(et,Ge.geojsonVtOptions)),this.loaded={};let xt={};if(We){let At=We.finish();At&&(xt.resourceTiming={},xt.resourceTiming[Ge.source]=JSON.parse(JSON.stringify(At)))}return xt}catch(xt){if(delete this._pendingRequest,i.bB(xt))return{abandoned:!0};throw xt}var et})}getData(){return i._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(Ge){let Je=this.loaded;return Je&&Je[Ge.uid]?super.reloadTile(Ge):this.loadTile(Ge)}loadAndProcessGeoJSON(Ge,Je){return i._(this,void 0,void 0,function*(){let We=yield this.loadGeoJSON(Ge,Je);if(delete this._pendingRequest,typeof We!="object")throw new Error(`Input data given to '${Ge.source}' is not a valid GeoJSON object.`);if(d(We,!0),Ge.filter){let et=i.bC(Ge.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(et.result==="error")throw new Error(et.value.map(At=>`${At.key}: ${At.message}`).join(", "));We={type:"FeatureCollection",features:We.features.filter(At=>et.value.evaluate({zoom:0},At))}}return We})}loadGeoJSON(Ge,Je){return i._(this,void 0,void 0,function*(){let{promoteId:We}=Ge;if(Ge.request){let et=yield i.h(Ge.request,Je);return this._dataUpdateable=Ar(et.data,We)?ei(et.data,We):void 0,et.data}if(typeof Ge.data=="string")try{let et=JSON.parse(Ge.data);return this._dataUpdateable=Ar(et,We)?ei(et,We):void 0,et}catch(et){throw new Error(`Input data given to '${Ge.source}' is not a valid GeoJSON object.`)}if(!Ge.dataDiff)throw new Error(`Input data given to '${Ge.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Ge.source}`);return function(et,xt,At){var Kt,Qt,Mr,Gr;if(xt.removeAll&&et.clear(),xt.remove)for(let Ir of xt.remove)et.delete(Ir);if(xt.add)for(let Ir of xt.add){let Yr=mr(Ir,At);Yr!=null&&et.set(Yr,Ir)}if(xt.update)for(let Ir of xt.update){let Yr=et.get(Ir.id);if(Yr==null)continue;let _i=!Ir.removeAllProperties&&(((Kt=Ir.removeProperties)===null||Kt===void 0?void 0:Kt.length)>0||((Qt=Ir.addOrUpdateProperties)===null||Qt===void 0?void 0:Qt.length)>0);if((Ir.newGeometry||Ir.removeAllProperties||_i)&&(Yr=Object.assign({},Yr),et.set(Ir.id,Yr),_i&&(Yr.properties=Object.assign({},Yr.properties))),Ir.newGeometry&&(Yr.geometry=Ir.newGeometry),Ir.removeAllProperties)Yr.properties={};else if(((Mr=Ir.removeProperties)===null||Mr===void 0?void 0:Mr.length)>0)for(let Pi of Ir.removeProperties)Object.prototype.hasOwnProperty.call(Yr.properties,Pi)&&delete Yr.properties[Pi];if(((Gr=Ir.addOrUpdateProperties)===null||Gr===void 0?void 0:Gr.length)>0)for(let{key:Pi,value:ai}of Ir.addOrUpdateProperties)Yr.properties[Pi]=ai}}(this._dataUpdateable,Ge.dataDiff,We),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(Ge){return i._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(Ge){return this._geoJSONIndex.getClusterExpansionZoom(Ge.clusterId)}getClusterChildren(Ge){return this._geoJSONIndex.getChildren(Ge.clusterId)}getClusterLeaves(Ge){return this._geoJSONIndex.getLeaves(Ge.clusterId,Ge.limit,Ge.offset)}}class jr{constructor(Ge){this.self=Ge,this.actor=new i.F(Ge),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Je,We)=>{if(this.externalWorkerSourceTypes[Je])throw new Error(`Worker source with name "${Je}" already registered.`);this.externalWorkerSourceTypes[Je]=We},this.self.addProtocol=i.bi,this.self.removeProtocol=i.bj,this.self.registerRTLTextPlugin=Je=>{if(i.bD.isParsed())throw new Error("RTL text plugin already registered.");i.bD.setMethods(Je)},this.actor.registerMessageHandler("LDT",(Je,We)=>this._getDEMWorkerSource(Je,We.source).loadTile(We)),this.actor.registerMessageHandler("RDT",(Je,We)=>i._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Je,We.source).removeTile(We)})),this.actor.registerMessageHandler("GCEZ",(Je,We)=>i._(this,void 0,void 0,function*(){return this._getWorkerSource(Je,We.type,We.source).getClusterExpansionZoom(We)})),this.actor.registerMessageHandler("GCC",(Je,We)=>i._(this,void 0,void 0,function*(){return this._getWorkerSource(Je,We.type,We.source).getClusterChildren(We)})),this.actor.registerMessageHandler("GCL",(Je,We)=>i._(this,void 0,void 0,function*(){return this._getWorkerSource(Je,We.type,We.source).getClusterLeaves(We)})),this.actor.registerMessageHandler("LD",(Je,We)=>this._getWorkerSource(Je,We.type,We.source).loadData(We)),this.actor.registerMessageHandler("GD",(Je,We)=>this._getWorkerSource(Je,We.type,We.source).getData()),this.actor.registerMessageHandler("LT",(Je,We)=>this._getWorkerSource(Je,We.type,We.source).loadTile(We)),this.actor.registerMessageHandler("RT",(Je,We)=>this._getWorkerSource(Je,We.type,We.source).reloadTile(We)),this.actor.registerMessageHandler("AT",(Je,We)=>this._getWorkerSource(Je,We.type,We.source).abortTile(We)),this.actor.registerMessageHandler("RMT",(Je,We)=>this._getWorkerSource(Je,We.type,We.source).removeTile(We)),this.actor.registerMessageHandler("RS",(Je,We)=>i._(this,void 0,void 0,function*(){if(!this.workerSources[Je]||!this.workerSources[Je][We.type]||!this.workerSources[Je][We.type][We.source])return;let et=this.workerSources[Je][We.type][We.source];delete this.workerSources[Je][We.type][We.source],et.removeSource!==void 0&&et.removeSource(We)})),this.actor.registerMessageHandler("RM",Je=>i._(this,void 0,void 0,function*(){delete this.layerIndexes[Je],delete this.availableImages[Je],delete this.workerSources[Je],delete this.demWorkerSources[Je]})),this.actor.registerMessageHandler("SR",(Je,We)=>i._(this,void 0,void 0,function*(){this.referrer=We})),this.actor.registerMessageHandler("SRPS",(Je,We)=>this._syncRTLPluginState(Je,We)),this.actor.registerMessageHandler("IS",(Je,We)=>i._(this,void 0,void 0,function*(){this.self.importScripts(We)})),this.actor.registerMessageHandler("SI",(Je,We)=>this._setImages(Je,We)),this.actor.registerMessageHandler("UL",(Je,We)=>i._(this,void 0,void 0,function*(){this._getLayerIndex(Je).update(We.layers,We.removedIds)})),this.actor.registerMessageHandler("SL",(Je,We)=>i._(this,void 0,void 0,function*(){this._getLayerIndex(Je).replace(We)}))}_setImages(Ge,Je){return i._(this,void 0,void 0,function*(){this.availableImages[Ge]=Je;for(let We in this.workerSources[Ge]){let et=this.workerSources[Ge][We];for(let xt in et)et[xt].availableImages=Je}})}_syncRTLPluginState(Ge,Je){return i._(this,void 0,void 0,function*(){if(i.bD.isParsed())return i.bD.getState();if(Je.pluginStatus!=="loading")return i.bD.setState(Je),Je;let We=Je.pluginURL;if(this.self.importScripts(We),i.bD.isParsed()){let et={pluginStatus:"loaded",pluginURL:We};return i.bD.setState(et),et}throw i.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${We}`)})}_getAvailableImages(Ge){let Je=this.availableImages[Ge];return Je||(Je=[]),Je}_getLayerIndex(Ge){let Je=this.layerIndexes[Ge];return Je||(Je=this.layerIndexes[Ge]=new a),Je}_getWorkerSource(Ge,Je,We){if(this.workerSources[Ge]||(this.workerSources[Ge]={}),this.workerSources[Ge][Je]||(this.workerSources[Ge][Je]={}),!this.workerSources[Ge][Je][We]){let et={sendAsync:(xt,At)=>(xt.targetMapId=Ge,this.actor.sendAsync(xt,At))};switch(Je){case"vector":this.workerSources[Ge][Je][We]=new u(et,this._getLayerIndex(Ge),this._getAvailableImages(Ge));break;case"geojson":this.workerSources[Ge][Je][We]=new qr(et,this._getLayerIndex(Ge),this._getAvailableImages(Ge));break;default:this.workerSources[Ge][Je][We]=new this.externalWorkerSourceTypes[Je](et,this._getLayerIndex(Ge),this._getAvailableImages(Ge))}}return this.workerSources[Ge][Je][We]}_getDEMWorkerSource(Ge,Je){return this.demWorkerSources[Ge]||(this.demWorkerSources[Ge]={}),this.demWorkerSources[Ge][Je]||(this.demWorkerSources[Ge][Je]=new c),this.demWorkerSources[Ge][Je]}}return i.i(self)&&(self.worker=new jr(self)),jr}),r("index",["exports","./shared"],function(i,a){"use strict";var o="4.7.1";let s,l,u={now:typeof performance!="undefined"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:ue=>new Promise((w,B)=>{let Q=requestAnimationFrame(w);ue.signal.addEventListener("abort",()=>{cancelAnimationFrame(Q),B(a.c())})}),getImageData(ue,w=0){return this.getImageCanvasContext(ue).getImageData(-w,-w,ue.width+2*w,ue.height+2*w)},getImageCanvasContext(ue){let w=window.document.createElement("canvas"),B=w.getContext("2d",{willReadFrequently:!0});if(!B)throw new Error("failed to create canvas 2d context");return w.width=ue.width,w.height=ue.height,B.drawImage(ue,0,0,ue.width,ue.height),B},resolveURL:ue=>(s||(s=document.createElement("a")),s.href=ue,s.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(l==null&&(l=matchMedia("(prefers-reduced-motion: reduce)")),l.matches)}};class c{static testProp(w){if(!c.docStyle)return w[0];for(let B=0;B<w.length;B++)if(w[B]in c.docStyle)return w[B];return w[0]}static create(w,B,Q){let ee=window.document.createElement(w);return B!==void 0&&(ee.className=B),Q&&Q.appendChild(ee),ee}static createNS(w,B){return window.document.createElementNS(w,B)}static disableDrag(){c.docStyle&&c.selectProp&&(c.userSelect=c.docStyle[c.selectProp],c.docStyle[c.selectProp]="none")}static enableDrag(){c.docStyle&&c.selectProp&&(c.docStyle[c.selectProp]=c.userSelect)}static setTransform(w,B){w.style[c.transformProp]=B}static addEventListener(w,B,Q,ee={}){w.addEventListener(B,Q,"passive"in ee?ee:ee.capture)}static removeEventListener(w,B,Q,ee={}){w.removeEventListener(B,Q,"passive"in ee?ee:ee.capture)}static suppressClickInternal(w){w.preventDefault(),w.stopPropagation(),window.removeEventListener("click",c.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",c.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",c.suppressClickInternal,!0)},0)}static getScale(w){let B=w.getBoundingClientRect();return{x:B.width/w.offsetWidth||1,y:B.height/w.offsetHeight||1,boundingClientRect:B}}static getPoint(w,B,Q){let ee=B.boundingClientRect;return new a.P((Q.clientX-ee.left)/B.x-w.clientLeft,(Q.clientY-ee.top)/B.y-w.clientTop)}static mousePos(w,B){let Q=c.getScale(w);return c.getPoint(w,Q,B)}static touchPos(w,B){let Q=[],ee=c.getScale(w);for(let le=0;le<B.length;le++)Q.push(c.getPoint(w,ee,B[le]));return Q}static mouseButton(w){return w.button}static remove(w){w.parentNode&&w.parentNode.removeChild(w)}}c.docStyle=typeof window!="undefined"&&window.document&&window.document.documentElement.style,c.selectProp=c.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),c.transformProp=c.testProp(["transform","WebkitTransform"]);let f={supported:!1,testSupport:function(ue){!v&&d&&(m?b(ue):h=ue)}},h,d,v=!1,m=!1;function b(ue){let w=ue.createTexture();ue.bindTexture(ue.TEXTURE_2D,w);try{if(ue.texImage2D(ue.TEXTURE_2D,0,ue.RGBA,ue.RGBA,ue.UNSIGNED_BYTE,d),ue.isContextLost())return;f.supported=!0}catch(B){}ue.deleteTexture(w),v=!0}var p;typeof document!="undefined"&&(d=document.createElement("img"),d.onload=()=>{h&&b(h),h=null,m=!0},d.onerror=()=>{v=!0,h=null},d.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(ue){let w,B,Q,ee;ue.resetRequestQueue=()=>{w=[],B=0,Q=0,ee={}},ue.addThrottleControl=ut=>{let Mt=Q++;return ee[Mt]=ut,Mt},ue.removeThrottleControl=ut=>{delete ee[ut],Fe()},ue.getImage=(ut,Mt,Jt=!0)=>new Promise(($t,yr)=>{f.supported&&(ut.headers||(ut.headers={}),ut.headers.accept="image/webp,*/*"),a.e(ut,{type:"image"}),w.push({abortController:Mt,requestParameters:ut,supportImageRefresh:Jt,state:"queued",onError:Cr=>{yr(Cr)},onSuccess:Cr=>{$t(Cr)}}),Fe()});let le=ut=>a._(this,void 0,void 0,function*(){ut.state="running";let{requestParameters:Mt,supportImageRefresh:Jt,onError:$t,onSuccess:yr,abortController:Cr}=ut,ve=Jt===!1&&!a.i(self)&&!a.g(Mt.url)&&(!Mt.headers||Object.keys(Mt.headers).reduce((ze,Qe)=>ze&&Qe==="accept",!0));B++;let xe=ve?Ze(Mt,Cr):a.m(Mt,Cr);try{let ze=yield xe;delete ut.abortController,ut.state="completed",ze.data instanceof HTMLImageElement||a.b(ze.data)?yr(ze):ze.data&&yr({data:yield(Ie=ze.data,typeof createImageBitmap=="function"?a.d(Ie):a.f(Ie)),cacheControl:ze.cacheControl,expires:ze.expires})}catch(ze){delete ut.abortController,$t(ze)}finally{B--,Fe()}var Ie}),Fe=()=>{let ut=(()=>{for(let Mt of Object.keys(ee))if(ee[Mt]())return!0;return!1})()?a.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:a.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let Mt=B;Mt<ut&&w.length>0;Mt++){let Jt=w.shift();Jt.abortController.signal.aborted?Mt--:le(Jt)}},Ze=(ut,Mt)=>new Promise((Jt,$t)=>{let yr=new Image,Cr=ut.url,ve=ut.credentials;ve&&ve==="include"?yr.crossOrigin="use-credentials":(ve&&ve==="same-origin"||!a.s(Cr))&&(yr.crossOrigin="anonymous"),Mt.signal.addEventListener("abort",()=>{yr.src="",$t(a.c())}),yr.fetchPriority="high",yr.onload=()=>{yr.onerror=yr.onload=null,Jt({data:yr})},yr.onerror=()=>{yr.onerror=yr.onload=null,Mt.signal.aborted||$t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},yr.src=Cr})}(p||(p={})),p.resetRequestQueue();class k{constructor(w){this._transformRequestFn=w}transformRequest(w,B){return this._transformRequestFn&&this._transformRequestFn(w,B)||{url:w}}setTransformRequest(w){this._transformRequestFn=w}}function M(ue){var w=new a.A(3);return w[0]=ue[0],w[1]=ue[1],w[2]=ue[2],w}var T,L=function(ue,w,B){return ue[0]=w[0]-B[0],ue[1]=w[1]-B[1],ue[2]=w[2]-B[2],ue};T=new a.A(3),a.A!=Float32Array&&(T[0]=0,T[1]=0,T[2]=0);var x=function(ue){var w=ue[0],B=ue[1];return w*w+B*B};function C(ue){let w=[];if(typeof ue=="string")w.push({id:"default",url:ue});else if(ue&&ue.length>0){let B=[];for(let{id:Q,url:ee}of ue){let le=`${Q}${ee}`;B.indexOf(le)===-1&&(B.push(le),w.push({id:Q,url:ee}))}}return w}function S(ue,w,B){let Q=ue.split("?");return Q[0]+=`${w}${B}`,Q.join("?")}(function(){var ue=new a.A(2);a.A!=Float32Array&&(ue[0]=0,ue[1]=0)})();class g{constructor(w,B,Q,ee){this.context=w,this.format=Q,this.texture=w.gl.createTexture(),this.update(B,ee)}update(w,B,Q){let{width:ee,height:le}=w,Fe=!(this.size&&this.size[0]===ee&&this.size[1]===le||Q),{context:Ze}=this,{gl:ut}=Ze;if(this.useMipmap=!!(B&&B.useMipmap),ut.bindTexture(ut.TEXTURE_2D,this.texture),Ze.pixelStoreUnpackFlipY.set(!1),Ze.pixelStoreUnpack.set(1),Ze.pixelStoreUnpackPremultiplyAlpha.set(this.format===ut.RGBA&&(!B||B.premultiply!==!1)),Fe)this.size=[ee,le],w instanceof HTMLImageElement||w instanceof HTMLCanvasElement||w instanceof HTMLVideoElement||w instanceof ImageData||a.b(w)?ut.texImage2D(ut.TEXTURE_2D,0,this.format,this.format,ut.UNSIGNED_BYTE,w):ut.texImage2D(ut.TEXTURE_2D,0,this.format,ee,le,0,this.format,ut.UNSIGNED_BYTE,w.data);else{let{x:Mt,y:Jt}=Q||{x:0,y:0};w instanceof HTMLImageElement||w instanceof HTMLCanvasElement||w instanceof HTMLVideoElement||w instanceof ImageData||a.b(w)?ut.texSubImage2D(ut.TEXTURE_2D,0,Mt,Jt,ut.RGBA,ut.UNSIGNED_BYTE,w):ut.texSubImage2D(ut.TEXTURE_2D,0,Mt,Jt,ee,le,ut.RGBA,ut.UNSIGNED_BYTE,w.data)}this.useMipmap&&this.isSizePowerOfTwo()&&ut.generateMipmap(ut.TEXTURE_2D)}bind(w,B,Q){let{context:ee}=this,{gl:le}=ee;le.bindTexture(le.TEXTURE_2D,this.texture),Q!==le.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(Q=le.LINEAR),w!==this.filter&&(le.texParameteri(le.TEXTURE_2D,le.TEXTURE_MAG_FILTER,w),le.texParameteri(le.TEXTURE_2D,le.TEXTURE_MIN_FILTER,Q||w),this.filter=w),B!==this.wrap&&(le.texParameteri(le.TEXTURE_2D,le.TEXTURE_WRAP_S,B),le.texParameteri(le.TEXTURE_2D,le.TEXTURE_WRAP_T,B),this.wrap=B)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:w}=this.context;w.deleteTexture(this.texture),this.texture=null}}function P(ue){let{userImage:w}=ue;return!!(w&&w.render&&w.render())&&(ue.data.replace(new Uint8Array(w.data.buffer)),!0)}class E extends a.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(w){if(this.loaded!==w&&(this.loaded=w,w)){for(let{ids:B,promiseResolve:Q}of this.requestors)Q(this._getImagesForIds(B));this.requestors=[]}}getImage(w){let B=this.images[w];if(B&&!B.data&&B.spriteData){let Q=B.spriteData;B.data=new a.R({width:Q.width,height:Q.height},Q.context.getImageData(Q.x,Q.y,Q.width,Q.height).data),B.spriteData=null}return B}addImage(w,B){if(this.images[w])throw new Error(`Image id ${w} already exist, use updateImage instead`);this._validate(w,B)&&(this.images[w]=B)}_validate(w,B){let Q=!0,ee=B.data||B.spriteData;return this._validateStretch(B.stretchX,ee&&ee.width)||(this.fire(new a.j(new Error(`Image "${w}" has invalid "stretchX" value`))),Q=!1),this._validateStretch(B.stretchY,ee&&ee.height)||(this.fire(new a.j(new Error(`Image "${w}" has invalid "stretchY" value`))),Q=!1),this._validateContent(B.content,B)||(this.fire(new a.j(new Error(`Image "${w}" has invalid "content" value`))),Q=!1),Q}_validateStretch(w,B){if(!w)return!0;let Q=0;for(let ee of w){if(ee[0]<Q||ee[1]<ee[0]||B<ee[1])return!1;Q=ee[1]}return!0}_validateContent(w,B){if(!w)return!0;if(w.length!==4)return!1;let Q=B.spriteData,ee=Q&&Q.width||B.data.width,le=Q&&Q.height||B.data.height;return!(w[0]<0||ee<w[0]||w[1]<0||le<w[1]||w[2]<0||ee<w[2]||w[3]<0||le<w[3]||w[2]<w[0]||w[3]<w[1])}updateImage(w,B,Q=!0){let ee=this.getImage(w);if(Q&&(ee.data.width!==B.data.width||ee.data.height!==B.data.height))throw new Error(`size mismatch between old image (${ee.data.width}x${ee.data.height}) and new image (${B.data.width}x${B.data.height}).`);B.version=ee.version+1,this.images[w]=B,this.updatedImages[w]=!0}removeImage(w){let B=this.images[w];delete this.images[w],delete this.patterns[w],B.userImage&&B.userImage.onRemove&&B.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(w){return new Promise((B,Q)=>{let ee=!0;if(!this.isLoaded())for(let le of w)this.images[le]||(ee=!1);this.isLoaded()||ee?B(this._getImagesForIds(w)):this.requestors.push({ids:w,promiseResolve:B})})}_getImagesForIds(w){let B={};for(let Q of w){let ee=this.getImage(Q);ee||(this.fire(new a.k("styleimagemissing",{id:Q})),ee=this.getImage(Q)),ee?B[Q]={data:ee.data.clone(),pixelRatio:ee.pixelRatio,sdf:ee.sdf,version:ee.version,stretchX:ee.stretchX,stretchY:ee.stretchY,content:ee.content,textFitWidth:ee.textFitWidth,textFitHeight:ee.textFitHeight,hasRenderCallback:!!(ee.userImage&&ee.userImage.render)}:a.w(`Image "${Q}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return B}getPixelSize(){let{width:w,height:B}=this.atlasImage;return{width:w,height:B}}getPattern(w){let B=this.patterns[w],Q=this.getImage(w);if(!Q)return null;if(B&&B.position.version===Q.version)return B.position;if(B)B.position.version=Q.version;else{let ee={w:Q.data.width+2,h:Q.data.height+2,x:0,y:0},le=new a.I(ee,Q);this.patterns[w]={bin:ee,position:le}}return this._updatePatternAtlas(),this.patterns[w].position}bind(w){let B=w.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new g(w,this.atlasImage,B.RGBA),this.atlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE)}_updatePatternAtlas(){let w=[];for(let le in this.patterns)w.push(this.patterns[le].bin);let{w:B,h:Q}=a.p(w),ee=this.atlasImage;ee.resize({width:B||1,height:Q||1});for(let le in this.patterns){let{bin:Fe}=this.patterns[le],Ze=Fe.x+1,ut=Fe.y+1,Mt=this.getImage(le).data,Jt=Mt.width,$t=Mt.height;a.R.copy(Mt,ee,{x:0,y:0},{x:Ze,y:ut},{width:Jt,height:$t}),a.R.copy(Mt,ee,{x:0,y:$t-1},{x:Ze,y:ut-1},{width:Jt,height:1}),a.R.copy(Mt,ee,{x:0,y:0},{x:Ze,y:ut+$t},{width:Jt,height:1}),a.R.copy(Mt,ee,{x:Jt-1,y:0},{x:Ze-1,y:ut},{width:1,height:$t}),a.R.copy(Mt,ee,{x:0,y:0},{x:Ze+Jt,y:ut},{width:1,height:$t})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(w){for(let B of w){if(this.callbackDispatchedThisFrame[B])continue;this.callbackDispatchedThisFrame[B]=!0;let Q=this.getImage(B);Q||a.w(`Image with ID: "${B}" was not found`),P(Q)&&this.updateImage(B,Q)}}}let z=1e20;function q(ue,w,B,Q,ee,le,Fe,Ze,ut){for(let Mt=w;Mt<w+Q;Mt++)V(ue,B*le+Mt,le,ee,Fe,Ze,ut);for(let Mt=B;Mt<B+ee;Mt++)V(ue,Mt*le+w,1,Q,Fe,Ze,ut)}function V(ue,w,B,Q,ee,le,Fe){le[0]=0,Fe[0]=-z,Fe[1]=z,ee[0]=ue[w];for(let Ze=1,ut=0,Mt=0;Ze<Q;Ze++){ee[Ze]=ue[w+Ze*B];let Jt=Ze*Ze;do{let $t=le[ut];Mt=(ee[Ze]-ee[$t]+Jt-$t*$t)/(Ze-$t)/2}while(Mt<=Fe[ut]&&--ut>-1);ut++,le[ut]=Ze,Fe[ut]=Mt,Fe[ut+1]=z}for(let Ze=0,ut=0;Ze<Q;Ze++){for(;Fe[ut+1]<Ze;)ut++;let Mt=le[ut],Jt=Ze-Mt;ue[w+Ze*B]=ee[Mt]+Jt*Jt}}class G{constructor(w,B){this.requestManager=w,this.localIdeographFontFamily=B,this.entries={}}setURL(w){this.url=w}getGlyphs(w){return a._(this,void 0,void 0,function*(){let B=[];for(let le in w)for(let Fe of w[le])B.push(this._getAndCacheGlyphsPromise(le,Fe));let Q=yield Promise.all(B),ee={};for(let{stack:le,id:Fe,glyph:Ze}of Q)ee[le]||(ee[le]={}),ee[le][Fe]=Ze&&{id:Ze.id,bitmap:Ze.bitmap.clone(),metrics:Ze.metrics};return ee})}_getAndCacheGlyphsPromise(w,B){return a._(this,void 0,void 0,function*(){let Q=this.entries[w];Q||(Q=this.entries[w]={glyphs:{},requests:{},ranges:{}});let ee=Q.glyphs[B];if(ee!==void 0)return{stack:w,id:B,glyph:ee};if(ee=this._tinySDF(Q,w,B),ee)return Q.glyphs[B]=ee,{stack:w,id:B,glyph:ee};let le=Math.floor(B/256);if(256*le>65535)throw new Error("glyphs > 65535 not supported");if(Q.ranges[le])return{stack:w,id:B,glyph:ee};if(!this.url)throw new Error("glyphsUrl is not set");if(!Q.requests[le]){let Ze=G.loadGlyphRange(w,le,this.url,this.requestManager);Q.requests[le]=Ze}let Fe=yield Q.requests[le];for(let Ze in Fe)this._doesCharSupportLocalGlyph(+Ze)||(Q.glyphs[+Ze]=Fe[+Ze]);return Q.ranges[le]=!0,{stack:w,id:B,glyph:Fe[B]||null}})}_doesCharSupportLocalGlyph(w){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(w))}_tinySDF(w,B,Q){let ee=this.localIdeographFontFamily;if(!ee||!this._doesCharSupportLocalGlyph(Q))return;let le=w.tinySDF;if(!le){let Ze="400";/bold/i.test(B)?Ze="900":/medium/i.test(B)?Ze="500":/light/i.test(B)&&(Ze="200"),le=w.tinySDF=new G.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:ee,fontWeight:Ze})}let Fe=le.draw(String.fromCharCode(Q));return{id:Q,bitmap:new a.o({width:Fe.width||60,height:Fe.height||60},Fe.data),metrics:{width:Fe.glyphWidth/2||24,height:Fe.glyphHeight/2||24,left:Fe.glyphLeft/2+.5||0,top:Fe.glyphTop/2-27.5||-8,advance:Fe.glyphAdvance/2||24,isDoubleResolution:!0}}}}G.loadGlyphRange=function(ue,w,B,Q){return a._(this,void 0,void 0,function*(){let ee=256*w,le=ee+255,Fe=Q.transformRequest(B.replace("{fontstack}",ue).replace("{range}",`${ee}-${le}`),"Glyphs"),Ze=yield a.l(Fe,new AbortController);if(!Ze||!Ze.data)throw new Error(`Could not load glyph range. range: ${w}, ${ee}-${le}`);let ut={};for(let Mt of a.n(Ze.data))ut[Mt.id]=Mt;return ut})},G.TinySDF=class{constructor({fontSize:ue=24,buffer:w=3,radius:B=8,cutoff:Q=.25,fontFamily:ee="sans-serif",fontWeight:le="normal",fontStyle:Fe="normal"}={}){this.buffer=w,this.cutoff=Q,this.radius=B;let Ze=this.size=ue+4*w,ut=this._createCanvas(Ze),Mt=this.ctx=ut.getContext("2d",{willReadFrequently:!0});Mt.font=`${Fe} ${le} ${ue}px ${ee}`,Mt.textBaseline="alphabetic",Mt.textAlign="left",Mt.fillStyle="black",this.gridOuter=new Float64Array(Ze*Ze),this.gridInner=new Float64Array(Ze*Ze),this.f=new Float64Array(Ze),this.z=new Float64Array(Ze+1),this.v=new Uint16Array(Ze)}_createCanvas(ue){let w=document.createElement("canvas");return w.width=w.height=ue,w}draw(ue){let{width:w,actualBoundingBoxAscent:B,actualBoundingBoxDescent:Q,actualBoundingBoxLeft:ee,actualBoundingBoxRight:le}=this.ctx.measureText(ue),Fe=Math.ceil(B),Ze=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(le-ee))),ut=Math.min(this.size-this.buffer,Fe+Math.ceil(Q)),Mt=Ze+2*this.buffer,Jt=ut+2*this.buffer,$t=Math.max(Mt*Jt,0),yr=new Uint8ClampedArray($t),Cr={data:yr,width:Mt,height:Jt,glyphWidth:Ze,glyphHeight:ut,glyphTop:Fe,glyphLeft:0,glyphAdvance:w};if(Ze===0||ut===0)return Cr;let{ctx:ve,buffer:xe,gridInner:Ie,gridOuter:ze}=this;ve.clearRect(xe,xe,Ze,ut),ve.fillText(ue,xe,xe+Fe);let Qe=ve.getImageData(xe,xe,Ze,ut);ze.fill(z,0,$t),Ie.fill(0,0,$t);for(let Xe=0;Xe<ut;Xe++)for(let nt=0;nt<Ze;nt++){let qt=Qe.data[4*(Xe*Ze+nt)+3]/255;if(qt===0)continue;let Wt=(Xe+xe)*Mt+nt+xe;if(qt===1)ze[Wt]=0,Ie[Wt]=z;else{let nr=.5-qt;ze[Wt]=nr>0?nr*nr:0,Ie[Wt]=nr<0?nr*nr:0}}q(ze,0,0,Mt,Jt,Mt,this.f,this.v,this.z),q(Ie,xe,xe,Ze,ut,Mt,this.f,this.v,this.z);for(let Xe=0;Xe<$t;Xe++){let nt=Math.sqrt(ze[Xe])-Math.sqrt(Ie[Xe]);yr[Xe]=Math.round(255-255*(nt/this.radius+this.cutoff))}return Cr}};class Z{constructor(){this.specification=a.v.light.position}possiblyEvaluate(w,B){return a.x(w.expression.evaluate(B))}interpolate(w,B,Q){return{x:a.y.number(w.x,B.x,Q),y:a.y.number(w.y,B.y,Q),z:a.y.number(w.z,B.z,Q)}}}let j;class N extends a.E{constructor(w){super(),j=j||new a.q({anchor:new a.D(a.v.light.anchor),position:new Z,color:new a.D(a.v.light.color),intensity:new a.D(a.v.light.intensity)}),this._transitionable=new a.T(j),this.setLight(w),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(w,B={}){if(!this._validate(a.r,w,B))for(let Q in w){let ee=w[Q];Q.endsWith("-transition")?this._transitionable.setTransition(Q.slice(0,-11),ee):this._transitionable.setValue(Q,ee)}}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}_validate(w,B,Q){return(!Q||Q.validate!==!1)&&a.t(this,w.call(a.u,{value:B,style:{glyphs:!0,sprite:!0},styleSpec:a.v}))}}let H=new a.q({"sky-color":new a.D(a.v.sky["sky-color"]),"horizon-color":new a.D(a.v.sky["horizon-color"]),"fog-color":new a.D(a.v.sky["fog-color"]),"fog-ground-blend":new a.D(a.v.sky["fog-ground-blend"]),"horizon-fog-blend":new a.D(a.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new a.D(a.v.sky["sky-horizon-blend"]),"atmosphere-blend":new a.D(a.v.sky["atmosphere-blend"])});class ie extends a.E{constructor(w){super(),this._transitionable=new a.T(H),this.setSky(w),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new a.z(0))}setSky(w,B={}){if(!this._validate(a.B,w,B)){w||(w={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let Q in w){let ee=w[Q];Q.endsWith("-transition")?this._transitionable.setTransition(Q.slice(0,-11),ee):this._transitionable.setValue(Q,ee)}}}getSky(){return this._transitionable.serialize()}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}_validate(w,B,Q={}){return(Q==null?void 0:Q.validate)!==!1&&a.t(this,w.call(a.u,a.e({value:B,style:{glyphs:!0,sprite:!0},styleSpec:a.v})))}calculateFogBlendOpacity(w){return w<60?0:w<70?(w-60)/10:1}}class ae{constructor(w,B){this.width=w,this.height=B,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(w,B){let Q=w.join(",")+String(B);return this.dashEntry[Q]||(this.dashEntry[Q]=this.addDash(w,B)),this.dashEntry[Q]}getDashRanges(w,B,Q){let ee=[],le=w.length%2==1?-w[w.length-1]*Q:0,Fe=w[0]*Q,Ze=!0;ee.push({left:le,right:Fe,isDash:Ze,zeroLength:w[0]===0});let ut=w[0];for(let Mt=1;Mt<w.length;Mt++){Ze=!Ze;let Jt=w[Mt];le=ut*Q,ut+=Jt,Fe=ut*Q,ee.push({left:le,right:Fe,isDash:Ze,zeroLength:Jt===0})}return ee}addRoundDash(w,B,Q){let ee=B/2;for(let le=-Q;le<=Q;le++){let Fe=this.width*(this.nextRow+Q+le),Ze=0,ut=w[Ze];for(let Mt=0;Mt<this.width;Mt++){Mt/ut.right>1&&(ut=w[++Ze]);let Jt=Math.abs(Mt-ut.left),$t=Math.abs(Mt-ut.right),yr=Math.min(Jt,$t),Cr,ve=le/Q*(ee+1);if(ut.isDash){let xe=ee-Math.abs(ve);Cr=Math.sqrt(yr*yr+xe*xe)}else Cr=ee-Math.sqrt(yr*yr+ve*ve);this.data[Fe+Mt]=Math.max(0,Math.min(255,Cr+128))}}}addRegularDash(w){for(let Ze=w.length-1;Ze>=0;--Ze){let ut=w[Ze],Mt=w[Ze+1];ut.zeroLength?w.splice(Ze,1):Mt&&Mt.isDash===ut.isDash&&(Mt.left=ut.left,w.splice(Ze,1))}let B=w[0],Q=w[w.length-1];B.isDash===Q.isDash&&(B.left=Q.left-this.width,Q.right=B.right+this.width);let ee=this.width*this.nextRow,le=0,Fe=w[le];for(let Ze=0;Ze<this.width;Ze++){Ze/Fe.right>1&&(Fe=w[++le]);let ut=Math.abs(Ze-Fe.left),Mt=Math.abs(Ze-Fe.right),Jt=Math.min(ut,Mt);this.data[ee+Ze]=Math.max(0,Math.min(255,(Fe.isDash?Jt:-Jt)+128))}}addDash(w,B){let Q=B?7:0,ee=2*Q+1;if(this.nextRow+ee>this.height)return a.w("LineAtlas out of space"),null;let le=0;for(let Ze=0;Ze<w.length;Ze++)le+=w[Ze];if(le!==0){let Ze=this.width/le,ut=this.getDashRanges(w,this.width,Ze);B?this.addRoundDash(ut,Ze,Q):this.addRegularDash(ut)}let Fe={y:(this.nextRow+Q+.5)/this.height,height:2*Q/this.height,width:le};return this.nextRow+=ee,this.dirty=!0,Fe}bind(w){let B=w.gl;this.texture?(B.bindTexture(B.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,B.texSubImage2D(B.TEXTURE_2D,0,0,0,this.width,this.height,B.ALPHA,B.UNSIGNED_BYTE,this.data))):(this.texture=B.createTexture(),B.bindTexture(B.TEXTURE_2D,this.texture),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.REPEAT),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.REPEAT),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.LINEAR),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.LINEAR),B.texImage2D(B.TEXTURE_2D,0,B.ALPHA,this.width,this.height,0,B.ALPHA,B.UNSIGNED_BYTE,this.data))}}let _e="maplibre_preloaded_worker_pool";class Ee{constructor(){this.active={}}acquire(w){if(!this.workers)for(this.workers=[];this.workers.length<Ee.workerCount;)this.workers.push(new Worker(a.a.WORKER_URL));return this.active[w]=!0,this.workers.slice()}release(w){delete this.active[w],this.numActive()===0&&(this.workers.forEach(B=>{B.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[_e]}numActive(){return Object.keys(this.active).length}}let Ce=Math.floor(u.hardwareConcurrency/2),ge,re;function Se(){return ge||(ge=new Ee),ge}Ee.workerCount=a.C(globalThis)?Math.max(Math.min(Ce,3),1):1;class ke{constructor(w,B){this.workerPool=w,this.actors=[],this.currentActor=0,this.id=B;let Q=this.workerPool.acquire(B);for(let ee=0;ee<Q.length;ee++){let le=new a.F(Q[ee],B);le.name=`Worker ${ee}`,this.actors.push(le)}if(!this.actors.length)throw new Error("No actors found")}broadcast(w,B){let Q=[];for(let ee of this.actors)Q.push(ee.sendAsync({type:w,data:B}));return Promise.all(Q)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(w=!0){this.actors.forEach(B=>{B.remove()}),this.actors=[],w&&this.workerPool.release(this.id)}registerMessageHandler(w,B){for(let Q of this.actors)Q.registerMessageHandler(w,B)}}function be(){return re||(re=new ke(Se(),a.G),re.registerMessageHandler("GR",(ue,w,B)=>a.m(w,B))),re}function Be(ue,w){let B=a.H();return a.J(B,B,[1,1,0]),a.K(B,B,[.5*ue.width,.5*ue.height,1]),a.L(B,B,ue.calculatePosMatrix(w.toUnwrapped()))}function Le(ue,w,B,Q,ee,le){let Fe=function($t,yr,Cr){if($t)for(let ve of $t){let xe=yr[ve];if(xe&&xe.source===Cr&&xe.type==="fill-extrusion")return!0}else for(let ve in yr){let xe=yr[ve];if(xe.source===Cr&&xe.type==="fill-extrusion")return!0}return!1}(ee&&ee.layers,w,ue.id),Ze=le.maxPitchScaleFactor(),ut=ue.tilesIn(Q,Ze,Fe);ut.sort(me);let Mt=[];for(let $t of ut)Mt.push({wrappedTileID:$t.tileID.wrapped().key,queryResults:$t.tile.queryRenderedFeatures(w,B,ue._state,$t.queryGeometry,$t.cameraQueryGeometry,$t.scale,ee,le,Ze,Be(ue.transform,$t.tileID))});let Jt=function($t){let yr={},Cr={};for(let ve of $t){let xe=ve.queryResults,Ie=ve.wrappedTileID,ze=Cr[Ie]=Cr[Ie]||{};for(let Qe in xe){let Xe=xe[Qe],nt=ze[Qe]=ze[Qe]||{},qt=yr[Qe]=yr[Qe]||[];for(let Wt of Xe)nt[Wt.featureIndex]||(nt[Wt.featureIndex]=!0,qt.push(Wt))}}return yr}(Mt);for(let $t in Jt)Jt[$t].forEach(yr=>{let Cr=yr.feature,ve=ue.getFeatureState(Cr.layer["source-layer"],Cr.id);Cr.source=Cr.layer.source,Cr.layer["source-layer"]&&(Cr.sourceLayer=Cr.layer["source-layer"]),Cr.state=ve});return Jt}function me(ue,w){let B=ue.tileID,Q=w.tileID;return B.overscaledZ-Q.overscaledZ||B.canonical.y-Q.canonical.y||B.wrap-Q.wrap||B.canonical.x-Q.canonical.x}function Pe(ue,w,B){return a._(this,void 0,void 0,function*(){let Q=ue;if(ue.url?Q=(yield a.h(w.transformRequest(ue.url,"Source"),B)).data:yield u.frameAsync(B),!Q)return null;let ee=a.M(a.e(Q,ue),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in Q&&Q.vector_layers&&(ee.vectorLayerIds=Q.vector_layers.map(le=>le.id)),ee})}class ce{constructor(w,B){w&&(B?this.setSouthWest(w).setNorthEast(B):Array.isArray(w)&&(w.length===4?this.setSouthWest([w[0],w[1]]).setNorthEast([w[2],w[3]]):this.setSouthWest(w[0]).setNorthEast(w[1])))}setNorthEast(w){return this._ne=w instanceof a.N?new a.N(w.lng,w.lat):a.N.convert(w),this}setSouthWest(w){return this._sw=w instanceof a.N?new a.N(w.lng,w.lat):a.N.convert(w),this}extend(w){let B=this._sw,Q=this._ne,ee,le;if(w instanceof a.N)ee=w,le=w;else{if(!(w instanceof ce))return Array.isArray(w)?w.length===4||w.every(Array.isArray)?this.extend(ce.convert(w)):this.extend(a.N.convert(w)):w&&("lng"in w||"lon"in w)&&"lat"in w?this.extend(a.N.convert(w)):this;if(ee=w._sw,le=w._ne,!ee||!le)return this}return B||Q?(B.lng=Math.min(ee.lng,B.lng),B.lat=Math.min(ee.lat,B.lat),Q.lng=Math.max(le.lng,Q.lng),Q.lat=Math.max(le.lat,Q.lat)):(this._sw=new a.N(ee.lng,ee.lat),this._ne=new a.N(le.lng,le.lat)),this}getCenter(){return new a.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new a.N(this.getWest(),this.getNorth())}getSouthEast(){return new a.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(w){let{lng:B,lat:Q}=a.N.convert(w),ee=this._sw.lng<=B&&B<=this._ne.lng;return this._sw.lng>this._ne.lng&&(ee=this._sw.lng>=B&&B>=this._ne.lng),this._sw.lat<=Q&&Q<=this._ne.lat&&ee}static convert(w){return w instanceof ce?w:w&&new ce(w)}static fromLngLat(w,B=0){let Q=360*B/40075017,ee=Q/Math.cos(Math.PI/180*w.lat);return new ce(new a.N(w.lng-ee,w.lat-Q),new a.N(w.lng+ee,w.lat+Q))}adjustAntiMeridian(){let w=new a.N(this._sw.lng,this._sw.lat),B=new a.N(this._ne.lng,this._ne.lat);return new ce(w,w.lng>B.lng?new a.N(B.lng+360,B.lat):B)}}class He{constructor(w,B,Q){this.bounds=ce.convert(this.validateBounds(w)),this.minzoom=B||0,this.maxzoom=Q||24}validateBounds(w){return Array.isArray(w)&&w.length===4?[Math.max(-180,w[0]),Math.max(-90,w[1]),Math.min(180,w[2]),Math.min(90,w[3])]:[-180,-90,180,90]}contains(w){let B=Math.pow(2,w.z),Q=Math.floor(a.O(this.bounds.getWest())*B),ee=Math.floor(a.Q(this.bounds.getNorth())*B),le=Math.ceil(a.O(this.bounds.getEast())*B),Fe=Math.ceil(a.Q(this.bounds.getSouth())*B);return w.x>=Q&&w.x<le&&w.y>=ee&&w.y<Fe}}class lt extends a.E{constructor(w,B,Q,ee){if(super(),this.id=w,this.dispatcher=Q,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.e(this,a.M(B,["url","scheme","tileSize","promoteId"])),this._options=a.e({type:"vector"},B),this._collectResourceTiming=B.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(ee)}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let w=yield Pe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),w&&(a.e(this,w),w.bounds&&(this.tileBounds=new He(w.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))}catch(w){this._tileJSONRequest=null,this.fire(new a.j(w))}})}loaded(){return this._loaded}hasTile(w){return!this.tileBounds||this.tileBounds.contains(w.canonical)}onAdd(w){this.map=w,this.load()}setSourceProperty(w){this._tileJSONRequest&&this._tileJSONRequest.abort(),w(),this.load()}setTiles(w){return this.setSourceProperty(()=>{this._options.tiles=w}),this}setUrl(w){return this.setSourceProperty(()=>{this.url=w,this._options.url=w}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return a.e({},this._options)}loadTile(w){return a._(this,void 0,void 0,function*(){let B=w.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),Q={request:this.map._requestManager.transformRequest(B,"Tile"),uid:w.uid,tileID:w.tileID,zoom:w.tileID.overscaledZ,tileSize:this.tileSize*w.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};Q.request.collectResourceTiming=this._collectResourceTiming;let ee="RT";if(w.actor&&w.state!=="expired"){if(w.state==="loading")return new Promise((le,Fe)=>{w.reloadPromise={resolve:le,reject:Fe}})}else w.actor=this.dispatcher.getActor(),ee="LT";w.abortController=new AbortController;try{let le=yield w.actor.sendAsync({type:ee,data:Q},w.abortController);if(delete w.abortController,w.aborted)return;this._afterTileLoadWorkerResponse(w,le)}catch(le){if(delete w.abortController,w.aborted)return;if(le&&le.status!==404)throw le;this._afterTileLoadWorkerResponse(w,null)}})}_afterTileLoadWorkerResponse(w,B){if(B&&B.resourceTiming&&(w.resourceTiming=B.resourceTiming),B&&this.map._refreshExpiredTiles&&w.setExpiryData(B),w.loadVectorData(B,this.map.painter),w.reloadPromise){let Q=w.reloadPromise;w.reloadPromise=null,this.loadTile(w).then(Q.resolve).catch(Q.reject)}}abortTile(w){return a._(this,void 0,void 0,function*(){w.abortController&&(w.abortController.abort(),delete w.abortController),w.actor&&(yield w.actor.sendAsync({type:"AT",data:{uid:w.uid,type:this.type,source:this.id}}))})}unloadTile(w){return a._(this,void 0,void 0,function*(){w.unloadVectorData(),w.actor&&(yield w.actor.sendAsync({type:"RMT",data:{uid:w.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class mt extends a.E{constructor(w,B,Q,ee){super(),this.id=w,this.dispatcher=Q,this.setEventedParent(ee),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.e({type:"raster"},B),a.e(this,a.M(B,["url","scheme","tileSize"]))}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let w=yield Pe(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,w&&(a.e(this,w),w.bounds&&(this.tileBounds=new He(w.bounds,this.minzoom,this.maxzoom)),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})))}catch(w){this._tileJSONRequest=null,this.fire(new a.j(w))}})}loaded(){return this._loaded}onAdd(w){this.map=w,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(w){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),w(),this.load()}setTiles(w){return this.setSourceProperty(()=>{this._options.tiles=w}),this}setUrl(w){return this.setSourceProperty(()=>{this.url=w,this._options.url=w}),this}serialize(){return a.e({},this._options)}hasTile(w){return!this.tileBounds||this.tileBounds.contains(w.canonical)}loadTile(w){return a._(this,void 0,void 0,function*(){let B=w.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);w.abortController=new AbortController;try{let Q=yield p.getImage(this.map._requestManager.transformRequest(B,"Tile"),w.abortController,this.map._refreshExpiredTiles);if(delete w.abortController,w.aborted)return void(w.state="unloaded");if(Q&&Q.data){this.map._refreshExpiredTiles&&Q.cacheControl&&Q.expires&&w.setExpiryData({cacheControl:Q.cacheControl,expires:Q.expires});let ee=this.map.painter.context,le=ee.gl,Fe=Q.data;w.texture=this.map.painter.getTileTexture(Fe.width),w.texture?w.texture.update(Fe,{useMipmap:!0}):(w.texture=new g(ee,Fe,le.RGBA,{useMipmap:!0}),w.texture.bind(le.LINEAR,le.CLAMP_TO_EDGE,le.LINEAR_MIPMAP_NEAREST)),w.state="loaded"}}catch(Q){if(delete w.abortController,w.aborted)w.state="unloaded";else if(Q)throw w.state="errored",Q}})}abortTile(w){return a._(this,void 0,void 0,function*(){w.abortController&&(w.abortController.abort(),delete w.abortController)})}unloadTile(w){return a._(this,void 0,void 0,function*(){w.texture&&this.map.painter.saveTileTexture(w.texture)})}hasTransition(){return!1}}class Ht extends mt{constructor(w,B,Q,ee){super(w,B,Q,ee),this.type="raster-dem",this.maxzoom=22,this._options=a.e({type:"raster-dem"},B),this.encoding=B.encoding||"mapbox",this.redFactor=B.redFactor,this.greenFactor=B.greenFactor,this.blueFactor=B.blueFactor,this.baseShift=B.baseShift}loadTile(w){return a._(this,void 0,void 0,function*(){let B=w.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),Q=this.map._requestManager.transformRequest(B,"Tile");w.neighboringTiles=this._getNeighboringTiles(w.tileID),w.abortController=new AbortController;try{let ee=yield p.getImage(Q,w.abortController,this.map._refreshExpiredTiles);if(delete w.abortController,w.aborted)return void(w.state="unloaded");if(ee&&ee.data){let le=ee.data;this.map._refreshExpiredTiles&&ee.cacheControl&&ee.expires&&w.setExpiryData({cacheControl:ee.cacheControl,expires:ee.expires});let Fe=a.b(le)&&a.U()?le:yield this.readImageNow(le),Ze={type:this.type,uid:w.uid,source:this.id,rawImageData:Fe,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!w.actor||w.state==="expired"){w.actor=this.dispatcher.getActor();let ut=yield w.actor.sendAsync({type:"LDT",data:Ze});w.dem=ut,w.needsHillshadePrepare=!0,w.needsTerrainPrepare=!0,w.state="loaded"}}}catch(ee){if(delete w.abortController,w.aborted)w.state="unloaded";else if(ee)throw w.state="errored",ee}})}readImageNow(w){return a._(this,void 0,void 0,function*(){if(typeof VideoFrame!="undefined"&&a.V()){let B=w.width+2,Q=w.height+2;try{return new a.R({width:B,height:Q},yield a.W(w,-1,-1,B,Q))}catch(ee){}}return u.getImageData(w,1)})}_getNeighboringTiles(w){let B=w.canonical,Q=Math.pow(2,B.z),ee=(B.x-1+Q)%Q,le=B.x===0?w.wrap-1:w.wrap,Fe=(B.x+1+Q)%Q,Ze=B.x+1===Q?w.wrap+1:w.wrap,ut={};return ut[new a.S(w.overscaledZ,le,B.z,ee,B.y).key]={backfilled:!1},ut[new a.S(w.overscaledZ,Ze,B.z,Fe,B.y).key]={backfilled:!1},B.y>0&&(ut[new a.S(w.overscaledZ,le,B.z,ee,B.y-1).key]={backfilled:!1},ut[new a.S(w.overscaledZ,w.wrap,B.z,B.x,B.y-1).key]={backfilled:!1},ut[new a.S(w.overscaledZ,Ze,B.z,Fe,B.y-1).key]={backfilled:!1}),B.y+1<Q&&(ut[new a.S(w.overscaledZ,le,B.z,ee,B.y+1).key]={backfilled:!1},ut[new a.S(w.overscaledZ,w.wrap,B.z,B.x,B.y+1).key]={backfilled:!1},ut[new a.S(w.overscaledZ,Ze,B.z,Fe,B.y+1).key]={backfilled:!1}),ut}unloadTile(w){return a._(this,void 0,void 0,function*(){w.demTexture&&this.map.painter.saveTileTexture(w.demTexture),w.fbo&&(w.fbo.destroy(),delete w.fbo),w.dem&&delete w.dem,delete w.neighboringTiles,w.state="unloaded",w.actor&&(yield w.actor.sendAsync({type:"RDT",data:{type:this.type,uid:w.uid,source:this.id}}))})}}class at extends a.E{constructor(w,B,Q,ee){super(),this.id=w,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=Q.getActor(),this.setEventedParent(ee),this._data=B.data,this._options=a.e({},B),this._collectResourceTiming=B.collectResourceTiming,B.maxzoom!==void 0&&(this.maxzoom=B.maxzoom),B.type&&(this.type=B.type),B.attribution&&(this.attribution=B.attribution),this.promoteId=B.promoteId;let le=a.X/this.tileSize;B.clusterMaxZoom!==void 0&&this.maxzoom<=B.clusterMaxZoom&&a.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${B.clusterMaxZoom}".`),this.workerOptions=a.e({source:this.id,cluster:B.cluster||!1,geojsonVtOptions:{buffer:(B.buffer!==void 0?B.buffer:128)*le,tolerance:(B.tolerance!==void 0?B.tolerance:.375)*le,extent:a.X,maxZoom:this.maxzoom,lineMetrics:B.lineMetrics||!1,generateId:B.generateId||!1},superclusterOptions:{maxZoom:B.clusterMaxZoom!==void 0?B.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,B.clusterMinPoints||2),extent:a.X,radius:(B.clusterRadius||50)*le,log:!1,generateId:B.generateId||!1},clusterProperties:B.clusterProperties,filter:B.filter},B.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return a._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(w){this.map=w,this.load()}setData(w){return this._data=w,this._updateWorkerData(),this}updateData(w){return this._updateWorkerData(w),this}getData(){return a._(this,void 0,void 0,function*(){let w=a.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:w})})}setClusterOptions(w){return this.workerOptions.cluster=w.cluster,w&&(w.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=w.clusterRadius),w.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=w.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(w){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:w,source:this.id}})}getClusterChildren(w){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:w,source:this.id}})}getClusterLeaves(w,B,Q){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:w,limit:B,offset:Q}})}_updateWorkerData(w){return a._(this,void 0,void 0,function*(){let B=a.e({type:this.type},this.workerOptions);w?B.dataDiff=w:typeof this._data=="string"?(B.request=this.map._requestManager.transformRequest(u.resolveURL(this._data),"Source"),B.request.collectResourceTiming=this._collectResourceTiming):B.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new a.k("dataloading",{dataType:"source"}));try{let Q=yield this.actor.sendAsync({type:"LD",data:B});if(this._pendingLoads--,this._removed||Q.abandoned)return void this.fire(new a.k("dataabort",{dataType:"source"}));let ee=null;Q.resourceTiming&&Q.resourceTiming[this.id]&&(ee=Q.resourceTiming[this.id].slice(0));let le={dataType:"source"};this._collectResourceTiming&&ee&&ee.length>0&&a.e(le,{resourceTiming:ee}),this.fire(new a.k("data",Object.assign(Object.assign({},le),{sourceDataType:"metadata"}))),this.fire(new a.k("data",Object.assign(Object.assign({},le),{sourceDataType:"content"})))}catch(Q){if(this._pendingLoads--,this._removed)return void this.fire(new a.k("dataabort",{dataType:"source"}));this.fire(new a.j(Q))}})}loaded(){return this._pendingLoads===0}loadTile(w){return a._(this,void 0,void 0,function*(){let B=w.actor?"RT":"LT";w.actor=this.actor;let Q={type:this.type,uid:w.uid,tileID:w.tileID,zoom:w.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};w.abortController=new AbortController;let ee=yield this.actor.sendAsync({type:B,data:Q},w.abortController);delete w.abortController,w.unloadVectorData(),w.aborted||w.loadVectorData(ee,this.map.painter,B==="RT")})}abortTile(w){return a._(this,void 0,void 0,function*(){w.abortController&&(w.abortController.abort(),delete w.abortController),w.aborted=!0})}unloadTile(w){return a._(this,void 0,void 0,function*(){w.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:w.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return a.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ct=a.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ar extends a.E{constructor(w,B,Q,ee){super(),this.id=w,this.dispatcher=Q,this.coordinates=B.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(ee),this.options=B}load(w){return a._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new a.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let B=yield p.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,B&&B.data&&(this.image=B.data,w&&(this.coordinates=w),this._finishLoading())}catch(B){this._request=null,this._loaded=!0,this.fire(new a.j(B))}})}loaded(){return this._loaded}updateImage(w){return w.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=w.url,this.load(w.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(w){this.map=w,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(w){this.coordinates=w;let B=w.map(a.Z.fromLngLat);this.tileID=function(ee){let le=1/0,Fe=1/0,Ze=-1/0,ut=-1/0;for(let yr of ee)le=Math.min(le,yr.x),Fe=Math.min(Fe,yr.y),Ze=Math.max(Ze,yr.x),ut=Math.max(ut,yr.y);let Mt=Math.max(Ze-le,ut-Fe),Jt=Math.max(0,Math.floor(-Math.log(Mt)/Math.LN2)),$t=Math.pow(2,Jt);return new a.a1(Jt,Math.floor((le+Ze)/2*$t),Math.floor((Fe+ut)/2*$t))}(B),this.minzoom=this.maxzoom=this.tileID.z;let Q=B.map(ee=>this.tileID.getTilePoint(ee)._round());return this._boundsArray=new a.$,this._boundsArray.emplaceBack(Q[0].x,Q[0].y,0,0),this._boundsArray.emplaceBack(Q[1].x,Q[1].y,a.X,0),this._boundsArray.emplaceBack(Q[3].x,Q[3].y,0,a.X),this._boundsArray.emplaceBack(Q[2].x,Q[2].y,a.X,a.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let w=this.map.painter.context,B=w.gl;this.boundsBuffer||(this.boundsBuffer=w.createVertexBuffer(this._boundsArray,ct.members)),this.boundsSegments||(this.boundsSegments=a.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new g(w,this.image,B.RGBA),this.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE));let Q=!1;for(let ee in this.tiles){let le=this.tiles[ee];le.state!=="loaded"&&(le.state="loaded",le.texture=this.texture,Q=!0)}Q&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(w){return a._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(w.tileID.canonical)?(this.tiles[String(w.tileID.wrap)]=w,w.buckets={}):w.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Vt extends ar{constructor(w,B,Q,ee){super(w,B,Q,ee),this.roundZoom=!0,this.type="video",this.options=B}load(){return a._(this,void 0,void 0,function*(){this._loaded=!1;let w=this.options;this.urls=[];for(let B of w.urls)this.urls.push(this.map._requestManager.transformRequest(B,"Source").url);try{let B=yield a.a3(this.urls);if(this._loaded=!0,!B)return;this.video=B,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(B){this.fire(new a.j(B))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(w){if(this.video){let B=this.video.seekable;w<B.start(0)||w>B.end(0)?this.fire(new a.j(new a.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${B.start(0)} and ${B.end(0)}-second mark.`))):this.video.currentTime=w}}getVideo(){return this.video}onAdd(w){this.map||(this.map=w,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let w=this.map.painter.context,B=w.gl;this.boundsBuffer||(this.boundsBuffer=w.createVertexBuffer(this._boundsArray,ct.members)),this.boundsSegments||(this.boundsSegments=a.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE),B.texSubImage2D(B.TEXTURE_2D,0,0,0,B.RGBA,B.UNSIGNED_BYTE,this.video)):(this.texture=new g(w,this.video,B.RGBA),this.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE));let Q=!1;for(let ee in this.tiles){let le=this.tiles[ee];le.state!=="loaded"&&(le.state="loaded",le.texture=this.texture,Q=!0)}Q&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class rr extends ar{constructor(w,B,Q,ee){super(w,B,Q,ee),B.coordinates?Array.isArray(B.coordinates)&&B.coordinates.length===4&&!B.coordinates.some(le=>!Array.isArray(le)||le.length!==2||le.some(Fe=>typeof Fe!="number"))||this.fire(new a.j(new a.a2(`sources.${w}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.j(new a.a2(`sources.${w}`,null,'missing required property "coordinates"'))),B.animate&&typeof B.animate!="boolean"&&this.fire(new a.j(new a.a2(`sources.${w}`,null,'optional "animate" property must be a boolean value'))),B.canvas?typeof B.canvas=="string"||B.canvas instanceof HTMLCanvasElement||this.fire(new a.j(new a.a2(`sources.${w}`,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 a.j(new a.a2(`sources.${w}`,null,'missing required property "canvas"'))),this.options=B,this.animate=B.animate===void 0||B.animate}load(){return a._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.j(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())})}getCanvas(){return this.canvas}onAdd(w){this.map=w,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let w=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,w=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,w=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let B=this.map.painter.context,Q=B.gl;this.boundsBuffer||(this.boundsBuffer=B.createVertexBuffer(this._boundsArray,ct.members)),this.boundsSegments||(this.boundsSegments=a.a0.simpleSegment(0,0,4,2)),this.texture?(w||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new g(B,this.canvas,Q.RGBA,{premultiply:!0});let ee=!1;for(let le in this.tiles){let Fe=this.tiles[le];Fe.state!=="loaded"&&(Fe.state="loaded",Fe.texture=this.texture,ee=!0)}ee&&this.fire(new a.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let w of[this.canvas.width,this.canvas.height])if(isNaN(w)||w<=0)return!0;return!1}}let tt={},je=ue=>{switch(ue){case"geojson":return at;case"image":return ar;case"raster":return mt;case"raster-dem":return Ht;case"vector":return lt;case"video":return Vt;case"canvas":return rr}return tt[ue]},Ue="RTLPluginLoaded";class Ae extends a.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=be()}_syncState(w){return this.status=w,this.dispatcher.broadcast("SRPS",{pluginStatus:w,pluginURL:this.url}).catch(B=>{throw this.status="error",B})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(w){return a._(this,arguments,void 0,function*(B,Q=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=u.resolveURL(B),!this.url)throw new Error(`requested url ${B} is invalid`);if(this.status==="unavailable"){if(!Q)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return a._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new a.k(Ue))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let rt=null;function St(){return rt||(rt=new Ae),rt}class Tt{constructor(w,B){this.timeAdded=0,this.fadeEndTime=0,this.tileID=w,this.uid=a.a4(),this.uses=0,this.tileSize=B,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(w){let B=w+this.timeAdded;B<this.fadeEndTime||(this.fadeEndTime=B)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(w){this.demTexture&&w.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(w,B,Q){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",w){w.featureIndex&&(this.latestFeatureIndex=w.featureIndex,w.rawTileData?(this.latestRawTileData=w.rawTileData,this.latestFeatureIndex.rawTileData=w.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=w.collisionBoxArray,this.buckets=function(ee,le){let Fe={};if(!le)return Fe;for(let Ze of ee){let ut=Ze.layerIds.map(Mt=>le.getLayer(Mt)).filter(Boolean);if(ut.length!==0){Ze.layers=ut,Ze.stateDependentLayerIds&&(Ze.stateDependentLayers=Ze.stateDependentLayerIds.map(Mt=>ut.filter(Jt=>Jt.id===Mt)[0]));for(let Mt of ut)Fe[Mt.id]=Ze}}return Fe}(w.buckets,B.style),this.hasSymbolBuckets=!1;for(let ee in this.buckets){let le=this.buckets[ee];if(le instanceof a.a6){if(this.hasSymbolBuckets=!0,!Q)break;le.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let ee in this.buckets){let le=this.buckets[ee];if(le instanceof a.a6&&le.hasRTLText){this.hasRTLText=!0,St().lazyLoad();break}}this.queryPadding=0;for(let ee in this.buckets){let le=this.buckets[ee];this.queryPadding=Math.max(this.queryPadding,B.style.getLayer(ee).queryRadius(le))}w.imageAtlas&&(this.imageAtlas=w.imageAtlas),w.glyphAtlasImage&&(this.glyphAtlasImage=w.glyphAtlasImage)}else this.collisionBoxArray=new a.a5}unloadVectorData(){for(let w in this.buckets)this.buckets[w].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(w){return this.buckets[w.id]}upload(w){for(let Q in this.buckets){let ee=this.buckets[Q];ee.uploadPending()&&ee.upload(w)}let B=w.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new g(w,this.imageAtlas.image,B.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new g(w,this.glyphAtlasImage,B.ALPHA),this.glyphAtlasImage=null)}prepare(w){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(w,this.imageAtlasTexture)}queryRenderedFeatures(w,B,Q,ee,le,Fe,Ze,ut,Mt,Jt){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:ee,cameraQueryGeometry:le,scale:Fe,tileSize:this.tileSize,pixelPosMatrix:Jt,transform:ut,params:Ze,queryPadding:this.queryPadding*Mt},w,B,Q):{}}querySourceFeatures(w,B){let Q=this.latestFeatureIndex;if(!Q||!Q.rawTileData)return;let ee=Q.loadVTLayers(),le=B&&B.sourceLayer?B.sourceLayer:"",Fe=ee._geojsonTileLayer||ee[le];if(!Fe)return;let Ze=a.a7(B&&B.filter),{z:ut,x:Mt,y:Jt}=this.tileID.canonical,$t={z:ut,x:Mt,y:Jt};for(let yr=0;yr<Fe.length;yr++){let Cr=Fe.feature(yr);if(Ze.needGeometry){let Ie=a.a8(Cr,!0);if(!Ze.filter(new a.z(this.tileID.overscaledZ),Ie,this.tileID.canonical))continue}else if(!Ze.filter(new a.z(this.tileID.overscaledZ),Cr))continue;let ve=Q.getId(Cr,le),xe=new a.a9(Cr,ut,Mt,Jt,ve);xe.tile=$t,w.push(xe)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(w){let B=this.expirationTime;if(w.cacheControl){let Q=a.aa(w.cacheControl);Q["max-age"]&&(this.expirationTime=Date.now()+1e3*Q["max-age"])}else w.expires&&(this.expirationTime=new Date(w.expires).getTime());if(this.expirationTime){let Q=Date.now(),ee=!1;if(this.expirationTime>Q)ee=!1;else if(B)if(this.expirationTime<B)ee=!0;else{let le=this.expirationTime-B;le?this.expirationTime=Q+Math.max(le,3e4):ee=!0}else ee=!0;ee?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(w,B){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(w).length===0)return;let Q=this.latestFeatureIndex.loadVTLayers();for(let ee in this.buckets){if(!B.style.hasLayer(ee))continue;let le=this.buckets[ee],Fe=le.layers[0].sourceLayer||"_geojsonTileLayer",Ze=Q[Fe],ut=w[Fe];if(!Ze||!ut||Object.keys(ut).length===0)continue;le.update(ut,Ze,this.imageAtlas&&this.imageAtlas.patternPositions||{});let Mt=B&&B.style&&B.style.getLayer(ee);Mt&&(this.queryPadding=Math.max(this.queryPadding,Mt.queryRadius(le)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<u.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(w){this.symbolFadeHoldUntil=u.now()+w}setDependencies(w,B){let Q={};for(let ee of B)Q[ee]=!0;this.dependencies[w]=Q}hasDependency(w,B){for(let Q of w){let ee=this.dependencies[Q];if(ee){for(let le of B)if(ee[le])return!0}}return!1}}class dt{constructor(w,B){this.max=w,this.onRemove=B,this.reset()}reset(){for(let w in this.data)for(let B of this.data[w])B.timeout&&clearTimeout(B.timeout),this.onRemove(B.value);return this.data={},this.order=[],this}add(w,B,Q){let ee=w.wrapped().key;this.data[ee]===void 0&&(this.data[ee]=[]);let le={value:B,timeout:void 0};if(Q!==void 0&&(le.timeout=setTimeout(()=>{this.remove(w,le)},Q)),this.data[ee].push(le),this.order.push(ee),this.order.length>this.max){let Fe=this._getAndRemoveByKey(this.order[0]);Fe&&this.onRemove(Fe)}return this}has(w){return w.wrapped().key in this.data}getAndRemove(w){return this.has(w)?this._getAndRemoveByKey(w.wrapped().key):null}_getAndRemoveByKey(w){let B=this.data[w].shift();return B.timeout&&clearTimeout(B.timeout),this.data[w].length===0&&delete this.data[w],this.order.splice(this.order.indexOf(w),1),B.value}getByKey(w){let B=this.data[w];return B?B[0].value:null}get(w){return this.has(w)?this.data[w.wrapped().key][0].value:null}remove(w,B){if(!this.has(w))return this;let Q=w.wrapped().key,ee=B===void 0?0:this.data[Q].indexOf(B),le=this.data[Q][ee];return this.data[Q].splice(ee,1),le.timeout&&clearTimeout(le.timeout),this.data[Q].length===0&&delete this.data[Q],this.onRemove(le.value),this.order.splice(this.order.indexOf(Q),1),this}setMaxSize(w){for(this.max=w;this.order.length>this.max;){let B=this._getAndRemoveByKey(this.order[0]);B&&this.onRemove(B)}return this}filter(w){let B=[];for(let Q in this.data)for(let ee of this.data[Q])w(ee.value)||B.push(ee);for(let Q of B)this.remove(Q.value.tileID,Q)}}class Et{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(w,B,Q){let ee=String(B);if(this.stateChanges[w]=this.stateChanges[w]||{},this.stateChanges[w][ee]=this.stateChanges[w][ee]||{},a.e(this.stateChanges[w][ee],Q),this.deletedStates[w]===null){this.deletedStates[w]={};for(let le in this.state[w])le!==ee&&(this.deletedStates[w][le]=null)}else if(this.deletedStates[w]&&this.deletedStates[w][ee]===null){this.deletedStates[w][ee]={};for(let le in this.state[w][ee])Q[le]||(this.deletedStates[w][ee][le]=null)}else for(let le in Q)this.deletedStates[w]&&this.deletedStates[w][ee]&&this.deletedStates[w][ee][le]===null&&delete this.deletedStates[w][ee][le]}removeFeatureState(w,B,Q){if(this.deletedStates[w]===null)return;let ee=String(B);if(this.deletedStates[w]=this.deletedStates[w]||{},Q&&B!==void 0)this.deletedStates[w][ee]!==null&&(this.deletedStates[w][ee]=this.deletedStates[w][ee]||{},this.deletedStates[w][ee][Q]=null);else if(B!==void 0)if(this.stateChanges[w]&&this.stateChanges[w][ee])for(Q in this.deletedStates[w][ee]={},this.stateChanges[w][ee])this.deletedStates[w][ee][Q]=null;else this.deletedStates[w][ee]=null;else this.deletedStates[w]=null}getState(w,B){let Q=String(B),ee=a.e({},(this.state[w]||{})[Q],(this.stateChanges[w]||{})[Q]);if(this.deletedStates[w]===null)return{};if(this.deletedStates[w]){let le=this.deletedStates[w][B];if(le===null)return{};for(let Fe in le)delete ee[Fe]}return ee}initializeTileState(w,B){w.setFeatureState(this.state,B)}coalesceChanges(w,B){let Q={};for(let ee in this.stateChanges){this.state[ee]=this.state[ee]||{};let le={};for(let Fe in this.stateChanges[ee])this.state[ee][Fe]||(this.state[ee][Fe]={}),a.e(this.state[ee][Fe],this.stateChanges[ee][Fe]),le[Fe]=this.state[ee][Fe];Q[ee]=le}for(let ee in this.deletedStates){this.state[ee]=this.state[ee]||{};let le={};if(this.deletedStates[ee]===null)for(let Fe in this.state[ee])le[Fe]={},this.state[ee][Fe]={};else for(let Fe in this.deletedStates[ee]){if(this.deletedStates[ee][Fe]===null)this.state[ee][Fe]={};else for(let Ze of Object.keys(this.deletedStates[ee][Fe]))delete this.state[ee][Fe][Ze];le[Fe]=this.state[ee][Fe]}Q[ee]=Q[ee]||{},a.e(Q[ee],le)}if(this.stateChanges={},this.deletedStates={},Object.keys(Q).length!==0)for(let ee in w)w[ee].setFeatureState(Q,B)}}class pt extends a.E{constructor(w,B,Q){super(),this.id=w,this.dispatcher=Q,this.on("data",ee=>this._dataHandler(ee)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((ee,le,Fe,Ze)=>{let ut=new(je(le.type))(ee,le,Fe,Ze);if(ut.id!==ee)throw new Error(`Expected Source id to be ${ee} instead of ${ut.id}`);return ut})(w,B,Q,this),this._tiles={},this._cache=new dt(0,ee=>this._unloadTile(ee)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Et,this._didEmitContent=!1,this._updated=!1}onAdd(w){this.map=w,this._maxTileCacheSize=w?w._maxTileCacheSize:null,this._maxTileCacheZoomLevels=w?w._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(w)}onRemove(w){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(w)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let w in this._tiles){let B=this._tiles[w];if(B.state!=="loaded"&&B.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let w=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,w&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(w,B,Q){return a._(this,void 0,void 0,function*(){try{yield this._source.loadTile(w),this._tileLoaded(w,B,Q)}catch(ee){w.state="errored",ee.status!==404?this._source.fire(new a.j(ee,{tile:w})):this.update(this.transform,this.terrain)}})}_unloadTile(w){this._source.unloadTile&&this._source.unloadTile(w)}_abortTile(w){this._source.abortTile&&this._source.abortTile(w),this._source.fire(new a.k("dataabort",{tile:w,coord:w.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(w){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let B in this._tiles){let Q=this._tiles[B];Q.upload(w),Q.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(w=>w.tileID).sort(jt).map(w=>w.key)}getRenderableIds(w){let B=[];for(let Q in this._tiles)this._isIdRenderable(Q,w)&&B.push(this._tiles[Q]);return w?B.sort((Q,ee)=>{let le=Q.tileID,Fe=ee.tileID,Ze=new a.P(le.canonical.x,le.canonical.y)._rotate(this.transform.angle),ut=new a.P(Fe.canonical.x,Fe.canonical.y)._rotate(this.transform.angle);return le.overscaledZ-Fe.overscaledZ||ut.y-Ze.y||ut.x-Ze.x}).map(Q=>Q.tileID.key):B.map(Q=>Q.tileID).sort(jt).map(Q=>Q.key)}hasRenderableParent(w){let B=this.findLoadedParent(w,0);return!!B&&this._isIdRenderable(B.tileID.key)}_isIdRenderable(w,B){return this._tiles[w]&&this._tiles[w].hasData()&&!this._coveredTiles[w]&&(B||!this._tiles[w].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let w in this._tiles)this._tiles[w].state!=="errored"&&this._reloadTile(w,"reloading")}}_reloadTile(w,B){return a._(this,void 0,void 0,function*(){let Q=this._tiles[w];Q&&(Q.state!=="loading"&&(Q.state=B),yield this._loadTile(Q,w,B))})}_tileLoaded(w,B,Q){w.timeAdded=u.now(),Q==="expired"&&(w.refreshedUponExpiration=!0),this._setTileReloadTimer(B,w),this.getSource().type==="raster-dem"&&w.dem&&this._backfillDEM(w),this._state.initializeTileState(w,this.map?this.map.painter:null),w.aborted||this._source.fire(new a.k("data",{dataType:"source",tile:w,coord:w.tileID}))}_backfillDEM(w){let B=this.getRenderableIds();for(let ee=0;ee<B.length;ee++){let le=B[ee];if(w.neighboringTiles&&w.neighboringTiles[le]){let Fe=this.getTileByID(le);Q(w,Fe),Q(Fe,w)}}function Q(ee,le){ee.needsHillshadePrepare=!0,ee.needsTerrainPrepare=!0;let Fe=le.tileID.canonical.x-ee.tileID.canonical.x,Ze=le.tileID.canonical.y-ee.tileID.canonical.y,ut=Math.pow(2,ee.tileID.canonical.z),Mt=le.tileID.key;Fe===0&&Ze===0||Math.abs(Ze)>1||(Math.abs(Fe)>1&&(Math.abs(Fe+ut)===1?Fe+=ut:Math.abs(Fe-ut)===1&&(Fe-=ut)),le.dem&&ee.dem&&(ee.dem.backfillBorder(le.dem,Fe,Ze),ee.neighboringTiles&&ee.neighboringTiles[Mt]&&(ee.neighboringTiles[Mt].backfilled=!0)))}}getTile(w){return this.getTileByID(w.key)}getTileByID(w){return this._tiles[w]}_retainLoadedChildren(w,B,Q,ee){for(let le in this._tiles){let Fe=this._tiles[le];if(ee[le]||!Fe.hasData()||Fe.tileID.overscaledZ<=B||Fe.tileID.overscaledZ>Q)continue;let Ze=Fe.tileID;for(;Fe&&Fe.tileID.overscaledZ>B+1;){let Mt=Fe.tileID.scaledTo(Fe.tileID.overscaledZ-1);Fe=this._tiles[Mt.key],Fe&&Fe.hasData()&&(Ze=Mt)}let ut=Ze;for(;ut.overscaledZ>B;)if(ut=ut.scaledTo(ut.overscaledZ-1),w[ut.key]){ee[Ze.key]=Ze;break}}}findLoadedParent(w,B){if(w.key in this._loadedParentTiles){let Q=this._loadedParentTiles[w.key];return Q&&Q.tileID.overscaledZ>=B?Q:null}for(let Q=w.overscaledZ-1;Q>=B;Q--){let ee=w.scaledTo(Q),le=this._getLoadedTile(ee);if(le)return le}}findLoadedSibling(w){return this._getLoadedTile(w)}_getLoadedTile(w){let B=this._tiles[w.key];return B&&B.hasData()?B:this._cache.getByKey(w.wrapped().key)}updateCacheSize(w){let B=Math.ceil(w.width/this._source.tileSize)+1,Q=Math.ceil(w.height/this._source.tileSize)+1,ee=Math.floor(B*Q*(this._maxTileCacheZoomLevels===null?a.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),le=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,ee):ee;this._cache.setMaxSize(le)}handleWrapJump(w){let B=Math.round((w-(this._prevLng===void 0?w:this._prevLng))/360);if(this._prevLng=w,B){let Q={};for(let ee in this._tiles){let le=this._tiles[ee];le.tileID=le.tileID.unwrapTo(le.tileID.wrap+B),Q[le.tileID.key]=le}this._tiles=Q;for(let ee in this._timers)clearTimeout(this._timers[ee]),delete this._timers[ee];for(let ee in this._tiles)this._setTileReloadTimer(ee,this._tiles[ee])}}_updateCoveredAndRetainedTiles(w,B,Q,ee,le,Fe){let Ze={},ut={},Mt=Object.keys(w),Jt=u.now();for(let $t of Mt){let yr=w[$t],Cr=this._tiles[$t];if(!Cr||Cr.fadeEndTime!==0&&Cr.fadeEndTime<=Jt)continue;let ve=this.findLoadedParent(yr,B),xe=this.findLoadedSibling(yr),Ie=ve||xe||null;Ie&&(this._addTile(Ie.tileID),Ze[Ie.tileID.key]=Ie.tileID),ut[$t]=yr}this._retainLoadedChildren(ut,ee,Q,w);for(let $t in Ze)w[$t]||(this._coveredTiles[$t]=!0,w[$t]=Ze[$t]);if(Fe){let $t={},yr={};for(let Cr of le)this._tiles[Cr.key].hasData()?$t[Cr.key]=Cr:yr[Cr.key]=Cr;for(let Cr in yr){let ve=yr[Cr].children(this._source.maxzoom);this._tiles[ve[0].key]&&this._tiles[ve[1].key]&&this._tiles[ve[2].key]&&this._tiles[ve[3].key]&&($t[ve[0].key]=w[ve[0].key]=ve[0],$t[ve[1].key]=w[ve[1].key]=ve[1],$t[ve[2].key]=w[ve[2].key]=ve[2],$t[ve[3].key]=w[ve[3].key]=ve[3],delete yr[Cr])}for(let Cr in yr){let ve=yr[Cr],xe=this.findLoadedParent(ve,this._source.minzoom),Ie=this.findLoadedSibling(ve),ze=xe||Ie||null;if(ze){$t[ze.tileID.key]=w[ze.tileID.key]=ze.tileID;for(let Qe in $t)$t[Qe].isChildOf(ze.tileID)&&delete $t[Qe]}}for(let Cr in this._tiles)$t[Cr]||(this._coveredTiles[Cr]=!0)}}update(w,B){if(!this._sourceLoaded||this._paused)return;let Q;this.transform=w,this.terrain=B,this.updateCacheSize(w),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?Q=w.getVisibleUnwrappedCoordinates(this._source.tileID).map(Jt=>new a.S(Jt.canonical.z,Jt.wrap,Jt.canonical.z,Jt.canonical.x,Jt.canonical.y)):(Q=w.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:B}),this._source.hasTile&&(Q=Q.filter(Jt=>this._source.hasTile(Jt)))):Q=[];let ee=w.coveringZoomLevel(this._source),le=Math.max(ee-pt.maxOverzooming,this._source.minzoom),Fe=Math.max(ee+pt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let Jt={};for(let $t of Q)if($t.canonical.z>this._source.minzoom){let yr=$t.scaledTo($t.canonical.z-1);Jt[yr.key]=yr;let Cr=$t.scaledTo(Math.max(this._source.minzoom,Math.min($t.canonical.z,5)));Jt[Cr.key]=Cr}Q=Q.concat(Object.values(Jt))}let Ze=Q.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,Ze&&this.fire(new a.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let ut=this._updateRetainedTiles(Q,ee);or(this._source.type)&&this._updateCoveredAndRetainedTiles(ut,le,Fe,ee,Q,B);for(let Jt in ut)this._tiles[Jt].clearFadeHold();let Mt=a.ab(this._tiles,ut);for(let Jt of Mt){let $t=this._tiles[Jt];$t.hasSymbolBuckets&&!$t.holdingForFade()?$t.setHoldDuration(this.map._fadeDuration):$t.hasSymbolBuckets&&!$t.symbolFadeFinished()||this._removeTile(Jt)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let w in this._tiles)this._tiles[w].holdingForFade()&&this._removeTile(w)}_updateRetainedTiles(w,B){var Q;let ee={},le={},Fe=Math.max(B-pt.maxOverzooming,this._source.minzoom),Ze=Math.max(B+pt.maxUnderzooming,this._source.minzoom),ut={};for(let Mt of w){let Jt=this._addTile(Mt);ee[Mt.key]=Mt,Jt.hasData()||B<this._source.maxzoom&&(ut[Mt.key]=Mt)}this._retainLoadedChildren(ut,B,Ze,ee);for(let Mt of w){let Jt=this._tiles[Mt.key];if(Jt.hasData())continue;if(B+1>this._source.maxzoom){let yr=Mt.children(this._source.maxzoom)[0],Cr=this.getTile(yr);if(Cr&&Cr.hasData()){ee[yr.key]=yr;continue}}else{let yr=Mt.children(this._source.maxzoom);if(ee[yr[0].key]&&ee[yr[1].key]&&ee[yr[2].key]&&ee[yr[3].key])continue}let $t=Jt.wasRequested();for(let yr=Mt.overscaledZ-1;yr>=Fe;--yr){let Cr=Mt.scaledTo(yr);if(le[Cr.key])break;if(le[Cr.key]=!0,Jt=this.getTile(Cr),!Jt&&$t&&(Jt=this._addTile(Cr)),Jt){let ve=Jt.hasData();if((ve||!(!((Q=this.map)===null||Q===void 0)&&Q.cancelPendingTileRequestsWhileZooming)||$t)&&(ee[Cr.key]=Cr),$t=Jt.wasRequested(),ve)break}}}return ee}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let w in this._tiles){let B=[],Q,ee=this._tiles[w].tileID;for(;ee.overscaledZ>0;){if(ee.key in this._loadedParentTiles){Q=this._loadedParentTiles[ee.key];break}B.push(ee.key);let le=ee.scaledTo(ee.overscaledZ-1);if(Q=this._getLoadedTile(le),Q)break;ee=le}for(let le of B)this._loadedParentTiles[le]=Q}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let w in this._tiles){let B=this._tiles[w].tileID,Q=this._getLoadedTile(B);this._loadedSiblingTiles[B.key]=Q}}_addTile(w){let B=this._tiles[w.key];if(B)return B;B=this._cache.getAndRemove(w),B&&(this._setTileReloadTimer(w.key,B),B.tileID=w,this._state.initializeTileState(B,this.map?this.map.painter:null),this._cacheTimers[w.key]&&(clearTimeout(this._cacheTimers[w.key]),delete this._cacheTimers[w.key],this._setTileReloadTimer(w.key,B)));let Q=B;return B||(B=new Tt(w,this._source.tileSize*w.overscaleFactor()),this._loadTile(B,w.key,B.state)),B.uses++,this._tiles[w.key]=B,Q||this._source.fire(new a.k("dataloading",{tile:B,coord:B.tileID,dataType:"source"})),B}_setTileReloadTimer(w,B){w in this._timers&&(clearTimeout(this._timers[w]),delete this._timers[w]);let Q=B.getExpiryTimeout();Q&&(this._timers[w]=setTimeout(()=>{this._reloadTile(w,"expired"),delete this._timers[w]},Q))}_removeTile(w){let B=this._tiles[w];B&&(B.uses--,delete this._tiles[w],this._timers[w]&&(clearTimeout(this._timers[w]),delete this._timers[w]),B.uses>0||(B.hasData()&&B.state!=="reloading"?this._cache.add(B.tileID,B,B.getExpiryTimeout()):(B.aborted=!0,this._abortTile(B),this._unloadTile(B))))}_dataHandler(w){let B=w.sourceDataType;w.dataType==="source"&&B==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&w.dataType==="source"&&B==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let w in this._tiles)this._removeTile(w);this._cache.reset()}tilesIn(w,B,Q){let ee=[],le=this.transform;if(!le)return ee;let Fe=Q?le.getCameraQueryGeometry(w):w,Ze=w.map(ve=>le.pointCoordinate(ve,this.terrain)),ut=Fe.map(ve=>le.pointCoordinate(ve,this.terrain)),Mt=this.getIds(),Jt=1/0,$t=1/0,yr=-1/0,Cr=-1/0;for(let ve of ut)Jt=Math.min(Jt,ve.x),$t=Math.min($t,ve.y),yr=Math.max(yr,ve.x),Cr=Math.max(Cr,ve.y);for(let ve=0;ve<Mt.length;ve++){let xe=this._tiles[Mt[ve]];if(xe.holdingForFade())continue;let Ie=xe.tileID,ze=Math.pow(2,le.zoom-xe.tileID.overscaledZ),Qe=B*xe.queryPadding*a.X/xe.tileSize/ze,Xe=[Ie.getTilePoint(new a.Z(Jt,$t)),Ie.getTilePoint(new a.Z(yr,Cr))];if(Xe[0].x-Qe<a.X&&Xe[0].y-Qe<a.X&&Xe[1].x+Qe>=0&&Xe[1].y+Qe>=0){let nt=Ze.map(Wt=>Ie.getTilePoint(Wt)),qt=ut.map(Wt=>Ie.getTilePoint(Wt));ee.push({tile:xe,tileID:Ie,queryGeometry:nt,cameraQueryGeometry:qt,scale:ze})}}return ee}getVisibleCoordinates(w){let B=this.getRenderableIds(w).map(Q=>this._tiles[Q].tileID);for(let Q of B)Q.posMatrix=this.transform.calculatePosMatrix(Q.toUnwrapped());return B}hasTransition(){if(this._source.hasTransition())return!0;if(or(this._source.type)){let w=u.now();for(let B in this._tiles)if(this._tiles[B].fadeEndTime>=w)return!0}return!1}setFeatureState(w,B,Q){this._state.updateState(w=w||"_geojsonTileLayer",B,Q)}removeFeatureState(w,B,Q){this._state.removeFeatureState(w=w||"_geojsonTileLayer",B,Q)}getFeatureState(w,B){return this._state.getState(w=w||"_geojsonTileLayer",B)}setDependencies(w,B,Q){let ee=this._tiles[w];ee&&ee.setDependencies(B,Q)}reloadTilesForDependencies(w,B){for(let Q in this._tiles)this._tiles[Q].hasDependency(w,B)&&this._reloadTile(Q,"reloading");this._cache.filter(Q=>!Q.hasDependency(w,B))}}function jt(ue,w){let B=Math.abs(2*ue.wrap)-+(ue.wrap<0),Q=Math.abs(2*w.wrap)-+(w.wrap<0);return ue.overscaledZ-w.overscaledZ||Q-B||w.canonical.y-ue.canonical.y||w.canonical.x-ue.canonical.x}function or(ue){return ue==="raster"||ue==="image"||ue==="video"}pt.maxOverzooming=10,pt.maxUnderzooming=3;class mr{constructor(w,B){this.reset(w,B)}reset(w,B){this.points=w||[],this._distances=[0];for(let Q=1;Q<this.points.length;Q++)this._distances[Q]=this._distances[Q-1]+this.points[Q].dist(this.points[Q-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(B||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(w){if(this.points.length===1)return this.points[0];w=a.ac(w,0,1);let B=1,Q=this._distances[B],ee=w*this.paddedLength+this.padding;for(;Q<ee&&B<this._distances.length;)Q=this._distances[++B];let le=B-1,Fe=this._distances[le],Ze=Q-Fe,ut=Ze>0?(ee-Fe)/Ze:0;return this.points[le].mult(1-ut).add(this.points[B].mult(ut))}}function Ar(ue,w){let B=!0;return ue==="always"||ue!=="never"&&w!=="never"||(B=!1),B}class ei{constructor(w,B,Q){let ee=this.boxCells=[],le=this.circleCells=[];this.xCellCount=Math.ceil(w/Q),this.yCellCount=Math.ceil(B/Q);for(let Fe=0;Fe<this.xCellCount*this.yCellCount;Fe++)ee.push([]),le.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=w,this.height=B,this.xScale=this.xCellCount/w,this.yScale=this.yCellCount/B,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(w,B,Q,ee,le){this._forEachCell(B,Q,ee,le,this._insertBoxCell,this.boxUid++),this.boxKeys.push(w),this.bboxes.push(B),this.bboxes.push(Q),this.bboxes.push(ee),this.bboxes.push(le)}insertCircle(w,B,Q,ee){this._forEachCell(B-ee,Q-ee,B+ee,Q+ee,this._insertCircleCell,this.circleUid++),this.circleKeys.push(w),this.circles.push(B),this.circles.push(Q),this.circles.push(ee)}_insertBoxCell(w,B,Q,ee,le,Fe){this.boxCells[le].push(Fe)}_insertCircleCell(w,B,Q,ee,le,Fe){this.circleCells[le].push(Fe)}_query(w,B,Q,ee,le,Fe,Ze){if(Q<0||w>this.width||ee<0||B>this.height)return[];let ut=[];if(w<=0&&B<=0&&this.width<=Q&&this.height<=ee){if(le)return[{key:null,x1:w,y1:B,x2:Q,y2:ee}];for(let Mt=0;Mt<this.boxKeys.length;Mt++)ut.push({key:this.boxKeys[Mt],x1:this.bboxes[4*Mt],y1:this.bboxes[4*Mt+1],x2:this.bboxes[4*Mt+2],y2:this.bboxes[4*Mt+3]});for(let Mt=0;Mt<this.circleKeys.length;Mt++){let Jt=this.circles[3*Mt],$t=this.circles[3*Mt+1],yr=this.circles[3*Mt+2];ut.push({key:this.circleKeys[Mt],x1:Jt-yr,y1:$t-yr,x2:Jt+yr,y2:$t+yr})}}else this._forEachCell(w,B,Q,ee,this._queryCell,ut,{hitTest:le,overlapMode:Fe,seenUids:{box:{},circle:{}}},Ze);return ut}query(w,B,Q,ee){return this._query(w,B,Q,ee,!1,null)}hitTest(w,B,Q,ee,le,Fe){return this._query(w,B,Q,ee,!0,le,Fe).length>0}hitTestCircle(w,B,Q,ee,le){let Fe=w-Q,Ze=w+Q,ut=B-Q,Mt=B+Q;if(Ze<0||Fe>this.width||Mt<0||ut>this.height)return!1;let Jt=[];return this._forEachCell(Fe,ut,Ze,Mt,this._queryCellCircle,Jt,{hitTest:!0,overlapMode:ee,circle:{x:w,y:B,radius:Q},seenUids:{box:{},circle:{}}},le),Jt.length>0}_queryCell(w,B,Q,ee,le,Fe,Ze,ut){let{seenUids:Mt,hitTest:Jt,overlapMode:$t}=Ze,yr=this.boxCells[le];if(yr!==null){let ve=this.bboxes;for(let xe of yr)if(!Mt.box[xe]){Mt.box[xe]=!0;let Ie=4*xe,ze=this.boxKeys[xe];if(w<=ve[Ie+2]&&B<=ve[Ie+3]&&Q>=ve[Ie+0]&&ee>=ve[Ie+1]&&(!ut||ut(ze))&&(!Jt||!Ar($t,ze.overlapMode))&&(Fe.push({key:ze,x1:ve[Ie],y1:ve[Ie+1],x2:ve[Ie+2],y2:ve[Ie+3]}),Jt))return!0}}let Cr=this.circleCells[le];if(Cr!==null){let ve=this.circles;for(let xe of Cr)if(!Mt.circle[xe]){Mt.circle[xe]=!0;let Ie=3*xe,ze=this.circleKeys[xe];if(this._circleAndRectCollide(ve[Ie],ve[Ie+1],ve[Ie+2],w,B,Q,ee)&&(!ut||ut(ze))&&(!Jt||!Ar($t,ze.overlapMode))){let Qe=ve[Ie],Xe=ve[Ie+1],nt=ve[Ie+2];if(Fe.push({key:ze,x1:Qe-nt,y1:Xe-nt,x2:Qe+nt,y2:Xe+nt}),Jt)return!0}}}return!1}_queryCellCircle(w,B,Q,ee,le,Fe,Ze,ut){let{circle:Mt,seenUids:Jt,overlapMode:$t}=Ze,yr=this.boxCells[le];if(yr!==null){let ve=this.bboxes;for(let xe of yr)if(!Jt.box[xe]){Jt.box[xe]=!0;let Ie=4*xe,ze=this.boxKeys[xe];if(this._circleAndRectCollide(Mt.x,Mt.y,Mt.radius,ve[Ie+0],ve[Ie+1],ve[Ie+2],ve[Ie+3])&&(!ut||ut(ze))&&!Ar($t,ze.overlapMode))return Fe.push(!0),!0}}let Cr=this.circleCells[le];if(Cr!==null){let ve=this.circles;for(let xe of Cr)if(!Jt.circle[xe]){Jt.circle[xe]=!0;let Ie=3*xe,ze=this.circleKeys[xe];if(this._circlesCollide(ve[Ie],ve[Ie+1],ve[Ie+2],Mt.x,Mt.y,Mt.radius)&&(!ut||ut(ze))&&!Ar($t,ze.overlapMode))return Fe.push(!0),!0}}}_forEachCell(w,B,Q,ee,le,Fe,Ze,ut){let Mt=this._convertToXCellCoord(w),Jt=this._convertToYCellCoord(B),$t=this._convertToXCellCoord(Q),yr=this._convertToYCellCoord(ee);for(let Cr=Mt;Cr<=$t;Cr++)for(let ve=Jt;ve<=yr;ve++)if(le.call(this,w,B,Q,ee,this.xCellCount*ve+Cr,Fe,Ze,ut))return}_convertToXCellCoord(w){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(w*this.xScale)))}_convertToYCellCoord(w){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(w*this.yScale)))}_circlesCollide(w,B,Q,ee,le,Fe){let Ze=ee-w,ut=le-B,Mt=Q+Fe;return Mt*Mt>Ze*Ze+ut*ut}_circleAndRectCollide(w,B,Q,ee,le,Fe,Ze){let ut=(Fe-ee)/2,Mt=Math.abs(w-(ee+ut));if(Mt>ut+Q)return!1;let Jt=(Ze-le)/2,$t=Math.abs(B-(le+Jt));if($t>Jt+Q)return!1;if(Mt<=ut||$t<=Jt)return!0;let yr=Mt-ut,Cr=$t-Jt;return yr*yr+Cr*Cr<=Q*Q}}function qr(ue,w,B,Q,ee){let le=a.H();return w?(a.K(le,le,[1/ee,1/ee,1]),B||a.ad(le,le,Q.angle)):a.L(le,Q.labelPlaneMatrix,ue),le}function jr(ue,w,B,Q,ee){if(w){let le=a.ae(ue);return a.K(le,le,[ee,ee,1]),B||a.ad(le,le,-Q.angle),le}return Q.glCoordMatrix}function gt(ue,w,B,Q){let ee;Q?(ee=[ue,w,Q(ue,w),1],a.af(ee,ee,B)):(ee=[ue,w,0,1],ai(ee,ee,B));let le=ee[3];return{point:new a.P(ee[0]/le,ee[1]/le),signedDistanceFromCamera:le,isOccluded:!1}}function Ge(ue,w){return .5+ue/w*.5}function Je(ue,w){return ue.x>=-w[0]&&ue.x<=w[0]&&ue.y>=-w[1]&&ue.y<=w[1]}function We(ue,w,B,Q,ee,le,Fe,Ze,ut,Mt,Jt,$t,yr,Cr,ve){let xe=Q?ue.textSizeData:ue.iconSizeData,Ie=a.ag(xe,B.transform.zoom),ze=[256/B.width*2+1,256/B.height*2+1],Qe=Q?ue.text.dynamicLayoutVertexArray:ue.icon.dynamicLayoutVertexArray;Qe.clear();let Xe=ue.lineVertexArray,nt=Q?ue.text.placedSymbolArray:ue.icon.placedSymbolArray,qt=B.transform.width/B.transform.height,Wt=!1;for(let nr=0;nr<nt.length;nr++){let fr=nt.get(nr);if(fr.hidden||fr.writingMode===a.ah.vertical&&!Wt){Pi(fr.numGlyphs,Qe);continue}Wt=!1;let br=gt(fr.anchorX,fr.anchorY,w,ve);if(!Je(br.point,ze)){Pi(fr.numGlyphs,Qe);continue}let Fr=Ge(B.transform.cameraToCenterDistance,br.signedDistanceFromCamera),Hr=a.ai(xe,Ie,fr),ri=Fe?Hr/Fr:Hr*Fr,Ci={getElevation:ve,labelPlaneMatrix:ee,lineVertexArray:Xe,pitchWithMap:Fe,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:Mt,tileAnchorPoint:new a.P(fr.anchorX,fr.anchorY),unwrappedTileID:Jt,width:$t,height:yr,translation:Cr},cn=At(Ci,fr,ri,!1,Ze,w,le,ue.glyphOffsetArray,Qe,qt,ut);Wt=cn.useVertical,(cn.notEnoughRoom||Wt||cn.needsFlipping&&At(Ci,fr,ri,!0,Ze,w,le,ue.glyphOffsetArray,Qe,qt,ut).notEnoughRoom)&&Pi(fr.numGlyphs,Qe)}Q?ue.text.dynamicLayoutVertexBuffer.updateData(Qe):ue.icon.dynamicLayoutVertexBuffer.updateData(Qe)}function et(ue,w,B,Q,ee,le,Fe,Ze){let ut=le.glyphStartIndex+le.numGlyphs,Mt=le.lineStartIndex,Jt=le.lineStartIndex+le.lineLength,$t=w.getoffsetX(le.glyphStartIndex),yr=w.getoffsetX(ut-1),Cr=Yr(ue*$t,B,Q,ee,le.segment,Mt,Jt,Ze,Fe);if(!Cr)return null;let ve=Yr(ue*yr,B,Q,ee,le.segment,Mt,Jt,Ze,Fe);return ve?Ze.projectionCache.anyProjectionOccluded?null:{first:Cr,last:ve}:null}function xt(ue,w,B,Q){return ue===a.ah.horizontal&&Math.abs(B.y-w.y)>Math.abs(B.x-w.x)*Q?{useVertical:!0}:(ue===a.ah.vertical?w.y<B.y:w.x>B.x)?{needsFlipping:!0}:null}function At(ue,w,B,Q,ee,le,Fe,Ze,ut,Mt,Jt){let $t=B/24,yr=w.lineOffsetX*$t,Cr=w.lineOffsetY*$t,ve;if(w.numGlyphs>1){let xe=w.glyphStartIndex+w.numGlyphs,Ie=w.lineStartIndex,ze=w.lineStartIndex+w.lineLength,Qe=et($t,Ze,yr,Cr,Q,w,Jt,ue);if(!Qe)return{notEnoughRoom:!0};let Xe=gt(Qe.first.point.x,Qe.first.point.y,Fe,ue.getElevation).point,nt=gt(Qe.last.point.x,Qe.last.point.y,Fe,ue.getElevation).point;if(ee&&!Q){let qt=xt(w.writingMode,Xe,nt,Mt);if(qt)return qt}ve=[Qe.first];for(let qt=w.glyphStartIndex+1;qt<xe-1;qt++)ve.push(Yr($t*Ze.getoffsetX(qt),yr,Cr,Q,w.segment,Ie,ze,ue,Jt));ve.push(Qe.last)}else{if(ee&&!Q){let Ie=gt(ue.tileAnchorPoint.x,ue.tileAnchorPoint.y,le,ue.getElevation).point,ze=w.lineStartIndex+w.segment+1,Qe=new a.P(ue.lineVertexArray.getx(ze),ue.lineVertexArray.gety(ze)),Xe=gt(Qe.x,Qe.y,le,ue.getElevation),nt=Xe.signedDistanceFromCamera>0?Xe.point:function(Wt,nr,fr,br,Fr,Hr){return Kt(Wt,nr,fr,1,Fr,Hr)}(ue.tileAnchorPoint,Qe,Ie,0,le,ue),qt=xt(w.writingMode,Ie,nt,Mt);if(qt)return qt}let xe=Yr($t*Ze.getoffsetX(w.glyphStartIndex),yr,Cr,Q,w.segment,w.lineStartIndex,w.lineStartIndex+w.lineLength,ue,Jt);if(!xe||ue.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ve=[xe]}for(let xe of ve)a.aj(ut,xe.point,xe.angle);return{}}function Kt(ue,w,B,Q,ee,le){let Fe=ue.add(ue.sub(w)._unit()),Ze=ee!==void 0?gt(Fe.x,Fe.y,ee,le.getElevation).point:Mr(Fe.x,Fe.y,le).point,ut=B.sub(Ze);return B.add(ut._mult(Q/ut.mag()))}function Qt(ue,w,B){let Q=w.projectionCache;if(Q.projections[ue])return Q.projections[ue];let ee=new a.P(w.lineVertexArray.getx(ue),w.lineVertexArray.gety(ue)),le=Mr(ee.x,ee.y,w);if(le.signedDistanceFromCamera>0)return Q.projections[ue]=le.point,Q.anyProjectionOccluded=Q.anyProjectionOccluded||le.isOccluded,le.point;let Fe=ue-B.direction;return function(Ze,ut,Mt,Jt,$t){return Kt(Ze,ut,Mt,Jt,void 0,$t)}(B.distanceFromAnchor===0?w.tileAnchorPoint:new a.P(w.lineVertexArray.getx(Fe),w.lineVertexArray.gety(Fe)),ee,B.previousVertex,B.absOffsetX-B.distanceFromAnchor+1,w)}function Mr(ue,w,B){let Q=ue+B.translation[0],ee=w+B.translation[1],le;return!B.pitchWithMap&&B.projection.useSpecialProjectionForSymbols?(le=B.projection.projectTileCoordinates(Q,ee,B.unwrappedTileID,B.getElevation),le.point.x=(.5*le.point.x+.5)*B.width,le.point.y=(.5*-le.point.y+.5)*B.height):(le=gt(Q,ee,B.labelPlaneMatrix,B.getElevation),le.isOccluded=!1),le}function Gr(ue,w,B){return ue._unit()._perp()._mult(w*B)}function Ir(ue,w,B,Q,ee,le,Fe,Ze,ut){if(Ze.projectionCache.offsets[ue])return Ze.projectionCache.offsets[ue];let Mt=B.add(w);if(ue+ut.direction<Q||ue+ut.direction>=ee)return Ze.projectionCache.offsets[ue]=Mt,Mt;let Jt=Qt(ue+ut.direction,Ze,ut),$t=Gr(Jt.sub(B),Fe,ut.direction),yr=B.add($t),Cr=Jt.add($t);return Ze.projectionCache.offsets[ue]=a.ak(le,Mt,yr,Cr)||Mt,Ze.projectionCache.offsets[ue]}function Yr(ue,w,B,Q,ee,le,Fe,Ze,ut){let Mt=Q?ue-w:ue+w,Jt=Mt>0?1:-1,$t=0;Q&&(Jt*=-1,$t=Math.PI),Jt<0&&($t+=Math.PI);let yr,Cr=Jt>0?le+ee:le+ee+1;Ze.projectionCache.cachedAnchorPoint?yr=Ze.projectionCache.cachedAnchorPoint:(yr=Mr(Ze.tileAnchorPoint.x,Ze.tileAnchorPoint.y,Ze).point,Ze.projectionCache.cachedAnchorPoint=yr);let ve,xe,Ie=yr,ze=yr,Qe=0,Xe=0,nt=Math.abs(Mt),qt=[],Wt;for(;Qe+Xe<=nt;){if(Cr+=Jt,Cr<le||Cr>=Fe)return null;Qe+=Xe,ze=Ie,xe=ve;let br={absOffsetX:nt,direction:Jt,distanceFromAnchor:Qe,previousVertex:ze};if(Ie=Qt(Cr,Ze,br),B===0)qt.push(ze),Wt=Ie.sub(ze);else{let Fr,Hr=Ie.sub(ze);Fr=Hr.mag()===0?Gr(Qt(Cr+Jt,Ze,br).sub(Ie),B,Jt):Gr(Hr,B,Jt),xe||(xe=ze.add(Fr)),ve=Ir(Cr,Fr,Ie,le,Fe,xe,B,Ze,br),qt.push(xe),Wt=ve.sub(xe)}Xe=Wt.mag()}let nr=Wt._mult((nt-Qe)/Xe)._add(xe||ze),fr=$t+Math.atan2(Ie.y-ze.y,Ie.x-ze.x);return qt.push(nr),{point:nr,angle:ut?fr:0,path:qt}}let _i=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Pi(ue,w){for(let B=0;B<ue;B++){let Q=w.length;w.resize(Q+4),w.float32.set(_i,3*Q)}}function ai(ue,w,B){let Q=w[0],ee=w[1];return ue[0]=B[0]*Q+B[4]*ee+B[12],ue[1]=B[1]*Q+B[5]*ee+B[13],ue[3]=B[3]*Q+B[7]*ee+B[15],ue}let mi=100;class un{constructor(w,B,Q=new ei(w.width+200,w.height+200,25),ee=new ei(w.width+200,w.height+200,25)){this.transform=w,this.mapProjection=B,this.grid=Q,this.ignoredGrid=ee,this.pitchFactor=Math.cos(w._pitch)*w.cameraToCenterDistance,this.screenRightBoundary=w.width+mi,this.screenBottomBoundary=w.height+mi,this.gridRightBoundary=w.width+200,this.gridBottomBoundary=w.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(w,B,Q,ee,le,Fe,Ze,ut,Mt,Jt,$t){let yr=w.anchorPointX+ut[0],Cr=w.anchorPointY+ut[1],ve=this.projectAndGetPerspectiveRatio(ee,yr,Cr,le,Jt),xe=Q*ve.perspectiveRatio,Ie;if(Fe||Ze)Ie=this._projectCollisionBox(w,xe,ee,le,Fe,Ze,ut,ve,Jt,$t);else{let qt=ve.point.x+($t?$t.x*xe:0),Wt=ve.point.y+($t?$t.y*xe:0);Ie={allPointsOccluded:!1,box:[qt+w.x1*xe,Wt+w.y1*xe,qt+w.x2*xe,Wt+w.y2*xe]}}let[ze,Qe,Xe,nt]=Ie.box;return this.mapProjection.useSpecialProjectionForSymbols&&(Fe?Ie.allPointsOccluded:this.mapProjection.isOccluded(yr,Cr,le))||ve.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ze,Qe,Xe,nt)||B!=="always"&&this.grid.hitTest(ze,Qe,Xe,nt,B,Mt)?{box:[ze,Qe,Xe,nt],placeable:!1,offscreen:!1}:{box:[ze,Qe,Xe,nt],placeable:!0,offscreen:this.isOffscreen(ze,Qe,Xe,nt)}}placeCollisionCircles(w,B,Q,ee,le,Fe,Ze,ut,Mt,Jt,$t,yr,Cr,ve,xe,Ie){let ze=[],Qe=new a.P(B.anchorX,B.anchorY),Xe=this.getPerspectiveRatio(Fe,Qe.x,Qe.y,Ze,Ie),nt=($t?le/Xe:le*Xe)/a.ap,qt={getElevation:Ie,labelPlaneMatrix:ut,lineVertexArray:Q,pitchWithMap:$t,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Qe,unwrappedTileID:Ze,width:this.transform.width,height:this.transform.height,translation:xe},Wt=et(nt,ee,B.lineOffsetX*nt,B.lineOffsetY*nt,!1,B,!1,qt),nr=!1,fr=!1,br=!0;if(Wt){let Fr=.5*Cr*Xe+ve,Hr=new a.P(-100,-100),ri=new a.P(this.screenRightBoundary,this.screenBottomBoundary),Ci=new mr,cn=Wt.first,sn=Wt.last,Ln=[];for(let fa=cn.path.length-1;fa>=1;fa--)Ln.push(cn.path[fa]);for(let fa=1;fa<sn.path.length;fa++)Ln.push(sn.path[fa]);let Yn=2.5*Fr;if(Mt){let fa=this.projectPathToScreenSpace(Ln,qt,Mt);Ln=fa.some($a=>$a.signedDistanceFromCamera<=0)?[]:fa.map($a=>$a.point)}let Aa=[];if(Ln.length>0){let fa=Ln[0].clone(),$a=Ln[0].clone();for(let Co=1;Co<Ln.length;Co++)fa.x=Math.min(fa.x,Ln[Co].x),fa.y=Math.min(fa.y,Ln[Co].y),$a.x=Math.max($a.x,Ln[Co].x),$a.y=Math.max($a.y,Ln[Co].y);Aa=fa.x>=Hr.x&&$a.x<=ri.x&&fa.y>=Hr.y&&$a.y<=ri.y?[Ln]:$a.x<Hr.x||fa.x>ri.x||$a.y<Hr.y||fa.y>ri.y?[]:a.al([Ln],Hr.x,Hr.y,ri.x,ri.y)}for(let fa of Aa){Ci.reset(fa,.25*Fr);let $a=0;$a=Ci.length<=.5*Fr?1:Math.ceil(Ci.paddedLength/Yn)+1;for(let Co=0;Co<$a;Co++){let Qa=Co/Math.max($a-1,1),mo=Ci.lerp(Qa),Bo=mo.x+mi,Ps=mo.y+mi;ze.push(Bo,Ps,Fr,0);let Ts=Bo-Fr,wo=Ps-Fr,To=Bo+Fr,hl=Ps+Fr;if(br=br&&this.isOffscreen(Ts,wo,To,hl),fr=fr||this.isInsideGrid(Ts,wo,To,hl),w!=="always"&&this.grid.hitTestCircle(Bo,Ps,Fr,w,yr)&&(nr=!0,!Jt))return{circles:[],offscreen:!1,collisionDetected:nr}}}}return{circles:!Jt&&nr||!fr||Xe<this.perspectiveRatioCutoff?[]:ze,offscreen:br,collisionDetected:nr}}projectPathToScreenSpace(w,B,Q){return w.map(ee=>gt(ee.x,ee.y,Q,B.getElevation))}queryRenderedSymbols(w){if(w.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let B=[],Q=1/0,ee=1/0,le=-1/0,Fe=-1/0;for(let Jt of w){let $t=new a.P(Jt.x+mi,Jt.y+mi);Q=Math.min(Q,$t.x),ee=Math.min(ee,$t.y),le=Math.max(le,$t.x),Fe=Math.max(Fe,$t.y),B.push($t)}let Ze=this.grid.query(Q,ee,le,Fe).concat(this.ignoredGrid.query(Q,ee,le,Fe)),ut={},Mt={};for(let Jt of Ze){let $t=Jt.key;if(ut[$t.bucketInstanceId]===void 0&&(ut[$t.bucketInstanceId]={}),ut[$t.bucketInstanceId][$t.featureIndex])continue;let yr=[new a.P(Jt.x1,Jt.y1),new a.P(Jt.x2,Jt.y1),new a.P(Jt.x2,Jt.y2),new a.P(Jt.x1,Jt.y2)];a.am(B,yr)&&(ut[$t.bucketInstanceId][$t.featureIndex]=!0,Mt[$t.bucketInstanceId]===void 0&&(Mt[$t.bucketInstanceId]=[]),Mt[$t.bucketInstanceId].push($t.featureIndex))}return Mt}insertCollisionBox(w,B,Q,ee,le,Fe){(Q?this.ignoredGrid:this.grid).insert({bucketInstanceId:ee,featureIndex:le,collisionGroupID:Fe,overlapMode:B},w[0],w[1],w[2],w[3])}insertCollisionCircles(w,B,Q,ee,le,Fe){let Ze=Q?this.ignoredGrid:this.grid,ut={bucketInstanceId:ee,featureIndex:le,collisionGroupID:Fe,overlapMode:B};for(let Mt=0;Mt<w.length;Mt+=4)Ze.insertCircle(ut,w[Mt],w[Mt+1],w[Mt+2])}projectAndGetPerspectiveRatio(w,B,Q,ee,le){let Fe;le?(Fe=[B,Q,le(B,Q),1],a.af(Fe,Fe,w)):(Fe=[B,Q,0,1],ai(Fe,Fe,w));let Ze=Fe[3];return{point:new a.P((Fe[0]/Ze+1)/2*this.transform.width+mi,(-Fe[1]/Ze+1)/2*this.transform.height+mi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/Ze*.5,isOccluded:!1,signedDistanceFromCamera:Ze}}getPerspectiveRatio(w,B,Q,ee,le){let Fe=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(B,Q,ee,le):gt(B,Q,w,le);return .5+this.transform.cameraToCenterDistance/Fe.signedDistanceFromCamera*.5}isOffscreen(w,B,Q,ee){return Q<mi||w>=this.screenRightBoundary||ee<mi||B>this.screenBottomBoundary}isInsideGrid(w,B,Q,ee){return Q>=0&&w<this.gridRightBoundary&&ee>=0&&B<this.gridBottomBoundary}getViewportMatrix(){let w=a.an([]);return a.J(w,w,[-100,-100,0]),w}_projectCollisionBox(w,B,Q,ee,le,Fe,Ze,ut,Mt,Jt){let $t=new a.P(1,0),yr=new a.P(0,1),Cr=new a.P(w.anchorPointX+Ze[0],w.anchorPointY+Ze[1]);if(Fe&&!le){let br=this.projectAndGetPerspectiveRatio(Q,Cr.x+1,Cr.y,ee,Mt).point.sub(ut.point).unit(),Fr=Math.atan(br.y/br.x)+(br.x<0?Math.PI:0),Hr=Math.sin(Fr),ri=Math.cos(Fr);$t=new a.P(ri,Hr),yr=new a.P(-Hr,ri)}else if(!Fe&&le){let br=-this.transform.angle,Fr=Math.sin(br),Hr=Math.cos(br);$t=new a.P(Hr,Fr),yr=new a.P(-Fr,Hr)}let ve=ut.point,xe=B;if(le){ve=Cr;let br=this.transform.zoom-Math.floor(this.transform.zoom);xe=Math.pow(2,-br),xe*=this.mapProjection.getPitchedTextCorrection(this.transform,Cr,ee),Jt||(xe*=a.ac(.5+ut.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}Jt&&(ve=ve.add($t.mult(Jt.x*xe)).add(yr.mult(Jt.y*xe)));let Ie=w.x1*xe,ze=w.x2*xe,Qe=(Ie+ze)/2,Xe=w.y1*xe,nt=w.y2*xe,qt=(Xe+nt)/2,Wt=[{offsetX:Ie,offsetY:Xe},{offsetX:Qe,offsetY:Xe},{offsetX:ze,offsetY:Xe},{offsetX:ze,offsetY:qt},{offsetX:ze,offsetY:nt},{offsetX:Qe,offsetY:nt},{offsetX:Ie,offsetY:nt},{offsetX:Ie,offsetY:qt}],nr=[];for(let{offsetX:br,offsetY:Fr}of Wt)nr.push(new a.P(ve.x+$t.x*br+yr.x*Fr,ve.y+$t.y*br+yr.y*Fr));let fr=!1;if(le){let br=nr.map(Fr=>this.projectAndGetPerspectiveRatio(Q,Fr.x,Fr.y,ee,Mt));fr=br.some(Fr=>!Fr.isOccluded),nr=br.map(Fr=>Fr.point)}else fr=!0;return{box:a.ao(nr),allPointsOccluded:!fr}}}function Fn(ue,w,B){return w*(a.X/(ue.tileSize*Math.pow(2,B-ue.tileID.overscaledZ)))}class An{constructor(w,B,Q,ee){this.opacity=w?Math.max(0,Math.min(1,w.opacity+(w.placed?B:-B))):ee&&Q?1:0,this.placed=Q}isHidden(){return this.opacity===0&&!this.placed}}class Hn{constructor(w,B,Q,ee,le){this.text=new An(w?w.text:null,B,Q,le),this.icon=new An(w?w.icon:null,B,ee,le)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Qn{constructor(w,B,Q){this.text=w,this.icon=B,this.skipFade=Q}}class Vi{constructor(){this.invProjMatrix=a.H(),this.viewportMatrix=a.H(),this.circles=[]}}class Kn{constructor(w,B,Q,ee,le){this.bucketInstanceId=w,this.featureIndex=B,this.sourceLayerIndex=Q,this.bucketIndex=ee,this.tileID=le}}class Jn{constructor(w){this.crossSourceCollisions=w,this.maxGroupID=0,this.collisionGroups={}}get(w){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[w]){let B=++this.maxGroupID;this.collisionGroups[w]={ID:B,predicate:Q=>Q.collisionGroupID===B}}return this.collisionGroups[w]}}function Gt(ue,w,B,Q,ee){let{horizontalAlign:le,verticalAlign:Fe}=a.au(ue);return new a.P(-(le-.5)*w+Q[0]*ee,-(Fe-.5)*B+Q[1]*ee)}class wt{constructor(w,B,Q,ee,le,Fe){this.transform=w.clone(),this.terrain=Q,this.collisionIndex=new un(this.transform,B),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=ee,this.retainedQueryData={},this.collisionGroups=new Jn(le),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=Fe,Fe&&(Fe.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(w){let B=this.terrain;return B?(Q,ee)=>B.getElevation(w,Q,ee):null}getBucketParts(w,B,Q,ee){let le=Q.getBucket(B),Fe=Q.latestFeatureIndex;if(!le||!Fe||B.id!==le.layerIds[0])return;let Ze=Q.collisionBoxArray,ut=le.layers[0].layout,Mt=le.layers[0].paint,Jt=Math.pow(2,this.transform.zoom-Q.tileID.overscaledZ),$t=Q.tileSize/a.X,yr=Q.tileID.toUnwrapped(),Cr=this.transform.calculatePosMatrix(yr),ve=ut.get("text-pitch-alignment")==="map",xe=ut.get("text-rotation-alignment")==="map",Ie=Fn(Q,1,this.transform.zoom),ze=this.collisionIndex.mapProjection.translatePosition(this.transform,Q,Mt.get("text-translate"),Mt.get("text-translate-anchor")),Qe=this.collisionIndex.mapProjection.translatePosition(this.transform,Q,Mt.get("icon-translate"),Mt.get("icon-translate-anchor")),Xe=qr(Cr,ve,xe,this.transform,Ie),nt=null;if(ve){let Wt=jr(Cr,ve,xe,this.transform,Ie);nt=a.L([],this.transform.labelPlaneMatrix,Wt)}this.retainedQueryData[le.bucketInstanceId]=new Kn(le.bucketInstanceId,Fe,le.sourceLayerIndex,le.index,Q.tileID);let qt={bucket:le,layout:ut,translationText:ze,translationIcon:Qe,posMatrix:Cr,unwrappedTileID:yr,textLabelPlaneMatrix:Xe,labelToScreenMatrix:nt,scale:Jt,textPixelRatio:$t,holdingForFade:Q.holdingForFade(),collisionBoxArray:Ze,partiallyEvaluatedTextSize:a.ag(le.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(le.sourceID)};if(ee)for(let Wt of le.sortKeyRanges){let{sortKey:nr,symbolInstanceStart:fr,symbolInstanceEnd:br}=Wt;w.push({sortKey:nr,symbolInstanceStart:fr,symbolInstanceEnd:br,parameters:qt})}else w.push({symbolInstanceStart:0,symbolInstanceEnd:le.symbolInstances.length,parameters:qt})}attemptAnchorPlacement(w,B,Q,ee,le,Fe,Ze,ut,Mt,Jt,$t,yr,Cr,ve,xe,Ie,ze,Qe,Xe){let nt=a.aq[w.textAnchor],qt=[w.textOffset0,w.textOffset1],Wt=Gt(nt,Q,ee,qt,le),nr=this.collisionIndex.placeCollisionBox(B,yr,ut,Mt,Jt,Ze,Fe,Ie,$t.predicate,Xe,Wt);if((!Qe||this.collisionIndex.placeCollisionBox(Qe,yr,ut,Mt,Jt,Ze,Fe,ze,$t.predicate,Xe,Wt).placeable)&&nr.placeable){let fr;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Cr.crossTileID]&&this.prevPlacement.placements[Cr.crossTileID]&&this.prevPlacement.placements[Cr.crossTileID].text&&(fr=this.prevPlacement.variableOffsets[Cr.crossTileID].anchor),Cr.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Cr.crossTileID]={textOffset:qt,width:Q,height:ee,anchor:nt,textBoxScale:le,prevAnchor:fr},this.markUsedJustification(ve,nt,Cr,xe),ve.allowVerticalPlacement&&(this.markUsedOrientation(ve,xe,Cr),this.placedOrientations[Cr.crossTileID]=xe),{shift:Wt,placedGlyphBoxes:nr}}}placeLayerBucketPart(w,B,Q){let{bucket:ee,layout:le,translationText:Fe,translationIcon:Ze,posMatrix:ut,unwrappedTileID:Mt,textLabelPlaneMatrix:Jt,labelToScreenMatrix:$t,textPixelRatio:yr,holdingForFade:Cr,collisionBoxArray:ve,partiallyEvaluatedTextSize:xe,collisionGroup:Ie}=w.parameters,ze=le.get("text-optional"),Qe=le.get("icon-optional"),Xe=a.ar(le,"text-overlap","text-allow-overlap"),nt=Xe==="always",qt=a.ar(le,"icon-overlap","icon-allow-overlap"),Wt=qt==="always",nr=le.get("text-rotation-alignment")==="map",fr=le.get("text-pitch-alignment")==="map",br=le.get("icon-text-fit")!=="none",Fr=le.get("symbol-z-order")==="viewport-y",Hr=nt&&(Wt||!ee.hasIconData()||Qe),ri=Wt&&(nt||!ee.hasTextData()||ze);!ee.collisionArrays&&ve&&ee.deserializeCollisionBoxes(ve);let Ci=this._getTerrainElevationFunc(this.retainedQueryData[ee.bucketInstanceId].tileID),cn=(sn,Ln,Yn)=>{var Aa,fa;if(B[sn.crossTileID])return;if(Cr)return void(this.placements[sn.crossTileID]=new Qn(!1,!1,!1));let $a=!1,Co=!1,Qa=!0,mo=null,Bo={box:null,placeable:!1,offscreen:null},Ps={box:null,placeable:!1,offscreen:null},Ts=null,wo=null,To=null,hl=0,Ul=0,Lu=0;Ln.textFeatureIndex?hl=Ln.textFeatureIndex:sn.useRuntimeCollisionCircles&&(hl=sn.featureIndex),Ln.verticalTextFeatureIndex&&(Ul=Ln.verticalTextFeatureIndex);let au=Ln.textBox;if(au){let Tl=Te=>{let qe=a.ah.horizontal;if(ee.allowVerticalPlacement&&!Te&&this.prevPlacement){let Ve=this.prevPlacement.placedOrientations[sn.crossTileID];Ve&&(this.placedOrientations[sn.crossTileID]=Ve,qe=Ve,this.markUsedOrientation(ee,qe,sn))}return qe},Al=(Te,qe)=>{if(ee.allowVerticalPlacement&&sn.numVerticalGlyphVertices>0&&Ln.verticalTextBox){for(let Ve of ee.writingModes)if(Ve===a.ah.vertical?(Bo=qe(),Ps=Bo):Bo=Te(),Bo&&Bo.placeable)break}else Bo=Te()},X=sn.textAnchorOffsetStartIndex,se=sn.textAnchorOffsetEndIndex;if(se===X){let Te=(qe,Ve)=>{let Ye=this.collisionIndex.placeCollisionBox(qe,Xe,yr,ut,Mt,fr,nr,Fe,Ie.predicate,Ci);return Ye&&Ye.placeable&&(this.markUsedOrientation(ee,Ve,sn),this.placedOrientations[sn.crossTileID]=Ve),Ye};Al(()=>Te(au,a.ah.horizontal),()=>{let qe=Ln.verticalTextBox;return ee.allowVerticalPlacement&&sn.numVerticalGlyphVertices>0&&qe?Te(qe,a.ah.vertical):{box:null,offscreen:null}}),Tl(Bo&&Bo.placeable)}else{let Te=a.aq[(fa=(Aa=this.prevPlacement)===null||Aa===void 0?void 0:Aa.variableOffsets[sn.crossTileID])===null||fa===void 0?void 0:fa.anchor],qe=(Ye,Pt,ot)=>{let Xt=Ye.x2-Ye.x1,dr=Ye.y2-Ye.y1,pr=sn.textBoxScale,Ur=br&&qt==="never"?Pt:null,zr=null,gi=Xe==="never"?1:2,xi="never";Te&&gi++;for(let Wr=0;Wr<gi;Wr++){for(let ii=X;ii<se;ii++){let di=ee.textAnchorOffsets.get(ii);if(Te&&di.textAnchor!==Te)continue;let Li=this.attemptAnchorPlacement(di,Ye,Xt,dr,pr,nr,fr,yr,ut,Mt,Ie,xi,sn,ee,ot,Fe,Ze,Ur,Ci);if(Li&&(zr=Li.placedGlyphBoxes,zr&&zr.placeable))return $a=!0,mo=Li.shift,zr}Te?Te=null:xi=Xe}return Q&&!zr&&(zr={box:this.collisionIndex.placeCollisionBox(au,"always",yr,ut,Mt,fr,nr,Fe,Ie.predicate,Ci,new a.P(0,0)).box,offscreen:!1,placeable:!1}),zr};Al(()=>qe(au,Ln.iconBox,a.ah.horizontal),()=>{let Ye=Ln.verticalTextBox;return ee.allowVerticalPlacement&&(!Bo||!Bo.placeable)&&sn.numVerticalGlyphVertices>0&&Ye?qe(Ye,Ln.verticalIconBox,a.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Bo&&($a=Bo.placeable,Qa=Bo.offscreen);let Ve=Tl(Bo&&Bo.placeable);if(!$a&&this.prevPlacement){let Ye=this.prevPlacement.variableOffsets[sn.crossTileID];Ye&&(this.variableOffsets[sn.crossTileID]=Ye,this.markUsedJustification(ee,Ye.anchor,sn,Ve))}}}if(Ts=Bo,$a=Ts&&Ts.placeable,Qa=Ts&&Ts.offscreen,sn.useRuntimeCollisionCircles){let Tl=ee.text.placedSymbolArray.get(sn.centerJustifiedTextSymbolIndex),Al=a.ai(ee.textSizeData,xe,Tl),X=le.get("text-padding");wo=this.collisionIndex.placeCollisionCircles(Xe,Tl,ee.lineVertexArray,ee.glyphOffsetArray,Al,ut,Mt,Jt,$t,Q,fr,Ie.predicate,sn.collisionCircleDiameter,X,Fe,Ci),wo.circles.length&&wo.collisionDetected&&!Q&&a.w("Collisions detected, but collision boxes are not shown"),$a=nt||wo.circles.length>0&&!wo.collisionDetected,Qa=Qa&&wo.offscreen}if(Ln.iconFeatureIndex&&(Lu=Ln.iconFeatureIndex),Ln.iconBox){let Tl=Al=>this.collisionIndex.placeCollisionBox(Al,qt,yr,ut,Mt,fr,nr,Ze,Ie.predicate,Ci,br&&mo?mo:void 0);Ps&&Ps.placeable&&Ln.verticalIconBox?(To=Tl(Ln.verticalIconBox),Co=To.placeable):(To=Tl(Ln.iconBox),Co=To.placeable),Qa=Qa&&To.offscreen}let Js=ze||sn.numHorizontalGlyphVertices===0&&sn.numVerticalGlyphVertices===0,eu=Qe||sn.numIconVertices===0;Js||eu?eu?Js||(Co=Co&&$a):$a=Co&&$a:Co=$a=Co&&$a;let dc=Co&&To.placeable;if($a&&Ts.placeable&&this.collisionIndex.insertCollisionBox(Ts.box,Xe,le.get("text-ignore-placement"),ee.bucketInstanceId,Ps&&Ps.placeable&&Ul?Ul:hl,Ie.ID),dc&&this.collisionIndex.insertCollisionBox(To.box,qt,le.get("icon-ignore-placement"),ee.bucketInstanceId,Lu,Ie.ID),wo&&$a&&this.collisionIndex.insertCollisionCircles(wo.circles,Xe,le.get("text-ignore-placement"),ee.bucketInstanceId,hl,Ie.ID),Q&&this.storeCollisionData(ee.bucketInstanceId,Yn,Ln,Ts,To,wo),sn.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(ee.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[sn.crossTileID]=new Qn($a||Hr,Co||ri,Qa||ee.justReloaded),B[sn.crossTileID]=!0};if(Fr){if(w.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let sn=ee.getSortedSymbolIndexes(this.transform.angle);for(let Ln=sn.length-1;Ln>=0;--Ln){let Yn=sn[Ln];cn(ee.symbolInstances.get(Yn),ee.collisionArrays[Yn],Yn)}}else for(let sn=w.symbolInstanceStart;sn<w.symbolInstanceEnd;sn++)cn(ee.symbolInstances.get(sn),ee.collisionArrays[sn],sn);if(Q&&ee.bucketInstanceId in this.collisionCircleArrays){let sn=this.collisionCircleArrays[ee.bucketInstanceId];a.as(sn.invProjMatrix,ut),sn.viewportMatrix=this.collisionIndex.getViewportMatrix()}ee.justReloaded=!1}storeCollisionData(w,B,Q,ee,le,Fe){if(Q.textBox||Q.iconBox){let Ze,ut;this.collisionBoxArrays.has(w)?Ze=this.collisionBoxArrays.get(w):(Ze=new Map,this.collisionBoxArrays.set(w,Ze)),Ze.has(B)?ut=Ze.get(B):(ut={text:null,icon:null},Ze.set(B,ut)),Q.textBox&&(ut.text=ee.box),Q.iconBox&&(ut.icon=le.box)}if(Fe){let Ze=this.collisionCircleArrays[w];Ze===void 0&&(Ze=this.collisionCircleArrays[w]=new Vi);for(let ut=0;ut<Fe.circles.length;ut+=4)Ze.circles.push(Fe.circles[ut+0]),Ze.circles.push(Fe.circles[ut+1]),Ze.circles.push(Fe.circles[ut+2]),Ze.circles.push(Fe.collisionDetected?1:0)}}markUsedJustification(w,B,Q,ee){let le;le=ee===a.ah.vertical?Q.verticalPlacedTextSymbolIndex:{left:Q.leftJustifiedTextSymbolIndex,center:Q.centerJustifiedTextSymbolIndex,right:Q.rightJustifiedTextSymbolIndex}[a.at(B)];let Fe=[Q.leftJustifiedTextSymbolIndex,Q.centerJustifiedTextSymbolIndex,Q.rightJustifiedTextSymbolIndex,Q.verticalPlacedTextSymbolIndex];for(let Ze of Fe)Ze>=0&&(w.text.placedSymbolArray.get(Ze).crossTileID=le>=0&&Ze!==le?0:Q.crossTileID)}markUsedOrientation(w,B,Q){let ee=B===a.ah.horizontal||B===a.ah.horizontalOnly?B:0,le=B===a.ah.vertical?B:0,Fe=[Q.leftJustifiedTextSymbolIndex,Q.centerJustifiedTextSymbolIndex,Q.rightJustifiedTextSymbolIndex];for(let Ze of Fe)w.text.placedSymbolArray.get(Ze).placedOrientation=ee;Q.verticalPlacedTextSymbolIndex&&(w.text.placedSymbolArray.get(Q.verticalPlacedTextSymbolIndex).placedOrientation=le)}commit(w){this.commitTime=w,this.zoomAtLastRecencyCheck=this.transform.zoom;let B=this.prevPlacement,Q=!1;this.prevZoomAdjustment=B?B.zoomAdjustment(this.transform.zoom):0;let ee=B?B.symbolFadeChange(w):1,le=B?B.opacities:{},Fe=B?B.variableOffsets:{},Ze=B?B.placedOrientations:{};for(let ut in this.placements){let Mt=this.placements[ut],Jt=le[ut];Jt?(this.opacities[ut]=new Hn(Jt,ee,Mt.text,Mt.icon),Q=Q||Mt.text!==Jt.text.placed||Mt.icon!==Jt.icon.placed):(this.opacities[ut]=new Hn(null,ee,Mt.text,Mt.icon,Mt.skipFade),Q=Q||Mt.text||Mt.icon)}for(let ut in le){let Mt=le[ut];if(!this.opacities[ut]){let Jt=new Hn(Mt,ee,!1,!1);Jt.isHidden()||(this.opacities[ut]=Jt,Q=Q||Mt.text.placed||Mt.icon.placed)}}for(let ut in Fe)this.variableOffsets[ut]||!this.opacities[ut]||this.opacities[ut].isHidden()||(this.variableOffsets[ut]=Fe[ut]);for(let ut in Ze)this.placedOrientations[ut]||!this.opacities[ut]||this.opacities[ut].isHidden()||(this.placedOrientations[ut]=Ze[ut]);if(B&&B.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");Q?this.lastPlacementChangeTime=w:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=B?B.lastPlacementChangeTime:w)}updateLayerOpacities(w,B){let Q={};for(let ee of B){let le=ee.getBucket(w);le&&ee.latestFeatureIndex&&w.id===le.layerIds[0]&&this.updateBucketOpacities(le,ee.tileID,Q,ee.collisionBoxArray)}}updateBucketOpacities(w,B,Q,ee){w.hasTextData()&&(w.text.opacityVertexArray.clear(),w.text.hasVisibleVertices=!1),w.hasIconData()&&(w.icon.opacityVertexArray.clear(),w.icon.hasVisibleVertices=!1),w.hasIconCollisionBoxData()&&w.iconCollisionBox.collisionVertexArray.clear(),w.hasTextCollisionBoxData()&&w.textCollisionBox.collisionVertexArray.clear();let le=w.layers[0],Fe=le.layout,Ze=new Hn(null,0,!1,!1,!0),ut=Fe.get("text-allow-overlap"),Mt=Fe.get("icon-allow-overlap"),Jt=le._unevaluatedLayout.hasValue("text-variable-anchor")||le._unevaluatedLayout.hasValue("text-variable-anchor-offset"),$t=Fe.get("text-rotation-alignment")==="map",yr=Fe.get("text-pitch-alignment")==="map",Cr=Fe.get("icon-text-fit")!=="none",ve=new Hn(null,0,ut&&(Mt||!w.hasIconData()||Fe.get("icon-optional")),Mt&&(ut||!w.hasTextData()||Fe.get("text-optional")),!0);!w.collisionArrays&&ee&&(w.hasIconCollisionBoxData()||w.hasTextCollisionBoxData())&&w.deserializeCollisionBoxes(ee);let xe=(ze,Qe,Xe)=>{for(let nt=0;nt<Qe/4;nt++)ze.opacityVertexArray.emplaceBack(Xe);ze.hasVisibleVertices=ze.hasVisibleVertices||Xe!==fn},Ie=this.collisionBoxArrays.get(w.bucketInstanceId);for(let ze=0;ze<w.symbolInstances.length;ze++){let Qe=w.symbolInstances.get(ze),{numHorizontalGlyphVertices:Xe,numVerticalGlyphVertices:nt,crossTileID:qt}=Qe,Wt=this.opacities[qt];Q[qt]?Wt=Ze:Wt||(Wt=ve,this.opacities[qt]=Wt),Q[qt]=!0;let nr=Qe.numIconVertices>0,fr=this.placedOrientations[Qe.crossTileID],br=fr===a.ah.vertical,Fr=fr===a.ah.horizontal||fr===a.ah.horizontalOnly;if(Xe>0||nt>0){let ri=en(Wt.text);xe(w.text,Xe,br?fn:ri),xe(w.text,nt,Fr?fn:ri);let Ci=Wt.text.isHidden();[Qe.rightJustifiedTextSymbolIndex,Qe.centerJustifiedTextSymbolIndex,Qe.leftJustifiedTextSymbolIndex].forEach(Ln=>{Ln>=0&&(w.text.placedSymbolArray.get(Ln).hidden=Ci||br?1:0)}),Qe.verticalPlacedTextSymbolIndex>=0&&(w.text.placedSymbolArray.get(Qe.verticalPlacedTextSymbolIndex).hidden=Ci||Fr?1:0);let cn=this.variableOffsets[Qe.crossTileID];cn&&this.markUsedJustification(w,cn.anchor,Qe,fr);let sn=this.placedOrientations[Qe.crossTileID];sn&&(this.markUsedJustification(w,"left",Qe,sn),this.markUsedOrientation(w,sn,Qe))}if(nr){let ri=en(Wt.icon),Ci=!(Cr&&Qe.verticalPlacedIconSymbolIndex&&br);Qe.placedIconSymbolIndex>=0&&(xe(w.icon,Qe.numIconVertices,Ci?ri:fn),w.icon.placedSymbolArray.get(Qe.placedIconSymbolIndex).hidden=Wt.icon.isHidden()),Qe.verticalPlacedIconSymbolIndex>=0&&(xe(w.icon,Qe.numVerticalIconVertices,Ci?fn:ri),w.icon.placedSymbolArray.get(Qe.verticalPlacedIconSymbolIndex).hidden=Wt.icon.isHidden())}let Hr=Ie&&Ie.has(ze)?Ie.get(ze):{text:null,icon:null};if(w.hasIconCollisionBoxData()||w.hasTextCollisionBoxData()){let ri=w.collisionArrays[ze];if(ri){let Ci=new a.P(0,0);if(ri.textBox||ri.verticalTextBox){let cn=!0;if(Jt){let sn=this.variableOffsets[qt];sn?(Ci=Gt(sn.anchor,sn.width,sn.height,sn.textOffset,sn.textBoxScale),$t&&Ci._rotate(yr?this.transform.angle:-this.transform.angle)):cn=!1}if(ri.textBox||ri.verticalTextBox){let sn;ri.textBox&&(sn=br),ri.verticalTextBox&&(sn=Fr),tr(w.textCollisionBox.collisionVertexArray,Wt.text.placed,!cn||sn,Hr.text,Ci.x,Ci.y)}}if(ri.iconBox||ri.verticalIconBox){let cn=!!(!Fr&&ri.verticalIconBox),sn;ri.iconBox&&(sn=cn),ri.verticalIconBox&&(sn=!cn),tr(w.iconCollisionBox.collisionVertexArray,Wt.icon.placed,sn,Hr.icon,Cr?Ci.x:0,Cr?Ci.y:0)}}}}if(w.sortFeatures(this.transform.angle),this.retainedQueryData[w.bucketInstanceId]&&(this.retainedQueryData[w.bucketInstanceId].featureSortOrder=w.featureSortOrder),w.hasTextData()&&w.text.opacityVertexBuffer&&w.text.opacityVertexBuffer.updateData(w.text.opacityVertexArray),w.hasIconData()&&w.icon.opacityVertexBuffer&&w.icon.opacityVertexBuffer.updateData(w.icon.opacityVertexArray),w.hasIconCollisionBoxData()&&w.iconCollisionBox.collisionVertexBuffer&&w.iconCollisionBox.collisionVertexBuffer.updateData(w.iconCollisionBox.collisionVertexArray),w.hasTextCollisionBoxData()&&w.textCollisionBox.collisionVertexBuffer&&w.textCollisionBox.collisionVertexBuffer.updateData(w.textCollisionBox.collisionVertexArray),w.text.opacityVertexArray.length!==w.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${w.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${w.text.layoutVertexArray.length}) / 4`);if(w.icon.opacityVertexArray.length!==w.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${w.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${w.icon.layoutVertexArray.length}) / 4`);if(w.bucketInstanceId in this.collisionCircleArrays){let ze=this.collisionCircleArrays[w.bucketInstanceId];w.placementInvProjMatrix=ze.invProjMatrix,w.placementViewportMatrix=ze.viewportMatrix,w.collisionCircleArray=ze.circles,delete this.collisionCircleArrays[w.bucketInstanceId]}}symbolFadeChange(w){return this.fadeDuration===0?1:(w-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(w){return Math.max(0,(this.transform.zoom-w)/1.5)}hasTransitions(w){return this.stale||w-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(w,B){let Q=this.zoomAtLastRecencyCheck===B?1-this.zoomAdjustment(B):1;return this.zoomAtLastRecencyCheck=B,this.commitTime+this.fadeDuration*Q>w}setStale(){this.stale=!0}}function tr(ue,w,B,Q,ee,le){Q&&Q.length!==0||(Q=[0,0,0,0]);let Fe=Q[0]-mi,Ze=Q[1]-mi,ut=Q[2]-mi,Mt=Q[3]-mi;ue.emplaceBack(w?1:0,B?1:0,ee||0,le||0,Fe,Ze),ue.emplaceBack(w?1:0,B?1:0,ee||0,le||0,ut,Ze),ue.emplaceBack(w?1:0,B?1:0,ee||0,le||0,ut,Mt),ue.emplaceBack(w?1:0,B?1:0,ee||0,le||0,Fe,Mt)}let ir=Math.pow(2,25),wr=Math.pow(2,24),Xr=Math.pow(2,17),ti=Math.pow(2,16),$r=Math.pow(2,9),Ri=Math.pow(2,8),Zi=Math.pow(2,1);function en(ue){if(ue.opacity===0&&!ue.placed)return 0;if(ue.opacity===1&&ue.placed)return 4294967295;let w=ue.placed?1:0,B=Math.floor(127*ue.opacity);return B*ir+w*wr+B*Xr+w*ti+B*$r+w*Ri+B*Zi+w}let fn=0;function yn(){return{isOccluded:(ue,w,B)=>!1,getPitchedTextCorrection:(ue,w,B)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(ue,w,B,Q){throw new Error("Not implemented.")},translatePosition:(ue,w,B,Q)=>function(ee,le,Fe,Ze,ut=!1){if(!Fe[0]&&!Fe[1])return[0,0];let Mt=ut?Ze==="map"?ee.angle:0:Ze==="viewport"?-ee.angle:0;if(Mt){let Jt=Math.sin(Mt),$t=Math.cos(Mt);Fe=[Fe[0]*$t-Fe[1]*Jt,Fe[0]*Jt+Fe[1]*$t]}return[ut?Fe[0]:Fn(le,Fe[0],ee.zoom),ut?Fe[1]:Fn(le,Fe[1],ee.zoom)]}(ue,w,B,Q),getCircleRadiusCorrection:ue=>1}}class Mn{constructor(w){this._sortAcrossTiles=w.layout.get("symbol-z-order")!=="viewport-y"&&!w.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(w,B,Q,ee,le){let Fe=this._bucketParts;for(;this._currentTileIndex<w.length;)if(B.getBucketParts(Fe,ee,w[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,le())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,Fe.sort((Ze,ut)=>Ze.sortKey-ut.sortKey));this._currentPartIndex<Fe.length;)if(B.placeLayerBucketPart(Fe[this._currentPartIndex],this._seenCrossTileIDs,Q),this._currentPartIndex++,le())return!0;return!1}}class Ba{constructor(w,B,Q,ee,le,Fe,Ze,ut){this.placement=new wt(w,yn(),B,Fe,Ze,ut),this._currentPlacementIndex=Q.length-1,this._forceFullPlacement=ee,this._showCollisionBoxes=le,this._done=!1}isDone(){return this._done}continuePlacement(w,B,Q){let ee=u.now(),le=()=>!this._forceFullPlacement&&u.now()-ee>2;for(;this._currentPlacementIndex>=0;){let Fe=B[w[this._currentPlacementIndex]],Ze=this.placement.collisionIndex.transform.zoom;if(Fe.type==="symbol"&&(!Fe.minzoom||Fe.minzoom<=Ze)&&(!Fe.maxzoom||Fe.maxzoom>Ze)){if(this._inProgressLayer||(this._inProgressLayer=new Mn(Fe)),this._inProgressLayer.continuePlacement(Q[Fe.source],this.placement,this._showCollisionBoxes,Fe,le))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(w){return this.placement.commit(w),this.placement}}let ua=512/a.X/2;class ma{constructor(w,B,Q){this.tileID=w,this.bucketInstanceId=Q,this._symbolsByKey={};let ee=new Map;for(let le=0;le<B.length;le++){let Fe=B.get(le),Ze=Fe.key,ut=ee.get(Ze);ut?ut.push(Fe):ee.set(Ze,[Fe])}for(let[le,Fe]of ee){let Ze={positions:Fe.map(ut=>({x:Math.floor(ut.anchorX*ua),y:Math.floor(ut.anchorY*ua)})),crossTileIDs:Fe.map(ut=>ut.crossTileID)};if(Ze.positions.length>128){let ut=new a.av(Ze.positions.length,16,Uint16Array);for(let{x:Mt,y:Jt}of Ze.positions)ut.add(Mt,Jt);ut.finish(),delete Ze.positions,Ze.index=ut}this._symbolsByKey[le]=Ze}}getScaledCoordinates(w,B){let{x:Q,y:ee,z:le}=this.tileID.canonical,{x:Fe,y:Ze,z:ut}=B.canonical,Mt=ua/Math.pow(2,ut-le),Jt=(Ze*a.X+w.anchorY)*Mt,$t=ee*a.X*ua;return{x:Math.floor((Fe*a.X+w.anchorX)*Mt-Q*a.X*ua),y:Math.floor(Jt-$t)}}findMatches(w,B,Q){let ee=this.tileID.canonical.z<B.canonical.z?1:Math.pow(2,this.tileID.canonical.z-B.canonical.z);for(let le=0;le<w.length;le++){let Fe=w.get(le);if(Fe.crossTileID)continue;let Ze=this._symbolsByKey[Fe.key];if(!Ze)continue;let ut=this.getScaledCoordinates(Fe,B);if(Ze.index){let Mt=Ze.index.range(ut.x-ee,ut.y-ee,ut.x+ee,ut.y+ee).sort();for(let Jt of Mt){let $t=Ze.crossTileIDs[Jt];if(!Q[$t]){Q[$t]=!0,Fe.crossTileID=$t;break}}}else if(Ze.positions)for(let Mt=0;Mt<Ze.positions.length;Mt++){let Jt=Ze.positions[Mt],$t=Ze.crossTileIDs[Mt];if(Math.abs(Jt.x-ut.x)<=ee&&Math.abs(Jt.y-ut.y)<=ee&&!Q[$t]){Q[$t]=!0,Fe.crossTileID=$t;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:w})=>w)}}class Wa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Fa{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(w){let B=Math.round((w-this.lng)/360);if(B!==0)for(let Q in this.indexes){let ee=this.indexes[Q],le={};for(let Fe in ee){let Ze=ee[Fe];Ze.tileID=Ze.tileID.unwrapTo(Ze.tileID.wrap+B),le[Ze.tileID.key]=Ze}this.indexes[Q]=le}this.lng=w}addBucket(w,B,Q){if(this.indexes[w.overscaledZ]&&this.indexes[w.overscaledZ][w.key]){if(this.indexes[w.overscaledZ][w.key].bucketInstanceId===B.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(w.overscaledZ,this.indexes[w.overscaledZ][w.key])}for(let le=0;le<B.symbolInstances.length;le++)B.symbolInstances.get(le).crossTileID=0;this.usedCrossTileIDs[w.overscaledZ]||(this.usedCrossTileIDs[w.overscaledZ]={});let ee=this.usedCrossTileIDs[w.overscaledZ];for(let le in this.indexes){let Fe=this.indexes[le];if(Number(le)>w.overscaledZ)for(let Ze in Fe){let ut=Fe[Ze];ut.tileID.isChildOf(w)&&ut.findMatches(B.symbolInstances,w,ee)}else{let Ze=Fe[w.scaledTo(Number(le)).key];Ze&&Ze.findMatches(B.symbolInstances,w,ee)}}for(let le=0;le<B.symbolInstances.length;le++){let Fe=B.symbolInstances.get(le);Fe.crossTileID||(Fe.crossTileID=Q.generate(),ee[Fe.crossTileID]=!0)}return this.indexes[w.overscaledZ]===void 0&&(this.indexes[w.overscaledZ]={}),this.indexes[w.overscaledZ][w.key]=new ma(w,B.symbolInstances,B.bucketInstanceId),!0}removeBucketCrossTileIDs(w,B){for(let Q of B.getCrossTileIDsLists())for(let ee of Q)delete this.usedCrossTileIDs[w][ee]}removeStaleBuckets(w){let B=!1;for(let Q in this.indexes){let ee=this.indexes[Q];for(let le in ee)w[ee[le].bucketInstanceId]||(this.removeBucketCrossTileIDs(Q,ee[le]),delete ee[le],B=!0)}return B}}class Xo{constructor(){this.layerIndexes={},this.crossTileIDs=new Wa,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(w,B,Q){let ee=this.layerIndexes[w.id];ee===void 0&&(ee=this.layerIndexes[w.id]=new Fa);let le=!1,Fe={};ee.handleWrapJump(Q);for(let Ze of B){let ut=Ze.getBucket(w);ut&&w.id===ut.layerIds[0]&&(ut.bucketInstanceId||(ut.bucketInstanceId=++this.maxBucketInstanceId),ee.addBucket(Ze.tileID,ut,this.crossTileIDs)&&(le=!0),Fe[ut.bucketInstanceId]=!0)}return ee.removeStaleBuckets(Fe)&&(le=!0),le}pruneUnusedLayers(w){let B={};w.forEach(Q=>{B[Q]=!0});for(let Q in this.layerIndexes)B[Q]||delete this.layerIndexes[Q]}}let da=(ue,w)=>a.t(ue,w&&w.filter(B=>B.identifier!=="source.canvas")),jn=a.aw();class Ha extends a.E{constructor(w,B={}){super(),this._rtlPluginLoaded=()=>{for(let Q in this.sourceCaches){let ee=this.sourceCaches[Q].getSource().type;ee!=="vector"&&ee!=="geojson"||this.sourceCaches[Q].reload()}},this.map=w,this.dispatcher=new ke(Se(),w._getMapId()),this.dispatcher.registerMessageHandler("GG",(Q,ee)=>this.getGlyphs(Q,ee)),this.dispatcher.registerMessageHandler("GI",(Q,ee)=>this.getImages(Q,ee)),this.imageManager=new E,this.imageManager.setEventedParent(this),this.glyphManager=new G(w._requestManager,B.localIdeographFontFamily),this.lineAtlas=new ae(256,512),this.crossTileSymbolIndex=new Xo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",a.ay()),St().on(Ue,this._rtlPluginLoaded),this.on("data",Q=>{if(Q.dataType!=="source"||Q.sourceDataType!=="metadata")return;let ee=this.sourceCaches[Q.sourceId];if(!ee)return;let le=ee.getSource();if(le&&le.vectorLayerIds)for(let Fe in this._layers){let Ze=this._layers[Fe];Ze.source===le.id&&this._validateLayer(Ze)}})}loadURL(w,B={},Q){this.fire(new a.k("dataloading",{dataType:"style"})),B.validate=typeof B.validate!="boolean"||B.validate;let ee=this.map._requestManager.transformRequest(w,"Style");this._loadStyleRequest=new AbortController;let le=this._loadStyleRequest;a.h(ee,this._loadStyleRequest).then(Fe=>{this._loadStyleRequest=null,this._load(Fe.data,B,Q)}).catch(Fe=>{this._loadStyleRequest=null,Fe&&!le.signal.aborted&&this.fire(new a.j(Fe))})}loadJSON(w,B={},Q){this.fire(new a.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,u.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,B.validate=B.validate!==!1,this._load(w,B,Q)}).catch(()=>{})}loadEmpty(){this.fire(new a.k("dataloading",{dataType:"style"})),this._load(jn,{validate:!1})}_load(w,B,Q){var ee;let le=B.transformStyle?B.transformStyle(Q,w):w;if(!B.validate||!da(this,a.u(le))){this._loaded=!0,this.stylesheet=le;for(let Fe in le.sources)this.addSource(Fe,le.sources[Fe],{validate:!1});le.sprite?this._loadSprite(le.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(le.glyphs),this._createLayers(),this.light=new N(this.stylesheet.light),this.sky=new ie(this.stylesheet.sky),this.map.setTerrain((ee=this.stylesheet.terrain)!==null&&ee!==void 0?ee:null),this.fire(new a.k("data",{dataType:"style"})),this.fire(new a.k("style.load"))}}_createLayers(){let w=a.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",w),this._order=w.map(B=>B.id),this._layers={},this._serializedLayers=null;for(let B of w){let Q=a.aA(B);Q.setEventedParent(this,{layer:{id:B.id}}),this._layers[B.id]=Q}}_loadSprite(w,B=!1,Q=void 0){let ee;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(le,Fe,Ze,ut){return a._(this,void 0,void 0,function*(){let Mt=C(le),Jt=Ze>1?"@2x":"",$t={},yr={};for(let{id:Cr,url:ve}of Mt){let xe=Fe.transformRequest(S(ve,Jt,".json"),"SpriteJSON");$t[Cr]=a.h(xe,ut);let Ie=Fe.transformRequest(S(ve,Jt,".png"),"SpriteImage");yr[Cr]=p.getImage(Ie,ut)}return yield Promise.all([...Object.values($t),...Object.values(yr)]),function(Cr,ve){return a._(this,void 0,void 0,function*(){let xe={};for(let Ie in Cr){xe[Ie]={};let ze=u.getImageCanvasContext((yield ve[Ie]).data),Qe=(yield Cr[Ie]).data;for(let Xe in Qe){let{width:nt,height:qt,x:Wt,y:nr,sdf:fr,pixelRatio:br,stretchX:Fr,stretchY:Hr,content:ri,textFitWidth:Ci,textFitHeight:cn}=Qe[Xe];xe[Ie][Xe]={data:null,pixelRatio:br,sdf:fr,stretchX:Fr,stretchY:Hr,content:ri,textFitWidth:Ci,textFitHeight:cn,spriteData:{width:nt,height:qt,x:Wt,y:nr,context:ze}}}}return xe})}($t,yr)})}(w,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(le=>{if(this._spriteRequest=null,le)for(let Fe in le){this._spritesImagesIds[Fe]=[];let Ze=this._spritesImagesIds[Fe]?this._spritesImagesIds[Fe].filter(ut=>!(ut in le)):[];for(let ut of Ze)this.imageManager.removeImage(ut),this._changedImages[ut]=!0;for(let ut in le[Fe]){let Mt=Fe==="default"?ut:`${Fe}:${ut}`;this._spritesImagesIds[Fe].push(Mt),Mt in this.imageManager.images?this.imageManager.updateImage(Mt,le[Fe][ut],!1):this.imageManager.addImage(Mt,le[Fe][ut]),B&&(this._changedImages[Mt]=!0)}}}).catch(le=>{this._spriteRequest=null,ee=le,this.fire(new a.j(ee))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),B&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"})),Q&&Q(ee)})}_unloadSprite(){for(let w of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(w),this._changedImages[w]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}_validateLayer(w){let B=this.sourceCaches[w.source];if(!B)return;let Q=w.sourceLayer;if(!Q)return;let ee=B.getSource();(ee.type==="geojson"||ee.vectorLayerIds&&ee.vectorLayerIds.indexOf(Q)===-1)&&this.fire(new a.j(new Error(`Source layer "${Q}" does not exist on source "${ee.id}" as specified by style layer "${w.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let w in this.sourceCaches)if(!this.sourceCaches[w].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(w,B=!1){let Q=this._serializedAllLayers();if(!w||w.length===0)return Object.values(B?a.aB(Q):Q);let ee=[];for(let le of w)if(Q[le]){let Fe=B?a.aB(Q[le]):Q[le];ee.push(Fe)}return ee}_serializedAllLayers(){let w=this._serializedLayers;if(w)return w;w=this._serializedLayers={};let B=Object.keys(this._layers);for(let Q of B){let ee=this._layers[Q];ee.type!=="custom"&&(w[Q]=ee.serialize())}return w}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let w in this.sourceCaches)if(this.sourceCaches[w].hasTransition())return!0;for(let w in this._layers)if(this._layers[w].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(w){if(!this._loaded)return;let B=this._changed;if(B){let ee=Object.keys(this._updatedLayers),le=Object.keys(this._removedLayers);(ee.length||le.length)&&this._updateWorkerLayers(ee,le);for(let Fe in this._updatedSources){let Ze=this._updatedSources[Fe];if(Ze==="reload")this._reloadSource(Fe);else{if(Ze!=="clear")throw new Error(`Invalid action ${Ze}`);this._clearSource(Fe)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let Fe in this._updatedPaintProps)this._layers[Fe].updateTransitions(w);this.light.updateTransitions(w),this.sky.updateTransitions(w),this._resetUpdates()}let Q={};for(let ee in this.sourceCaches){let le=this.sourceCaches[ee];Q[ee]=le.used,le.used=!1}for(let ee of this._order){let le=this._layers[ee];le.recalculate(w,this._availableImages),!le.isHidden(w.zoom)&&le.source&&(this.sourceCaches[le.source].used=!0)}for(let ee in Q){let le=this.sourceCaches[ee];!!Q[ee]!=!!le.used&&le.fire(new a.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:ee}))}this.light.recalculate(w),this.sky.recalculate(w),this.z=w.zoom,B&&this.fire(new a.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let w=Object.keys(this._changedImages);if(w.length){for(let B in this.sourceCaches)this.sourceCaches[B].reloadTilesForDependencies(["icons","patterns"],w);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let w in this.sourceCaches)this.sourceCaches[w].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(w,B){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(w,!1),removedIds:B})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(w,B={}){var Q;this._checkLoaded();let ee=this.serialize();if(w=B.transformStyle?B.transformStyle(ee,w):w,((Q=B.validate)===null||Q===void 0||Q)&&da(this,a.u(w)))return!1;(w=a.aB(w)).layers=a.az(w.layers);let le=a.aC(ee,w),Fe=this._getOperationsToPerform(le);if(Fe.unimplemented.length>0)throw new Error(`Unimplemented: ${Fe.unimplemented.join(", ")}.`);if(Fe.operations.length===0)return!1;for(let Ze of Fe.operations)Ze();return this.stylesheet=w,this._serializedLayers=null,!0}_getOperationsToPerform(w){let B=[],Q=[];for(let ee of w)switch(ee.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":B.push(()=>this.addLayer.apply(this,ee.args));break;case"removeLayer":B.push(()=>this.removeLayer.apply(this,ee.args));break;case"setPaintProperty":B.push(()=>this.setPaintProperty.apply(this,ee.args));break;case"setLayoutProperty":B.push(()=>this.setLayoutProperty.apply(this,ee.args));break;case"setFilter":B.push(()=>this.setFilter.apply(this,ee.args));break;case"addSource":B.push(()=>this.addSource.apply(this,ee.args));break;case"removeSource":B.push(()=>this.removeSource.apply(this,ee.args));break;case"setLayerZoomRange":B.push(()=>this.setLayerZoomRange.apply(this,ee.args));break;case"setLight":B.push(()=>this.setLight.apply(this,ee.args));break;case"setGeoJSONSourceData":B.push(()=>this.setGeoJSONSourceData.apply(this,ee.args));break;case"setGlyphs":B.push(()=>this.setGlyphs.apply(this,ee.args));break;case"setSprite":B.push(()=>this.setSprite.apply(this,ee.args));break;case"setSky":B.push(()=>this.setSky.apply(this,ee.args));break;case"setTerrain":B.push(()=>this.map.setTerrain.apply(this,ee.args));break;case"setTransition":B.push(()=>{});break;default:Q.push(ee.command)}return{operations:B,unimplemented:Q}}addImage(w,B){if(this.getImage(w))return this.fire(new a.j(new Error(`An image named "${w}" already exists.`)));this.imageManager.addImage(w,B),this._afterImageUpdated(w)}updateImage(w,B){this.imageManager.updateImage(w,B)}getImage(w){return this.imageManager.getImage(w)}removeImage(w){if(!this.getImage(w))return this.fire(new a.j(new Error(`An image named "${w}" does not exist.`)));this.imageManager.removeImage(w),this._afterImageUpdated(w)}_afterImageUpdated(w){this._availableImages=this.imageManager.listImages(),this._changedImages[w]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(w,B,Q={}){if(this._checkLoaded(),this.sourceCaches[w]!==void 0)throw new Error(`Source "${w}" already exists.`);if(!B.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(B).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(B.type)>=0&&this._validate(a.u.source,`sources.${w}`,B,null,Q))return;this.map&&this.map._collectResourceTiming&&(B.collectResourceTiming=!0);let ee=this.sourceCaches[w]=new pt(w,B,this.dispatcher);ee.style=this,ee.setEventedParent(this,()=>({isSourceLoaded:ee.loaded(),source:ee.serialize(),sourceId:w})),ee.onAdd(this.map),this._changed=!0}removeSource(w){if(this._checkLoaded(),this.sourceCaches[w]===void 0)throw new Error("There is no source with this ID");for(let Q in this._layers)if(this._layers[Q].source===w)return this.fire(new a.j(new Error(`Source "${w}" cannot be removed while layer "${Q}" is using it.`)));let B=this.sourceCaches[w];delete this.sourceCaches[w],delete this._updatedSources[w],B.fire(new a.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:w})),B.setEventedParent(null),B.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(w,B){if(this._checkLoaded(),this.sourceCaches[w]===void 0)throw new Error(`There is no source with this ID=${w}`);let Q=this.sourceCaches[w].getSource();if(Q.type!=="geojson")throw new Error(`geojsonSource.type is ${Q.type}, which is !== 'geojson`);Q.setData(B),this._changed=!0}getSource(w){return this.sourceCaches[w]&&this.sourceCaches[w].getSource()}addLayer(w,B,Q={}){this._checkLoaded();let ee=w.id;if(this.getLayer(ee))return void this.fire(new a.j(new Error(`Layer "${ee}" already exists on this map.`)));let le;if(w.type==="custom"){if(da(this,a.aD(w)))return;le=a.aA(w)}else{if("source"in w&&typeof w.source=="object"&&(this.addSource(ee,w.source),w=a.aB(w),w=a.e(w,{source:ee})),this._validate(a.u.layer,`layers.${ee}`,w,{arrayIndex:-1},Q))return;le=a.aA(w),this._validateLayer(le),le.setEventedParent(this,{layer:{id:ee}})}let Fe=B?this._order.indexOf(B):this._order.length;if(B&&Fe===-1)this.fire(new a.j(new Error(`Cannot add layer "${ee}" before non-existing layer "${B}".`)));else{if(this._order.splice(Fe,0,ee),this._layerOrderChanged=!0,this._layers[ee]=le,this._removedLayers[ee]&&le.source&&le.type!=="custom"){let Ze=this._removedLayers[ee];delete this._removedLayers[ee],Ze.type!==le.type?this._updatedSources[le.source]="clear":(this._updatedSources[le.source]="reload",this.sourceCaches[le.source].pause())}this._updateLayer(le),le.onAdd&&le.onAdd(this.map)}}moveLayer(w,B){if(this._checkLoaded(),this._changed=!0,!this._layers[w])return void this.fire(new a.j(new Error(`The layer '${w}' does not exist in the map's style and cannot be moved.`)));if(w===B)return;let Q=this._order.indexOf(w);this._order.splice(Q,1);let ee=B?this._order.indexOf(B):this._order.length;B&&ee===-1?this.fire(new a.j(new Error(`Cannot move layer "${w}" before non-existing layer "${B}".`))):(this._order.splice(ee,0,w),this._layerOrderChanged=!0)}removeLayer(w){this._checkLoaded();let B=this._layers[w];if(!B)return void this.fire(new a.j(new Error(`Cannot remove non-existing layer "${w}".`)));B.setEventedParent(null);let Q=this._order.indexOf(w);this._order.splice(Q,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[w]=B,delete this._layers[w],this._serializedLayers&&delete this._serializedLayers[w],delete this._updatedLayers[w],delete this._updatedPaintProps[w],B.onRemove&&B.onRemove(this.map)}getLayer(w){return this._layers[w]}getLayersOrder(){return[...this._order]}hasLayer(w){return w in this._layers}setLayerZoomRange(w,B,Q){this._checkLoaded();let ee=this.getLayer(w);ee?ee.minzoom===B&&ee.maxzoom===Q||(B!=null&&(ee.minzoom=B),Q!=null&&(ee.maxzoom=Q),this._updateLayer(ee)):this.fire(new a.j(new Error(`Cannot set the zoom range of non-existing layer "${w}".`)))}setFilter(w,B,Q={}){this._checkLoaded();let ee=this.getLayer(w);if(ee){if(!a.aE(ee.filter,B))return B==null?(ee.filter=void 0,void this._updateLayer(ee)):void(this._validate(a.u.filter,`layers.${ee.id}.filter`,B,null,Q)||(ee.filter=a.aB(B),this._updateLayer(ee)))}else this.fire(new a.j(new Error(`Cannot filter non-existing layer "${w}".`)))}getFilter(w){return a.aB(this.getLayer(w).filter)}setLayoutProperty(w,B,Q,ee={}){this._checkLoaded();let le=this.getLayer(w);le?a.aE(le.getLayoutProperty(B),Q)||(le.setLayoutProperty(B,Q,ee),this._updateLayer(le)):this.fire(new a.j(new Error(`Cannot style non-existing layer "${w}".`)))}getLayoutProperty(w,B){let Q=this.getLayer(w);if(Q)return Q.getLayoutProperty(B);this.fire(new a.j(new Error(`Cannot get style of non-existing layer "${w}".`)))}setPaintProperty(w,B,Q,ee={}){this._checkLoaded();let le=this.getLayer(w);le?a.aE(le.getPaintProperty(B),Q)||(le.setPaintProperty(B,Q,ee)&&this._updateLayer(le),this._changed=!0,this._updatedPaintProps[w]=!0,this._serializedLayers=null):this.fire(new a.j(new Error(`Cannot style non-existing layer "${w}".`)))}getPaintProperty(w,B){return this.getLayer(w).getPaintProperty(B)}setFeatureState(w,B){this._checkLoaded();let Q=w.source,ee=w.sourceLayer,le=this.sourceCaches[Q];if(le===void 0)return void this.fire(new a.j(new Error(`The source '${Q}' does not exist in the map's style.`)));let Fe=le.getSource().type;Fe==="geojson"&&ee?this.fire(new a.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):Fe!=="vector"||ee?(w.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),le.setFeatureState(ee,w.id,B)):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(w,B){this._checkLoaded();let Q=w.source,ee=this.sourceCaches[Q];if(ee===void 0)return void this.fire(new a.j(new Error(`The source '${Q}' does not exist in the map's style.`)));let le=ee.getSource().type,Fe=le==="vector"?w.sourceLayer:void 0;le!=="vector"||Fe?B&&typeof w.id!="string"&&typeof w.id!="number"?this.fire(new a.j(new Error("A feature id is required to remove its specific state property."))):ee.removeFeatureState(Fe,w.id,B):this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(w){this._checkLoaded();let B=w.source,Q=w.sourceLayer,ee=this.sourceCaches[B];if(ee!==void 0)return ee.getSource().type!=="vector"||Q?(w.id===void 0&&this.fire(new a.j(new Error("The feature id parameter must be provided."))),ee.getFeatureState(Q,w.id)):void this.fire(new a.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.j(new Error(`The source '${B}' does not exist in the map's style.`)))}getTransition(){return a.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let w=a.aF(this.sourceCaches,le=>le.serialize()),B=this._serializeByIds(this._order,!0),Q=this.map.getTerrain()||void 0,ee=this.stylesheet;return a.aG({version:ee.version,name:ee.name,metadata:ee.metadata,light:ee.light,sky:ee.sky,center:ee.center,zoom:ee.zoom,bearing:ee.bearing,pitch:ee.pitch,sprite:ee.sprite,glyphs:ee.glyphs,transition:ee.transition,sources:w,layers:B,terrain:Q},le=>le!==void 0)}_updateLayer(w){this._updatedLayers[w.id]=!0,w.source&&!this._updatedSources[w.source]&&this.sourceCaches[w.source].getSource().type!=="raster"&&(this._updatedSources[w.source]="reload",this.sourceCaches[w.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(w){let B=Fe=>this._layers[Fe].type==="fill-extrusion",Q={},ee=[];for(let Fe=this._order.length-1;Fe>=0;Fe--){let Ze=this._order[Fe];if(B(Ze)){Q[Ze]=Fe;for(let ut of w){let Mt=ut[Ze];if(Mt)for(let Jt of Mt)ee.push(Jt)}}}ee.sort((Fe,Ze)=>Ze.intersectionZ-Fe.intersectionZ);let le=[];for(let Fe=this._order.length-1;Fe>=0;Fe--){let Ze=this._order[Fe];if(B(Ze))for(let ut=ee.length-1;ut>=0;ut--){let Mt=ee[ut].feature;if(Q[Mt.layer.id]<Fe)break;le.push(Mt),ee.pop()}else for(let ut of w){let Mt=ut[Ze];if(Mt)for(let Jt of Mt)le.push(Jt.feature)}}return le}queryRenderedFeatures(w,B,Q){B&&B.filter&&this._validate(a.u.filter,"queryRenderedFeatures.filter",B.filter,null,B);let ee={};if(B&&B.layers){if(!Array.isArray(B.layers))return this.fire(new a.j(new Error("parameters.layers must be an Array."))),[];for(let Ze of B.layers){let ut=this._layers[Ze];if(!ut)return this.fire(new a.j(new Error(`The layer '${Ze}' does not exist in the map's style and cannot be queried for features.`))),[];ee[ut.source]=!0}}let le=[];B.availableImages=this._availableImages;let Fe=this._serializedAllLayers();for(let Ze in this.sourceCaches)B.layers&&!ee[Ze]||le.push(Le(this.sourceCaches[Ze],this._layers,Fe,w,B,Q));return this.placement&&le.push(function(Ze,ut,Mt,Jt,$t,yr,Cr){let ve={},xe=yr.queryRenderedSymbols(Jt),Ie=[];for(let ze of Object.keys(xe).map(Number))Ie.push(Cr[ze]);Ie.sort(me);for(let ze of Ie){let Qe=ze.featureIndex.lookupSymbolFeatures(xe[ze.bucketInstanceId],ut,ze.bucketIndex,ze.sourceLayerIndex,$t.filter,$t.layers,$t.availableImages,Ze);for(let Xe in Qe){let nt=ve[Xe]=ve[Xe]||[],qt=Qe[Xe];qt.sort((Wt,nr)=>{let fr=ze.featureSortOrder;if(fr){let br=fr.indexOf(Wt.featureIndex);return fr.indexOf(nr.featureIndex)-br}return nr.featureIndex-Wt.featureIndex});for(let Wt of qt)nt.push(Wt)}}for(let ze in ve)ve[ze].forEach(Qe=>{let Xe=Qe.feature,nt=Mt[Ze[ze].source].getFeatureState(Xe.layer["source-layer"],Xe.id);Xe.source=Xe.layer.source,Xe.layer["source-layer"]&&(Xe.sourceLayer=Xe.layer["source-layer"]),Xe.state=nt});return ve}(this._layers,Fe,this.sourceCaches,w,B,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(le)}querySourceFeatures(w,B){B&&B.filter&&this._validate(a.u.filter,"querySourceFeatures.filter",B.filter,null,B);let Q=this.sourceCaches[w];return Q?function(ee,le){let Fe=ee.getRenderableIds().map(Mt=>ee.getTileByID(Mt)),Ze=[],ut={};for(let Mt=0;Mt<Fe.length;Mt++){let Jt=Fe[Mt],$t=Jt.tileID.canonical.key;ut[$t]||(ut[$t]=!0,Jt.querySourceFeatures(Ze,le))}return Ze}(Q,B):[]}getLight(){return this.light.getLight()}setLight(w,B={}){this._checkLoaded();let Q=this.light.getLight(),ee=!1;for(let Fe in w)if(!a.aE(w[Fe],Q[Fe])){ee=!0;break}if(!ee)return;let le={now:u.now(),transition:a.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(w,B),this.light.updateTransitions(le)}getSky(){var w;return(w=this.stylesheet)===null||w===void 0?void 0:w.sky}setSky(w,B={}){let Q=this.getSky(),ee=!1;if(!w&&!Q)return;if(w&&!Q)ee=!0;else if(!w&&Q)ee=!0;else for(let Fe in w)if(!a.aE(w[Fe],Q[Fe])){ee=!0;break}if(!ee)return;let le={now:u.now(),transition:a.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=w,this.sky.setSky(w,B),this.sky.updateTransitions(le)}_validate(w,B,Q,ee,le={}){return(!le||le.validate!==!1)&&da(this,w.call(a.u,a.e({key:B,style:this.serialize(),value:Q,styleSpec:a.v},ee)))}_remove(w=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),St().off(Ue,this._rtlPluginLoaded);for(let B in this._layers)this._layers[B].setEventedParent(null);for(let B in this.sourceCaches){let Q=this.sourceCaches[B];Q.setEventedParent(null),Q.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),w&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(w)}_clearSource(w){this.sourceCaches[w].clearTiles()}_reloadSource(w){this.sourceCaches[w].resume(),this.sourceCaches[w].reload()}_updateSources(w){for(let B in this.sourceCaches)this.sourceCaches[B].update(w,this.map.terrain)}_generateCollisionBoxes(){for(let w in this.sourceCaches)this._reloadSource(w)}_updatePlacement(w,B,Q,ee,le=!1){let Fe=!1,Ze=!1,ut={};for(let Mt of this._order){let Jt=this._layers[Mt];if(Jt.type!=="symbol")continue;if(!ut[Jt.source]){let yr=this.sourceCaches[Jt.source];ut[Jt.source]=yr.getRenderableIds(!0).map(Cr=>yr.getTileByID(Cr)).sort((Cr,ve)=>ve.tileID.overscaledZ-Cr.tileID.overscaledZ||(Cr.tileID.isLessThan(ve.tileID)?-1:1))}let $t=this.crossTileSymbolIndex.addLayer(Jt,ut[Jt.source],w.center.lng);Fe=Fe||$t}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((le=le||this._layerOrderChanged||Q===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(u.now(),w.zoom))&&(this.pauseablePlacement=new Ba(w,this.map.terrain,this._order,le,B,Q,ee,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,ut),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(u.now()),Ze=!0),Fe&&this.pauseablePlacement.placement.setStale()),Ze||Fe)for(let Mt of this._order){let Jt=this._layers[Mt];Jt.type==="symbol"&&this.placement.updateLayerOpacities(Jt,ut[Jt.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(u.now())}_releaseSymbolFadeTiles(){for(let w in this.sourceCaches)this.sourceCaches[w].releaseSymbolFadeTiles()}getImages(w,B){return a._(this,void 0,void 0,function*(){let Q=yield this.imageManager.getImages(B.icons);this._updateTilesForChangedImages();let ee=this.sourceCaches[B.source];return ee&&ee.setDependencies(B.tileID.key,B.type,B.icons),Q})}getGlyphs(w,B){return a._(this,void 0,void 0,function*(){let Q=yield this.glyphManager.getGlyphs(B.stacks),ee=this.sourceCaches[B.source];return ee&&ee.setDependencies(B.tileID.key,B.type,[""]),Q})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(w,B={}){this._checkLoaded(),w&&this._validate(a.u.glyphs,"glyphs",w,null,B)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=w,this.glyphManager.entries={},this.glyphManager.setURL(w))}addSprite(w,B,Q={},ee){this._checkLoaded();let le=[{id:w,url:B}],Fe=[...C(this.stylesheet.sprite),...le];this._validate(a.u.sprite,"sprite",Fe,null,Q)||(this.stylesheet.sprite=Fe,this._loadSprite(le,!0,ee))}removeSprite(w){this._checkLoaded();let B=C(this.stylesheet.sprite);if(B.find(Q=>Q.id===w)){if(this._spritesImagesIds[w])for(let Q of this._spritesImagesIds[w])this.imageManager.removeImage(Q),this._changedImages[Q]=!0;B.splice(B.findIndex(Q=>Q.id===w),1),this.stylesheet.sprite=B.length>0?B:void 0,delete this._spritesImagesIds[w],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new a.k("data",{dataType:"style"}))}else this.fire(new a.j(new Error(`Sprite "${w}" doesn't exists on this map.`)))}getSprite(){return C(this.stylesheet.sprite)}setSprite(w,B={},Q){this._checkLoaded(),w&&this._validate(a.u.sprite,"sprite",w,null,B)||(this.stylesheet.sprite=w,w?this._loadSprite(w,!0,Q):(this._unloadSprite(),Q&&Q(null)))}}var vo=a.Y([{name:"a_pos",type:"Int16",components:2}]);let Gn={prelude:Ct(`#ifdef GL_ES |
| 3229 | precision mediump float; |
| 3230 | #else |
nothing calls this directly
no test coverage detected