MCPcopy Index your code
hub / github.com/plotly/plotly.py / loadVectorTile

Method loadVectorTile

js/lib/mimeExtension.js:3214–3214  ·  view source on GitHub ↗
(Ne,Ye)

Source from the content-addressed store, hash-verified

3212`),mapOnErrorMsg:"Map error."}}}),c1=De({"src/plots/map/layout_attributes.js"(Y,H){"use strict";var p=ui(),x=vo().defaultLine,S=Ec().attributes,E=qu(),e=lf().textposition,t=gc().overrideAll,r=Gl().templatedArray,o=f0(),i=E({noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0});i.family.dflt="Open Sans Regular, Arial Unicode MS Regular";var n=H.exports=t({_arrayAttrRegexps:[p.counterRegex("map",".layers",!0)],domain:S({name:"map"}),style:{valType:"any",values:o.styleValuesMap,dflt:o.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:r("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:x},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:x}},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:i,textposition:p.extendFlat({},e,{arrayOk:!1})}})},"plot","from-root");n.uirevision={valType:"any",editType:"none"}}}),Cb=De({"src/traces/scattermap/attributes.js"(Y,H){"use strict";var{hovertemplateAttrs:p,texttemplateAttrs:x,templatefallbackAttrs:S}=ou(),E=vv(),e=om(),t=lf(),r=c1(),o=Yl(),i=zu(),n=Xo().extendFlat,a=gc().overrideAll,s=c1(),h=e.line,c=e.marker;H.exports=a({lon:e.lon,lat:e.lat,cluster:{enabled:{valType:"boolean"},maxzoom:n({},s.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:n({},c.opacity,{dflt:1})},mode:n({},t.mode,{dflt:"markers"}),text:n({},t.text,{}),texttemplate:x({editType:"plot"},{keys:["lat","lon","text"]}),texttemplatefallback:S({editType:"plot"}),hovertext:n({},t.hovertext,{}),line:{color:h.color,width:h.width},connectgaps:t.connectgaps,marker:n({symbol:{valType:"string",dflt:"circle",arrayOk:!0},angle:{valType:"number",dflt:"auto",arrayOk:!0},allowoverlap:{valType:"boolean",dflt:!1},opacity:c.opacity,size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode},i("marker")),fill:e.fill,fillcolor:E(),textfont:r.layers.symbol.textfont,textposition:r.layers.symbol.textposition,below:{valType:"string"},selected:{marker:t.selected.marker},unselected:{marker:t.unselected.marker},hoverinfo:n({},o.hoverinfo,{flags:["lon","lat","text","name"]}),hovertemplate:p(),hovertemplatefallback:S()},"calc","nested")}}),dA=De({"src/traces/scattermap/constants.js"(Y,H){"use strict";var p=["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"];H.exports={isSupportedFont:function(x){return p.indexOf(x)!==-1}}}}),sD=De({"src/traces/scattermap/defaults.js"(Y,H){"use strict";var p=ui(),x=Hu(),S=Od(),E=Wd(),e=Xd(),t=mv(),r=Cb(),o=dA().isSupportedFont;H.exports=function(a,s,h,c){function m(y,f){return p.coerce(a,s,r,y,f)}function d(y,f){return p.coerce2(a,s,r,y,f)}var T=i(a,s,m);if(!T){s.visible=!1;return}if(m("text"),m("texttemplate"),m("texttemplatefallback"),m("hovertext"),m("hovertemplate"),m("hovertemplatefallback"),m("mode"),m("below"),x.hasMarkers(s)){S(a,s,h,c,m,{noLine:!0,noAngle:!0}),m("marker.allowoverlap"),m("marker.angle");var l=s.marker;l.symbol!=="circle"&&(p.isArrayOrTypedArray(l.size)&&(l.size=l.size[0]),p.isArrayOrTypedArray(l.color)&&(l.color=l.color[0]))}x.hasLines(s)&&(E(a,s,h,c,m,{noDash:!0}),m("connectgaps"));var _=d("cluster.maxzoom"),w=d("cluster.step"),A=d("cluster.color",s.marker&&s.marker.color||h),M=d("cluster.size"),g=d("cluster.opacity"),b=_!==!1||w!==!1||A!==!1||M!==!1||g!==!1,v=m("cluster.enabled",b);if(v||x.hasText(s)){var u=c.font.family;e(a,s,c,m,{noSelect:!0,noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0,font:{family:o(u)?u:"Open Sans Regular",weight:c.font.weight,style:c.font.style,size:c.font.size,color:c.font.color}})}m("fill"),s.fill!=="none"&&t(a,s,h,m),p.coerceSelectionMarkerOpacity(s,m)};function i(n,a,s){var h=s("lon")||[],c=s("lat")||[],m=Math.min(h.length,c.length);return a._length=m,m}}}),vA=De({"src/traces/scattermap/format_labels.js"(Y,H){"use strict";var p=us();H.exports=function(S,E,e){var t={},r=e[E.subplot]._subplot,o=r.mockAxis,i=S.lonlat;return t.lonLabel=p.tickText(o,o.c2l(i[0]),!0).text,t.latLabel=p.tickText(o,o.c2l(i[1]),!0).text,t}}}),pA=De({"src/plots/map/convert_text_opts.js"(Y,H){"use strict";var p=ui();H.exports=function(S,E){var e=S.split(" "),t=e[0],r=e[1],o=p.isArrayOrTypedArray(E)?p.mean(E):E,i=.5+o/100,n=1.5+o/100,a=["",""],s=[0,0];switch(t){case"top":a[0]="top",s[1]=-n;break;case"bottom":a[0]="bottom",s[1]=n;break}switch(r){case"left":a[1]="right",s[0]=-i;break;case"right":a[1]="left",s[0]=i;break}var h;return a[0]&&a[1]?h=a.join("-"):a[0]?h=a[0]:a[1]?h=a[1]:h="center",{anchor:h,offset:s}}}}),lD=De({"src/traces/scattermap/convert.js"(Y,H){"use strict";var p=vn(),x=ui(),S=zn().BADNUM,E=o0(),e=oc(),t=ys(),r=Km(),o=Hu(),i=dA().isSupportedFont,n=pA(),a=Ad().appendArrayPointValue,s=vu().NEWLINES,h=vu().BR_TAG_ALL;H.exports=function(g,b){var v=b[0].trace,u=v.visible===!0&&v._length!==0,y=v.fill!=="none",f=o.hasLines(v),R=o.hasMarkers(v),L=o.hasText(v),z=R&&v.marker.symbol==="circle",F=R&&v.marker.symbol!=="circle",N=v.cluster&&v.cluster.enabled,B=c("fill"),I=c("line"),U=c("circle"),O=c("symbol"),X={fill:B,line:I,circle:U,symbol:O};if(!u)return X;var J;if((y||f)&&(J=E.calcTraceToLineCoords(b)),y&&(B.geojson=E.makePolygon(J),B.layout.visibility="visible",x.extendFlat(B.paint,{"fill-color":v.fillcolor})),f&&(I.geojson=E.makeLine(J),I.layout.visibility="visible",x.extendFlat(I.paint,{"line-width":v.line.width,"line-color":v.line.color,"line-opacity":v.opacity})),z){var se=m(b);U.geojson=se.geojson,U.layout.visibility="visible",N&&(U.filter=["!",["has","point_count"]],X.cluster={type:"circle",filter:["has","point_count"],layout:{visibility:"visible"},paint:{"circle-color":w(v.cluster.color,v.cluster.step),"circle-radius":w(v.cluster.size,v.cluster.step),"circle-opacity":w(v.cluster.opacity,v.cluster.step)}},X.clusterCount={type:"symbol",filter:["has","point_count"],paint:{},layout:{"text-field":"{point_count_abbreviated}","text-font":A(v),"text-size":12}}),x.extendFlat(U.paint,{"circle-color":se.mcc,"circle-radius":se.mrc,"circle-opacity":se.mo})}if(z&&N&&(U.filter=["!",["has","point_count"]]),(F||L)&&(O.geojson=d(b,g),x.extendFlat(O.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),F&&(x.extendFlat(O.layout,{"icon-size":v.marker.size/10}),"angle"in v.marker&&v.marker.angle!=="auto"&&x.extendFlat(O.layout,{"icon-rotate":{type:"identity",property:"angle"},"icon-rotation-alignment":"map"}),O.layout["icon-allow-overlap"]=v.marker.allowoverlap,x.extendFlat(O.paint,{"icon-opacity":v.opacity*v.marker.opacity,"icon-color":v.marker.color})),L)){var le=(v.marker||{}).size,ce=n(v.textposition,le);x.extendFlat(O.layout,{"text-size":v.textfont.size,"text-anchor":ce.anchor,"text-offset":ce.offset,"text-font":A(v)}),x.extendFlat(O.paint,{"text-color":v.textfont.color,"text-opacity":v.opacity})}return X};function c(M){return{type:M,geojson:E.makeBlank(),layout:{visibility:"none"},filter:null,paint:{}}}function m(M){var g=M[0].trace,b=g.marker,v=g.selectedpoints,u=x.isArrayOrTypedArray(b.color),y=x.isArrayOrTypedArray(b.size),f=x.isArrayOrTypedArray(b.opacity),R;function L(le){return g.opacity*le}function z(le){return le/2}var F;u&&(e.hasColorscale(g,"marker")?F=e.makeColorScaleFuncFromTrace(b):F=x.identity);var N;y&&(N=r(g));var B;f&&(B=function(le){var ce=p(le)?+x.constrain(le,0,1):0;return L(ce)});var I=[];for(R=0;R<M.length;R++){var U=M[R],O=U.lonlat;if(!_(O)){var X={};F&&(X.mcc=U.mcc=F(U.mc)),N&&(X.mrc=U.mrc=N(U.ms)),B&&(X.mo=B(U.mo)),v&&(X.selected=U.selected||0),I.push({type:"Feature",id:R+1,geometry:{type:"Point",coordinates:O},properties:X})}}var J;if(v)for(J=t.makeSelectedPointStyleFns(g),R=0;R<I.length;R++){var se=I[R].properties;J.selectedOpacityFn&&(se.mo=L(J.selectedOpacityFn(se))),J.selectedColorFn&&(se.mcc=J.selectedColorFn(se)),J.selectedSizeFn&&(se.mrc=J.selectedSizeFn(se))}return{geojson:{type:"FeatureCollection",features:I},mcc:u||J&&J.selectedColorFn?{type:"identity",property:"mcc"}:b.color,mrc:y||J&&J.selectedSizeFn?{type:"identity",property:"mrc"}:z(b.size),mo:f||J&&J.selectedOpacityFn?{type:"identity",property:"mo"}:L(b.opacity)}}function d(M,g){for(var b=g._fullLayout,v=M[0].trace,u=v.marker||{},y=u.symbol,f=u.angle,R=y!=="circle"?T(y):l,L=f!=="auto"?T(f,!0):l,z=o.hasText(v)?T(v.text):l,F=[],N=0;N<M.length;N++){var B=M[N];if(!_(B.lonlat)){var I=v.texttemplate,U;if(I){var O=Array.isArray(I)?I[N]||"":I,X=v._module.formatLabels(B,v,b),J={};a(J,v,B.i),U=x.texttemplateString({data:[J,B,v._meta],fallback:v.texttemplatefallback,labels:X,locale:b._d3locale,template:O})}else U=z(N);U&&(U=U.replace(s,"").replace(h,`
3213`)),F.push({type:"Feature",geometry:{type:"Point",coordinates:B.lonlat},properties:{symbol:R(N),angle:L(N),text:U}})}}return{type:"FeatureCollection",features:F}}function T(M,g){return x.isArrayOrTypedArray(M)?g?function(b){return p(M[b])?+M[b]:0}:function(b){return M[b]}:M?function(){return M}:l}function l(){return""}function _(M){return M[0]===S}function w(M,g){var b;if(x.isArrayOrTypedArray(M)&&x.isArrayOrTypedArray(g)){b=["step",["get","point_count"],M[0]];for(var v=1;v<M.length;v++)b.push(g[v-1],M[v])}else b=M;return b}function A(M){var g=M.textfont,b=g.family,v=g.style,u=g.weight,y=b.split(" "),f=y[y.length-1]==="Italic";f&&y.pop(),f=f||v==="italic";var R=y.join(" ");u==="bold"&&y.indexOf("Bold")===-1?R+=" Bold":u<=1e3&&(y[0]==="Metropolis"?(R="Metropolis",u>850?R+=" Black":u>750?R+=" Extra Bold":u>650?R+=" Bold":u>550?R+=" Semi Bold":u>450?R+=" Medium":u>350?R+=" Regular":u>250?R+=" Light":u>150?R+=" Extra Light":R+=" Thin"):y.slice(0,2).join(" ")==="Open Sans"?(R="Open Sans",u>750?R+=" Extrabold":u>650?R+=" Bold":u>550?R+=" Semibold":u>350?R+=" Regular":R+=" Light"):y.slice(0,3).join(" ")==="Klokantech Noto Sans"&&(R="Klokantech Noto Sans",y[3]==="CJK"&&(R+=" CJK"),R+=u>500?" Bold":" Regular")),f&&(R+=" Italic"),R==="Open Sans Regular Italic"?R="Open Sans Italic":R==="Open Sans Regular Bold"?R="Open Sans Bold":R==="Open Sans Regular Bold Italic"?R="Open Sans Bold Italic":R==="Klokantech Noto Sans Regular Italic"&&(R="Klokantech Noto Sans Italic"),i(R)||(R=b);var L=R.split(", ");return L}}}),uD=De({"src/traces/scattermap/plot.js"(Y,H){"use strict";var p=ui(),x=lD(),S=f0().traceLayerPrefix,E={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function e(r,o,i,n){this.type="scattermap",this.subplot=r,this.uid=o,this.clusterEnabled=i,this.isHidden=n,this.sourceIds={fill:"source-"+o+"-fill",line:"source-"+o+"-line",circle:"source-"+o+"-circle",symbol:"source-"+o+"-symbol",cluster:"source-"+o+"-circle",clusterCount:"source-"+o+"-circle"},this.layerIds={fill:S+o+"-fill",line:S+o+"-line",circle:S+o+"-circle",symbol:S+o+"-symbol",cluster:S+o+"-cluster",clusterCount:S+o+"-cluster-count"},this.below=null}var t=e.prototype;t.addSource=function(r,o,i){var n={type:"geojson",data:o.geojson};i&&i.enabled&&p.extendFlat(n,{cluster:!0,clusterMaxZoom:i.maxzoom});var a=this.subplot.map.getSource(this.sourceIds[r]);a?a.setData(o.geojson):this.subplot.map.addSource(this.sourceIds[r],n)},t.setSourceData=function(r,o){this.subplot.map.getSource(this.sourceIds[r]).setData(o.geojson)},t.addLayer=function(r,o,i){var n={type:o.type,id:this.layerIds[r],source:this.sourceIds[r],layout:o.layout,paint:o.paint};o.filter&&(n.filter=o.filter);for(var a=this.layerIds[r],s,h=this.subplot.getMapLayers(),c=0;c<h.length;c++)if(h[c].id===a){s=!0;break}s?(this.subplot.setOptions(a,"setLayoutProperty",n.layout),n.layout.visibility==="visible"&&this.subplot.setOptions(a,"setPaintProperty",n.paint)):this.subplot.addLayer(n,i)},t.update=function(o){var i=o[0].trace,n=this.subplot,a=n.map,s=x(n.gd,o),h=n.belowLookup["trace-"+this.uid],c=!!(i.cluster&&i.cluster.enabled),m=!!this.clusterEnabled,d=this;function T(u){u||d.addSource("circle",s.circle,i.cluster);for(var y=E.cluster,f=0;f<y.length;f++){var R=y[f],L=s[R];d.addLayer(R,L,h)}}function l(u){for(var y=E.cluster,f=y.length-1;f>=0;f--){var R=y[f];a.removeLayer(d.layerIds[R])}u||a.removeSource(d.sourceIds.circle)}function _(u){for(var y=E.nonCluster,f=0;f<y.length;f++){var R=y[f],L=s[R];u||d.addSource(R,L),d.addLayer(R,L,h)}}function w(u){for(var y=E.nonCluster,f=y.length-1;f>=0;f--){var R=y[f];a.removeLayer(d.layerIds[R]),u||a.removeSource(d.sourceIds[R])}}function A(u){m?l(u):w(u)}function M(u){c?T(u):_(u)}function g(){for(var u=c?E.cluster:E.nonCluster,y=0;y<u.length;y++){var f=u[y],R=s[f];R&&(n.setOptions(d.layerIds[f],"setLayoutProperty",R.layout),R.layout.visibility==="visible"&&(f!=="cluster"&&d.setSourceData(f,R),n.setOptions(d.layerIds[f],"setPaintProperty",R.paint)))}}var b=this.isHidden,v=i.visible!==!0;v?b||A():b?v||M():m!==c?(A(),M()):(this.below!==h&&(A(!0),M(!0)),g()),this.clusterEnabled=c,this.isHidden=v,this.below=h,o[0].trace._glTrace=this},t.dispose=function(){for(var o=this.subplot.map,i=this.clusterEnabled?E.cluster:E.nonCluster,n=i.length-1;n>=0;n--){var a=i[n];o.removeLayer(this.layerIds[a]),o.removeSource(this.sourceIds[a])}},H.exports=function(o,i){var n=i[0].trace,a=n.cluster&&n.cluster.enabled,s=n.visible!==!0,h=new e(o,n.uid,a,s),c=x(o.gd,i),m=h.below=o.belowLookup["trace-"+n.uid],d,T,l;if(a)for(h.addSource("circle",c.circle,n.cluster),d=0;d<E.cluster.length;d++)T=E.cluster[d],l=c[T],h.addLayer(T,l,m);else for(d=0;d<E.nonCluster.length;d++)T=E.nonCluster[d],l=c[T],h.addSource(T,l,n.cluster),h.addLayer(T,l,m);return i[0].trace._glTrace=h,h}}}),Lb=De({"src/traces/scattermap/hover.js"(Y,H){"use strict";var p=sf(),x=ui(),S=rg(),E=x.fillText,e=zn().BADNUM,t=f0().traceLayerPrefix;function r(i,n,a){var s=i.cd,h=s[0].trace,c=i.xa,m=i.ya,d=i.subplot,T=[],l=t+h.uid+"-circle",_=h.cluster&&h.cluster.enabled;if(_){var w=d.map.queryRenderedFeatures(null,{layers:[l]});T=w.map(function(N){return N.id})}var A=n>=0?Math.floor((n+180)/360):Math.ceil((n-180)/360),M=A*360,g=n-M;function b(N){var B=N.lonlat;if(B[0]===e||_&&T.indexOf(N.i+1)===-1)return 1/0;var I=x.modHalf(B[0],360),U=B[1],O=d.project([I,U]),X=O.x-c.c2p([g,U]),J=O.y-m.c2p([I,a]),se=Math.max(3,N.mrc||0);return Math.max(Math.sqrt(X*X+J*J)-se,1-3/se)}if(p.getClosest(s,b,i),i.index!==!1){var v=s[i.index],u=v.lonlat,y=[x.modHalf(u[0],360)+M,u[1]],f=c.c2p(y),R=m.c2p(y),L=v.mrc||1;i.x0=f-L,i.x1=f+L,i.y0=R-L,i.y1=R+L;var z={};z[h.subplot]={_subplot:d};var F=h._module.formatLabels(v,h,z);return i.lonLabel=F.lonLabel,i.latLabel=F.latLabel,i.color=S(h,v),i.extraText=o(h,v,s[0].t.labels),i.hovertemplate=h.hovertemplate,[i]}}function o(i,n,a){if(i.hovertemplate)return;var s=n.hi||i.hoverinfo,h=s.split("+"),c=h.indexOf("all")!==-1,m=h.indexOf("lon")!==-1,d=h.indexOf("lat")!==-1,T=n.lonlat,l=[];function _(w){return w+"\xB0"}return c||m&&d?l.push("("+_(T[1])+", "+_(T[0])+")"):m?l.push(a.lon+_(T[0])):d&&l.push(a.lat+_(T[1])),(c||h.indexOf("text")!==-1)&&E(n,i,l),l.join("<br>")}H.exports={hoverPoints:r,getExtraText:o}}}),cD=De({"src/traces/scattermap/event_data.js"(Y,H){"use strict";H.exports=function(x,S){return x.lon=S.lon,x.lat=S.lat,x}}}),fD=De({"src/traces/scattermap/select.js"(Y,H){"use strict";var p=ui(),x=Hu(),S=zn().BADNUM;H.exports=function(e,t){var r=e.cd,o=e.xaxis,i=e.yaxis,n=[],a=r[0].trace,s;if(!x.hasMarkers(a))return[];if(t===!1)for(s=0;s<r.length;s++)r[s].selected=0;else for(s=0;s<r.length;s++){var h=r[s],c=h.lonlat;if(c[0]!==S){var m=[p.modHalf(c[0],360),c[1]],d=[o.c2p(m),i.c2p(m)];t.contains(d,null,s,e)?(n.push({pointNumber:s,lon:c[0],lat:c[1]}),h.selected=1):h.selected=0}}return n}}}),hD=De({"node_modules/maplibre-gl/dist/maplibre-gl.js"(Y,H){(function(p,x){typeof Y=="object"&&typeof H<"u"?H.exports=x():(p=typeof globalThis<"u"?globalThis:p||self,p.maplibregl=x())})(Y,function(){"use strict";var p={},x={};function S(e,t,r){if(x[e]=r,e==="index"){var o="var sharedModule = {}; ("+x.shared+")(sharedModule); ("+x.worker+")(sharedModule);",i={};return x.shared(i),x.index(p,i),typeof window<"u"&&p.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),p}}S("shared",["exports"],function(e){"use strict";function t(W,D,$,he){return new($||($=Promise))(function(Ee,je){function We(Nt){try{St(he.next(Nt))}catch(sr){je(sr)}}function ct(Nt){try{St(he.throw(Nt))}catch(sr){je(sr)}}function St(Nt){var sr;Nt.done?Ee(Nt.value):(sr=Nt.value,sr instanceof $?sr:new $(function(Er){Er(sr)})).then(We,ct)}St((he=he.apply(W,D||[])).next())})}function r(W){return W&&W.__esModule&&Object.prototype.hasOwnProperty.call(W,"default")?W.default:W}typeof SuppressedError=="function"&&SuppressedError;var o=i;function i(W,D){this.x=W,this.y=D}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(W){return this.clone()._add(W)},sub:function(W){return this.clone()._sub(W)},multByPoint:function(W){return this.clone()._multByPoint(W)},divByPoint:function(W){return this.clone()._divByPoint(W)},mult:function(W){return this.clone()._mult(W)},div:function(W){return this.clone()._div(W)},rotate:function(W){return this.clone()._rotate(W)},rotateAround:function(W,D){return this.clone()._rotateAround(W,D)},matMult:function(W){return this.clone()._matMult(W)},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(W){return this.x===W.x&&this.y===W.y},dist:function(W){return Math.sqrt(this.distSqr(W))},distSqr:function(W){var D=W.x-this.x,$=W.y-this.y;return D*D+$*$},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(W){return Math.atan2(this.y-W.y,this.x-W.x)},angleWith:function(W){return this.angleWithSep(W.x,W.y)},angleWithSep:function(W,D){return Math.atan2(this.x*D-this.y*W,this.x*W+this.y*D)},_matMult:function(W){var D=W[2]*this.x+W[3]*this.y;return this.x=W[0]*this.x+W[1]*this.y,this.y=D,this},_add:function(W){return this.x+=W.x,this.y+=W.y,this},_sub:function(W){return this.x-=W.x,this.y-=W.y,this},_mult:function(W){return this.x*=W,this.y*=W,this},_div:function(W){return this.x/=W,this.y/=W,this},_multByPoint:function(W){return this.x*=W.x,this.y*=W.y,this},_divByPoint:function(W){return this.x/=W.x,this.y/=W.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var W=this.y;return this.y=this.x,this.x=-W,this},_rotate:function(W){var D=Math.cos(W),$=Math.sin(W),he=$*this.x+D*this.y;return this.x=D*this.x-$*this.y,this.y=he,this},_rotateAround:function(W,D){var $=Math.cos(W),he=Math.sin(W),Ee=D.y+he*(this.x-D.x)+$*(this.y-D.y);return this.x=D.x+$*(this.x-D.x)-he*(this.y-D.y),this.y=Ee,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(W){return W instanceof i?W:Array.isArray(W)?new i(W[0],W[1]):W};var n=r(o),a=s;function s(W,D,$,he){this.cx=3*W,this.bx=3*($-W)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*D,this.by=3*(he-D)-this.cy,this.ay=1-this.cy-this.by,this.p1x=W,this.p1y=D,this.p2x=$,this.p2y=he}s.prototype={sampleCurveX:function(W){return((this.ax*W+this.bx)*W+this.cx)*W},sampleCurveY:function(W){return((this.ay*W+this.by)*W+this.cy)*W},sampleCurveDerivativeX:function(W){return(3*this.ax*W+2*this.bx)*W+this.cx},solveCurveX:function(W,D){if(D===void 0&&(D=1e-6),W<0)return 0;if(W>1)return 1;for(var $=W,he=0;he<8;he++){var Ee=this.sampleCurveX($)-W;if(Math.abs(Ee)<D)return $;var je=this.sampleCurveDerivativeX($);if(Math.abs(je)<1e-6)break;$-=Ee/je}var We=0,ct=1;for($=W,he=0;he<20&&(Ee=this.sampleCurveX($),!(Math.abs(Ee-W)<D));he++)W>Ee?We=$:ct=$,$=.5*(ct-We)+We;return $},solve:function(W,D){return this.sampleCurveY(this.solveCurveX(W,D))}};var h=r(a);let c,m;function d(){return c==null&&(c=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),c}function T(){if(m==null&&(m=!1,d())){let D=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(D){for(let he=0;he<5*5;he++){let Ee=4*he;D.fillStyle=`rgb(${Ee},${Ee+1},${Ee+2})`,D.fillRect(he%5,Math.floor(he/5),1,1)}let $=D.getImageData(0,0,5,5).data;for(let he=0;he<5*5*4;he++)if(he%4!=3&&$[he]!==he){m=!0;break}}}return m||!1}function l(W,D,$,he){let Ee=new h(W,D,$,he);return je=>Ee.solve(je)}let _=l(.25,.1,.25,1);function w(W,D,$){return Math.min($,Math.max(D,W))}function A(W,D,$){let he=$-D,Ee=((W-D)%he+he)%he+D;return Ee===D?$:Ee}function M(W,...D){for(let $ of D)for(let he in $)W[he]=$[he];return W}let g=1;function b(W,D,$){let he={};for(let Ee in W)he[Ee]=D.call(this,W[Ee],Ee,W);return he}function v(W,D,$){let he={};for(let Ee in W)D.call(this,W[Ee],Ee,W)&&(he[Ee]=W[Ee]);return he}function u(W){return Array.isArray(W)?W.map(u):typeof W=="object"&&W?b(W,u):W}let y={};function f(W){y[W]||(typeof console<"u"&&console.warn(W),y[W]=!0)}function R(W,D,$){return($.y-W.y)*(D.x-W.x)>(D.y-W.y)*($.x-W.x)}function L(W){return typeof WorkerGlobalScope<"u"&&W!==void 0&&W instanceof WorkerGlobalScope}let z=null;function F(W){return typeof ImageBitmap<"u"&&W instanceof ImageBitmap}let N="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function B(W,D,$,he,Ee){return t(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let je=new VideoFrame(W,{timestamp:0});try{let We=je?.format;if(!We||!We.startsWith("BGR")&&!We.startsWith("RGB"))throw new Error(`Unrecognized format ${We}`);let ct=We.startsWith("BGR"),St=new Uint8ClampedArray(he*Ee*4);if(yield je.copyTo(St,function(Nt,sr,Er,Fr,Xr){let ni=4*Math.max(-sr,0),gi=(Math.max(0,Er)-Er)*Fr*4+ni,Zi=4*Fr,aa=Math.max(0,sr),nn=Math.max(0,Er);return{rect:{x:aa,y:nn,width:Math.min(Nt.width,sr+Fr)-aa,height:Math.min(Nt.height,Er+Xr)-nn},layout:[{offset:gi,stride:Zi}]}}(W,D,$,he,Ee)),ct)for(let Nt=0;Nt<St.length;Nt+=4){let sr=St[Nt];St[Nt]=St[Nt+2],St[Nt+2]=sr}return St}finally{je.close()}})}let I,U,O="AbortError";function X(){return new Error(O)}let J={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function se(W){return J.REGISTERED_PROTOCOLS[W.substring(0,W.indexOf("://"))]}let le="global-dispatcher";class ce extends Error{constructor(D,$,he,Ee){super(`AJAXError: ${$} (${D}): ${he}`),this.status=D,this.statusText=$,this.url=he,this.body=Ee}}let q=()=>L(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Z=function(W,D){if(/:\/\//.test(W.url)&&!/^https?:|^file:/.test(W.url)){let he=se(W.url);if(he)return he(W,D);if(L(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:W,targetMapId:le},D)}if(!(/^file:/.test($=W.url)||/^file:/.test(q())&&!/^\w+:/.test($))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(he,Ee){return t(this,void 0,void 0,function*(){let je=new Request(he.url,{method:he.method||"GET",body:he.body,credentials:he.credentials,headers:he.headers,cache:he.cache,referrer:q(),signal:Ee.signal});he.type!=="json"||je.headers.has("Accept")||je.headers.set("Accept","application/json");let We=yield fetch(je);if(!We.ok){let Nt=yield We.blob();throw new ce(We.status,We.statusText,he.url,Nt)}let ct;ct=he.type==="arrayBuffer"||he.type==="image"?We.arrayBuffer():he.type==="json"?We.json():We.text();let St=yield ct;if(Ee.signal.aborted)throw X();return{data:St,cacheControl:We.headers.get("Cache-Control"),expires:We.headers.get("Expires")}})}(W,D);if(L(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:W,mustQueue:!0,targetMapId:le},D)}var $;return function(he,Ee){return new Promise((je,We)=>{var ct;let St=new XMLHttpRequest;St.open(he.method||"GET",he.url,!0),he.type!=="arrayBuffer"&&he.type!=="image"||(St.responseType="arraybuffer");for(let Nt in he.headers)St.setRequestHeader(Nt,he.headers[Nt]);he.type==="json"&&(St.responseType="text",!((ct=he.headers)===null||ct===void 0)&&ct.Accept||St.setRequestHeader("Accept","application/json")),St.withCredentials=he.credentials==="include",St.onerror=()=>{We(new Error(St.statusText))},St.onload=()=>{if(!Ee.signal.aborted)if((St.status>=200&&St.status<300||St.status===0)&&St.response!==null){let Nt=St.response;if(he.type==="json")try{Nt=JSON.parse(St.response)}catch(sr){return void We(sr)}je({data:Nt,cacheControl:St.getResponseHeader("Cache-Control"),expires:St.getResponseHeader("Expires")})}else{let Nt=new Blob([St.response],{type:St.getResponseHeader("Content-Type")});We(new ce(St.status,St.statusText,he.url,Nt))}},Ee.signal.addEventListener("abort",()=>{St.abort(),We(X())}),St.send(he.body)})}(W,D)};function ee(W){if(!W||W.indexOf("://")<=0||W.indexOf("data:image/")===0||W.indexOf("blob:")===0)return!0;let D=new URL(W),$=window.location;return D.protocol===$.protocol&&D.host===$.host}function V(W,D,$){$[W]&&$[W].indexOf(D)!==-1||($[W]=$[W]||[],$[W].push(D))}function oe(W,D,$){if($&&$[W]){let he=$[W].indexOf(D);he!==-1&&$[W].splice(he,1)}}class ie{constructor(D,$={}){M(this,$),this.type=D}}class j extends ie{constructor(D,$={}){super("error",M({error:D},$))}}class Q{on(D,$){return this._listeners=this._listeners||{},V(D,$,this._listeners),this}off(D,$){return oe(D,$,this._listeners),oe(D,$,this._oneTimeListeners),this}once(D,$){return $?(this._oneTimeListeners=this._oneTimeListeners||{},V(D,$,this._oneTimeListeners),this):new Promise(he=>this.once(D,he))}fire(D,$){typeof D=="string"&&(D=new ie(D,$||{}));let he=D.type;if(this.listens(he)){D.target=this;let Ee=this._listeners&&this._listeners[he]?this._listeners[he].slice():[];for(let ct of Ee)ct.call(this,D);let je=this._oneTimeListeners&&this._oneTimeListeners[he]?this._oneTimeListeners[he].slice():[];for(let ct of je)oe(he,ct,this._oneTimeListeners),ct.call(this,D);let We=this._eventedParent;We&&(M(D,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),We.fire(D))}else D instanceof j&&console.error(D.error);return this}listens(D){return this._listeners&&this._listeners[D]&&this._listeners[D].length>0||this._oneTimeListeners&&this._oneTimeListeners[D]&&this._oneTimeListeners[D].length>0||this._eventedParent&&this._eventedParent.listens(D)}setEventedParent(D,$){return this._eventedParent=D,this._eventedParentData=$,this}}var re={$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 ue=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function _e(W,D){let $={};for(let he in W)he!=="ref"&&($[he]=W[he]);return ue.forEach(he=>{he in D&&($[he]=D[he])}),$}function we(W,D){if(Array.isArray(W)){if(!Array.isArray(D)||W.length!==D.length)return!1;for(let $=0;$<W.length;$++)if(!we(W[$],D[$]))return!1;return!0}if(typeof W=="object"&&W!==null&&D!==null){if(typeof D!="object"||Object.keys(W).length!==Object.keys(D).length)return!1;for(let $ in W)if(!we(W[$],D[$]))return!1;return!0}return W===D}function Re(W,D){W.push(D)}function ze(W,D,$){Re($,{command:"addSource",args:[W,D[W]]})}function Xe(W,D,$){Re(D,{command:"removeSource",args:[W]}),$[W]=!0}function tt(W,D,$,he){Xe(W,$,he),ze(W,D,$)}function it(W,D,$){let he;for(he in W[$])if(Object.prototype.hasOwnProperty.call(W[$],he)&&he!=="data"&&!we(W[$][he],D[$][he]))return!1;for(he in D[$])if(Object.prototype.hasOwnProperty.call(D[$],he)&&he!=="data"&&!we(W[$][he],D[$][he]))return!1;return!0}function et(W,D,$,he,Ee,je){W=W||{},D=D||{};for(let We in W)Object.prototype.hasOwnProperty.call(W,We)&&(we(W[We],D[We])||$.push({command:je,args:[he,We,D[We],Ee]}));for(let We in D)Object.prototype.hasOwnProperty.call(D,We)&&!Object.prototype.hasOwnProperty.call(W,We)&&(we(W[We],D[We])||$.push({command:je,args:[he,We,D[We],Ee]}))}function nt(W){return W.id}function Ae(W,D){return W[D.id]=D,W}class me{constructor(D,$,he,Ee){this.message=(D?`${D}: `:"")+he,Ee&&(this.identifier=Ee),$!=null&&$.__line__&&(this.line=$.__line__)}}function fe(W,...D){for(let $ of D)for(let he in $)W[he]=$[he];return W}class Be extends Error{constructor(D,$){super($),this.message=$,this.key=D}}class Qe{constructor(D,$=[]){this.parent=D,this.bindings={};for(let[he,Ee]of $)this.bindings[he]=Ee}concat(D){return new Qe(this,D)}get(D){if(this.bindings[D])return this.bindings[D];if(this.parent)return this.parent.get(D);throw new Error(`${D} not found in scope.`)}has(D){return!!this.bindings[D]||!!this.parent&&this.parent.has(D)}}let at={kind:"null"},$e={kind:"number"},It={kind:"string"},Pt={kind:"boolean"},Vt={kind:"color"},Wt={kind:"object"},Cr={kind:"value"},yr={kind:"collator"},qr={kind:"formatted"},Mr={kind:"padding"},Dr={kind:"resolvedImage"},xt={kind:"variableAnchorOffsetCollection"};function Ne(W,D){return{kind:"array",itemType:W,N:D}}function Ye(W){if(W.kind==="array"){let D=Ye(W.itemType);return typeof W.N=="number"?`array<${D}, ${W.N}>`:W.itemType.kind==="value"?"array":`array<${D}>`}return W.kind}let be=[at,$e,It,Pt,Vt,qr,Wt,Ne(Cr),Mr,Dr,xt];function Ie(W,D){if(D.kind==="error")return null;if(W.kind==="array"){if(D.kind==="array"&&(D.N===0&&D.itemType.kind==="value"||!Ie(W.itemType,D.itemType))&&(typeof W.N!="number"||W.N===D.N))return null}else{if(W.kind===D.kind)return null;if(W.kind==="value"){for(let $ of be)if(!Ie($,D))return null}}return`Expected ${Ye(W)} but found ${Ye(D)} instead.`}function qe(W,D){return D.some($=>$.kind===W.kind)}function ke(W,D){return D.some($=>$==="null"?W===null:$==="array"?Array.isArray(W):$==="object"?W&&!Array.isArray(W)&&typeof W=="object":$===typeof W)}function Me(W,D){return W.kind==="array"&&D.kind==="array"?W.itemType.kind===D.itemType.kind&&typeof W.N=="number":W.kind===D.kind}let Le=.96422,ut=.82521,lt=4/29,gt=6/29,kt=3*gt*gt,nr=gt*gt*gt,ir=Math.PI/180,tr=180/Math.PI;function Ir(W){return(W%=360)<0&&(W+=360),W}function vi([W,D,$,he]){let Ee,je,We=Ui((.2225045*(W=Vi(W))+.7168786*(D=Vi(D))+.0606169*($=Vi($)))/1);W===D&&D===$?Ee=je=We:(Ee=Ui((.4360747*W+.3850649*D+.1430804*$)/Le),je=Ui((.0139322*W+.0971045*D+.7141733*$)/ut));let ct=116*We-16;return[ct<0?0:ct,500*(Ee-We),200*(We-je),he]}function Vi(W){return W<=.04045?W/12.92:Math.pow((W+.055)/1.055,2.4)}function Ui(W){return W>nr?Math.pow(W,1/3):W/kt+lt}function Ki([W,D,$,he]){let Ee=(W+16)/116,je=isNaN(D)?Ee:Ee+D/500,We=isNaN($)?Ee:Ee-$/200;return Ee=1*Bi(Ee),je=Le*Bi(je),We=ut*Bi(We),[ea(3.1338561*je-1.6168667*Ee-.4906146*We),ea(-.9787684*je+1.9161415*Ee+.033454*We),ea(.0719453*je-.2289914*Ee+1.4052427*We),he]}function ea(W){return(W=W<=.00304?12.92*W:1.055*Math.pow(W,1/2.4)-.055)<0?0:W>1?1:W}function Bi(W){return W>gt?W*W*W:kt*(W-lt)}function _a(W){return parseInt(W.padEnd(2,W),16)/255}function Ca(W,D){return Kt(D?W/100:W,0,1)}function Kt(W,D,$){return Math.min(Math.max(D,W),$)}function zt(W){return!W.some(Number.isNaN)}let Zt={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 Jt{constructor(D,$,he,Ee=1,je=!0){this.r=D,this.g=$,this.b=he,this.a=Ee,je||(this.r*=Ee,this.g*=Ee,this.b*=Ee,Ee||this.overwriteGetter("rgb",[D,$,he,Ee]))}static parse(D){if(D instanceof Jt)return D;if(typeof D!="string")return;let $=function(he){if((he=he.toLowerCase().trim())==="transparent")return[0,0,0,0];let Ee=Zt[he];if(Ee){let[We,ct,St]=Ee;return[We/255,ct/255,St/255,1]}if(he.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(he)){let We=he.length<6?1:2,ct=1;return[_a(he.slice(ct,ct+=We)),_a(he.slice(ct,ct+=We)),_a(he.slice(ct,ct+=We)),_a(he.slice(ct,ct+We)||"ff")]}if(he.startsWith("rgb")){let We=he.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(We){let[ct,St,Nt,sr,Er,Fr,Xr,ni,gi,Zi,aa,nn]=We,Aa=[sr||" ",Xr||" ",Zi].join("");if(Aa===" "||Aa===" /"||Aa===",,"||Aa===",,,"){let Ja=[Nt,Fr,gi].join(""),dn=Ja==="%%%"?100:Ja===""?255:0;if(dn){let no=[Kt(+St/dn,0,1),Kt(+Er/dn,0,1),Kt(+ni/dn,0,1),aa?Ca(+aa,nn):1];if(zt(no))return no}}return}}let je=he.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(je){let[We,ct,St,Nt,sr,Er,Fr,Xr,ni]=je,gi=[St||" ",sr||" ",Fr].join("");if(gi===" "||gi===" /"||gi===",,"||gi===",,,"){let Zi=[+ct,Kt(+Nt,0,100),Kt(+Er,0,100),Xr?Ca(+Xr,ni):1];if(zt(Zi))return function([aa,nn,Aa,Ja]){function dn(no){let Zo=(no+aa/30)%12,Ds=nn*Math.min(Aa,1-Aa);return Aa-Ds*Math.max(-1,Math.min(Zo-3,9-Zo,1))}return aa=Ir(aa),nn/=100,Aa/=100,[dn(0),dn(8),dn(4),Ja]}(Zi)}}}(D);return $?new Jt(...$,!1):void 0}get rgb(){let{r:D,g:$,b:he,a:Ee}=this,je=Ee||1/0;return this.overwriteGetter("rgb",[D/je,$/je,he/je,Ee])}get hcl(){return this.overwriteGetter("hcl",function(D){let[$,he,Ee,je]=vi(D),We=Math.sqrt(he*he+Ee*Ee);return[Math.round(1e4*We)?Ir(Math.atan2(Ee,he)*tr):NaN,We,$,je]}(this.rgb))}get lab(){return this.overwriteGetter("lab",vi(this.rgb))}overwriteGetter(D,$){return Object.defineProperty(this,D,{value:$}),$}toString(){let[D,$,he,Ee]=this.rgb;return`rgba(${[D,$,he].map(je=>Math.round(255*je)).join(",")},${Ee})`}}Jt.black=new Jt(0,0,0,1),Jt.white=new Jt(1,1,1,1),Jt.transparent=new Jt(0,0,0,0),Jt.red=new Jt(1,0,0,1);class Br{constructor(D,$,he){this.sensitivity=D?$?"variant":"case":$?"accent":"base",this.locale=he,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(D,$){return this.collator.compare(D,$)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ri{constructor(D,$,he,Ee,je){this.text=D,this.image=$,this.scale=he,this.fontStack=Ee,this.textColor=je}}class ii{constructor(D){this.sections=D}static fromString(D){return new ii([new ri(D,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(D=>D.text.length!==0||D.image&&D.image.name.length!==0)}static factory(D){return D instanceof ii?D:ii.fromString(D)}toString(){return this.sections.length===0?"":this.sections.map(D=>D.text).join("")}}class di{constructor(D){this.values=D.slice()}static parse(D){if(D instanceof di)return D;if(typeof D=="number")return new di([D,D,D,D]);if(Array.isArray(D)&&!(D.length<1||D.length>4)){for(let $ of D)if(typeof $!="number")return;switch(D.length){case 1:D=[D[0],D[0],D[0],D[0]];break;case 2:D=[D[0],D[1],D[0],D[1]];break;case 3:D=[D[0],D[1],D[2],D[1]]}return new di(D)}}toString(){return JSON.stringify(this.values)}}let Wi=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class oa{constructor(D){this.values=D.slice()}static parse(D){if(D instanceof oa)return D;if(Array.isArray(D)&&!(D.length<1)&&D.length%2==0){for(let $=0;$<D.length;$+=2){let he=D[$],Ee=D[$+1];if(typeof he!="string"||!Wi.has(he)||!Array.isArray(Ee)||Ee.length!==2||typeof Ee[0]!="number"||typeof Ee[1]!="number")return}return new oa(D)}}toString(){return JSON.stringify(this.values)}}class ra{constructor(D){this.name=D.name,this.available=D.available}toString(){return this.name}static fromString(D){return D?new ra({name:D,available:!1}):null}}function ca(W,D,$,he){return typeof W=="number"&&W>=0&&W<=255&&typeof D=="number"&&D>=0&&D<=255&&typeof $=="number"&&$>=0&&$<=255?he===void 0||typeof he=="number"&&he>=0&&he<=1?null:`Invalid rgba value [${[W,D,$,he].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof he=="number"?[W,D,$,he]:[W,D,$]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function xa(W){if(W===null||typeof W=="string"||typeof W=="boolean"||typeof W=="number"||W instanceof Jt||W instanceof Br||W instanceof ii||W instanceof di||W instanceof oa||W instanceof ra)return!0;if(Array.isArray(W)){for(let D of W)if(!xa(D))return!1;return!0}if(typeof W=="object"){for(let D in W)if(!xa(W[D]))return!1;return!0}return!1}function ji(W){if(W===null)return at;if(typeof W=="string")return It;if(typeof W=="boolean")return Pt;if(typeof W=="number")return $e;if(W instanceof Jt)return Vt;if(W instanceof Br)return yr;if(W instanceof ii)return qr;if(W instanceof di)return Mr;if(W instanceof oa)return xt;if(W instanceof ra)return Dr;if(Array.isArray(W)){let D=W.length,$;for(let he of W){let Ee=ji(he);if($){if($===Ee)continue;$=Cr;break}$=Ee}return Ne($||Cr,D)}return Wt}function pn(W){let D=typeof W;return W===null?"":D==="string"||D==="number"||D==="boolean"?String(W):W instanceof Jt||W instanceof ii||W instanceof di||W instanceof oa||W instanceof ra?W.toString():JSON.stringify(W)}class _n{constructor(D,$){this.type=D,this.value=$}static parse(D,$){if(D.length!==2)return $.error(`'literal' expression requires exactly one argument, but found ${D.length-1} instead.`);if(!xa(D[1]))return $.error("invalid value");let he=D[1],Ee=ji(he),je=$.expectedType;return Ee.kind!=="array"||Ee.N!==0||!je||je.kind!=="array"||typeof je.N=="number"&&je.N!==0||(Ee=je),new _n(Ee,he)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class En{constructor(D){this.name="ExpressionEvaluationError",this.message=D}toJSON(){return this.message}}let bt={string:It,number:$e,boolean:Pt,object:Wt};class st{constructor(D,$){this.type=D,this.args=$}static parse(D,$){if(D.length<2)return $.error("Expected at least one argument.");let he,Ee=1,je=D[0];if(je==="array"){let ct,St;if(D.length>2){let Nt=D[1];if(typeof Nt!="string"||!(Nt in bt)||Nt==="object")return $.error('The item type argument of "array" must be one of string, number, boolean',1);ct=bt[Nt],Ee++}else ct=Cr;if(D.length>3){if(D[2]!==null&&(typeof D[2]!="number"||D[2]<0||D[2]!==Math.floor(D[2])))return $.error('The length argument to "array" must be a positive integer literal',2);St=D[2],Ee++}he=Ne(ct,St)}else{if(!bt[je])throw new Error(`Types doesn't contain name = ${je}`);he=bt[je]}let We=[];for(;Ee<D.length;Ee++){let ct=$.parse(D[Ee],Ee,Cr);if(!ct)return null;We.push(ct)}return new st(he,We)}evaluate(D){for(let $=0;$<this.args.length;$++){let he=this.args[$].evaluate(D);if(!Ie(this.type,ji(he)))return he;if($===this.args.length-1)throw new En(`Expected value to be of type ${Ye(this.type)}, but found ${Ye(ji(he))} instead.`)}throw new Error}eachChild(D){this.args.forEach(D)}outputDefined(){return this.args.every(D=>D.outputDefined())}}let Nr={"to-boolean":Pt,"to-color":Vt,"to-number":$e,"to-string":It};class Lr{constructor(D,$){this.type=D,this.args=$}static parse(D,$){if(D.length<2)return $.error("Expected at least one argument.");let he=D[0];if(!Nr[he])throw new Error(`Can't parse ${he} as it is not part of the known types`);if((he==="to-boolean"||he==="to-string")&&D.length!==2)return $.error("Expected one argument.");let Ee=Nr[he],je=[];for(let We=1;We<D.length;We++){let ct=$.parse(D[We],We,Cr);if(!ct)return null;je.push(ct)}return new Lr(Ee,je)}evaluate(D){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(D);case"color":{let $,he;for(let Ee of this.args){if($=Ee.evaluate(D),he=null,$ instanceof Jt)return $;if(typeof $=="string"){let je=D.parseColor($);if(je)return je}else if(Array.isArray($)&&(he=$.length<3||$.length>4?`Invalid rbga value ${JSON.stringify($)}: expected an array containing either three or four numeric values.`:ca($[0],$[1],$[2],$[3]),!he))return new Jt($[0]/255,$[1]/255,$[2]/255,$[3])}throw new En(he||`Could not parse color from value '${typeof $=="string"?$:JSON.stringify($)}'`)}case"padding":{let $;for(let he of this.args){$=he.evaluate(D);let Ee=di.parse($);if(Ee)return Ee}throw new En(`Could not parse padding from value '${typeof $=="string"?$:JSON.stringify($)}'`)}case"variableAnchorOffsetCollection":{let $;for(let he of this.args){$=he.evaluate(D);let Ee=oa.parse($);if(Ee)return Ee}throw new En(`Could not parse variableAnchorOffsetCollection from value '${typeof $=="string"?$:JSON.stringify($)}'`)}case"number":{let $=null;for(let he of this.args){if($=he.evaluate(D),$===null)return 0;let Ee=Number($);if(!isNaN(Ee))return Ee}throw new En(`Could not convert ${JSON.stringify($)} to number.`)}case"formatted":return ii.fromString(pn(this.args[0].evaluate(D)));case"resolvedImage":return ra.fromString(pn(this.args[0].evaluate(D)));default:return pn(this.args[0].evaluate(D))}}eachChild(D){this.args.forEach(D)}outputDefined(){return this.args.every(D=>D.outputDefined())}}let br=["Unknown","Point","LineString","Polygon"];class Rr{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"?br[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(D){let $=this._parseColorCache[D];return $||($=this._parseColorCache[D]=Jt.parse(D)),$}}class jr{constructor(D,$,he=[],Ee,je=new Qe,We=[]){this.registry=D,this.path=he,this.key=he.map(ct=>`[${ct}]`).join(""),this.scope=je,this.errors=We,this.expectedType=Ee,this._isConstant=$}parse(D,$,he,Ee,je={}){return $?this.concat($,he,Ee)._parse(D,je):this._parse(D,je)}_parse(D,$){function he(Ee,je,We){return We==="assert"?new st(je,[Ee]):We==="coerce"?new Lr(je,[Ee]):Ee}if(D!==null&&typeof D!="string"&&typeof D!="boolean"&&typeof D!="number"||(D=["literal",D]),Array.isArray(D)){if(D.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let Ee=D[0];if(typeof Ee!="string")return this.error(`Expression name must be a string, but found ${typeof Ee} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let je=this.registry[Ee];if(je){let We=je.parse(D,this);if(!We)return null;if(this.expectedType){let ct=this.expectedType,St=We.type;if(ct.kind!=="string"&&ct.kind!=="number"&&ct.kind!=="boolean"&&ct.kind!=="object"&&ct.kind!=="array"||St.kind!=="value")if(ct.kind!=="color"&&ct.kind!=="formatted"&&ct.kind!=="resolvedImage"||St.kind!=="value"&&St.kind!=="string")if(ct.kind!=="padding"||St.kind!=="value"&&St.kind!=="number"&&St.kind!=="array")if(ct.kind!=="variableAnchorOffsetCollection"||St.kind!=="value"&&St.kind!=="array"){if(this.checkSubtype(ct,St))return null}else We=he(We,ct,$.typeAnnotation||"coerce");else We=he(We,ct,$.typeAnnotation||"coerce");else We=he(We,ct,$.typeAnnotation||"coerce");else We=he(We,ct,$.typeAnnotation||"assert")}if(!(We instanceof _n)&&We.type.kind!=="resolvedImage"&&this._isConstant(We)){let ct=new Rr;try{We=new _n(We.type,We.evaluate(ct))}catch(St){return this.error(St.message),null}}return We}return this.error(`Unknown expression "${Ee}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(D===void 0?"'undefined' value invalid. Use null instead.":typeof D=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof D} instead.`)}concat(D,$,he){let Ee=typeof D=="number"?this.path.concat(D):this.path,je=he?this.scope.concat(he):this.scope;return new jr(this.registry,this._isConstant,Ee,$||null,je,this.errors)}error(D,...$){let he=`${this.key}${$.map(Ee=>`[${Ee}]`).join("")}`;this.errors.push(new Be(he,D))}checkSubtype(D,$){let he=Ie(D,$);return he&&this.error(he),he}}class Wr{constructor(D,$){this.type=$.type,this.bindings=[].concat(D),this.result=$}evaluate(D){return this.result.evaluate(D)}eachChild(D){for(let $ of this.bindings)D($[1]);D(this.result)}static parse(D,$){if(D.length<4)return $.error(`Expected at least 3 arguments, but found ${D.length-1} instead.`);let he=[];for(let je=1;je<D.length-1;je+=2){let We=D[je];if(typeof We!="string")return $.error(`Expected string, but found ${typeof We} instead.`,je);if(/[^a-zA-Z0-9_]/.test(We))return $.error("Variable names must contain only alphanumeric characters or '_'.",je);let ct=$.parse(D[je+1],je+1);if(!ct)return null;he.push([We,ct])}let Ee=$.parse(D[D.length-1],D.length-1,$.expectedType,he);return Ee?new Wr(he,Ee):null}outputDefined(){return this.result.outputDefined()}}class yt{constructor(D,$){this.type=$.type,this.name=D,this.boundExpression=$}static parse(D,$){if(D.length!==2||typeof D[1]!="string")return $.error("'var' expression requires exactly one string literal argument.");let he=D[1];return $.scope.has(he)?new yt(he,$.scope.get(he)):$.error(`Unknown variable "${he}". Make sure "${he}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(D){return this.boundExpression.evaluate(D)}eachChild(){}outputDefined(){return!1}}class Xt{constructor(D,$,he){this.type=D,this.index=$,this.input=he}static parse(D,$){if(D.length!==3)return $.error(`Expected 2 arguments, but found ${D.length-1} instead.`);let he=$.parse(D[1],1,$e),Ee=$.parse(D[2],2,Ne($.expectedType||Cr));return he&&Ee?new Xt(Ee.type.itemType,he,Ee):null}evaluate(D){let $=this.index.evaluate(D),he=this.input.evaluate(D);if($<0)throw new En(`Array index out of bounds: ${$} < 0.`);if($>=he.length)throw new En(`Array index out of bounds: ${$} > ${he.length-1}.`);if($!==Math.floor($))throw new En(`Array index must be an integer, but found ${$} instead.`);return he[$]}eachChild(D){D(this.index),D(this.input)}outputDefined(){return!1}}class mr{constructor(D,$){this.type=Pt,this.needle=D,this.haystack=$}static parse(D,$){if(D.length!==3)return $.error(`Expected 2 arguments, but found ${D.length-1} instead.`);let he=$.parse(D[1],1,Cr),Ee=$.parse(D[2],2,Cr);return he&&Ee?qe(he.type,[Pt,It,$e,at,Cr])?new mr(he,Ee):$.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(he.type)} instead`):null}evaluate(D){let $=this.needle.evaluate(D),he=this.haystack.evaluate(D);if(!he)return!1;if(!ke($,["boolean","string","number","null"]))throw new En(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(ji($))} instead.`);if(!ke(he,["string","array"]))throw new En(`Expected second argument to be of type array or string, but found ${Ye(ji(he))} instead.`);return he.indexOf($)>=0}eachChild(D){D(this.needle),D(this.haystack)}outputDefined(){return!0}}class Or{constructor(D,$,he){this.type=$e,this.needle=D,this.haystack=$,this.fromIndex=he}static parse(D,$){if(D.length<=2||D.length>=5)return $.error(`Expected 3 or 4 arguments, but found ${D.length-1} instead.`);let he=$.parse(D[1],1,Cr),Ee=$.parse(D[2],2,Cr);if(!he||!Ee)return null;if(!qe(he.type,[Pt,It,$e,at,Cr]))return $.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(he.type)} instead`);if(D.length===4){let je=$.parse(D[3],3,$e);return je?new Or(he,Ee,je):null}return new Or(he,Ee)}evaluate(D){let $=this.needle.evaluate(D),he=this.haystack.evaluate(D);if(!ke($,["boolean","string","number","null"]))throw new En(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(ji($))} instead.`);let Ee;if(this.fromIndex&&(Ee=this.fromIndex.evaluate(D)),ke(he,["string"])){let je=he.indexOf($,Ee);return je===-1?-1:[...he.slice(0,je)].length}if(ke(he,["array"]))return he.indexOf($,Ee);throw new En(`Expected second argument to be of type array or string, but found ${Ye(ji(he))} instead.`)}eachChild(D){D(this.needle),D(this.haystack),this.fromIndex&&D(this.fromIndex)}outputDefined(){return!1}}class ki{constructor(D,$,he,Ee,je,We){this.inputType=D,this.type=$,this.input=he,this.cases=Ee,this.outputs=je,this.otherwise=We}static parse(D,$){if(D.length<5)return $.error(`Expected at least 4 arguments, but found only ${D.length-1}.`);if(D.length%2!=1)return $.error("Expected an even number of arguments.");let he,Ee;$.expectedType&&$.expectedType.kind!=="value"&&(Ee=$.expectedType);let je={},We=[];for(let Nt=2;Nt<D.length-1;Nt+=2){let sr=D[Nt],Er=D[Nt+1];Array.isArray(sr)||(sr=[sr]);let Fr=$.concat(Nt);if(sr.length===0)return Fr.error("Expected at least one branch label.");for(let ni of sr){if(typeof ni!="number"&&typeof ni!="string")return Fr.error("Branch labels must be numbers or strings.");if(typeof ni=="number"&&Math.abs(ni)>Number.MAX_SAFE_INTEGER)return Fr.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ni=="number"&&Math.floor(ni)!==ni)return Fr.error("Numeric branch labels must be integer values.");if(he){if(Fr.checkSubtype(he,ji(ni)))return null}else he=ji(ni);if(je[String(ni)]!==void 0)return Fr.error("Branch labels must be unique.");je[String(ni)]=We.length}let Xr=$.parse(Er,Nt,Ee);if(!Xr)return null;Ee=Ee||Xr.type,We.push(Xr)}let ct=$.parse(D[1],1,Cr);if(!ct)return null;let St=$.parse(D[D.length-1],D.length-1,Ee);return St?ct.type.kind!=="value"&&$.concat(1).checkSubtype(he,ct.type)?null:new ki(he,Ee,ct,je,We,St):null}evaluate(D){let $=this.input.evaluate(D);return(ji($)===this.inputType&&this.outputs[this.cases[$]]||this.otherwise).evaluate(D)}eachChild(D){D(this.input),this.outputs.forEach(D),D(this.otherwise)}outputDefined(){return this.outputs.every(D=>D.outputDefined())&&this.otherwise.outputDefined()}}class Ni{constructor(D,$,he){this.type=D,this.branches=$,this.otherwise=he}static parse(D,$){if(D.length<4)return $.error(`Expected at least 3 arguments, but found only ${D.length-1}.`);if(D.length%2!=0)return $.error("Expected an odd number of arguments.");let he;$.expectedType&&$.expectedType.kind!=="value"&&(he=$.expectedType);let Ee=[];for(let We=1;We<D.length-1;We+=2){let ct=$.parse(D[We],We,Pt);if(!ct)return null;let St=$.parse(D[We+1],We+1,he);if(!St)return null;Ee.push([ct,St]),he=he||St.type}let je=$.parse(D[D.length-1],D.length-1,he);if(!je)return null;if(!he)throw new Error("Can't infer output type");return new Ni(he,Ee,je)}evaluate(D){for(let[$,he]of this.branches)if($.evaluate(D))return he.evaluate(D);return this.otherwise.evaluate(D)}eachChild(D){for(let[$,he]of this.branches)D($),D(he);D(this.otherwise)}outputDefined(){return this.branches.every(([D,$])=>$.outputDefined())&&this.otherwise.outputDefined()}}class Si{constructor(D,$,he,Ee){this.type=D,this.input=$,this.beginIndex=he,this.endIndex=Ee}static parse(D,$){if(D.length<=2||D.length>=5)return $.error(`Expected 3 or 4 arguments, but found ${D.length-1} instead.`);let he=$.parse(D[1],1,Cr),Ee=$.parse(D[2],2,$e);if(!he||!Ee)return null;if(!qe(he.type,[Ne(Cr),It,Cr]))return $.error(`Expected first argument to be of type array or string, but found ${Ye(he.type)} instead`);if(D.length===4){let je=$.parse(D[3],3,$e);return je?new Si(he.type,he,Ee,je):null}return new Si(he.type,he,Ee)}evaluate(D){let $=this.input.evaluate(D),he=this.beginIndex.evaluate(D),Ee;if(this.endIndex&&(Ee=this.endIndex.evaluate(D)),ke($,["string"]))return[...$].slice(he,Ee).join("");if(ke($,["array"]))return $.slice(he,Ee);throw new En(`Expected first argument to be of type array or string, but found ${Ye(ji($))} instead.`)}eachChild(D){D(this.input),D(this.beginIndex),this.endIndex&&D(this.endIndex)}outputDefined(){return!1}}function fi(W,D){let $=W.length-1,he,Ee,je=0,We=$,ct=0;for(;je<=We;)if(ct=Math.floor((je+We)/2),he=W[ct],Ee=W[ct+1],he<=D){if(ct===$||D<Ee)return ct;je=ct+1}else{if(!(he>D))throw new En("Input is not a number.");We=ct-1}return 0}class Li{constructor(D,$,he){this.type=D,this.input=$,this.labels=[],this.outputs=[];for(let[Ee,je]of he)this.labels.push(Ee),this.outputs.push(je)}static parse(D,$){if(D.length-1<4)return $.error(`Expected at least 4 arguments, but found only ${D.length-1}.`);if((D.length-1)%2!=0)return $.error("Expected an even number of arguments.");let he=$.parse(D[1],1,$e);if(!he)return null;let Ee=[],je=null;$.expectedType&&$.expectedType.kind!=="value"&&(je=$.expectedType);for(let We=1;We<D.length;We+=2){let ct=We===1?-1/0:D[We],St=D[We+1],Nt=We,sr=We+1;if(typeof ct!="number")return $.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',Nt);if(Ee.length&&Ee[Ee.length-1][0]>=ct)return $.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',Nt);let Er=$.parse(St,sr,je);if(!Er)return null;je=je||Er.type,Ee.push([ct,Er])}return new Li(je,he,Ee)}evaluate(D){let $=this.labels,he=this.outputs;if($.length===1)return he[0].evaluate(D);let Ee=this.input.evaluate(D);if(Ee<=$[0])return he[0].evaluate(D);let je=$.length;return Ee>=$[je-1]?he[je-1].evaluate(D):he[fi($,Ee)].evaluate(D)}eachChild(D){D(this.input);for(let $ of this.outputs)D($)}outputDefined(){return this.outputs.every(D=>D.outputDefined())}}function Ia(W){return W&&W.__esModule&&Object.prototype.hasOwnProperty.call(W,"default")?W.default:W}var Fa=un;function un(W,D,$,he){this.cx=3*W,this.bx=3*($-W)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*D,this.by=3*(he-D)-this.cy,this.ay=1-this.cy-this.by,this.p1x=W,this.p1y=D,this.p2x=$,this.p2y=he}un.prototype={sampleCurveX:function(W){return((this.ax*W+this.bx)*W+this.cx)*W},sampleCurveY:function(W){return((this.ay*W+this.by)*W+this.cy)*W},sampleCurveDerivativeX:function(W){return(3*this.ax*W+2*this.bx)*W+this.cx},solveCurveX:function(W,D){if(D===void 0&&(D=1e-6),W<0)return 0;if(W>1)return 1;for(var $=W,he=0;he<8;he++){var Ee=this.sampleCurveX($)-W;if(Math.abs(Ee)<D)return $;var je=this.sampleCurveDerivativeX($);if(Math.abs(je)<1e-6)break;$-=Ee/je}var We=0,ct=1;for($=W,he=0;he<20&&(Ee=this.sampleCurveX($),!(Math.abs(Ee-W)<D));he++)W>Ee?We=$:ct=$,$=.5*(ct-We)+We;return $},solve:function(W,D){return this.sampleCurveY(this.solveCurveX(W,D))}};var Bn=Ia(Fa);function Kn(W,D,$){return W+$*(D-W)}function Gn(W,D,$){return W.map((he,Ee)=>Kn(he,D[Ee],$))}let eo={number:Kn,color:function(W,D,$,he="rgb"){switch(he){case"rgb":{let[Ee,je,We,ct]=Gn(W.rgb,D.rgb,$);return new Jt(Ee,je,We,ct,!1)}case"hcl":{let[Ee,je,We,ct]=W.hcl,[St,Nt,sr,Er]=D.hcl,Fr,Xr;if(isNaN(Ee)||isNaN(St))isNaN(Ee)?isNaN(St)?Fr=NaN:(Fr=St,We!==1&&We!==0||(Xr=Nt)):(Fr=Ee,sr!==1&&sr!==0||(Xr=je));else{let nn=St-Ee;St>Ee&&nn>180?nn-=360:St<Ee&&Ee-St>180&&(nn+=360),Fr=Ee+$*nn}let[ni,gi,Zi,aa]=function([nn,Aa,Ja,dn]){return nn=isNaN(nn)?0:nn*ir,Ki([Ja,Math.cos(nn)*Aa,Math.sin(nn)*Aa,dn])}([Fr,Xr??Kn(je,Nt,$),Kn(We,sr,$),Kn(ct,Er,$)]);return new Jt(ni,gi,Zi,aa,!1)}case"lab":{let[Ee,je,We,ct]=Ki(Gn(W.lab,D.lab,$));return new Jt(Ee,je,We,ct,!1)}}},array:Gn,padding:function(W,D,$){return new di(Gn(W.values,D.values,$))},variableAnchorOffsetCollection:function(W,D,$){let he=W.values,Ee=D.values;if(he.length!==Ee.length)throw new En(`Cannot interpolate values of different length. from: ${W.toString()}, to: ${D.toString()}`);let je=[];for(let We=0;We<he.length;We+=2){if(he[We]!==Ee[We])throw new En(`Cannot interpolate values containing mismatched anchors. from[${We}]: ${he[We]}, to[${We}]: ${Ee[We]}`);je.push(he[We]);let[ct,St]=he[We+1],[Nt,sr]=Ee[We+1];je.push([Kn(ct,Nt,$),Kn(St,sr,$)])}return new oa(je)}};class Ao{constructor(D,$,he,Ee,je){this.type=D,this.operator=$,this.interpolation=he,this.input=Ee,this.labels=[],this.outputs=[];for(let[We,ct]of je)this.labels.push(We),this.outputs.push(ct)}static interpolationFactor(D,$,he,Ee){let je=0;if(D.name==="exponential")je=An($,D.base,he,Ee);else if(D.name==="linear")je=An($,1,he,Ee);else if(D.name==="cubic-bezier"){let We=D.controlPoints;je=new Bn(We[0],We[1],We[2],We[3]).solve(An($,1,he,Ee))}return je}static parse(D,$){let[he,Ee,je,...We]=D;if(!Array.isArray(Ee)||Ee.length===0)return $.error("Expected an interpolation type expression.",1);if(Ee[0]==="linear")Ee={name:"linear"};else if(Ee[0]==="exponential"){let Nt=Ee[1];if(typeof Nt!="number")return $.error("Exponential interpolation requires a numeric base.",1,1);Ee={name:"exponential",base:Nt}}else{if(Ee[0]!=="cubic-bezier")return $.error(`Unknown interpolation type ${String(Ee[0])}`,1,0);{let Nt=Ee.slice(1);if(Nt.length!==4||Nt.some(sr=>typeof sr!="number"||sr<0||sr>1))return $.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);Ee={name:"cubic-bezier",controlPoints:Nt}}}if(D.length-1<4)return $.error(`Expected at least 4 arguments, but found only ${D.length-1}.`);if((D.length-1)%2!=0)return $.error("Expected an even number of arguments.");if(je=$.parse(je,2,$e),!je)return null;let ct=[],St=null;he==="interpolate-hcl"||he==="interpolate-lab"?St=Vt:$.expectedType&&$.expectedType.kind!=="value"&&(St=$.expectedType);for(let Nt=0;Nt<We.length;Nt+=2){let sr=We[Nt],Er=We[Nt+1],Fr=Nt+3,Xr=Nt+4;if(typeof sr!="number")return $.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',Fr);if(ct.length&&ct[ct.length-1][0]>=sr)return $.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',Fr);let ni=$.parse(Er,Xr,St);if(!ni)return null;St=St||ni.type,ct.push([sr,ni])}return Me(St,$e)||Me(St,Vt)||Me(St,Mr)||Me(St,xt)||Me(St,Ne($e))?new Ao(St,he,Ee,je,ct):$.error(`Type ${Ye(St)} is not interpolatable.`)}evaluate(D){let $=this.labels,he=this.outputs;if($.length===1)return he[0].evaluate(D);let Ee=this.input.evaluate(D);if(Ee<=$[0])return he[0].evaluate(D);let je=$.length;if(Ee>=$[je-1])return he[je-1].evaluate(D);let We=fi($,Ee),ct=Ao.interpolationFactor(this.interpolation,Ee,$[We],$[We+1]),St=he[We].evaluate(D),Nt=he[We+1].evaluate(D);switch(this.operator){case"interpolate":return eo[this.type.kind](St,Nt,ct);case"interpolate-hcl":return eo.color(St,Nt,ct,"hcl");case"interpolate-lab":return eo.color(St,Nt,ct,"lab")}}eachChild(D){D(this.input);for(let $ of this.outputs)D($)}outputDefined(){return this.outputs.every(D=>D.outputDefined())}}function An(W,D,$,he){let Ee=he-$,je=W-$;return Ee===0?0:D===1?je/Ee:(Math.pow(D,je)-1)/(Math.pow(D,Ee)-1)}class Eo{constructor(D,$){this.type=D,this.args=$}static parse(D,$){if(D.length<2)return $.error("Expectected at least one argument.");let he=null,Ee=$.expectedType;Ee&&Ee.kind!=="value"&&(he=Ee);let je=[];for(let ct of D.slice(1)){let St=$.parse(ct,1+je.length,he,void 0,{typeAnnotation:"omit"});if(!St)return null;he=he||St.type,je.push(St)}if(!he)throw new Error("No output type");let We=Ee&&je.some(ct=>Ie(Ee,ct.type));return new Eo(We?Cr:he,je)}evaluate(D){let $,he=null,Ee=0;for(let je of this.args)if(Ee++,he=je.evaluate(D),he&&he instanceof ra&&!he.available&&($||($=he.name),he=null,Ee===this.args.length&&(he=$)),he!==null)break;return he}eachChild(D){this.args.forEach(D)}outputDefined(){return this.args.every(D=>D.outputDefined())}}function fs(W,D){return W==="=="||W==="!="?D.kind==="boolean"||D.kind==="string"||D.kind==="number"||D.kind==="null"||D.kind==="value":D.kind==="string"||D.kind==="number"||D.kind==="value"}function Ls(W,D,$,he){return he.compare(D,$)===0}function ns(W,D,$){let he=W!=="=="&&W!=="!=";return class FS{constructor(je,We,ct){this.type=Pt,this.lhs=je,this.rhs=We,this.collator=ct,this.hasUntypedArgument=je.type.kind==="value"||We.type.kind==="value"}static parse(je,We){if(je.length!==3&&je.length!==4)return We.error("Expected two or three arguments.");let ct=je[0],St=We.parse(je[1],1,Cr);if(!St)return null;if(!fs(ct,St.type))return We.concat(1).error(`"${ct}" comparisons are not supported for type '${Ye(St.type)}'.`);let Nt=We.parse(je[2],2,Cr);if(!Nt)return null;if(!fs(ct,Nt.type))return We.concat(2).error(`"${ct}" comparisons are not supported for type '${Ye(Nt.type)}'.`);if(St.type.kind!==Nt.type.kind&&St.type.kind!=="value"&&Nt.type.kind!=="value")return We.error(`Cannot compare types '${Ye(St.type)}' and '${Ye(Nt.type)}'.`);he&&(St.type.kind==="value"&&Nt.type.kind!=="value"?St=new st(Nt.type,[St]):St.type.kind!=="value"&&Nt.type.kind==="value"&&(Nt=new st(St.type,[Nt])));let sr=null;if(je.length===4){if(St.type.kind!=="string"&&Nt.type.kind!=="string"&&St.type.kind!=="value"&&Nt.type.kind!=="value")return We.error("Cannot use collator to compare non-string types.");if(sr=We.parse(je[3],3,yr),!sr)return null}return new FS(St,Nt,sr)}evaluate(je){let We=this.lhs.evaluate(je),ct=this.rhs.evaluate(je);if(he&&this.hasUntypedArgument){let St=ji(We),Nt=ji(ct);if(St.kind!==Nt.kind||St.kind!=="string"&&St.kind!=="number")throw new En(`Expected arguments for "${W}" to be (string, string) or (number, number), but found (${St.kind}, ${Nt.kind}) instead.`)}if(this.collator&&!he&&this.hasUntypedArgument){let St=ji(We),Nt=ji(ct);if(St.kind!=="string"||Nt.kind!=="string")return D(je,We,ct)}return this.collator?$(je,We,ct,this.collator.evaluate(je)):D(je,We,ct)}eachChild(je){je(this.lhs),je(this.rhs),this.collator&&je(this.collator)}outputDefined(){return!0}}}let uo=ns("==",function(W,D,$){return D===$},Ls),ss=ns("!=",function(W,D,$){return D!==$},function(W,D,$,he){return!Ls(0,D,$,he)}),xs=ns("<",function(W,D,$){return D<$},function(W,D,$,he){return he.compare(D,$)<0}),el=ns(">",function(W,D,$){return D>$},function(W,D,$,he){return he.compare(D,$)>0}),Ss=ns("<=",function(W,D,$){return D<=$},function(W,D,$,he){return he.compare(D,$)<=0}),Co=ns(">=",function(W,D,$){return D>=$},function(W,D,$,he){return he.compare(D,$)>=0});class ao{constructor(D,$,he){this.type=yr,this.locale=he,this.caseSensitive=D,this.diacriticSensitive=$}static parse(D,$){if(D.length!==2)return $.error("Expected one argument.");let he=D[1];if(typeof he!="object"||Array.isArray(he))return $.error("Collator options argument must be an object.");let Ee=$.parse(he["case-sensitive"]!==void 0&&he["case-sensitive"],1,Pt);if(!Ee)return null;let je=$.parse(he["diacritic-sensitive"]!==void 0&&he["diacritic-sensitive"],1,Pt);if(!je)return null;let We=null;return he.locale&&(We=$.parse(he.locale,1,It),!We)?null:new ao(Ee,je,We)}evaluate(D){return new Br(this.caseSensitive.evaluate(D),this.diacriticSensitive.evaluate(D),this.locale?this.locale.evaluate(D):null)}eachChild(D){D(this.caseSensitive),D(this.diacriticSensitive),this.locale&&D(this.locale)}outputDefined(){return!1}}class co{constructor(D,$,he,Ee,je){this.type=It,this.number=D,this.locale=$,this.currency=he,this.minFractionDigits=Ee,this.maxFractionDigits=je}static parse(D,$){if(D.length!==3)return $.error("Expected two arguments.");let he=$.parse(D[1],1,$e);if(!he)return null;let Ee=D[2];if(typeof Ee!="object"||Array.isArray(Ee))return $.error("NumberFormat options argument must be an object.");let je=null;if(Ee.locale&&(je=$.parse(Ee.locale,1,It),!je))return null;let We=null;if(Ee.currency&&(We=$.parse(Ee.currency,1,It),!We))return null;let ct=null;if(Ee["min-fraction-digits"]&&(ct=$.parse(Ee["min-fraction-digits"],1,$e),!ct))return null;let St=null;return Ee["max-fraction-digits"]&&(St=$.parse(Ee["max-fraction-digits"],1,$e),!St)?null:new co(he,je,We,ct,St)}evaluate(D){return new Intl.NumberFormat(this.locale?this.locale.evaluate(D):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(D):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(D):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(D):void 0}).format(this.number.evaluate(D))}eachChild(D){D(this.number),this.locale&&D(this.locale),this.currency&&D(this.currency),this.minFractionDigits&&D(this.minFractionDigits),this.maxFractionDigits&&D(this.maxFractionDigits)}outputDefined(){return!1}}class Ms{constructor(D){this.type=qr,this.sections=D}static parse(D,$){if(D.length<2)return $.error("Expected at least one argument.");let he=D[1];if(!Array.isArray(he)&&typeof he=="object")return $.error("First argument must be an image or text section.");let Ee=[],je=!1;for(let We=1;We<=D.length-1;++We){let ct=D[We];if(je&&typeof ct=="object"&&!Array.isArray(ct)){je=!1;let St=null;if(ct["font-scale"]&&(St=$.parse(ct["font-scale"],1,$e),!St))return null;let Nt=null;if(ct["text-font"]&&(Nt=$.parse(ct["text-font"],1,Ne(It)),!Nt))return null;let sr=null;if(ct["text-color"]&&(sr=$.parse(ct["text-color"],1,Vt),!sr))return null;let Er=Ee[Ee.length-1];Er.scale=St,Er.font=Nt,Er.textColor=sr}else{let St=$.parse(D[We],1,Cr);if(!St)return null;let Nt=St.type.kind;if(Nt!=="string"&&Nt!=="value"&&Nt!=="null"&&Nt!=="resolvedImage")return $.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");je=!0,Ee.push({content:St,scale:null,font:null,textColor:null})}}return new Ms(Ee)}evaluate(D){return new ii(this.sections.map($=>{let he=$.content.evaluate(D);return ji(he)===Dr?new ri("",he,null,null,null):new ri(pn(he),null,$.scale?$.scale.evaluate(D):null,$.font?$.font.evaluate(D).join(","):null,$.textColor?$.textColor.evaluate(D):null)}))}eachChild(D){for(let $ of this.sections)D($.content),$.scale&&D($.scale),$.font&&D($.font),$.textColor&&D($.textColor)}outputDefined(){return!1}}class Gs{constructor(D){this.type=Dr,this.input=D}static parse(D,$){if(D.length!==2)return $.error("Expected two arguments.");let he=$.parse(D[1],1,It);return he?new Gs(he):$.error("No image name provided.")}evaluate(D){let $=this.input.evaluate(D),he=ra.fromString($);return he&&D.availableImages&&(he.available=D.availableImages.indexOf($)>-1),he}eachChild(D){D(this.input)}outputDefined(){return!1}}class ul{constructor(D){this.type=$e,this.input=D}static parse(D,$){if(D.length!==2)return $.error(`Expected 1 argument, but found ${D.length-1} instead.`);let he=$.parse(D[1],1);return he?he.type.kind!=="array"&&he.type.kind!=="string"&&he.type.kind!=="value"?$.error(`Expected argument of type string or array, but found ${Ye(he.type)} instead.`):new ul(he):null}evaluate(D){let $=this.input.evaluate(D);if(typeof $=="string")return[...$].length;if(Array.isArray($))return $.length;throw new En(`Expected value to be of type string or array, but found ${Ye(ji($))} instead.`)}eachChild(D){D(this.input)}outputDefined(){return!1}}let hs=8192;function rn(W,D){let $=(180+W[0])/360,he=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+W[1]*Math.PI/360)))/360,Ee=Math.pow(2,D.z);return[Math.round($*Ee*hs),Math.round(he*Ee*hs)]}function Xn(W,D){let $=Math.pow(2,D.z);return[(Ee=(W[0]/hs+D.x)/$,360*Ee-180),(he=(W[1]/hs+D.y)/$,360/Math.PI*Math.atan(Math.exp((180-360*he)*Math.PI/180))-90)];var he,Ee}function tl(W,D){W[0]=Math.min(W[0],D[0]),W[1]=Math.min(W[1],D[1]),W[2]=Math.max(W[2],D[0]),W[3]=Math.max(W[3],D[1])}function zs(W,D){return!(W[0]<=D[0]||W[2]>=D[2]||W[1]<=D[1]||W[3]>=D[3])}function so(W,D,$){let he=W[0]-D[0],Ee=W[1]-D[1],je=W[0]-$[0],We=W[1]-$[1];return he*We-je*Ee==0&&he*je<=0&&Ee*We<=0}function $s(W,D,$,he){return(Ee=[he[0]-$[0],he[1]-$[1]])[0]*(je=[D[0]-W[0],D[1]-W[1]])[1]-Ee[1]*je[0]!=0&&!(!jo(W,D,$,he)||!jo($,he,W,D));var Ee,je}function Ps(W,D,$){for(let he of $)for(let Ee=0;Ee<he.length-1;++Ee)if($s(W,D,he[Ee],he[Ee+1]))return!0;return!1}function nl(W,D,$=!1){let he=!1;for(let ct of D)for(let St=0;St<ct.length-1;St++){if(so(W,ct[St],ct[St+1]))return $;(je=ct[St])[1]>(Ee=W)[1]!=(We=ct[St+1])[1]>Ee[1]&&Ee[0]<(We[0]-je[0])*(Ee[1]-je[1])/(We[1]-je[1])+je[0]&&(he=!he)}var Ee,je,We;return he}function yl(W,D){for(let $ of D)if(nl(W,$))return!0;return!1}function On(W,D){for(let $ of W)if(!nl($,D))return!1;for(let $=0;$<W.length-1;++$)if(Ps(W[$],W[$+1],D))return!1;return!0}function Ko(W,D){for(let $ of D)if(On(W,$))return!0;return!1}function jo(W,D,$,he){let Ee=he[0]-$[0],je=he[1]-$[1],We=(W[0]-$[0])*je-Ee*(W[1]-$[1]),ct=(D[0]-$[0])*je-Ee*(D[1]-$[1]);return We>0&&ct<0||We<0&&ct>0}function Ys(W,D,$){let he=[];for(let Ee=0;Ee<W.length;Ee++){let je=[];for(let We=0;We<W[Ee].length;We++){let ct=rn(W[Ee][We],$);tl(D,ct),je.push(ct)}he.push(je)}return he}function Tu(W,D,$){let he=[];for(let Ee=0;Ee<W.length;Ee++){let je=Ys(W[Ee],D,$);he.push(je)}return he}function Lo(W,D,$,he){if(W[0]<$[0]||W[0]>$[2]){let Ee=.5*he,je=W[0]-$[0]>Ee?-he:$[0]-W[0]>Ee?he:0;je===0&&(je=W[0]-$[2]>Ee?-he:$[2]-W[0]>Ee?he:0),W[0]+=je}tl(D,W)}function al(W,D,$,he){let Ee=Math.pow(2,he.z)*hs,je=[he.x*hs,he.y*hs],We=[];for(let ct of W)for(let St of ct){let Nt=[St.x+je[0],St.y+je[1]];Lo(Nt,D,$,Ee),We.push(Nt)}return We}function kl(W,D,$,he){let Ee=Math.pow(2,he.z)*hs,je=[he.x*hs,he.y*hs],We=[];for(let St of W){let Nt=[];for(let sr of St){let Er=[sr.x+je[0],sr.y+je[1]];tl(D,Er),Nt.push(Er)}We.push(Nt)}if(D[2]-D[0]<=Ee/2){(ct=D)[0]=ct[1]=1/0,ct[2]=ct[3]=-1/0;for(let St of We)for(let Nt of St)Lo(Nt,D,$,Ee)}var ct;return We}class Ns{constructor(D,$){this.type=Pt,this.geojson=D,this.geometries=$}static parse(D,$){if(D.length!==2)return $.error(`'within' expression requires exactly one argument, but found ${D.length-1} instead.`);if(xa(D[1])){let he=D[1];if(he.type==="FeatureCollection"){let Ee=[];for(let je of he.features){let{type:We,coordinates:ct}=je.geometry;We==="Polygon"&&Ee.push(ct),We==="MultiPolygon"&&Ee.push(...ct)}if(Ee.length)return new Ns(he,{type:"MultiPolygon",coordinates:Ee})}else if(he.type==="Feature"){let Ee=he.geometry.type;if(Ee==="Polygon"||Ee==="MultiPolygon")return new Ns(he,he.geometry)}else if(he.type==="Polygon"||he.type==="MultiPolygon")return new Ns(he,he)}return $.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(D){if(D.geometry()!=null&&D.canonicalID()!=null){if(D.geometryType()==="Point")return function($,he){let Ee=[1/0,1/0,-1/0,-1/0],je=[1/0,1/0,-1/0,-1/0],We=$.canonicalID();if(he.type==="Polygon"){let ct=Ys(he.coordinates,je,We),St=al($.geometry(),Ee,je,We);if(!zs(Ee,je))return!1;for(let Nt of St)if(!nl(Nt,ct))return!1}if(he.type==="MultiPolygon"){let ct=Tu(he.coordinates,je,We),St=al($.geometry(),Ee,je,We);if(!zs(Ee,je))return!1;for(let Nt of St)if(!yl(Nt,ct))return!1}return!0}(D,this.geometries);if(D.geometryType()==="LineString")return function($,he){let Ee=[1/0,1/0,-1/0,-1/0],je=[1/0,1/0,-1/0,-1/0],We=$.canonicalID();if(he.type==="Polygon"){let ct=Ys(he.coordinates,je,We),St=kl($.geometry(),Ee,je,We);if(!zs(Ee,je))return!1;for(let Nt of St)if(!On(Nt,ct))return!1}if(he.type==="MultiPolygon"){let ct=Tu(he.coordinates,je,We),St=kl($.geometry(),Ee,je,We);if(!zs(Ee,je))return!1;for(let Nt of St)if(!Ko(Nt,ct))return!1}return!0}(D,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let rl=class{constructor(W=[],D=($,he)=>$<he?-1:$>he?1:0){if(this.data=W,this.length=this.data.length,this.compare=D,this.length>0)for(let $=(this.length>>1)-1;$>=0;$--)this._down($)}push(W){this.data.push(W),this._up(this.length++)}pop(){if(this.length===0)return;let W=this.data[0],D=this.data.pop();return--this.length>0&&(this.data[0]=D,this._down(0)),W}peek(){return this.data[0]}_up(W){let{data:D,compare:$}=this,he=D[W];for(;W>0;){let Ee=W-1>>1,je=D[Ee];if($(he,je)>=0)break;D[W]=je,W=Ee}D[W]=he}_down(W){let{data:D,compare:$}=this,he=this.length>>1,Ee=D[W];for(;W<he;){let je=1+(W<<1),We=je+1;if(We<this.length&&$(D[We],D[je])<0&&(je=We),$(D[je],Ee)>=0)break;D[W]=D[je],W=je}D[W]=Ee}};function Es(W,D,$,he,Ee){Us(W,D,$,he||W.length-1,Ee||pu)}function Us(W,D,$,he,Ee){for(;he>$;){if(he-$>600){var je=he-$+1,We=D-$+1,ct=Math.log(je),St=.5*Math.exp(2*ct/3),Nt=.5*Math.sqrt(ct*St*(je-St)/je)*(We-je/2<0?-1:1);Us(W,D,Math.max($,Math.floor(D-We*St/je+Nt)),Math.min(he,Math.floor(D+(je-We)*St/je+Nt)),Ee)}var sr=W[D],Er=$,Fr=he;for(Zl(W,$,D),Ee(W[he],sr)>0&&Zl(W,$,he);Er<Fr;){for(Zl(W,Er,Fr),Er++,Fr--;Ee(W[Er],sr)<0;)Er++;for(;Ee(W[Fr],sr)>0;)Fr--}Ee(W[$],sr)===0?Zl(W,$,Fr):Zl(W,++Fr,he),Fr<=D&&($=Fr+1),D<=Fr&&(he=Fr-1)}}function Zl(W,D,$){var he=W[D];W[D]=W[$],W[$]=he}function pu(W,D){return W<D?-1:W>D?1:0}function kc(W,D){if(W.length<=1)return[W];let $=[],he,Ee;for(let je of W){let We=Sf(je);We!==0&&(je.area=Math.abs(We),Ee===void 0&&(Ee=We<0),Ee===We<0?(he&&$.push(he),he=[je]):he.push(je))}if(he&&$.push(he),D>1)for(let je=0;je<$.length;je++)$[je].length<=D||(Es($[je],D,1,$[je].length-1,Au),$[je]=$[je].slice(0,D));return $}function Au(W,D){return D.area-W.area}function Sf(W){let D=0;for(let $,he,Ee=0,je=W.length,We=je-1;Ee<je;We=Ee++)$=W[Ee],he=W[We],D+=(he.x-$.x)*($.y+he.y);return D}let Gc=1/298.257223563,Js=Gc*(2-Gc),yc=Math.PI/180;class Zc{constructor(D){let $=6378.137*yc*1e3,he=Math.cos(D*yc),Ee=1/(1-Js*(1-he*he)),je=Math.sqrt(Ee);this.kx=$*je*he,this.ky=$*je*Ee*(1-Js)}distance(D,$){let he=this.wrap(D[0]-$[0])*this.kx,Ee=(D[1]-$[1])*this.ky;return Math.sqrt(he*he+Ee*Ee)}pointOnLine(D,$){let he,Ee,je,We,ct=1/0;for(let St=0;St<D.length-1;St++){let Nt=D[St][0],sr=D[St][1],Er=this.wrap(D[St+1][0]-Nt)*this.kx,Fr=(D[St+1][1]-sr)*this.ky,Xr=0;Er===0&&Fr===0||(Xr=(this.wrap($[0]-Nt)*this.kx*Er+($[1]-sr)*this.ky*Fr)/(Er*Er+Fr*Fr),Xr>1?(Nt=D[St+1][0],sr=D[St+1][1]):Xr>0&&(Nt+=Er/this.kx*Xr,sr+=Fr/this.ky*Xr)),Er=this.wrap($[0]-Nt)*this.kx,Fr=($[1]-sr)*this.ky;let ni=Er*Er+Fr*Fr;ni<ct&&(ct=ni,he=Nt,Ee=sr,je=St,We=Xr)}return{point:[he,Ee],index:je,t:Math.max(0,Math.min(1,We))}}wrap(D){for(;D<-180;)D+=360;for(;D>180;)D-=360;return D}}function mu(W,D){return D[0]-W[0]}function Vl(W){return W[1]-W[0]+1}function lc(W,D){return W[1]>=W[0]&&W[1]<D}function Gu(W,D){if(W[0]>W[1])return[null,null];let $=Vl(W);if(D){if($===2)return[W,null];let Ee=Math.floor($/2);return[[W[0],W[0]+Ee],[W[0]+Ee,W[1]]]}if($===1)return[W,null];let he=Math.floor($/2)-1;return[[W[0],W[0]+he],[W[0]+he+1,W[1]]]}function _l(W,D){if(!lc(D,W.length))return[1/0,1/0,-1/0,-1/0];let $=[1/0,1/0,-1/0,-1/0];for(let he=D[0];he<=D[1];++he)tl($,W[he]);return $}function Cl(W){let D=[1/0,1/0,-1/0,-1/0];for(let $ of W)for(let he of $)tl(D,he);return D}function Fs(W){return W[0]!==-1/0&&W[1]!==-1/0&&W[2]!==1/0&&W[3]!==1/0}function ol(W,D,$){if(!Fs(W)||!Fs(D))return NaN;let he=0,Ee=0;return W[2]<D[0]&&(he=D[0]-W[2]),W[0]>D[2]&&(he=W[0]-D[2]),W[1]>D[3]&&(Ee=W[1]-D[3]),W[3]<D[1]&&(Ee=D[1]-W[3]),$.distance([0,0],[he,Ee])}function uc(W,D,$){let he=$.pointOnLine(D,W);return $.distance(W,he.point)}function Kl(W,D,$,he,Ee){let je=Math.min(uc(W,[$,he],Ee),uc(D,[$,he],Ee)),We=Math.min(uc($,[W,D],Ee),uc(he,[W,D],Ee));return Math.min(je,We)}function Zu(W,D,$,he,Ee){if(!lc(D,W.length)||!lc(he,$.length))return 1/0;let je=1/0;for(let We=D[0];We<D[1];++We){let ct=W[We],St=W[We+1];for(let Nt=he[0];Nt<he[1];++Nt){let sr=$[Nt],Er=$[Nt+1];if($s(ct,St,sr,Er))return 0;je=Math.min(je,Kl(ct,St,sr,Er,Ee))}}return je}function Sl(W,D,$,he,Ee){if(!lc(D,W.length)||!lc(he,$.length))return NaN;let je=1/0;for(let We=D[0];We<=D[1];++We)for(let ct=he[0];ct<=he[1];++ct)if(je=Math.min(je,Ee.distance(W[We],$[ct])),je===0)return je;return je}function vh(W,D,$){if(nl(W,D,!0))return 0;let he=1/0;for(let Ee of D){let je=Ee[0],We=Ee[Ee.length-1];if(je!==We&&(he=Math.min(he,uc(W,[We,je],$)),he===0))return he;let ct=$.pointOnLine(Ee,W);if(he=Math.min(he,$.distance(W,ct.point)),he===0)return he}return he}function ws(W,D,$,he){if(!lc(D,W.length))return NaN;for(let je=D[0];je<=D[1];++je)if(nl(W[je],$,!0))return 0;let Ee=1/0;for(let je=D[0];je<D[1];++je){let We=W[je],ct=W[je+1];for(let St of $)for(let Nt=0,sr=St.length,Er=sr-1;Nt<sr;Er=Nt++){let Fr=St[Er],Xr=St[Nt];if($s(We,ct,Fr,Xr))return 0;Ee=Math.min(Ee,Kl(We,ct,Fr,Xr,he))}}return Ee}function ph(W,D){for(let $ of W)for(let he of $)if(nl(he,D,!0))return!0;return!1}function qs(W,D,$,he=1/0){let Ee=Cl(W),je=Cl(D);if(he!==1/0&&ol(Ee,je,$)>=he)return he;if(zs(Ee,je)){if(ph(W,D))return 0}else if(ph(D,W))return 0;let We=1/0;for(let ct of W)for(let St=0,Nt=ct.length,sr=Nt-1;St<Nt;sr=St++){let Er=ct[sr],Fr=ct[St];for(let Xr of D)for(let ni=0,gi=Xr.length,Zi=gi-1;ni<gi;Zi=ni++){let aa=Xr[Zi],nn=Xr[ni];if($s(Er,Fr,aa,nn))return 0;We=Math.min(We,Kl(Er,Fr,aa,nn,$))}}return We}function xo(W,D,$,he,Ee,je){if(!je)return;let We=ol(_l(he,je),Ee,$);We<D&&W.push([We,je,[0,0]])}function Kc(W,D,$,he,Ee,je,We){if(!je||!We)return;let ct=ol(_l(he,je),_l(Ee,We),$);ct<D&&W.push([ct,je,We])}function Ku(W,D,$,he,Ee=1/0){let je=Math.min(he.distance(W[0],$[0][0]),Ee);if(je===0)return je;let We=new rl([[0,[0,W.length-1],[0,0]]],mu),ct=Cl($);for(;We.length>0;){let St=We.pop();if(St[0]>=je)continue;let Nt=St[1],sr=D?50:100;if(Vl(Nt)<=sr){if(!lc(Nt,W.length))return NaN;if(D){let Er=ws(W,Nt,$,he);if(isNaN(Er)||Er===0)return Er;je=Math.min(je,Er)}else for(let Er=Nt[0];Er<=Nt[1];++Er){let Fr=vh(W[Er],$,he);if(je=Math.min(je,Fr),je===0)return 0}}else{let Er=Gu(Nt,D);xo(We,je,he,W,ct,Er[0]),xo(We,je,he,W,ct,Er[1])}}return je}function $l(W,D,$,he,Ee,je=1/0){let We=Math.min(je,Ee.distance(W[0],$[0]));if(We===0)return We;let ct=new rl([[0,[0,W.length-1],[0,$.length-1]]],mu);for(;ct.length>0;){let St=ct.pop();if(St[0]>=We)continue;let Nt=St[1],sr=St[2],Er=D?50:100,Fr=he?50:100;if(Vl(Nt)<=Er&&Vl(sr)<=Fr){if(!lc(Nt,W.length)&&lc(sr,$.length))return NaN;let Xr;if(D&&he)Xr=Zu(W,Nt,$,sr,Ee),We=Math.min(We,Xr);else if(D&&!he){let ni=W.slice(Nt[0],Nt[1]+1);for(let gi=sr[0];gi<=sr[1];++gi)if(Xr=uc($[gi],ni,Ee),We=Math.min(We,Xr),We===0)return We}else if(!D&&he){let ni=$.slice(sr[0],sr[1]+1);for(let gi=Nt[0];gi<=Nt[1];++gi)if(Xr=uc(W[gi],ni,Ee),We=Math.min(We,Xr),We===0)return We}else Xr=Sl(W,Nt,$,sr,Ee),We=Math.min(We,Xr)}else{let Xr=Gu(Nt,D),ni=Gu(sr,he);Kc(ct,We,Ee,W,$,Xr[0],ni[0]),Kc(ct,We,Ee,W,$,Xr[0],ni[1]),Kc(ct,We,Ee,W,$,Xr[1],ni[0]),Kc(ct,We,Ee,W,$,Xr[1],ni[1])}}return We}function Mf(W){return W.type==="MultiPolygon"?W.coordinates.map(D=>({type:"Polygon",coordinates:D})):W.type==="MultiLineString"?W.coordinates.map(D=>({type:"LineString",coordinates:D})):W.type==="MultiPoint"?W.coordinates.map(D=>({type:"Point",coordinates:D})):[W]}class Cc{constructor(D,$){this.type=$e,this.geojson=D,this.geometries=$}static parse(D,$){if(D.length!==2)return $.error(`'distance' expression requires exactly one argument, but found ${D.length-1} instead.`);if(xa(D[1])){let he=D[1];if(he.type==="FeatureCollection")return new Cc(he,he.features.map(Ee=>Mf(Ee.geometry)).flat());if(he.type==="Feature")return new Cc(he,Mf(he.geometry));if("type"in he&&"coordinates"in he)return new Cc(he,Mf(he))}return $.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(D){if(D.geometry()!=null&&D.canonicalID()!=null){if(D.geometryType()==="Point")return function($,he){let Ee=$.geometry(),je=Ee.flat().map(St=>Xn([St.x,St.y],$.canonical));if(Ee.length===0)return NaN;let We=new Zc(je[0][1]),ct=1/0;for(let St of he){switch(St.type){case"Point":ct=Math.min(ct,$l(je,!1,[St.coordinates],!1,We,ct));break;case"LineString":ct=Math.min(ct,$l(je,!1,St.coordinates,!0,We,ct));break;case"Polygon":ct=Math.min(ct,Ku(je,!1,St.coordinates,We,ct))}if(ct===0)return ct}return ct}(D,this.geometries);if(D.geometryType()==="LineString")return function($,he){let Ee=$.geometry(),je=Ee.flat().map(St=>Xn([St.x,St.y],$.canonical));if(Ee.length===0)return NaN;let We=new Zc(je[0][1]),ct=1/0;for(let St of he){switch(St.type){case"Point":ct=Math.min(ct,$l(je,!0,[St.coordinates],!1,We,ct));break;case"LineString":ct=Math.min(ct,$l(je,!0,St.coordinates,!0,We,ct));break;case"Polygon":ct=Math.min(ct,Ku(je,!0,St.coordinates,We,ct))}if(ct===0)return ct}return ct}(D,this.geometries);if(D.geometryType()==="Polygon")return function($,he){let Ee=$.geometry();if(Ee.length===0||Ee[0].length===0)return NaN;let je=kc(Ee,0).map(St=>St.map(Nt=>Nt.map(sr=>Xn([sr.x,sr.y],$.canonical)))),We=new Zc(je[0][0][0][1]),ct=1/0;for(let St of he)for(let Nt of je){switch(St.type){case"Point":ct=Math.min(ct,Ku([St.coordinates],!1,Nt,We,ct));break;case"LineString":ct=Math.min(ct,Ku(St.coordinates,!0,Nt,We,ct));break;case"Polygon":ct=Math.min(ct,qs(Nt,St.coordinates,We,ct))}if(ct===0)return ct}return ct}(D,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let uf={"==":uo,"!=":ss,">":el,"<":xs,">=":Co,"<=":Ss,array:st,at:Xt,boolean:st,case:Ni,coalesce:Eo,collator:ao,format:Ms,image:Gs,in:mr,"index-of":Or,interpolate:Ao,"interpolate-hcl":Ao,"interpolate-lab":Ao,length:ul,let:Wr,literal:_n,match:ki,number:st,"number-format":co,object:st,slice:Si,step:Li,string:st,"to-boolean":Lr,"to-color":Lr,"to-number":Lr,"to-string":Lr,var:yt,within:Ns,distance:Cc};class su{constructor(D,$,he,Ee){this.name=D,this.type=$,this._evaluate=he,this.args=Ee}evaluate(D){return this._evaluate(D,this.args)}eachChild(D){this.args.forEach(D)}outputDefined(){return!1}static parse(D,$){let he=D[0],Ee=su.definitions[he];if(!Ee)return $.error(`Unknown expression "${he}". If you wanted a literal array, use ["literal", [...]].`,0);let je=Array.isArray(Ee)?Ee[0]:Ee.type,We=Array.isArray(Ee)?[[Ee[1],Ee[2]]]:Ee.overloads,ct=We.filter(([Nt])=>!Array.isArray(Nt)||Nt.length===D.length-1),St=null;for(let[Nt,sr]of ct){St=new jr($.registry,Df,$.path,null,$.scope);let Er=[],Fr=!1;for(let Xr=1;Xr<D.length;Xr++){let ni=D[Xr],gi=Array.isArray(Nt)?Nt[Xr-1]:Nt.type,Zi=St.parse(ni,1+Er.length,gi);if(!Zi){Fr=!0;break}Er.push(Zi)}if(!Fr)if(Array.isArray(Nt)&&Nt.length!==Er.length)St.error(`Expected ${Nt.length} arguments, but found ${Er.length} instead.`);else{for(let Xr=0;Xr<Er.length;Xr++){let ni=Array.isArray(Nt)?Nt[Xr]:Nt.type,gi=Er[Xr];St.concat(Xr+1).checkSubtype(ni,gi.type)}if(St.errors.length===0)return new su(he,je,sr,Er)}}if(ct.length===1)$.errors.push(...St.errors);else{let Nt=(ct.length?ct:We).map(([Er])=>{return Fr=Er,Array.isArray(Fr)?`(${Fr.map(Ye).join(", ")})`:`(${Ye(Fr.type)}...)`;var Fr}).join(" | "),sr=[];for(let Er=1;Er<D.length;Er++){let Fr=$.parse(D[Er],1+sr.length);if(!Fr)return null;sr.push(Ye(Fr.type))}$.error(`Expected arguments of type ${Nt}, but found (${sr.join(", ")}) instead.`)}return null}static register(D,$){su.definitions=$;for(let he in $)D[he]=su}}function Wf(W,[D,$,he,Ee]){D=D.evaluate(W),$=$.evaluate(W),he=he.evaluate(W);let je=Ee?Ee.evaluate(W):1,We=ca(D,$,he,je);if(We)throw new En(We);return new Jt(D/255,$/255,he/255,je,!1)}function Rf(W,D){return W in D}function cf(W,D){let $=D[W];return $===void 0?null:$}function Wc(W){return{type:W}}function Df(W){if(W instanceof yt)return Df(W.boundExpression);if(W instanceof su&&W.name==="error"||W instanceof ao||W instanceof Ns||W instanceof Cc)return!1;let D=W instanceof Lr||W instanceof st,$=!0;return W.eachChild(he=>{$=D?$&&Df(he):$&&he instanceof _n}),!!$&&zf(W)&&Ef(W,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function zf(W){if(W instanceof su&&(W.name==="get"&&W.args.length===1||W.name==="feature-state"||W.name==="has"&&W.args.length===1||W.name==="properties"||W.name==="geometry-type"||W.name==="id"||/^filter-/.test(W.name))||W instanceof Ns||W instanceof Cc)return!1;let D=!0;return W.eachChild($=>{D&&!zf($)&&(D=!1)}),D}function $u(W){if(W instanceof su&&W.name==="feature-state")return!1;let D=!0;return W.eachChild($=>{D&&!$u($)&&(D=!1)}),D}function Ef(W,D){if(W instanceof su&&D.indexOf(W.name)>=0)return!1;let $=!0;return W.eachChild(he=>{$&&!Ef(he,D)&&($=!1)}),$}function cc(W){return{result:"success",value:W}}function $c(W){return{result:"error",value:W}}function lu(W){return W["property-type"]==="data-driven"||W["property-type"]==="cross-faded-data-driven"}function Xc(W){return!!W.expression&&W.expression.parameters.indexOf("zoom")>-1}function Lc(W){return!!W.expression&&W.expression.interpolated}function sl(W){return W instanceof Number?"number":W instanceof String?"string":W instanceof Boolean?"boolean":Array.isArray(W)?"array":W===null?"null":typeof W}function kf(W){return typeof W=="object"&&W!==null&&!Array.isArray(W)}function ah(W){return W}function Ff(W,D){let $=D.type==="color",he=W.stops&&typeof W.stops[0][0]=="object",Ee=he||!(he||W.property!==void 0),je=W.type||(Lc(D)?"exponential":"interval");if($||D.type==="padding"){let sr=$?Jt.parse:di.parse;(W=fe({},W)).stops&&(W.stops=W.stops.map(Er=>[Er[0],sr(Er[1])])),W.default=sr(W.default?W.default:D.default)}if(W.colorSpace&&(We=W.colorSpace)!=="rgb"&&We!=="hcl"&&We!=="lab")throw new Error(`Unknown color space: "${W.colorSpace}"`);var We;let ct,St,Nt;if(je==="exponential")ct=Bf;else if(je==="interval")ct=Fu;else if(je==="categorical"){ct=Xf,St=Object.create(null);for(let sr of W.stops)St[sr[0]]=sr[1];Nt=typeof W.stops[0][0]}else{if(je!=="identity")throw new Error(`Unknown function type "${je}"`);ct=Ll}if(he){let sr={},Er=[];for(let ni=0;ni<W.stops.length;ni++){let gi=W.stops[ni],Zi=gi[0].zoom;sr[Zi]===void 0&&(sr[Zi]={zoom:Zi,type:W.type,property:W.property,default:W.default,stops:[]},Er.push(Zi)),sr[Zi].stops.push([gi[0].value,gi[1]])}let Fr=[];for(let ni of Er)Fr.push([sr[ni].zoom,Ff(sr[ni],D)]);let Xr={name:"linear"};return{kind:"composite",interpolationType:Xr,interpolationFactor:Ao.interpolationFactor.bind(void 0,Xr),zoomStops:Fr.map(ni=>ni[0]),evaluate:({zoom:ni},gi)=>Bf({stops:Fr,base:W.base},D,ni).evaluate(ni,gi)}}if(Ee){let sr=je==="exponential"?{name:"exponential",base:W.base!==void 0?W.base:1}:null;return{kind:"camera",interpolationType:sr,interpolationFactor:Ao.interpolationFactor.bind(void 0,sr),zoomStops:W.stops.map(Er=>Er[0]),evaluate:({zoom:Er})=>ct(W,D,Er,St,Nt)}}return{kind:"source",evaluate(sr,Er){let Fr=Er&&Er.properties?Er.properties[W.property]:void 0;return Fr===void 0?Jc(W.default,D.default):ct(W,D,Fr,St,Nt)}}}function Jc(W,D,$){return W!==void 0?W:D!==void 0?D:$!==void 0?$:void 0}function Xf(W,D,$,he,Ee){return Jc(typeof $===Ee?he[$]:void 0,W.default,D.default)}function Fu(W,D,$){if(sl($)!=="number")return Jc(W.default,D.default);let he=W.stops.length;if(he===1||$<=W.stops[0][0])return W.stops[0][1];if($>=W.stops[he-1][0])return W.stops[he-1][1];let Ee=fi(W.stops.map(je=>je[0]),$);return W.stops[Ee][1]}function Bf(W,D,$){let he=W.base!==void 0?W.base:1;if(sl($)!=="number")return Jc(W.default,D.default);let Ee=W.stops.length;if(Ee===1||$<=W.stops[0][0])return W.stops[0][1];if($>=W.stops[Ee-1][0])return W.stops[Ee-1][1];let je=fi(W.stops.map(sr=>sr[0]),$),We=function(sr,Er,Fr,Xr){let ni=Xr-Fr,gi=sr-Fr;return ni===0?0:Er===1?gi/ni:(Math.pow(Er,gi)-1)/(Math.pow(Er,ni)-1)}($,he,W.stops[je][0],W.stops[je+1][0]),ct=W.stops[je][1],St=W.stops[je+1][1],Nt=eo[D.type]||ah;return typeof ct.evaluate=="function"?{evaluate(...sr){let Er=ct.evaluate.apply(void 0,sr),Fr=St.evaluate.apply(void 0,sr);if(Er!==void 0&&Fr!==void 0)return Nt(Er,Fr,We,W.colorSpace)}}:Nt(ct,St,We,W.colorSpace)}function Ll(W,D,$){switch(D.type){case"color":$=Jt.parse($);break;case"formatted":$=ii.fromString($.toString());break;case"resolvedImage":$=ra.fromString($.toString());break;case"padding":$=di.parse($);break;default:sl($)===D.type||D.type==="enum"&&D.values[$]||($=void 0)}return Jc($,W.default,D.default)}su.register(uf,{error:[{kind:"error"},[It],(W,[D])=>{throw new En(D.evaluate(W))}],typeof:[It,[Cr],(W,[D])=>Ye(ji(D.evaluate(W)))],"to-rgba":[Ne($e,4),[Vt],(W,[D])=>{let[$,he,Ee,je]=D.evaluate(W).rgb;return[255*$,255*he,255*Ee,je]}],rgb:[Vt,[$e,$e,$e],Wf],rgba:[Vt,[$e,$e,$e,$e],Wf],has:{type:Pt,overloads:[[[It],(W,[D])=>Rf(D.evaluate(W),W.properties())],[[It,Wt],(W,[D,$])=>Rf(D.evaluate(W),$.evaluate(W))]]},get:{type:Cr,overloads:[[[It],(W,[D])=>cf(D.evaluate(W),W.properties())],[[It,Wt],(W,[D,$])=>cf(D.evaluate(W),$.evaluate(W))]]},"feature-state":[Cr,[It],(W,[D])=>cf(D.evaluate(W),W.featureState||{})],properties:[Wt,[],W=>W.properties()],"geometry-type":[It,[],W=>W.geometryType()],id:[Cr,[],W=>W.id()],zoom:[$e,[],W=>W.globals.zoom],"heatmap-density":[$e,[],W=>W.globals.heatmapDensity||0],"line-progress":[$e,[],W=>W.globals.lineProgress||0],accumulated:[Cr,[],W=>W.globals.accumulated===void 0?null:W.globals.accumulated],"+":[$e,Wc($e),(W,D)=>{let $=0;for(let he of D)$+=he.evaluate(W);return $}],"*":[$e,Wc($e),(W,D)=>{let $=1;for(let he of D)$*=he.evaluate(W);return $}],"-":{type:$e,overloads:[[[$e,$e],(W,[D,$])=>D.evaluate(W)-$.evaluate(W)],[[$e],(W,[D])=>-D.evaluate(W)]]},"/":[$e,[$e,$e],(W,[D,$])=>D.evaluate(W)/$.evaluate(W)],"%":[$e,[$e,$e],(W,[D,$])=>D.evaluate(W)%$.evaluate(W)],ln2:[$e,[],()=>Math.LN2],pi:[$e,[],()=>Math.PI],e:[$e,[],()=>Math.E],"^":[$e,[$e,$e],(W,[D,$])=>Math.pow(D.evaluate(W),$.evaluate(W))],sqrt:[$e,[$e],(W,[D])=>Math.sqrt(D.evaluate(W))],log10:[$e,[$e],(W,[D])=>Math.log(D.evaluate(W))/Math.LN10],ln:[$e,[$e],(W,[D])=>Math.log(D.evaluate(W))],log2:[$e,[$e],(W,[D])=>Math.log(D.evaluate(W))/Math.LN2],sin:[$e,[$e],(W,[D])=>Math.sin(D.evaluate(W))],cos:[$e,[$e],(W,[D])=>Math.cos(D.evaluate(W))],tan:[$e,[$e],(W,[D])=>Math.tan(D.evaluate(W))],asin:[$e,[$e],(W,[D])=>Math.asin(D.evaluate(W))],acos:[$e,[$e],(W,[D])=>Math.acos(D.evaluate(W))],atan:[$e,[$e],(W,[D])=>Math.atan(D.evaluate(W))],min:[$e,Wc($e),(W,D)=>Math.min(...D.map($=>$.evaluate(W)))],max:[$e,Wc($e),(W,D)=>Math.max(...D.map($=>$.evaluate(W)))],abs:[$e,[$e],(W,[D])=>Math.abs(D.evaluate(W))],round:[$e,[$e],(W,[D])=>{let $=D.evaluate(W);return $<0?-Math.round(-$):Math.round($)}],floor:[$e,[$e],(W,[D])=>Math.floor(D.evaluate(W))],ceil:[$e,[$e],(W,[D])=>Math.ceil(D.evaluate(W))],"filter-==":[Pt,[It,Cr],(W,[D,$])=>W.properties()[D.value]===$.value],"filter-id-==":[Pt,[Cr],(W,[D])=>W.id()===D.value],"filter-type-==":[Pt,[It],(W,[D])=>W.geometryType()===D.value],"filter-<":[Pt,[It,Cr],(W,[D,$])=>{let he=W.properties()[D.value],Ee=$.value;return typeof he==typeof Ee&&he<Ee}],"filter-id-<":[Pt,[Cr],(W,[D])=>{let $=W.id(),he=D.value;return typeof $==typeof he&&$<he}],"filter->":[Pt,[It,Cr],(W,[D,$])=>{let he=W.properties()[D.value],Ee=$.value;return typeof he==typeof Ee&&he>Ee}],"filter-id->":[Pt,[Cr],(W,[D])=>{let $=W.id(),he=D.value;return typeof $==typeof he&&$>he}],"filter-<=":[Pt,[It,Cr],(W,[D,$])=>{let he=W.properties()[D.value],Ee=$.value;return typeof he==typeof Ee&&he<=Ee}],"filter-id-<=":[Pt,[Cr],(W,[D])=>{let $=W.id(),he=D.value;return typeof $==typeof he&&$<=he}],"filter->=":[Pt,[It,Cr],(W,[D,$])=>{let he=W.properties()[D.value],Ee=$.value;return typeof he==typeof Ee&&he>=Ee}],"filter-id->=":[Pt,[Cr],(W,[D])=>{let $=W.id(),he=D.value;return typeof $==typeof he&&$>=he}],"filter-has":[Pt,[Cr],(W,[D])=>D.value in W.properties()],"filter-has-id":[Pt,[],W=>W.id()!==null&&W.id()!==void 0],"filter-type-in":[Pt,[Ne(It)],(W,[D])=>D.value.indexOf(W.geometryType())>=0],"filter-id-in":[Pt,[Ne(Cr)],(W,[D])=>D.value.indexOf(W.id())>=0],"filter-in-small":[Pt,[It,Ne(Cr)],(W,[D,$])=>$.value.indexOf(W.properties()[D.value])>=0],"filter-in-large":[Pt,[It,Ne(Cr)],(W,[D,$])=>function(he,Ee,je,We){for(;je<=We;){let ct=je+We>>1;if(Ee[ct]===he)return!0;Ee[ct]>he?We=ct-1:je=ct+1}return!1}(W.properties()[D.value],$.value,0,$.value.length-1)],all:{type:Pt,overloads:[[[Pt,Pt],(W,[D,$])=>D.evaluate(W)&&$.evaluate(W)],[Wc(Pt),(W,D)=>{for(let $ of D)if(!$.evaluate(W))return!1;return!0}]]},any:{type:Pt,overloads:[[[Pt,Pt],(W,[D,$])=>D.evaluate(W)||$.evaluate(W)],[Wc(Pt),(W,D)=>{for(let $ of D)if($.evaluate(W))return!0;return!1}]]},"!":[Pt,[Pt],(W,[D])=>!D.evaluate(W)],"is-supported-script":[Pt,[It],(W,[D])=>{let $=W.globals&&W.globals.isSupportedScript;return!$||$(D.evaluate(W))}],upcase:[It,[It],(W,[D])=>D.evaluate(W).toUpperCase()],downcase:[It,[It],(W,[D])=>D.evaluate(W).toLowerCase()],concat:[It,Wc(Cr),(W,D)=>D.map($=>pn($.evaluate(W))).join("")],"resolved-locale":[It,[yr],(W,[D])=>D.evaluate(W).resolvedLocale()]});class Bu{constructor(D,$){var he;this.expression=D,this._warningHistory={},this._evaluator=new Rr,this._defaultValue=$?(he=$).type==="color"&&kf(he.default)?new Jt(0,0,0,0):he.type==="color"?Jt.parse(he.default)||null:he.type==="padding"?di.parse(he.default)||null:he.type==="variableAnchorOffsetCollection"?oa.parse(he.default)||null:he.default===void 0?null:he.default:null,this._enumValues=$&&$.type==="enum"?$.values:null}evaluateWithoutErrorHandling(D,$,he,Ee,je,We){return this._evaluator.globals=D,this._evaluator.feature=$,this._evaluator.featureState=he,this._evaluator.canonical=Ee,this._evaluator.availableImages=je||null,this._evaluator.formattedSection=We,this.expression.evaluate(this._evaluator)}evaluate(D,$,he,Ee,je,We){this._evaluator.globals=D,this._evaluator.feature=$||null,this._evaluator.featureState=he||null,this._evaluator.canonical=Ee,this._evaluator.availableImages=je||null,this._evaluator.formattedSection=We||null;try{let ct=this.expression.evaluate(this._evaluator);if(ct==null||typeof ct=="number"&&ct!=ct)return this._defaultValue;if(this._enumValues&&!(ct in this._enumValues))throw new En(`Expected value to be one of ${Object.keys(this._enumValues).map(St=>JSON.stringify(St)).join(", ")}, but found ${JSON.stringify(ct)} instead.`);return ct}catch(ct){return this._warningHistory[ct.message]||(this._warningHistory[ct.message]=!0,typeof console<"u"&&console.warn(ct.message)),this._defaultValue}}}function Ic(W){return Array.isArray(W)&&W.length>0&&typeof W[0]=="string"&&W[0]in uf}function xl(W,D){let $=new jr(uf,Df,[],D?function(Ee){let je={color:Vt,string:It,number:$e,enum:It,boolean:Pt,formatted:qr,padding:Mr,resolvedImage:Dr,variableAnchorOffsetCollection:xt};return Ee.type==="array"?Ne(je[Ee.value]||Cr,Ee.length):je[Ee.type]}(D):void 0),he=$.parse(W,void 0,void 0,void 0,D&&D.type==="string"?{typeAnnotation:"coerce"}:void 0);return he?cc(new Bu(he,D)):$c($.errors)}class _c{constructor(D,$){this.kind=D,this._styleExpression=$,this.isStateDependent=D!=="constant"&&!$u($.expression)}evaluateWithoutErrorHandling(D,$,he,Ee,je,We){return this._styleExpression.evaluateWithoutErrorHandling(D,$,he,Ee,je,We)}evaluate(D,$,he,Ee,je,We){return this._styleExpression.evaluate(D,$,he,Ee,je,We)}}class Eu{constructor(D,$,he,Ee){this.kind=D,this.zoomStops=he,this._styleExpression=$,this.isStateDependent=D!=="camera"&&!$u($.expression),this.interpolationType=Ee}evaluateWithoutErrorHandling(D,$,he,Ee,je,We){return this._styleExpression.evaluateWithoutErrorHandling(D,$,he,Ee,je,We)}evaluate(D,$,he,Ee,je,We){return this._styleExpression.evaluate(D,$,he,Ee,je,We)}interpolationFactor(D,$,he){return this.interpolationType?Ao.interpolationFactor(this.interpolationType,D,$,he):0}}function Iu(W,D){let $=xl(W,D);if($.result==="error")return $;let he=$.value.expression,Ee=zf(he);if(!Ee&&!lu(D))return $c([new Be("","data expressions not supported")]);let je=Ef(he,["zoom"]);if(!je&&!Xc(D))return $c([new Be("","zoom expressions not supported")]);let We=Of(he);return We||je?We instanceof Be?$c([We]):We instanceof Ao&&!Lc(D)?$c([new Be("",'"interpolate" expressions cannot be used with this property')]):cc(We?new Eu(Ee?"camera":"composite",$.value,We.labels,We instanceof Ao?We.interpolation:void 0):new _c(Ee?"constant":"source",$.value)):$c([new Be("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Nl{constructor(D,$){this._parameters=D,this._specification=$,fe(this,Ff(this._parameters,this._specification))}static deserialize(D){return new Nl(D._parameters,D._specification)}static serialize(D){return{_parameters:D._parameters,_specification:D._specification}}}function Of(W){let D=null;if(W instanceof Wr)D=Of(W.result);else if(W instanceof Eo){for(let $ of W.args)if(D=Of($),D)break}else(W instanceof Li||W instanceof Ao)&&W.input instanceof su&&W.input.name==="zoom"&&(D=W);return D instanceof Be||W.eachChild($=>{let he=Of($);he instanceof Be?D=he:!D&&he?D=new Be("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):D&&he&&D!==he&&(D=new Be("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),D}function Yf(W){if(W===!0||W===!1)return!0;if(!Array.isArray(W)||W.length===0)return!1;switch(W[0]){case"has":return W.length>=2&&W[1]!=="$id"&&W[1]!=="$type";case"in":return W.length>=3&&(typeof W[1]!="string"||Array.isArray(W[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return W.length!==3||Array.isArray(W[1])||Array.isArray(W[2]);case"any":case"all":for(let D of W.slice(1))if(!Yf(D)&&typeof D!="boolean")return!1;return!0;default:return!0}}let Wu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Pc(W){if(W==null)return{filter:()=>!0,needGeometry:!1};Yf(W)||(W=ff(W));let D=xl(W,Wu);if(D.result==="error")throw new Error(D.value.map($=>`${$.key}: ${$.message}`).join(", "));return{filter:($,he,Ee)=>D.value.evaluate($,he,{},Ee),needGeometry:_h(W)}}function xc(W,D){return W<D?-1:W>D?1:0}function _h(W){if(!Array.isArray(W))return!1;if(W[0]==="within"||W[0]==="distance")return!0;for(let D=1;D<W.length;D++)if(_h(W[D]))return!0;return!1}function ff(W){if(!W)return!0;let D=W[0];return W.length<=1?D!=="any":D==="=="?yf(W[1],W[2],"=="):D==="!="?hu(yf(W[1],W[2],"==")):D==="<"||D===">"||D==="<="||D===">="?yf(W[1],W[2],D):D==="any"?($=W.slice(1),["any"].concat($.map(ff))):D==="all"?["all"].concat(W.slice(1).map(ff)):D==="none"?["all"].concat(W.slice(1).map(ff).map(hu)):D==="in"?Xu(W[1],W.slice(2)):D==="!in"?hu(Xu(W[1],W.slice(2))):D==="has"?hf(W[1]):D!=="!has"||hu(hf(W[1]));var $}function yf(W,D,$){switch(W){case"$type":return[`filter-type-${$}`,D];case"$id":return[`filter-id-${$}`,D];default:return[`filter-${$}`,W,D]}}function Xu(W,D){if(D.length===0)return!1;switch(W){case"$type":return["filter-type-in",["literal",D]];case"$id":return["filter-id-in",["literal",D]];default:return D.length>200&&!D.some($=>typeof $!=typeof D[0])?["filter-in-large",W,["literal",D.sort(xc)]]:["filter-in-small",W,["literal",D]]}}function hf(W){switch(W){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",W]}}function hu(W){return["!",W]}function Qc(W){let D=typeof W;if(D==="number"||D==="boolean"||D==="string"||W==null)return JSON.stringify(W);if(Array.isArray(W)){let Ee="[";for(let je of W)Ee+=`${Qc(je)},`;return`${Ee}]`}let $=Object.keys(W).sort(),he="{";for(let Ee=0;Ee<$.length;Ee++)he+=`${JSON.stringify($[Ee])}:${Qc(W[$[Ee]])},`;return`${he}}`}function nh(W){let D="";for(let $ of ue)D+=`/${Qc(W[$])}`;return D}function _f(W){let D=W.value;return D?[new me(W.key,D,"constants have been deprecated as of v8")]:[]}function bl(W){return W instanceof Number||W instanceof String||W instanceof Boolean?W.valueOf():W}function ku(W){if(Array.isArray(W))return W.map(ku);if(W instanceof Object&&!(W instanceof Number||W instanceof String||W instanceof Boolean)){let D={};for(let $ in W)D[$]=ku(W[$]);return D}return bl(W)}function Ou(W){let D=W.key,$=W.value,he=W.valueSpec||{},Ee=W.objectElementValidators||{},je=W.style,We=W.styleSpec,ct=W.validateSpec,St=[],Nt=sl($);if(Nt!=="object")return[new me(D,$,`object expected, ${Nt} found`)];for(let sr in $){let Er=sr.split(".")[0],Fr=he[Er]||he["*"],Xr;if(Ee[Er])Xr=Ee[Er];else if(he[Er])Xr=ct;else if(Ee["*"])Xr=Ee["*"];else{if(!he["*"]){St.push(new me(D,$[sr],`unknown property "${sr}"`));continue}Xr=ct}St=St.concat(Xr({key:(D&&`${D}.`)+sr,value:$[sr],valueSpec:Fr,style:je,styleSpec:We,object:$,objectKey:sr,validateSpec:ct},$))}for(let sr in he)Ee[sr]||he[sr].required&&he[sr].default===void 0&&$[sr]===void 0&&St.push(new me(D,$,`missing required property "${sr}"`));return St}function Cf(W){let D=W.value,$=W.valueSpec,he=W.style,Ee=W.styleSpec,je=W.key,We=W.arrayElementValidator||W.validateSpec;if(sl(D)!=="array")return[new me(je,D,`array expected, ${sl(D)} found`)];if($.length&&D.length!==$.length)return[new me(je,D,`array length ${$.length} expected, length ${D.length} found`)];if($["min-length"]&&D.length<$["min-length"])return[new me(je,D,`array length at least ${$["min-length"]} expected, length ${D.length} found`)];let ct={type:$.value,values:$.values};Ee.$version<7&&(ct.function=$.function),sl($.value)==="object"&&(ct=$.value);let St=[];for(let Nt=0;Nt<D.length;Nt++)St=St.concat(We({array:D,arrayIndex:Nt,value:D[Nt],valueSpec:ct,validateSpec:W.validateSpec,style:he,styleSpec:Ee,key:`${je}[${Nt}]`}));return St}function Ml(W){let D=W.key,$=W.value,he=W.valueSpec,Ee=sl($);return Ee==="number"&&$!=$&&(Ee="NaN"),Ee!=="number"?[new me(D,$,`number expected, ${Ee} found`)]:"minimum"in he&&$<he.minimum?[new me(D,$,`${$} is less than the minimum value ${he.minimum}`)]:"maximum"in he&&$>he.maximum?[new me(D,$,`${$} is greater than the maximum value ${he.maximum}`)]:[]}function df(W){let D=W.valueSpec,$=bl(W.value.type),he,Ee,je,We={},ct=$!=="categorical"&&W.value.property===void 0,St=!ct,Nt=sl(W.value.stops)==="array"&&sl(W.value.stops[0])==="array"&&sl(W.value.stops[0][0])==="object",sr=Ou({key:W.key,value:W.value,valueSpec:W.styleSpec.function,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,objectElementValidators:{stops:function(Xr){if($==="identity")return[new me(Xr.key,Xr.value,'identity function may not have a "stops" property')];let ni=[],gi=Xr.value;return ni=ni.concat(Cf({key:Xr.key,value:gi,valueSpec:Xr.valueSpec,validateSpec:Xr.validateSpec,style:Xr.style,styleSpec:Xr.styleSpec,arrayElementValidator:Er})),sl(gi)==="array"&&gi.length===0&&ni.push(new me(Xr.key,gi,"array must have at least one stop")),ni},default:function(Xr){return Xr.validateSpec({key:Xr.key,value:Xr.value,valueSpec:D,validateSpec:Xr.validateSpec,style:Xr.style,styleSpec:Xr.styleSpec})}}});return $==="identity"&&ct&&sr.push(new me(W.key,W.value,'missing required property "property"')),$==="identity"||W.value.stops||sr.push(new me(W.key,W.value,'missing required property "stops"')),$==="exponential"&&W.valueSpec.expression&&!Lc(W.valueSpec)&&sr.push(new me(W.key,W.value,"exponential functions not supported")),W.styleSpec.$version>=8&&(St&&!lu(W.valueSpec)?sr.push(new me(W.key,W.value,"property functions not supported")):ct&&!Xc(W.valueSpec)&&sr.push(new me(W.key,W.value,"zoom functions not supported"))),$!=="categorical"&&!Nt||W.value.property!==void 0||sr.push(new me(W.key,W.value,'"property" property is required')),sr;function Er(Xr){let ni=[],gi=Xr.value,Zi=Xr.key;if(sl(gi)!=="array")return[new me(Zi,gi,`array expected, ${sl(gi)} found`)];if(gi.length!==2)return[new me(Zi,gi,`array length 2 expected, length ${gi.length} found`)];if(Nt){if(sl(gi[0])!=="object")return[new me(Zi,gi,`object expected, ${sl(gi[0])} found`)];if(gi[0].zoom===void 0)return[new me(Zi,gi,"object stop key must have zoom")];if(gi[0].value===void 0)return[new me(Zi,gi,"object stop key must have value")];if(je&&je>bl(gi[0].zoom))return[new me(Zi,gi[0].zoom,"stop zoom values must appear in ascending order")];bl(gi[0].zoom)!==je&&(je=bl(gi[0].zoom),Ee=void 0,We={}),ni=ni.concat(Ou({key:`${Zi}[0]`,value:gi[0],valueSpec:{zoom:{}},validateSpec:Xr.validateSpec,style:Xr.style,styleSpec:Xr.styleSpec,objectElementValidators:{zoom:Ml,value:Fr}}))}else ni=ni.concat(Fr({key:`${Zi}[0]`,value:gi[0],valueSpec:{},validateSpec:Xr.validateSpec,style:Xr.style,styleSpec:Xr.styleSpec},gi));return Ic(ku(gi[1]))?ni.concat([new me(`${Zi}[1]`,gi[1],"expressions are not allowed in function stops.")]):ni.concat(Xr.validateSpec({key:`${Zi}[1]`,value:gi[1],valueSpec:D,validateSpec:Xr.validateSpec,style:Xr.style,styleSpec:Xr.styleSpec}))}function Fr(Xr,ni){let gi=sl(Xr.value),Zi=bl(Xr.value),aa=Xr.value!==null?Xr.value:ni;if(he){if(gi!==he)return[new me(Xr.key,aa,`${gi} stop domain type must match previous stop domain type ${he}`)]}else he=gi;if(gi!=="number"&&gi!=="string"&&gi!=="boolean")return[new me(Xr.key,aa,"stop domain value must be a number, string, or boolean")];if(gi!=="number"&&$!=="categorical"){let nn=`number expected, ${gi} found`;return lu(D)&&$===void 0&&(nn+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new me(Xr.key,aa,nn)]}return $!=="categorical"||gi!=="number"||isFinite(Zi)&&Math.floor(Zi)===Zi?$!=="categorical"&&gi==="number"&&Ee!==void 0&&Zi<Ee?[new me(Xr.key,aa,"stop domain values must appear in ascending order")]:(Ee=Zi,$==="categorical"&&Zi in We?[new me(Xr.key,aa,"stop domain values must be unique")]:(We[Zi]=!0,[])):[new me(Xr.key,aa,`integer expected, found ${Zi}`)]}}function Rc(W){let D=(W.expressionContext==="property"?Iu:xl)(ku(W.value),W.valueSpec);if(D.result==="error")return D.value.map(he=>new me(`${W.key}${he.key}`,W.value,he.message));let $=D.value.expression||D.value._styleExpression.expression;if(W.expressionContext==="property"&&W.propertyKey==="text-font"&&!$.outputDefined())return[new me(W.key,W.value,`Invalid data expression for "${W.propertyKey}". Output values must be contained as literals within the expression.`)];if(W.expressionContext==="property"&&W.propertyType==="layout"&&!$u($))return[new me(W.key,W.value,'"feature-state" data expressions are not supported with layout properties.')];if(W.expressionContext==="filter"&&!$u($))return[new me(W.key,W.value,'"feature-state" data expressions are not supported with filters.')];if(W.expressionContext&&W.expressionContext.indexOf("cluster")===0){if(!Ef($,["zoom","feature-state"]))return[new me(W.key,W.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(W.expressionContext==="cluster-initial"&&!zf($))return[new me(W.key,W.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ju(W){let D=W.key,$=W.value,he=W.valueSpec,Ee=[];return Array.isArray(he.values)?he.values.indexOf(bl($))===-1&&Ee.push(new me(D,$,`expected one of [${he.values.join(", ")}], ${JSON.stringify($)} found`)):Object.keys(he.values).indexOf(bl($))===-1&&Ee.push(new me(D,$,`expected one of [${Object.keys(he.values).join(", ")}], ${JSON.stringify($)} found`)),Ee}function xf(W){return Yf(ku(W.value))?Rc(fe({},W,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Qu(W)}function Qu(W){let D=W.value,$=W.key;if(sl(D)!=="array")return[new me($,D,`array expected, ${sl(D)} found`)];let he=W.styleSpec,Ee,je=[];if(D.length<1)return[new me($,D,"filter array must have at least 1 element")];switch(je=je.concat(Ju({key:`${$}[0]`,value:D[0],valueSpec:he.filter_operator,style:W.style,styleSpec:W.styleSpec})),bl(D[0])){case"<":case"<=":case">":case">=":D.length>=2&&bl(D[1])==="$type"&&je.push(new me($,D,`"$type" cannot be use with operator "${D[0]}"`));case"==":case"!=":D.length!==3&&je.push(new me($,D,`filter array for operator "${D[0]}" must have 3 elements`));case"in":case"!in":D.length>=2&&(Ee=sl(D[1]),Ee!=="string"&&je.push(new me(`${$}[1]`,D[1],`string expected, ${Ee} found`)));for(let We=2;We<D.length;We++)Ee=sl(D[We]),bl(D[1])==="$type"?je=je.concat(Ju({key:`${$}[${We}]`,value:D[We],valueSpec:he.geometry_type,style:W.style,styleSpec:W.styleSpec})):Ee!=="string"&&Ee!=="number"&&Ee!=="boolean"&&je.push(new me(`${$}[${We}]`,D[We],`string, number, or boolean expected, ${Ee} found`));break;case"any":case"all":case"none":for(let We=1;We<D.length;We++)je=je.concat(Qu({key:`${$}[${We}]`,value:D[We],style:W.style,styleSpec:W.styleSpec}));break;case"has":case"!has":Ee=sl(D[1]),D.length!==2?je.push(new me($,D,`filter array for "${D[0]}" operator must have 2 elements`)):Ee!=="string"&&je.push(new me(`${$}[1]`,D[1],`string expected, ${Ee} found`))}return je}function ef(W,D){let $=W.key,he=W.validateSpec,Ee=W.style,je=W.styleSpec,We=W.value,ct=W.objectKey,St=je[`${D}_${W.layerType}`];if(!St)return[];let Nt=ct.match(/^(.*)-transition$/);if(D==="paint"&&Nt&&St[Nt[1]]&&St[Nt[1]].transition)return he({key:$,value:We,valueSpec:je.transition,style:Ee,styleSpec:je});let sr=W.valueSpec||St[ct];if(!sr)return[new me($,We,`unknown property "${ct}"`)];let Er;if(sl(We)==="string"&&lu(sr)&&!sr.tokens&&(Er=/^{([^}]+)}$/.exec(We)))return[new me($,We,`"${ct}" does not support interpolation syntax
3214Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(Er[1])} }\`.`)];let Fr=[];return W.layerType==="symbol"&&(ct==="text-field"&&Ee&&!Ee.glyphs&&Fr.push(new me($,We,'use of "text-field" requires a style "glyphs" property')),ct==="text-font"&&kf(ku(We))&&bl(We.type)==="identity"&&Fr.push(new me($,We,'"text-font" does not support identity functions'))),Fr.concat(he({key:W.key,value:We,valueSpec:sr,style:Ee,styleSpec:je,expressionContext:"property",propertyType:D,propertyKey:ct}))}function Lf(W){return ef(W,"paint")}function du(W){return ef(W,"layout")}function Nf(W){let D=[],$=W.value,he=W.key,Ee=W.style,je=W.styleSpec;$.type||$.ref||D.push(new me(he,$,'either "type" or "ref" is required'));let We=bl($.type),ct=bl($.ref);if($.id){let St=bl($.id);for(let Nt=0;Nt<W.arrayIndex;Nt++){let sr=Ee.layers[Nt];bl(sr.id)===St&&D.push(new me(he,$.id,`duplicate layer id "${$.id}", previously used at line ${sr.id.__line__}`))}}if("ref"in $){let St;["type","source","source-layer","filter","layout"].forEach(Nt=>{Nt in $&&D.push(new me(he,$[Nt],`"${Nt}" is prohibited for ref layers`))}),Ee.layers.forEach(Nt=>{bl(Nt.id)===ct&&(St=Nt)}),St?St.ref?D.push(new me(he,$.ref,"ref cannot reference another ref layer")):We=bl(St.type):D.push(new me(he,$.ref,`ref layer "${ct}" not found`))}else if(We!=="background")if($.source){let St=Ee.sources&&Ee.sources[$.source],Nt=St&&bl(St.type);St?Nt==="vector"&&We==="raster"?D.push(new me(he,$.source,`layer "${$.id}" requires a raster source`)):Nt!=="raster-dem"&&We==="hillshade"?D.push(new me(he,$.source,`layer "${$.id}" requires a raster-dem source`)):Nt==="raster"&&We!=="raster"?D.push(new me(he,$.source,`layer "${$.id}" requires a vector source`)):Nt!=="vector"||$["source-layer"]?Nt==="raster-dem"&&We!=="hillshade"?D.push(new me(he,$.source,"raster-dem source can only be used with layer type 'hillshade'.")):We!=="line"||!$.paint||!$.paint["line-gradient"]||Nt==="geojson"&&St.lineMetrics||D.push(new me(he,$,`layer "${$.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):D.push(new me(he,$,`layer "${$.id}" must specify a "source-layer"`)):D.push(new me(he,$.source,`source "${$.source}" not found`))}else D.push(new me(he,$,'missing required property "source"'));return D=D.concat(Ou({key:he,value:$,valueSpec:je.layer,style:W.style,styleSpec:W.styleSpec,validateSpec:W.validateSpec,objectElementValidators:{"*":()=>[],type:()=>W.validateSpec({key:`${he}.type`,value:$.type,valueSpec:je.layer.type,style:W.style,styleSpec:W.styleSpec,validateSpec:W.validateSpec,object:$,objectKey:"type"}),filter:xf,layout:St=>Ou({layer:$,key:St.key,value:St.value,style:St.style,styleSpec:St.styleSpec,validateSpec:St.validateSpec,objectElementValidators:{"*":Nt=>du(fe({layerType:We},Nt))}}),paint:St=>Ou({layer:$,key:St.key,value:St.value,style:St.style,styleSpec:St.styleSpec,validateSpec:St.validateSpec,objectElementValidators:{"*":Nt=>Lf(fe({layerType:We},Nt))}})}})),D}function ec(W){let D=W.value,$=W.key,he=sl(D);return he!=="string"?[new me($,D,`string expected, ${he} found`)]:[]}let Dc={promoteId:function({key:W,value:D}){if(sl(D)==="string")return ec({key:W,value:D});{let $=[];for(let he in D)$.push(...ec({key:`${W}.${he}`,value:D[he]}));return $}}};function bc(W){let D=W.value,$=W.key,he=W.styleSpec,Ee=W.style,je=W.validateSpec;if(!D.type)return[new me($,D,'"type" is required')];let We=bl(D.type),ct;switch(We){case"vector":case"raster":return ct=Ou({key:$,value:D,valueSpec:he[`source_${We.replace("-","_")}`],style:W.style,styleSpec:he,objectElementValidators:Dc,validateSpec:je}),ct;case"raster-dem":return ct=function(St){var Nt;let sr=(Nt=St.sourceName)!==null&&Nt!==void 0?Nt:"",Er=St.value,Fr=St.styleSpec,Xr=Fr.source_raster_dem,ni=St.style,gi=[],Zi=sl(Er);if(Er===void 0)return gi;if(Zi!=="object")return gi.push(new me("source_raster_dem",Er,`object expected, ${Zi} found`)),gi;let aa=bl(Er.encoding)==="custom",nn=["redFactor","greenFactor","blueFactor","baseShift"],Aa=St.value.encoding?`"${St.value.encoding}"`:"Default";for(let Ja in Er)!aa&&nn.includes(Ja)?gi.push(new me(Ja,Er[Ja],`In "${sr}": "${Ja}" is only valid when "encoding" is set to "custom". ${Aa} encoding found`)):Xr[Ja]?gi=gi.concat(St.validateSpec({key:Ja,value:Er[Ja],valueSpec:Xr[Ja],validateSpec:St.validateSpec,style:ni,styleSpec:Fr})):gi.push(new me(Ja,Er[Ja],`unknown property "${Ja}"`));return gi}({sourceName:$,value:D,style:W.style,styleSpec:he,validateSpec:je}),ct;case"geojson":if(ct=Ou({key:$,value:D,valueSpec:he.source_geojson,style:Ee,styleSpec:he,validateSpec:je,objectElementValidators:Dc}),D.cluster)for(let St in D.clusterProperties){let[Nt,sr]=D.clusterProperties[St],Er=typeof Nt=="string"?[Nt,["accumulated"],["get",St]]:Nt;ct.push(...Rc({key:`${$}.${St}.map`,value:sr,validateSpec:je,expressionContext:"cluster-map"})),ct.push(...Rc({key:`${$}.${St}.reduce`,value:Er,validateSpec:je,expressionContext:"cluster-reduce"}))}return ct;case"video":return Ou({key:$,value:D,valueSpec:he.source_video,style:Ee,validateSpec:je,styleSpec:he});case"image":return Ou({key:$,value:D,valueSpec:he.source_image,style:Ee,validateSpec:je,styleSpec:he});case"canvas":return[new me($,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ju({key:`${$}.type`,value:D.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:Ee,validateSpec:je,styleSpec:he})}}function Jl(W){let D=W.value,$=W.styleSpec,he=$.light,Ee=W.style,je=[],We=sl(D);if(D===void 0)return je;if(We!=="object")return je=je.concat([new me("light",D,`object expected, ${We} found`)]),je;for(let ct in D){let St=ct.match(/^(.*)-transition$/);je=je.concat(St&&he[St[1]]&&he[St[1]].transition?W.validateSpec({key:ct,value:D[ct],valueSpec:$.transition,validateSpec:W.validateSpec,style:Ee,styleSpec:$}):he[ct]?W.validateSpec({key:ct,value:D[ct],valueSpec:he[ct],validateSpec:W.validateSpec,style:Ee,styleSpec:$}):[new me(ct,D[ct],`unknown property "${ct}"`)])}return je}function Cu(W){let D=W.value,$=W.styleSpec,he=$.sky,Ee=W.style,je=sl(D);if(D===void 0)return[];if(je!=="object")return[new me("sky",D,`object expected, ${je} found`)];let We=[];for(let ct in D)We=We.concat(he[ct]?W.validateSpec({key:ct,value:D[ct],valueSpec:he[ct],style:Ee,styleSpec:$}):[new me(ct,D[ct],`unknown property "${ct}"`)]);return We}function zc(W){let D=W.value,$=W.styleSpec,he=$.terrain,Ee=W.style,je=[],We=sl(D);if(D===void 0)return je;if(We!=="object")return je=je.concat([new me("terrain",D,`object expected, ${We} found`)]),je;for(let ct in D)je=je.concat(he[ct]?W.validateSpec({key:ct,value:D[ct],valueSpec:he[ct],validateSpec:W.validateSpec,style:Ee,styleSpec:$}):[new me(ct,D[ct],`unknown property "${ct}"`)]);return je}function tf(W){let D=[],$=W.value,he=W.key;if(Array.isArray($)){let Ee=[],je=[];for(let We in $)$[We].id&&Ee.includes($[We].id)&&D.push(new me(he,$,`all the sprites' ids must be unique, but ${$[We].id} is duplicated`)),Ee.push($[We].id),$[We].url&&je.includes($[We].url)&&D.push(new me(he,$,`all the sprites' URLs must be unique, but ${$[We].url} is duplicated`)),je.push($[We].url),D=D.concat(Ou({key:`${he}[${We}]`,value:$[We],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:W.validateSpec}));return D}return ec({key:he,value:$})}let fc={"*":()=>[],array:Cf,boolean:function(W){let D=W.value,$=W.key,he=sl(D);return he!=="boolean"?[new me($,D,`boolean expected, ${he} found`)]:[]},number:Ml,color:function(W){let D=W.key,$=W.value,he=sl($);return he!=="string"?[new me(D,$,`color expected, ${he} found`)]:Jt.parse(String($))?[]:[new me(D,$,`color expected, "${$}" found`)]},constants:_f,enum:Ju,filter:xf,function:df,layer:Nf,object:Ou,source:bc,light:Jl,sky:Cu,terrain:zc,projection:function(W){let D=W.value,$=W.styleSpec,he=$.projection,Ee=W.style,je=sl(D);if(D===void 0)return[];if(je!=="object")return[new me("projection",D,`object expected, ${je} found`)];let We=[];for(let ct in D)We=We.concat(he[ct]?W.validateSpec({key:ct,value:D[ct],valueSpec:he[ct],style:Ee,styleSpec:$}):[new me(ct,D[ct],`unknown property "${ct}"`)]);return We},string:ec,formatted:function(W){return ec(W).length===0?[]:Rc(W)},resolvedImage:function(W){return ec(W).length===0?[]:Rc(W)},padding:function(W){let D=W.key,$=W.value;if(sl($)==="array"){if($.length<1||$.length>4)return[new me(D,$,`padding requires 1 to 4 values; ${$.length} values found`)];let he={type:"number"},Ee=[];for(let je=0;je<$.length;je++)Ee=Ee.concat(W.validateSpec({key:`${D}[${je}]`,value:$[je],validateSpec:W.validateSpec,valueSpec:he}));return Ee}return Ml({key:D,value:$,valueSpec:{}})},variableAnchorOffsetCollection:function(W){let D=W.key,$=W.value,he=sl($),Ee=W.styleSpec;if(he!=="array"||$.length<1||$.length%2!=0)return[new me(D,$,"variableAnchorOffsetCollection requires a non-empty array of even length")];let je=[];for(let We=0;We<$.length;We+=2)je=je.concat(Ju({key:`${D}[${We}]`,value:$[We],valueSpec:Ee.layout_symbol["text-anchor"]})),je=je.concat(Cf({key:`${D}[${We+1}]`,value:$[We+1],valueSpec:{length:2,value:"number"},validateSpec:W.validateSpec,style:W.style,styleSpec:Ee}));return je},sprite:tf};function Fc(W){let D=W.value,$=W.valueSpec,he=W.styleSpec;return W.validateSpec=Fc,$.expression&&kf(bl(D))?df(W):$.expression&&Ic(ku(D))?Rc(W):$.type&&fc[$.type]?fc[$.type](W):Ou(fe({},W,{valueSpec:$.type?he[$.type]:$}))}function er(W){let D=W.value,$=W.key,he=ec(W);return he.length||(D.indexOf("{fontstack}")===-1&&he.push(new me($,D,'"glyphs" url must include a "{fontstack}" token')),D.indexOf("{range}")===-1&&he.push(new me($,D,'"glyphs" url must include a "{range}" token'))),he}function wr(W,D=re){let $=[];return $=$.concat(Fc({key:"",value:W,valueSpec:D.$root,styleSpec:D,style:W,validateSpec:Fc,objectElementValidators:{glyphs:er,"*":()=>[]}})),W.constants&&($=$.concat(_f({key:"constants",value:W.constants,style:W,styleSpec:D,validateSpec:Fc}))),Jr($)}function ai(W){return function(D){return W(yi(Ri({},D),{validateSpec:Fc}))}}function Jr(W){return[].concat(W).sort((D,$)=>D.line-$.line)}function Fi(W){return function(...D){return Jr(W.apply(this,D))}}wr.source=Fi(ai(bc)),wr.sprite=Fi(ai(tf)),wr.glyphs=Fi(ai(er)),wr.light=Fi(ai(Jl)),wr.sky=Fi(ai(Cu)),wr.terrain=Fi(ai(zc)),wr.layer=Fi(ai(Nf)),wr.filter=Fi(ai(xf)),wr.paintProperty=Fi(ai(Lf)),wr.layoutProperty=Fi(ai(du));let pa=wr,Ba=pa.light,an=pa.sky,hn=pa.paintProperty,Ln=pa.layoutProperty;function Na(W,D){let $=!1;if(D&&D.length)for(let he of D)W.fire(new j(new Error(he.message))),$=!0;return $}class qa{constructor(D,$,he){let Ee=this.cells=[];if(D instanceof ArrayBuffer){this.arrayBuffer=D;let We=new Int32Array(this.arrayBuffer);D=We[0],this.d=($=We[1])+2*(he=We[2]);for(let St=0;St<this.d*this.d;St++){let Nt=We[3+St],sr=We[3+St+1];Ee.push(Nt===sr?null:We.subarray(Nt,sr))}let ct=We[3+Ee.length+1];this.keys=We.subarray(We[3+Ee.length],ct),this.bboxes=We.subarray(ct),this.insert=this._insertReadonly}else{this.d=$+2*he;for(let We=0;We<this.d*this.d;We++)Ee.push([]);this.keys=[],this.bboxes=[]}this.n=$,this.extent=D,this.padding=he,this.scale=$/D,this.uid=0;let je=he/$*D;this.min=-je,this.max=D+je}insert(D,$,he,Ee,je){this._forEachCell($,he,Ee,je,this._insertCell,this.uid++,void 0,void 0),this.keys.push(D),this.bboxes.push($),this.bboxes.push(he),this.bboxes.push(Ee),this.bboxes.push(je)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(D,$,he,Ee,je,We){this.cells[je].push(We)}query(D,$,he,Ee,je){let We=this.min,ct=this.max;if(D<=We&&$<=We&&ct<=he&&ct<=Ee&&!je)return Array.prototype.slice.call(this.keys);{let St=[];return this._forEachCell(D,$,he,Ee,this._queryCell,St,{},je),St}}_queryCell(D,$,he,Ee,je,We,ct,St){let Nt=this.cells[je];if(Nt!==null){let sr=this.keys,Er=this.bboxes;for(let Fr=0;Fr<Nt.length;Fr++){let Xr=Nt[Fr];if(ct[Xr]===void 0){let ni=4*Xr;(St?St(Er[ni+0],Er[ni+1],Er[ni+2],Er[ni+3]):D<=Er[ni+2]&&$<=Er[ni+3]&&he>=Er[ni+0]&&Ee>=Er[ni+1])?(ct[Xr]=!0,We.push(sr[Xr])):ct[Xr]=!1}}}}_forEachCell(D,$,he,Ee,je,We,ct,St){let Nt=this._convertToCellCoord(D),sr=this._convertToCellCoord($),Er=this._convertToCellCoord(he),Fr=this._convertToCellCoord(Ee);for(let Xr=Nt;Xr<=Er;Xr++)for(let ni=sr;ni<=Fr;ni++){let gi=this.d*ni+Xr;if((!St||St(this._convertFromCellCoord(Xr),this._convertFromCellCoord(ni),this._convertFromCellCoord(Xr+1),this._convertFromCellCoord(ni+1)))&&je.call(this,D,$,he,Ee,gi,We,ct,St))return}}_convertFromCellCoord(D){return(D-this.padding)/this.scale}_convertToCellCoord(D){return Math.max(0,Math.min(this.d-1,Math.floor(D*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let D=this.cells,$=3+this.cells.length+1+1,he=0;for(let We=0;We<this.cells.length;We++)he+=this.cells[We].length;let Ee=new Int32Array($+he+this.keys.length+this.bboxes.length);Ee[0]=this.extent,Ee[1]=this.n,Ee[2]=this.padding;let je=$;for(let We=0;We<D.length;We++){let ct=D[We];Ee[3+We]=je,Ee.set(ct,je),je+=ct.length}return Ee[3+D.length]=je,Ee.set(this.keys,je),je+=this.keys.length,Ee[3+D.length+1]=je,Ee.set(this.bboxes,je),je+=this.bboxes.length,Ee.buffer}static serialize(D,$){let he=D.toArrayBuffer();return $&&$.push(he),{buffer:he}}static deserialize(D){return new qa(D.buffer)}}let Za={};function Ta(W,D,$={}){if(Za[W])throw new Error(`${W} is already registered.`);Object.defineProperty(D,"_classRegistryKey",{value:W,writeable:!1}),Za[W]={klass:D,omit:$.omit||[],shallow:$.shallow||[]}}Ta("Object",Object),Ta("TransferableGridIndex",qa),Ta("Color",Jt),Ta("Error",Error),Ta("AJAXError",ce),Ta("ResolvedImage",ra),Ta("StylePropertyFunction",Nl),Ta("StyleExpression",Bu,{omit:["_evaluator"]}),Ta("ZoomDependentExpression",Eu),Ta("ZoomConstantExpression",_c),Ta("CompoundExpression",su,{omit:["_evaluate"]});for(let W in uf)uf[W]._classRegistryKey||Ta(`Expression_${W}`,uf[W]);function Hn(W){return W&&typeof ArrayBuffer<"u"&&(W instanceof ArrayBuffer||W.constructor&&W.constructor.name==="ArrayBuffer")}function go(W){return W.$name||W.constructor._classRegistryKey}function wo(W){return!function(D){if(D===null||typeof D!="object")return!1;let $=go(D);return!(!$||$==="Object")}(W)&&(W==null||typeof W=="boolean"||typeof W=="number"||typeof W=="string"||W instanceof Boolean||W instanceof Number||W instanceof String||W instanceof Date||W instanceof RegExp||W instanceof Blob||W instanceof Error||Hn(W)||F(W)||ArrayBuffer.isView(W)||W instanceof ImageData)}function yo(W,D){if(wo(W))return(Hn(W)||F(W))&&D&&D.push(W),ArrayBuffer.isView(W)&&D&&D.push(W.buffer),W instanceof ImageData&&D&&D.push(W.data.buffer),W;if(Array.isArray(W)){let je=[];for(let We of W)je.push(yo(We,D));return je}if(typeof W!="object")throw new Error("can't serialize object of type "+typeof W);let $=go(W);if(!$)throw new Error(`can't serialize object of unregistered class ${W.constructor.name}`);if(!Za[$])throw new Error(`${$} is not registered.`);let{klass:he}=Za[$],Ee=he.serialize?he.serialize(W,D):{};if(he.serialize){if(D&&Ee===D[D.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let je in W){if(!W.hasOwnProperty(je)||Za[$].omit.indexOf(je)>=0)continue;let We=W[je];Ee[je]=Za[$].shallow.indexOf(je)>=0?We:yo(We,D)}W instanceof Error&&(Ee.message=W.message)}if(Ee.$name)throw new Error("$name property is reserved for worker serialization logic.");return $!=="Object"&&(Ee.$name=$),Ee}function Io(W){if(wo(W))return W;if(Array.isArray(W))return W.map(Io);if(typeof W!="object")throw new Error("can't deserialize object of type "+typeof W);let D=go(W)||"Object";if(!Za[D])throw new Error(`can't deserialize unregistered class ${D}`);let{klass:$}=Za[D];if(!$)throw new Error(`can't deserialize unregistered class ${D}`);if($.deserialize)return $.deserialize(W);let he=Object.create($.prototype);for(let Ee of Object.keys(W)){if(Ee==="$name")continue;let je=W[Ee];he[Ee]=Za[D].shallow.indexOf(Ee)>=0?je:Io(je)}return he}class Vn{constructor(){this.first=!0}update(D,$){let he=Math.floor(D);return this.first?(this.first=!1,this.lastIntegerZoom=he,this.lastIntegerZoomTime=0,this.lastZoom=D,this.lastFloorZoom=he,!0):(this.lastFloorZoom>he?(this.lastIntegerZoom=he+1,this.lastIntegerZoomTime=$):this.lastFloorZoom<he&&(this.lastIntegerZoom=he,this.lastIntegerZoomTime=$),D!==this.lastZoom&&(this.lastZoom=D,this.lastFloorZoom=he,!0))}}let wn={"Latin-1 Supplement":W=>W>=128&&W<=255,"Hangul Jamo":W=>W>=4352&&W<=4607,Khmer:W=>W>=6016&&W<=6143,"General Punctuation":W=>W>=8192&&W<=8303,"Letterlike Symbols":W=>W>=8448&&W<=8527,"Number Forms":W=>W>=8528&&W<=8591,"Miscellaneous Technical":W=>W>=8960&&W<=9215,"Control Pictures":W=>W>=9216&&W<=9279,"Optical Character Recognition":W=>W>=9280&&W<=9311,"Enclosed Alphanumerics":W=>W>=9312&&W<=9471,"Geometric Shapes":W=>W>=9632&&W<=9727,"Miscellaneous Symbols":W=>W>=9728&&W<=9983,"Miscellaneous Symbols and Arrows":W=>W>=11008&&W<=11263,"Ideographic Description Characters":W=>W>=12272&&W<=12287,"CJK Symbols and Punctuation":W=>W>=12288&&W<=12351,Katakana:W=>W>=12448&&W<=12543,Kanbun:W=>W>=12688&&W<=12703,"CJK Strokes":W=>W>=12736&&W<=12783,"Enclosed CJK Letters and Months":W=>W>=12800&&W<=13055,"CJK Compatibility":W=>W>=13056&&W<=13311,"Yijing Hexagram Symbols":W=>W>=19904&&W<=19967,"Private Use Area":W=>W>=57344&&W<=63743,"Vertical Forms":W=>W>=65040&&W<=65055,"CJK Compatibility Forms":W=>W>=65072&&W<=65103,"Small Form Variants":W=>W>=65104&&W<=65135,"Halfwidth and Fullwidth Forms":W=>W>=65280&&W<=65519};function Oo(W){for(let D of W)if(Bs(D.charCodeAt(0)))return!0;return!1}function ps(W){for(let D of W)if(!Qs(D.charCodeAt(0)))return!1;return!0}function js(W){let D=W.map($=>{try{return new RegExp(`\\p{sc=${$}}`,"u").source}catch{return null}}).filter($=>$);return new RegExp(D.join("|"),"u")}let pl=js(["Arab","Dupl","Mong","Ougr","Syrc"]);function Qs(W){return!pl.test(String.fromCodePoint(W))}let hl=js(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Bs(W){return!(W!==746&&W!==747&&(W<4352||!(wn["CJK Compatibility Forms"](W)&&!(W>=65097&&W<=65103)||wn["CJK Compatibility"](W)||wn["CJK Strokes"](W)||!(!wn["CJK Symbols and Punctuation"](W)||W>=12296&&W<=12305||W>=12308&&W<=12319||W===12336)||wn["Enclosed CJK Letters and Months"](W)||wn["Ideographic Description Characters"](W)||wn.Kanbun(W)||wn.Katakana(W)&&W!==12540||!(!wn["Halfwidth and Fullwidth Forms"](W)||W===65288||W===65289||W===65293||W>=65306&&W<=65310||W===65339||W===65341||W===65343||W>=65371&&W<=65503||W===65507||W>=65512&&W<=65519)||!(!wn["Small Form Variants"](W)||W>=65112&&W<=65118||W>=65123&&W<=65126)||wn["Vertical Forms"](W)||wn["Yijing Hexagram Symbols"](W)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(W))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(W))||hl.test(String.fromCodePoint(W)))))}function Wl(W){return!(Bs(W)||function(D){return!!(wn["Latin-1 Supplement"](D)&&(D===167||D===169||D===174||D===177||D===188||D===189||D===190||D===215||D===247)||wn["General Punctuation"](D)&&(D===8214||D===8224||D===8225||D===8240||D===8241||D===8251||D===8252||D===8258||D===8263||D===8264||D===8265||D===8273)||wn["Letterlike Symbols"](D)||wn["Number Forms"](D)||wn["Miscellaneous Technical"](D)&&(D>=8960&&D<=8967||D>=8972&&D<=8991||D>=8996&&D<=9e3||D===9003||D>=9085&&D<=9114||D>=9150&&D<=9165||D===9167||D>=9169&&D<=9179||D>=9186&&D<=9215)||wn["Control Pictures"](D)&&D!==9251||wn["Optical Character Recognition"](D)||wn["Enclosed Alphanumerics"](D)||wn["Geometric Shapes"](D)||wn["Miscellaneous Symbols"](D)&&!(D>=9754&&D<=9759)||wn["Miscellaneous Symbols and Arrows"](D)&&(D>=11026&&D<=11055||D>=11088&&D<=11097||D>=11192&&D<=11243)||wn["CJK Symbols and Punctuation"](D)||wn.Katakana(D)||wn["Private Use Area"](D)||wn["CJK Compatibility Forms"](D)||wn["Small Form Variants"](D)||wn["Halfwidth and Fullwidth Forms"](D)||D===8734||D===8756||D===8757||D>=9984&&D<=10087||D>=10102&&D<=10131||D===65532||D===65533)}(W))}let Il=js(["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 wl(W){return Il.test(String.fromCodePoint(W))}function io(W,D){return!(!D&&wl(W)||W>=2304&&W<=3583||W>=3840&&W<=4255||wn.Khmer(W))}function Jo(W){for(let D of W)if(wl(D.charCodeAt(0)))return!0;return!1}let cl=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(W){this.pluginStatus=W.pluginStatus,this.pluginURL=W.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(W){this.applyArabicShaping=W.applyArabicShaping,this.processBidirectionalText=W.processBidirectionalText,this.processStyledBidirectionalText=W.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Zs{constructor(D,$){this.zoom=D,$?(this.now=$.now,this.fadeDuration=$.fadeDuration,this.zoomHistory=$.zoomHistory,this.transition=$.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Vn,this.transition={})}isSupportedScript(D){return function($,he){for(let Ee of $)if(!io(Ee.charCodeAt(0),he))return!1;return!0}(D,cl.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let D=this.zoom,$=D-Math.floor(D),he=this.crossFadingFactor();return D>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:$+(1-$)*he}:{fromScale:.5,toScale:1,t:1-(1-he)*$}}}class gu{constructor(D,$){this.property=D,this.value=$,this.expression=function(he,Ee){if(kf(he))return new Nl(he,Ee);if(Ic(he)){let je=Iu(he,Ee);if(je.result==="error")throw new Error(je.value.map(We=>`${We.key}: ${We.message}`).join(", "));return je.value}{let je=he;return Ee.type==="color"&&typeof he=="string"?je=Jt.parse(he):Ee.type!=="padding"||typeof he!="number"&&!Array.isArray(he)?Ee.type==="variableAnchorOffsetCollection"&&Array.isArray(he)&&(je=oa.parse(he)):je=di.parse(he),{kind:"constant",evaluate:()=>je}}}($===void 0?D.specification.default:$,D.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(D,$,he){return this.property.possiblyEvaluate(this,D,$,he)}}class Nu{constructor(D){this.property=D,this.value=new gu(D,void 0)}transitioned(D,$){return new Bc(this.property,this.value,$,M({},D.transition,this.transition),D.now)}untransitioned(){return new Bc(this.property,this.value,null,{},0)}}class tc{constructor(D){this._properties=D,this._values=Object.create(D.defaultTransitionablePropertyValues)}getValue(D){return u(this._values[D].value.value)}setValue(D,$){Object.prototype.hasOwnProperty.call(this._values,D)||(this._values[D]=new Nu(this._values[D].property)),this._values[D].value=new gu(this._values[D].property,$===null?void 0:u($))}getTransition(D){return u(this._values[D].transition)}setTransition(D,$){Object.prototype.hasOwnProperty.call(this._values,D)||(this._values[D]=new Nu(this._values[D].property)),this._values[D].transition=u($)||void 0}serialize(){let D={};for(let $ of Object.keys(this._values)){let he=this.getValue($);he!==void 0&&(D[$]=he);let Ee=this.getTransition($);Ee!==void 0&&(D[`${$}-transition`]=Ee)}return D}transitioned(D,$){let he=new Lu(this._properties);for(let Ee of Object.keys(this._values))he._values[Ee]=this._values[Ee].transitioned(D,$._values[Ee]);return he}untransitioned(){let D=new Lu(this._properties);for(let $ of Object.keys(this._values))D._values[$]=this._values[$].untransitioned();return D}}class Bc{constructor(D,$,he,Ee,je){this.property=D,this.value=$,this.begin=je+Ee.delay||0,this.end=this.begin+Ee.duration||0,D.specification.transition&&(Ee.delay||Ee.duration)&&(this.prior=he)}possiblyEvaluate(D,$,he){let Ee=D.now||0,je=this.value.possiblyEvaluate(D,$,he),We=this.prior;if(We){if(Ee>this.end)return this.prior=null,je;if(this.value.isDataDriven())return this.prior=null,je;if(Ee<this.begin)return We.possiblyEvaluate(D,$,he);{let ct=(Ee-this.begin)/(this.end-this.begin);return this.property.interpolate(We.possiblyEvaluate(D,$,he),je,function(St){if(St<=0)return 0;if(St>=1)return 1;let Nt=St*St,sr=Nt*St;return 4*(St<.5?sr:3*(St-Nt)+sr-.75)}(ct))}}return je}}class Lu{constructor(D){this._properties=D,this._values=Object.create(D.defaultTransitioningPropertyValues)}possiblyEvaluate(D,$,he){let Ee=new wc(this._properties);for(let je of Object.keys(this._values))Ee._values[je]=this._values[je].possiblyEvaluate(D,$,he);return Ee}hasTransition(){for(let D of Object.keys(this._values))if(this._values[D].prior)return!0;return!1}}class Oc{constructor(D){this._properties=D,this._values=Object.create(D.defaultPropertyValues)}hasValue(D){return this._values[D].value!==void 0}getValue(D){return u(this._values[D].value)}setValue(D,$){this._values[D]=new gu(this._values[D].property,$===null?void 0:u($))}serialize(){let D={};for(let $ of Object.keys(this._values)){let he=this.getValue($);he!==void 0&&(D[$]=he)}return D}possiblyEvaluate(D,$,he){let Ee=new wc(this._properties);for(let je of Object.keys(this._values))Ee._values[je]=this._values[je].possiblyEvaluate(D,$,he);return Ee}}class Pu{constructor(D,$,he){this.property=D,this.value=$,this.parameters=he}isConstant(){return this.value.kind==="constant"}constantOr(D){return this.value.kind==="constant"?this.value.value:D}evaluate(D,$,he,Ee){return this.property.evaluate(this.value,this.parameters,D,$,he,Ee)}}class wc{constructor(D){this._properties=D,this._values=Object.create(D.defaultPossiblyEvaluatedValues)}get(D){return this._values[D]}}class Po{constructor(D){this.specification=D}possiblyEvaluate(D,$){if(D.isDataDriven())throw new Error("Value should not be data driven");return D.expression.evaluate($)}interpolate(D,$,he){let Ee=eo[this.specification.type];return Ee?Ee(D,$,he):D}}class es{constructor(D,$){this.specification=D,this.overrides=$}possiblyEvaluate(D,$,he,Ee){return new Pu(this,D.expression.kind==="constant"||D.expression.kind==="camera"?{kind:"constant",value:D.expression.evaluate($,null,{},he,Ee)}:D.expression,$)}interpolate(D,$,he){if(D.value.kind!=="constant"||$.value.kind!=="constant")return D;if(D.value.value===void 0||$.value.value===void 0)return new Pu(this,{kind:"constant",value:void 0},D.parameters);let Ee=eo[this.specification.type];if(Ee){let je=Ee(D.value.value,$.value.value,he);return new Pu(this,{kind:"constant",value:je},D.parameters)}return D}evaluate(D,$,he,Ee,je,We){return D.kind==="constant"?D.value:D.evaluate($,he,Ee,je,We)}}class Nc extends es{possiblyEvaluate(D,$,he,Ee){if(D.value===void 0)return new Pu(this,{kind:"constant",value:void 0},$);if(D.expression.kind==="constant"){let je=D.expression.evaluate($,null,{},he,Ee),We=D.property.specification.type==="resolvedImage"&&typeof je!="string"?je.name:je,ct=this._calculate(We,We,We,$);return new Pu(this,{kind:"constant",value:ct},$)}if(D.expression.kind==="camera"){let je=this._calculate(D.expression.evaluate({zoom:$.zoom-1}),D.expression.evaluate({zoom:$.zoom}),D.expression.evaluate({zoom:$.zoom+1}),$);return new Pu(this,{kind:"constant",value:je},$)}return new Pu(this,D.expression,$)}evaluate(D,$,he,Ee,je,We){if(D.kind==="source"){let ct=D.evaluate($,he,Ee,je,We);return this._calculate(ct,ct,ct,$)}return D.kind==="composite"?this._calculate(D.evaluate({zoom:Math.floor($.zoom)-1},he,Ee),D.evaluate({zoom:Math.floor($.zoom)},he,Ee),D.evaluate({zoom:Math.floor($.zoom)+1},he,Ee),$):D.value}_calculate(D,$,he,Ee){return Ee.zoom>Ee.zoomHistory.lastIntegerZoom?{from:D,to:$}:{from:he,to:$}}interpolate(D){return D}}class hc{constructor(D){this.specification=D}possiblyEvaluate(D,$,he,Ee){if(D.value!==void 0){if(D.expression.kind==="constant"){let je=D.expression.evaluate($,null,{},he,Ee);return this._calculate(je,je,je,$)}return this._calculate(D.expression.evaluate(new Zs(Math.floor($.zoom-1),$)),D.expression.evaluate(new Zs(Math.floor($.zoom),$)),D.expression.evaluate(new Zs(Math.floor($.zoom+1),$)),$)}}_calculate(D,$,he,Ee){return Ee.zoom>Ee.zoomHistory.lastIntegerZoom?{from:D,to:$}:{from:he,to:$}}interpolate(D){return D}}class rc{constructor(D){this.specification=D}possiblyEvaluate(D,$,he,Ee){return!!D.expression.evaluate($,null,{},he,Ee)}interpolate(){return!1}}class Ue{constructor(D){this.properties=D,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let $ in D){let he=D[$];he.specification.overridable&&this.overridableProperties.push($);let Ee=this.defaultPropertyValues[$]=new gu(he,void 0),je=this.defaultTransitionablePropertyValues[$]=new Nu(he);this.defaultTransitioningPropertyValues[$]=je.untransitioned(),this.defaultPossiblyEvaluatedValues[$]=Ee.possiblyEvaluate({})}}}Ta("DataDrivenProperty",es),Ta("DataConstantProperty",Po),Ta("CrossFadedDataDrivenProperty",Nc),Ta("CrossFadedProperty",hc),Ta("ColorRampProperty",rc);let P="-transition";class ae extends Q{constructor(D,$){if(super(),this.id=D.id,this.type=D.type,this._featureFilter={filter:()=>!0,needGeometry:!1},D.type!=="custom"&&(this.metadata=D.metadata,this.minzoom=D.minzoom,this.maxzoom=D.maxzoom,D.type!=="background"&&(this.source=D.source,this.sourceLayer=D["source-layer"],this.filter=D.filter),$.layout&&(this._unevaluatedLayout=new Oc($.layout)),$.paint)){this._transitionablePaint=new tc($.paint);for(let he in D.paint)this.setPaintProperty(he,D.paint[he],{validate:!1});for(let he in D.layout)this.setLayoutProperty(he,D.layout[he],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new wc($.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(D){return D==="visibility"?this.visibility:this._unevaluatedLayout.getValue(D)}setLayoutProperty(D,$,he={}){$!=null&&this._validate(Ln,`layers.${this.id}.layout.${D}`,D,$,he)||(D!=="visibility"?this._unevaluatedLayout.setValue(D,$):this.visibility=$)}getPaintProperty(D){return D.endsWith(P)?this._transitionablePaint.getTransition(D.slice(0,-11)):this._transitionablePaint.getValue(D)}setPaintProperty(D,$,he={}){if($!=null&&this._validate(hn,`layers.${this.id}.paint.${D}`,D,$,he))return!1;if(D.endsWith(P))return this._transitionablePaint.setTransition(D.slice(0,-11),$||void 0),!1;{let Ee=this._transitionablePaint._values[D],je=Ee.property.specification["property-type"]==="cross-faded-data-driven",We=Ee.value.isDataDriven(),ct=Ee.value;this._transitionablePaint.setValue(D,$),this._handleSpecialPaintPropertyUpdate(D);let St=this._transitionablePaint._values[D].value;return St.isDataDriven()||We||je||this._handleOverridablePaintPropertyUpdate(D,ct,St)}}_handleSpecialPaintPropertyUpdate(D){}_handleOverridablePaintPropertyUpdate(D,$,he){return!1}isHidden(D){return!!(this.minzoom&&D<this.minzoom)||!!(this.maxzoom&&D>=this.maxzoom)||this.visibility==="none"}updateTransitions(D){this._transitioningPaint=this._transitionablePaint.transitioned(D,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(D,$){D.getCrossfadeParameters&&(this._crossfadeParameters=D.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(D,void 0,$)),this.paint=this._transitioningPaint.possiblyEvaluate(D,void 0,$)}serialize(){let D={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&&(D.layout=D.layout||{},D.layout.visibility=this.visibility),v(D,($,he)=>!($===void 0||he==="layout"&&!Object.keys($).length||he==="paint"&&!Object.keys($).length))}_validate(D,$,he,Ee,je={}){return(!je||je.validate!==!1)&&Na(this,D.call(pa,{key:$,layerType:this.type,objectKey:he,value:Ee,styleSpec:re,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let D in this.paint._values){let $=this.paint.get(D);if($ instanceof Pu&&lu($.property.specification)&&($.value.kind==="source"||$.value.kind==="composite")&&$.value.isStateDependent)return!0}return!1}}let xe={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Te{constructor(D,$){this._structArray=D,this._pos1=$*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Oe{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(D,$){return D._trim(),$&&(D.isTransferred=!0,$.push(D.arrayBuffer)),{length:D.length,arrayBuffer:D.arrayBuffer}}static deserialize(D){let $=Object.create(this.prototype);return $.arrayBuffer=D.arrayBuffer,$.length=D.length,$.capacity=D.arrayBuffer.byteLength/$.bytesPerElement,$._refreshViews(),$}_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(D){this.reserve(D),this.length=D}reserve(D){if(D>this.capacity){this.capacity=Math.max(D,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let $=this.uint8;this._refreshViews(),$&&this.uint8.set($)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ht(W,D=1){let $=0,he=0;return{members:W.map(Ee=>{let je=xe[Ee.type].BYTES_PER_ELEMENT,We=$=Tt($,Math.max(D,je)),ct=Ee.components||1;return he=Math.max(he,je),$+=je*ct,{name:Ee.name,type:Ee.type,components:ct,offset:We}}),size:Tt($,Math.max(he,D)),alignment:D}}function Tt(W,D){return Math.ceil(W/D)*D}class Ot extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$){let he=this.length;return this.resize(he+1),this.emplace(he,D,$)}emplace(D,$,he){let Ee=2*D;return this.int16[Ee+0]=$,this.int16[Ee+1]=he,D}}Ot.prototype.bytesPerElement=4,Ta("StructArrayLayout2i4",Ot);class Qt extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$,he){let Ee=this.length;return this.resize(Ee+1),this.emplace(Ee,D,$,he)}emplace(D,$,he,Ee){let je=3*D;return this.int16[je+0]=$,this.int16[je+1]=he,this.int16[je+2]=Ee,D}}Qt.prototype.bytesPerElement=6,Ta("StructArrayLayout3i6",Qt);class Ar extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee){let je=this.length;return this.resize(je+1),this.emplace(je,D,$,he,Ee)}emplace(D,$,he,Ee,je){let We=4*D;return this.int16[We+0]=$,this.int16[We+1]=he,this.int16[We+2]=Ee,this.int16[We+3]=je,D}}Ar.prototype.bytesPerElement=8,Ta("StructArrayLayout4i8",Ar);class Sr extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee,je,We){let ct=this.length;return this.resize(ct+1),this.emplace(ct,D,$,he,Ee,je,We)}emplace(D,$,he,Ee,je,We,ct){let St=6*D;return this.int16[St+0]=$,this.int16[St+1]=he,this.int16[St+2]=Ee,this.int16[St+3]=je,this.int16[St+4]=We,this.int16[St+5]=ct,D}}Sr.prototype.bytesPerElement=12,Ta("StructArrayLayout2i4i12",Sr);class Kr extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee,je,We){let ct=this.length;return this.resize(ct+1),this.emplace(ct,D,$,he,Ee,je,We)}emplace(D,$,he,Ee,je,We,ct){let St=4*D,Nt=8*D;return this.int16[St+0]=$,this.int16[St+1]=he,this.uint8[Nt+4]=Ee,this.uint8[Nt+5]=je,this.uint8[Nt+6]=We,this.uint8[Nt+7]=ct,D}}Kr.prototype.bytesPerElement=8,Ta("StructArrayLayout2i4ub8",Kr);class oi extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,$){let he=this.length;return this.resize(he+1),this.emplace(he,D,$)}emplace(D,$,he){let Ee=2*D;return this.float32[Ee+0]=$,this.float32[Ee+1]=he,D}}oi.prototype.bytesPerElement=8,Ta("StructArrayLayout2f8",oi);class Ge extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee,je,We,ct,St,Nt,sr){let Er=this.length;return this.resize(Er+1),this.emplace(Er,D,$,he,Ee,je,We,ct,St,Nt,sr)}emplace(D,$,he,Ee,je,We,ct,St,Nt,sr,Er){let Fr=10*D;return this.uint16[Fr+0]=$,this.uint16[Fr+1]=he,this.uint16[Fr+2]=Ee,this.uint16[Fr+3]=je,this.uint16[Fr+4]=We,this.uint16[Fr+5]=ct,this.uint16[Fr+6]=St,this.uint16[Fr+7]=Nt,this.uint16[Fr+8]=sr,this.uint16[Fr+9]=Er,D}}Ge.prototype.bytesPerElement=20,Ta("StructArrayLayout10ui20",Ge);class Ze extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr){let Xr=this.length;return this.resize(Xr+1),this.emplace(Xr,D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr)}emplace(D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr){let ni=12*D;return this.int16[ni+0]=$,this.int16[ni+1]=he,this.int16[ni+2]=Ee,this.int16[ni+3]=je,this.uint16[ni+4]=We,this.uint16[ni+5]=ct,this.uint16[ni+6]=St,this.uint16[ni+7]=Nt,this.int16[ni+8]=sr,this.int16[ni+9]=Er,this.int16[ni+10]=Fr,this.int16[ni+11]=Xr,D}}Ze.prototype.bytesPerElement=24,Ta("StructArrayLayout4i4ui4i24",Ze);class ot extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,$,he){let Ee=this.length;return this.resize(Ee+1),this.emplace(Ee,D,$,he)}emplace(D,$,he,Ee){let je=3*D;return this.float32[je+0]=$,this.float32[je+1]=he,this.float32[je+2]=Ee,D}}ot.prototype.bytesPerElement=12,Ta("StructArrayLayout3f12",ot);class dt extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(D){let $=this.length;return this.resize($+1),this.emplace($,D)}emplace(D,$){return this.uint32[1*D+0]=$,D}}dt.prototype.bytesPerElement=4,Ta("StructArrayLayout1ul4",dt);class Ct extends Oe{_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(D,$,he,Ee,je,We,ct,St,Nt){let sr=this.length;return this.resize(sr+1),this.emplace(sr,D,$,he,Ee,je,We,ct,St,Nt)}emplace(D,$,he,Ee,je,We,ct,St,Nt,sr){let Er=10*D,Fr=5*D;return this.int16[Er+0]=$,this.int16[Er+1]=he,this.int16[Er+2]=Ee,this.int16[Er+3]=je,this.int16[Er+4]=We,this.int16[Er+5]=ct,this.uint32[Fr+3]=St,this.uint16[Er+8]=Nt,this.uint16[Er+9]=sr,D}}Ct.prototype.bytesPerElement=20,Ta("StructArrayLayout6i1ul2ui20",Ct);class wt extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee,je,We){let ct=this.length;return this.resize(ct+1),this.emplace(ct,D,$,he,Ee,je,We)}emplace(D,$,he,Ee,je,We,ct){let St=6*D;return this.int16[St+0]=$,this.int16[St+1]=he,this.int16[St+2]=Ee,this.int16[St+3]=je,this.int16[St+4]=We,this.int16[St+5]=ct,D}}wt.prototype.bytesPerElement=12,Ta("StructArrayLayout2i2i2i12",wt);class Dt extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee,je){let We=this.length;return this.resize(We+1),this.emplace(We,D,$,he,Ee,je)}emplace(D,$,he,Ee,je,We){let ct=4*D,St=8*D;return this.float32[ct+0]=$,this.float32[ct+1]=he,this.float32[ct+2]=Ee,this.int16[St+6]=je,this.int16[St+7]=We,D}}Dt.prototype.bytesPerElement=16,Ta("StructArrayLayout2f1f2i16",Dt);class fr extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee,je,We){let ct=this.length;return this.resize(ct+1),this.emplace(ct,D,$,he,Ee,je,We)}emplace(D,$,he,Ee,je,We,ct){let St=16*D,Nt=4*D,sr=8*D;return this.uint8[St+0]=$,this.uint8[St+1]=he,this.float32[Nt+1]=Ee,this.float32[Nt+2]=je,this.int16[sr+6]=We,this.int16[sr+7]=ct,D}}fr.prototype.bytesPerElement=16,Ta("StructArrayLayout2ub2f2i16",fr);class _r extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,$,he){let Ee=this.length;return this.resize(Ee+1),this.emplace(Ee,D,$,he)}emplace(D,$,he,Ee){let je=3*D;return this.uint16[je+0]=$,this.uint16[je+1]=he,this.uint16[je+2]=Ee,D}}_r.prototype.bytesPerElement=6,Ta("StructArrayLayout3ui6",_r);class kr extends Oe{_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(D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni,gi,Zi,aa){let nn=this.length;return this.resize(nn+1),this.emplace(nn,D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni,gi,Zi,aa)}emplace(D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni,gi,Zi,aa,nn){let Aa=24*D,Ja=12*D,dn=48*D;return this.int16[Aa+0]=$,this.int16[Aa+1]=he,this.uint16[Aa+2]=Ee,this.uint16[Aa+3]=je,this.uint32[Ja+2]=We,this.uint32[Ja+3]=ct,this.uint32[Ja+4]=St,this.uint16[Aa+10]=Nt,this.uint16[Aa+11]=sr,this.uint16[Aa+12]=Er,this.float32[Ja+7]=Fr,this.float32[Ja+8]=Xr,this.uint8[dn+36]=ni,this.uint8[dn+37]=gi,this.uint8[dn+38]=Zi,this.uint32[Ja+10]=aa,this.int16[Aa+22]=nn,D}}kr.prototype.bytesPerElement=48,Ta("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",kr);class Vr extends Oe{_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(D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni,gi,Zi,aa,nn,Aa,Ja,dn,no,Zo,Ds,Fo,Jn,_s,ls){let is=this.length;return this.resize(is+1),this.emplace(is,D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni,gi,Zi,aa,nn,Aa,Ja,dn,no,Zo,Ds,Fo,Jn,_s,ls)}emplace(D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni,gi,Zi,aa,nn,Aa,Ja,dn,no,Zo,Ds,Fo,Jn,_s,ls,is){let Nn=32*D,Ts=16*D;return this.int16[Nn+0]=$,this.int16[Nn+1]=he,this.int16[Nn+2]=Ee,this.int16[Nn+3]=je,this.int16[Nn+4]=We,this.int16[Nn+5]=ct,this.int16[Nn+6]=St,this.int16[Nn+7]=Nt,this.uint16[Nn+8]=sr,this.uint16[Nn+9]=Er,this.uint16[Nn+10]=Fr,this.uint16[Nn+11]=Xr,this.uint16[Nn+12]=ni,this.uint16[Nn+13]=gi,this.uint16[Nn+14]=Zi,this.uint16[Nn+15]=aa,this.uint16[Nn+16]=nn,this.uint16[Nn+17]=Aa,this.uint16[Nn+18]=Ja,this.uint16[Nn+19]=dn,this.uint16[Nn+20]=no,this.uint16[Nn+21]=Zo,this.uint16[Nn+22]=Ds,this.uint32[Ts+12]=Fo,this.float32[Ts+13]=Jn,this.float32[Ts+14]=_s,this.uint16[Nn+30]=ls,this.uint16[Nn+31]=is,D}}Vr.prototype.bytesPerElement=64,Ta("StructArrayLayout8i15ui1ul2f2ui64",Vr);class Qr extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D){let $=this.length;return this.resize($+1),this.emplace($,D)}emplace(D,$){return this.float32[1*D+0]=$,D}}Qr.prototype.bytesPerElement=4,Ta("StructArrayLayout1f4",Qr);class _i extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,$,he){let Ee=this.length;return this.resize(Ee+1),this.emplace(Ee,D,$,he)}emplace(D,$,he,Ee){let je=3*D;return this.uint16[6*D+0]=$,this.float32[je+1]=he,this.float32[je+2]=Ee,D}}_i.prototype.bytesPerElement=12,Ta("StructArrayLayout1ui2f12",_i);class Pi extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,$,he){let Ee=this.length;return this.resize(Ee+1),this.emplace(Ee,D,$,he)}emplace(D,$,he,Ee){let je=4*D;return this.uint32[2*D+0]=$,this.uint16[je+2]=he,this.uint16[je+3]=Ee,D}}Pi.prototype.bytesPerElement=8,Ta("StructArrayLayout1ul2ui8",Pi);class qi extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,$){let he=this.length;return this.resize(he+1),this.emplace(he,D,$)}emplace(D,$,he){let Ee=2*D;return this.uint16[Ee+0]=$,this.uint16[Ee+1]=he,D}}qi.prototype.bytesPerElement=4,Ta("StructArrayLayout2ui4",qi);class ga extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D){let $=this.length;return this.resize($+1),this.emplace($,D)}emplace(D,$){return this.uint16[1*D+0]=$,D}}ga.prototype.bytesPerElement=2,Ta("StructArrayLayout1ui2",ga);class Qa extends Oe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,$,he,Ee){let je=this.length;return this.resize(je+1),this.emplace(je,D,$,he,Ee)}emplace(D,$,he,Ee,je){let We=4*D;return this.float32[We+0]=$,this.float32[We+1]=he,this.float32[We+2]=Ee,this.float32[We+3]=je,D}}Qa.prototype.bytesPerElement=16,Ta("StructArrayLayout4f16",Qa);class $a extends Te{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 n(this.anchorPointX,this.anchorPointY)}}$a.prototype.size=20;class yn extends Ct{get(D){return new $a(this,D)}}Ta("CollisionBoxArray",yn);class qn extends Te{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(D){this._structArray.uint8[this._pos1+37]=D}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(D){this._structArray.uint8[this._pos1+38]=D}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(D){this._structArray.uint32[this._pos4+10]=D}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}qn.prototype.size=48;class po extends kr{get(D){return new qn(this,D)}}Ta("PlacedSymbolArray",po);class to extends Te{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(D){this._structArray.uint32[this._pos4+12]=D}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]}}to.prototype.size=64;class Vo extends Vr{get(D){return new to(this,D)}}Ta("SymbolInstanceArray",Vo);class bs extends Qr{getoffsetX(D){return this.float32[1*D+0]}}Ta("GlyphOffsetArray",bs);class Ho extends Qt{getx(D){return this.int16[3*D+0]}gety(D){return this.int16[3*D+1]}gettileUnitDistanceFromAnchor(D){return this.int16[3*D+2]}}Ta("SymbolLineVertexArray",Ho);class ds extends Te{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]}}ds.prototype.size=12;class Is extends _i{get(D){return new ds(this,D)}}Ta("TextAnchorOffsetArray",Is);class Tl extends Te{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]}}Tl.prototype.size=8;class dl extends Pi{get(D){return new Tl(this,D)}}Ta("FeatureIndexArray",dl);class ms extends Ot{}class gs extends Ot{}class ql extends Ot{}class uu extends Sr{}class Uu extends Kr{}class Su extends oi{}class Fl extends Ge{}class yu extends Ze{}class dc extends ot{}class Ql extends dt{}class eu extends wt{}class de extends fr{}class Fe extends _r{}class Je extends qi{}let vt=ht([{name:"a_pos",components:2,type:"Int16"}],4),{members:_t}=vt;class At{constructor(D=[]){this.segments=D}prepareSegment(D,$,he,Ee){let je=this.segments[this.segments.length-1];return D>At.MAX_VERTEX_ARRAY_LENGTH&&f(`Max vertices per segment is ${At.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${D}`),(!je||je.vertexLength+D>At.MAX_VERTEX_ARRAY_LENGTH||je.sortKey!==Ee)&&(je={vertexOffset:$.length,primitiveOffset:he.length,vertexLength:0,primitiveLength:0},Ee!==void 0&&(je.sortKey=Ee),this.segments.push(je)),je}get(){return this.segments}destroy(){for(let D of this.segments)for(let $ in D.vaos)D.vaos[$].destroy()}static simpleSegment(D,$,he,Ee){return new At([{vertexOffset:D,primitiveOffset:$,vertexLength:he,primitiveLength:Ee,vaos:{},sortKey:0}])}}function ar(W,D){return 256*(W=w(Math.floor(W),0,255))+w(Math.floor(D),0,255)}At.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ta("SegmentVector",At);let Ft=ht([{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 xr={exports:{}},Gr={exports:{}};Gr.exports=function(W,D){var $,he,Ee,je,We,ct,St,Nt;for(he=W.length-($=3&W.length),Ee=D,We=3432918353,ct=461845907,Nt=0;Nt<he;)St=255&W.charCodeAt(Nt)|(255&W.charCodeAt(++Nt))<<8|(255&W.charCodeAt(++Nt))<<16|(255&W.charCodeAt(++Nt))<<24,++Nt,Ee=27492+(65535&(je=5*(65535&(Ee=(Ee^=St=(65535&(St=(St=(65535&St)*We+(((St>>>16)*We&65535)<<16)&4294967295)<<15|St>>>17))*ct+(((St>>>16)*ct&65535)<<16)&4294967295)<<13|Ee>>>19))+((5*(Ee>>>16)&65535)<<16)&4294967295))+((58964+(je>>>16)&65535)<<16);switch(St=0,$){case 3:St^=(255&W.charCodeAt(Nt+2))<<16;case 2:St^=(255&W.charCodeAt(Nt+1))<<8;case 1:Ee^=St=(65535&(St=(St=(65535&(St^=255&W.charCodeAt(Nt)))*We+(((St>>>16)*We&65535)<<16)&4294967295)<<15|St>>>17))*ct+(((St>>>16)*ct&65535)<<16)&4294967295}return Ee^=W.length,Ee=2246822507*(65535&(Ee^=Ee>>>16))+((2246822507*(Ee>>>16)&65535)<<16)&4294967295,Ee=3266489909*(65535&(Ee^=Ee>>>13))+((3266489909*(Ee>>>16)&65535)<<16)&4294967295,(Ee^=Ee>>>16)>>>0};var Yr=Gr.exports,Ei={exports:{}};Ei.exports=function(W,D){for(var $,he=W.length,Ee=D^he,je=0;he>=4;)$=1540483477*(65535&($=255&W.charCodeAt(je)|(255&W.charCodeAt(++je))<<8|(255&W.charCodeAt(++je))<<16|(255&W.charCodeAt(++je))<<24))+((1540483477*($>>>16)&65535)<<16),Ee=1540483477*(65535&Ee)+((1540483477*(Ee>>>16)&65535)<<16)^($=1540483477*(65535&($^=$>>>24))+((1540483477*($>>>16)&65535)<<16)),he-=4,++je;switch(he){case 3:Ee^=(255&W.charCodeAt(je+2))<<16;case 2:Ee^=(255&W.charCodeAt(je+1))<<8;case 1:Ee=1540483477*(65535&(Ee^=255&W.charCodeAt(je)))+((1540483477*(Ee>>>16)&65535)<<16)}return Ee=1540483477*(65535&(Ee^=Ee>>>13))+((1540483477*(Ee>>>16)&65535)<<16),(Ee^=Ee>>>15)>>>0};var xi=Yr,na=Ei.exports;xr.exports=xi,xr.exports.murmur3=xi,xr.exports.murmur2=na;var ua=r(xr.exports);class Di{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(D,$,he,Ee){this.ids.push(Hi(D)),this.positions.push($,he,Ee)}getPositions(D){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let $=Hi(D),he=0,Ee=this.ids.length-1;for(;he<Ee;){let We=he+Ee>>1;this.ids[We]>=$?Ee=We:he=We+1}let je=[];for(;this.ids[he]===$;)je.push({index:this.positions[3*he],start:this.positions[3*he+1],end:this.positions[3*he+2]}),he++;return je}static serialize(D,$){let he=new Float64Array(D.ids),Ee=new Uint32Array(D.positions);return ta(he,Ee,0,he.length-1),$&&$.push(he.buffer,Ee.buffer),{ids:he,positions:Ee}}static deserialize(D){let $=new Di;return $.ids=D.ids,$.positions=D.positions,$.indexed=!0,$}}function Hi(W){let D=+W;return!isNaN(D)&&D<=Number.MAX_SAFE_INTEGER?D:ua(String(W))}function ta(W,D,$,he){for(;$<he;){let Ee=W[$+he>>1],je=$-1,We=he+1;for(;;){do je++;while(W[je]<Ee);do We--;while(W[We]>Ee);if(je>=We)break;ya(W,je,We),ya(D,3*je,3*We),ya(D,3*je+1,3*We+1),ya(D,3*je+2,3*We+2)}We-$<he-We?(ta(W,D,$,We),$=We+1):(ta(W,D,We+1,he),he=We)}}function ya(W,D,$){let he=W[D];W[D]=W[$],W[$]=he}Ta("FeaturePositionMap",Di);class da{constructor(D,$){this.gl=D.gl,this.location=$}}class Oi extends da{constructor(D,$){super(D,$),this.current=0}set(D){this.current!==D&&(this.current=D,this.gl.uniform1f(this.location,D))}}class xn extends da{constructor(D,$){super(D,$),this.current=[0,0,0,0]}set(D){D[0]===this.current[0]&&D[1]===this.current[1]&&D[2]===this.current[2]&&D[3]===this.current[3]||(this.current=D,this.gl.uniform4f(this.location,D[0],D[1],D[2],D[3]))}}class mn extends da{constructor(D,$){super(D,$),this.current=Jt.transparent}set(D){D.r===this.current.r&&D.g===this.current.g&&D.b===this.current.b&&D.a===this.current.a||(this.current=D,this.gl.uniform4f(this.location,D.r,D.g,D.b,D.a))}}let In=new Float32Array(16);function Yn(W){return[ar(255*W.r,255*W.g),ar(255*W.b,255*W.a)]}class mo{constructor(D,$,he){this.value=D,this.uniformNames=$.map(Ee=>`u_${Ee}`),this.type=he}setUniform(D,$,he){D.set(he.constantOr(this.value))}getBinding(D,$,he){return this.type==="color"?new mn(D,$):new Oi(D,$)}}class bo{constructor(D,$){this.uniformNames=$.map(he=>`u_${he}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(D,$){this.pixelRatioFrom=$.pixelRatio,this.pixelRatioTo=D.pixelRatio,this.patternFrom=$.tlbr,this.patternTo=D.tlbr}setUniform(D,$,he,Ee){let je=Ee==="u_pattern_to"?this.patternTo:Ee==="u_pattern_from"?this.patternFrom:Ee==="u_pixel_ratio_to"?this.pixelRatioTo:Ee==="u_pixel_ratio_from"?this.pixelRatioFrom:null;je&&D.set(je)}getBinding(D,$,he){return he.substr(0,9)==="u_pattern"?new xn(D,$):new Oi(D,$)}}class vs{constructor(D,$,he,Ee){this.expression=D,this.type=he,this.maxValue=0,this.paintVertexAttributes=$.map(je=>({name:`a_${je}`,type:"Float32",components:he==="color"?2:1,offset:0})),this.paintVertexArray=new Ee}populatePaintArray(D,$,he,Ee,je){let We=this.paintVertexArray.length,ct=this.expression.evaluate(new Zs(0),$,{},Ee,[],je);this.paintVertexArray.resize(D),this._setPaintValue(We,D,ct)}updatePaintArray(D,$,he,Ee){let je=this.expression.evaluate({zoom:0},he,Ee);this._setPaintValue(D,$,je)}_setPaintValue(D,$,he){if(this.type==="color"){let Ee=Yn(he);for(let je=D;je<$;je++)this.paintVertexArray.emplace(je,Ee[0],Ee[1])}else{for(let Ee=D;Ee<$;Ee++)this.paintVertexArray.emplace(Ee,he);this.maxValue=Math.max(this.maxValue,Math.abs(he))}}upload(D){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=D.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class To{constructor(D,$,he,Ee,je,We){this.expression=D,this.uniformNames=$.map(ct=>`u_${ct}_t`),this.type=he,this.useIntegerZoom=Ee,this.zoom=je,this.maxValue=0,this.paintVertexAttributes=$.map(ct=>({name:`a_${ct}`,type:"Float32",components:he==="color"?4:2,offset:0})),this.paintVertexArray=new We}populatePaintArray(D,$,he,Ee,je){let We=this.expression.evaluate(new Zs(this.zoom),$,{},Ee,[],je),ct=this.expression.evaluate(new Zs(this.zoom+1),$,{},Ee,[],je),St=this.paintVertexArray.length;this.paintVertexArray.resize(D),this._setPaintValue(St,D,We,ct)}updatePaintArray(D,$,he,Ee){let je=this.expression.evaluate({zoom:this.zoom},he,Ee),We=this.expression.evaluate({zoom:this.zoom+1},he,Ee);this._setPaintValue(D,$,je,We)}_setPaintValue(D,$,he,Ee){if(this.type==="color"){let je=Yn(he),We=Yn(Ee);for(let ct=D;ct<$;ct++)this.paintVertexArray.emplace(ct,je[0],je[1],We[0],We[1])}else{for(let je=D;je<$;je++)this.paintVertexArray.emplace(je,he,Ee);this.maxValue=Math.max(this.maxValue,Math.abs(he),Math.abs(Ee))}}upload(D){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=D.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(D,$){let he=this.useIntegerZoom?Math.floor($.zoom):$.zoom,Ee=w(this.expression.interpolationFactor(he,this.zoom,this.zoom+1),0,1);D.set(Ee)}getBinding(D,$,he){return new Oi(D,$)}}class cs{constructor(D,$,he,Ee,je,We){this.expression=D,this.type=$,this.useIntegerZoom=he,this.zoom=Ee,this.layerId=We,this.zoomInPaintVertexArray=new je,this.zoomOutPaintVertexArray=new je}populatePaintArray(D,$,he){let Ee=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(D),this.zoomOutPaintVertexArray.resize(D),this._setPaintValues(Ee,D,$.patterns&&$.patterns[this.layerId],he)}updatePaintArray(D,$,he,Ee,je){this._setPaintValues(D,$,he.patterns&&he.patterns[this.layerId],je)}_setPaintValues(D,$,he,Ee){if(!Ee||!he)return;let{min:je,mid:We,max:ct}=he,St=Ee[je],Nt=Ee[We],sr=Ee[ct];if(St&&Nt&&sr)for(let Er=D;Er<$;Er++)this.zoomInPaintVertexArray.emplace(Er,Nt.tl[0],Nt.tl[1],Nt.br[0],Nt.br[1],St.tl[0],St.tl[1],St.br[0],St.br[1],Nt.pixelRatio,St.pixelRatio),this.zoomOutPaintVertexArray.emplace(Er,Nt.tl[0],Nt.tl[1],Nt.br[0],Nt.br[1],sr.tl[0],sr.tl[1],sr.br[0],sr.br[1],Nt.pixelRatio,sr.pixelRatio)}upload(D){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=D.createVertexBuffer(this.zoomInPaintVertexArray,Ft.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=D.createVertexBuffer(this.zoomOutPaintVertexArray,Ft.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Al{constructor(D,$,he){this.binders={},this._buffers=[];let Ee=[];for(let je in D.paint._values){if(!he(je))continue;let We=D.paint.get(je);if(!(We instanceof Pu&&lu(We.property.specification)))continue;let ct=Pl(je,D.type),St=We.value,Nt=We.property.specification.type,sr=We.property.useIntegerZoom,Er=We.property.specification["property-type"],Fr=Er==="cross-faded"||Er==="cross-faded-data-driven";if(St.kind==="constant")this.binders[je]=Fr?new bo(St.value,ct):new mo(St.value,ct,Nt),Ee.push(`/u_${je}`);else if(St.kind==="source"||Fr){let Xr=Dn(je,Nt,"source");this.binders[je]=Fr?new cs(St,Nt,sr,$,Xr,D.id):new vs(St,ct,Nt,Xr),Ee.push(`/a_${je}`)}else{let Xr=Dn(je,Nt,"composite");this.binders[je]=new To(St,ct,Nt,sr,$,Xr),Ee.push(`/z_${je}`)}}this.cacheKey=Ee.sort().join("")}getMaxValue(D){let $=this.binders[D];return $ instanceof vs||$ instanceof To?$.maxValue:0}populatePaintArrays(D,$,he,Ee,je){for(let We in this.binders){let ct=this.binders[We];(ct instanceof vs||ct instanceof To||ct instanceof cs)&&ct.populatePaintArray(D,$,he,Ee,je)}}setConstantPatternPositions(D,$){for(let he in this.binders){let Ee=this.binders[he];Ee instanceof bo&&Ee.setConstantPatternPositions(D,$)}}updatePaintArrays(D,$,he,Ee,je){let We=!1;for(let ct in D){let St=$.getPositions(ct);for(let Nt of St){let sr=he.feature(Nt.index);for(let Er in this.binders){let Fr=this.binders[Er];if((Fr instanceof vs||Fr instanceof To||Fr instanceof cs)&&Fr.expression.isStateDependent===!0){let Xr=Ee.paint.get(Er);Fr.expression=Xr.value,Fr.updatePaintArray(Nt.start,Nt.end,sr,D[ct],je),We=!0}}}}return We}defines(){let D=[];for(let $ in this.binders){let he=this.binders[$];(he instanceof mo||he instanceof bo)&&D.push(...he.uniformNames.map(Ee=>`#define HAS_UNIFORM_${Ee}`))}return D}getBinderAttributes(){let D=[];for(let $ in this.binders){let he=this.binders[$];if(he instanceof vs||he instanceof To)for(let Ee=0;Ee<he.paintVertexAttributes.length;Ee++)D.push(he.paintVertexAttributes[Ee].name);else if(he instanceof cs)for(let Ee=0;Ee<Ft.members.length;Ee++)D.push(Ft.members[Ee].name)}return D}getBinderUniforms(){let D=[];for(let $ in this.binders){let he=this.binders[$];if(he instanceof mo||he instanceof bo||he instanceof To)for(let Ee of he.uniformNames)D.push(Ee)}return D}getPaintVertexBuffers(){return this._buffers}getUniforms(D,$){let he=[];for(let Ee in this.binders){let je=this.binders[Ee];if(je instanceof mo||je instanceof bo||je instanceof To){for(let We of je.uniformNames)if($[We]){let ct=je.getBinding(D,$[We],We);he.push({name:We,property:Ee,binding:ct})}}}return he}setUniforms(D,$,he,Ee){for(let{name:je,property:We,binding:ct}of $)this.binders[We].setUniform(ct,Ee,he.get(We),je)}updatePaintBuffers(D){this._buffers=[];for(let $ in this.binders){let he=this.binders[$];if(D&&he instanceof cs){let Ee=D.fromScale===2?he.zoomInPaintVertexBuffer:he.zoomOutPaintVertexBuffer;Ee&&this._buffers.push(Ee)}else(he instanceof vs||he instanceof To)&&he.paintVertexBuffer&&this._buffers.push(he.paintVertexBuffer)}}upload(D){for(let $ in this.binders){let he=this.binders[$];(he instanceof vs||he instanceof To||he instanceof cs)&&he.upload(D)}this.updatePaintBuffers()}destroy(){for(let D in this.binders){let $=this.binders[D];($ instanceof vs||$ instanceof To||$ instanceof cs)&&$.destroy()}}}class ml{constructor(D,$,he=()=>!0){this.programConfigurations={};for(let Ee of D)this.programConfigurations[Ee.id]=new Al(Ee,$,he);this.needsUpload=!1,this._featureMap=new Di,this._bufferOffset=0}populatePaintArrays(D,$,he,Ee,je,We){for(let ct in this.programConfigurations)this.programConfigurations[ct].populatePaintArrays(D,$,Ee,je,We);$.id!==void 0&&this._featureMap.add($.id,he,this._bufferOffset,D),this._bufferOffset=D,this.needsUpload=!0}updatePaintArrays(D,$,he,Ee){for(let je of he)this.needsUpload=this.programConfigurations[je.id].updatePaintArrays(D,this._featureMap,$,je,Ee)||this.needsUpload}get(D){return this.programConfigurations[D]}upload(D){if(this.needsUpload){for(let $ in this.programConfigurations)this.programConfigurations[$].upload(D);this.needsUpload=!1}}destroy(){for(let D in this.programConfigurations)this.programConfigurations[D].destroy()}}function Pl(W,D){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"]}[W]||[W.replace(`${D}-`,"").replace(/-/g,"_")]}function Dn(W,D,$){let he={color:{source:oi,composite:Qa},number:{source:Qr,composite:oi}},Ee=function(je){return{"line-pattern":{source:Fl,composite:Fl},"fill-pattern":{source:Fl,composite:Fl},"fill-extrusion-pattern":{source:Fl,composite:Fl}}[je]}(W);return Ee&&Ee[$]||he[D][$]}Ta("ConstantBinder",mo),Ta("CrossFadedConstantBinder",bo),Ta("SourceExpressionBinder",vs),Ta("CrossFadedCompositeBinder",cs),Ta("CompositeExpressionBinder",To),Ta("ProgramConfiguration",Al,{omit:["_buffers"]}),Ta("ProgramConfigurationSet",ml);let zo=8192,ks=Math.pow(2,14)-1,Rs=-ks-1;function Bl(W){let D=zo/W.extent,$=W.loadGeometry();for(let he=0;he<$.length;he++){let Ee=$[he];for(let je=0;je<Ee.length;je++){let We=Ee[je],ct=Math.round(We.x*D),St=Math.round(We.y*D);We.x=w(ct,Rs,ks),We.y=w(St,Rs,ks),(ct<We.x||ct>We.x+1||St<We.y||St>We.y+1)&&f("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return $}function tu(W,D){return{type:W.type,id:W.id,properties:W.properties,geometry:D?Bl(W):[]}}function Ru(W,D,$,he,Ee){W.emplaceBack(2*D+(he+1)/2,2*$+(Ee+1)/2)}class Hl{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map($=>$.id),this.index=D.index,this.hasPattern=!1,this.layoutVertexArray=new gs,this.indexArray=new Fe,this.segments=new At,this.programConfigurations=new ml(D.layers,D.zoom),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(D,$,he){let Ee=this.layers[0],je=[],We=null,ct=!1;Ee.type==="circle"&&(We=Ee.layout.get("circle-sort-key"),ct=!We.isConstant());for(let{feature:St,id:Nt,index:sr,sourceLayerIndex:Er}of D){let Fr=this.layers[0]._featureFilter.needGeometry,Xr=tu(St,Fr);if(!this.layers[0]._featureFilter.filter(new Zs(this.zoom),Xr,he))continue;let ni=ct?We.evaluate(Xr,{},he):void 0,gi={id:Nt,properties:St.properties,type:St.type,sourceLayerIndex:Er,index:sr,geometry:Fr?Xr.geometry:Bl(St),patterns:{},sortKey:ni};je.push(gi)}ct&&je.sort((St,Nt)=>St.sortKey-Nt.sortKey);for(let St of je){let{geometry:Nt,index:sr,sourceLayerIndex:Er}=St,Fr=D[sr].feature;this.addFeature(St,Nt,sr,he),$.featureIndex.insert(Fr,Nt,sr,Er,this.index)}}update(D,$,he){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,$,this.stateDependentLayers,he)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(D){this.uploaded||(this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,_t),this.indexBuffer=D.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(D),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(D,$,he,Ee){for(let je of $)for(let We of je){let ct=We.x,St=We.y;if(ct<0||ct>=zo||St<0||St>=zo)continue;let Nt=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,D.sortKey),sr=Nt.vertexLength;Ru(this.layoutVertexArray,ct,St,-1,-1),Ru(this.layoutVertexArray,ct,St,1,-1),Ru(this.layoutVertexArray,ct,St,1,1),Ru(this.layoutVertexArray,ct,St,-1,1),this.indexArray.emplaceBack(sr,sr+1,sr+2),this.indexArray.emplaceBack(sr,sr+3,sr+2),Nt.vertexLength+=4,Nt.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,he,{},Ee)}}function Tc(W,D){for(let $=0;$<W.length;$++)if(ka(D,W[$]))return!0;for(let $=0;$<D.length;$++)if(ka(W,D[$]))return!0;return!!li(W,D)}function rt(W,D,$){return!!ka(W,D)||!!Ti(D,W,$)}function Yt(W,D){if(W.length===1)return ia(D,W[0]);for(let $=0;$<D.length;$++){let he=D[$];for(let Ee=0;Ee<he.length;Ee++)if(ka(W,he[Ee]))return!0}for(let $=0;$<W.length;$++)if(ia(D,W[$]))return!0;for(let $=0;$<D.length;$++)if(li(W,D[$]))return!0;return!1}function hr(W,D,$){if(W.length>1){if(li(W,D))return!0;for(let he=0;he<D.length;he++)if(Ti(D[he],W,$))return!0}for(let he=0;he<W.length;he++)if(Ti(W[he],D,$))return!0;return!1}function li(W,D){if(W.length===0||D.length===0)return!1;for(let $=0;$<W.length-1;$++){let he=W[$],Ee=W[$+1];for(let je=0;je<D.length-1;je++)if(Ci(he,Ee,D[je],D[je+1]))return!0}return!1}function Ci(W,D,$,he){return R(W,$,he)!==R(D,$,he)&&R(W,D,$)!==R(W,D,he)}function Ti(W,D,$){let he=$*$;if(D.length===1)return W.distSqr(D[0])<he;for(let Ee=1;Ee<D.length;Ee++)if(Mi(W,D[Ee-1],D[Ee])<he)return!0;return!1}function Mi(W,D,$){let he=D.distSqr($);if(he===0)return W.distSqr(D);let Ee=((W.x-D.x)*($.x-D.x)+(W.y-D.y)*($.y-D.y))/he;return W.distSqr(Ee<0?D:Ee>1?$:$.sub(D)._mult(Ee)._add(D))}function ia(W,D){let $,he,Ee,je=!1;for(let We=0;We<W.length;We++){$=W[We];for(let ct=0,St=$.length-1;ct<$.length;St=ct++)he=$[ct],Ee=$[St],he.y>D.y!=Ee.y>D.y&&D.x<(Ee.x-he.x)*(D.y-he.y)/(Ee.y-he.y)+he.x&&(je=!je)}return je}function ka(W,D){let $=!1;for(let he=0,Ee=W.length-1;he<W.length;Ee=he++){let je=W[he],We=W[Ee];je.y>D.y!=We.y>D.y&&D.x<(We.x-je.x)*(D.y-je.y)/(We.y-je.y)+je.x&&($=!$)}return $}function Sa(W,D,$){let he=$[0],Ee=$[2];if(W.x<he.x&&D.x<he.x||W.x>Ee.x&&D.x>Ee.x||W.y<he.y&&D.y<he.y||W.y>Ee.y&&D.y>Ee.y)return!1;let je=R(W,D,$[0]);return je!==R(W,D,$[1])||je!==R(W,D,$[2])||je!==R(W,D,$[3])}function va(W,D,$){let he=D.paint.get(W).value;return he.kind==="constant"?he.value:$.programConfigurations.get(D.id).getMaxValue(W)}function Fn(W){return Math.sqrt(W[0]*W[0]+W[1]*W[1])}function Ha(W,D,$,he,Ee){if(!D[0]&&!D[1])return W;let je=n.convert(D)._mult(Ee);$==="viewport"&&je._rotate(-he);let We=[];for(let ct=0;ct<W.length;ct++)We.push(W[ct].sub(je));return We}let Da,Xi;Ta("CircleBucket",Hl,{omit:["layers"]});var ei={get paint(){return Xi=Xi||new Ue({"circle-radius":new es(re.paint_circle["circle-radius"]),"circle-color":new es(re.paint_circle["circle-color"]),"circle-blur":new es(re.paint_circle["circle-blur"]),"circle-opacity":new es(re.paint_circle["circle-opacity"]),"circle-translate":new Po(re.paint_circle["circle-translate"]),"circle-translate-anchor":new Po(re.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Po(re.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Po(re.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new es(re.paint_circle["circle-stroke-width"]),"circle-stroke-color":new es(re.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new es(re.paint_circle["circle-stroke-opacity"])})},get layout(){return Da=Da||new Ue({"circle-sort-key":new es(re.layout_circle["circle-sort-key"])})}},zi=1e-6,la=typeof Float32Array<"u"?Float32Array:Array;function ba(W){return W[0]=1,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=1,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=1,W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W}function $i(W,D,$){var he=D[0],Ee=D[1],je=D[2],We=D[3],ct=D[4],St=D[5],Nt=D[6],sr=D[7],Er=D[8],Fr=D[9],Xr=D[10],ni=D[11],gi=D[12],Zi=D[13],aa=D[14],nn=D[15],Aa=$[0],Ja=$[1],dn=$[2],no=$[3];return W[0]=Aa*he+Ja*ct+dn*Er+no*gi,W[1]=Aa*Ee+Ja*St+dn*Fr+no*Zi,W[2]=Aa*je+Ja*Nt+dn*Xr+no*aa,W[3]=Aa*We+Ja*sr+dn*ni+no*nn,W[4]=(Aa=$[4])*he+(Ja=$[5])*ct+(dn=$[6])*Er+(no=$[7])*gi,W[5]=Aa*Ee+Ja*St+dn*Fr+no*Zi,W[6]=Aa*je+Ja*Nt+dn*Xr+no*aa,W[7]=Aa*We+Ja*sr+dn*ni+no*nn,W[8]=(Aa=$[8])*he+(Ja=$[9])*ct+(dn=$[10])*Er+(no=$[11])*gi,W[9]=Aa*Ee+Ja*St+dn*Fr+no*Zi,W[10]=Aa*je+Ja*Nt+dn*Xr+no*aa,W[11]=Aa*We+Ja*sr+dn*ni+no*nn,W[12]=(Aa=$[12])*he+(Ja=$[13])*ct+(dn=$[14])*Er+(no=$[15])*gi,W[13]=Aa*Ee+Ja*St+dn*Fr+no*Zi,W[14]=Aa*je+Ja*Nt+dn*Xr+no*aa,W[15]=Aa*We+Ja*sr+dn*ni+no*nn,W}Math.hypot||(Math.hypot=function(){for(var W=0,D=arguments.length;D--;)W+=arguments[D]*arguments[D];return Math.sqrt(W)});var Xa,Oa=$i;function kn(W,D,$){var he=D[0],Ee=D[1],je=D[2],We=D[3];return W[0]=$[0]*he+$[4]*Ee+$[8]*je+$[12]*We,W[1]=$[1]*he+$[5]*Ee+$[9]*je+$[13]*We,W[2]=$[2]*he+$[6]*Ee+$[10]*je+$[14]*We,W[3]=$[3]*he+$[7]*Ee+$[11]*je+$[15]*We,W}Xa=new la(4),la!=Float32Array&&(Xa[0]=0,Xa[1]=0,Xa[2]=0,Xa[3]=0);class Qi extends ae{constructor(D){super(D,ei)}createBucket(D){return new Hl(D)}queryRadius(D){let $=D;return va("circle-radius",this,$)+va("circle-stroke-width",this,$)+Fn(this.paint.get("circle-translate"))}queryIntersectsFeature(D,$,he,Ee,je,We,ct,St){let Nt=Ha(D,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),We.angle,ct),sr=this.paint.get("circle-radius").evaluate($,he)+this.paint.get("circle-stroke-width").evaluate($,he),Er=this.paint.get("circle-pitch-alignment")==="map",Fr=Er?Nt:function(ni,gi){return ni.map(Zi=>Yi(Zi,gi))}(Nt,St),Xr=Er?sr*ct:sr;for(let ni of Ee)for(let gi of ni){let Zi=Er?gi:Yi(gi,St),aa=Xr,nn=kn([],[gi.x,gi.y,0,1],St);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?aa*=nn[3]/We.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(aa*=We.cameraToCenterDistance/nn[3]),rt(Fr,Zi,aa))return!0}return!1}}function Yi(W,D){let $=kn([],[W.x,W.y,0,1],D);return new n($[0]/$[3],$[1]/$[3])}class ln extends Hl{}let Va;Ta("HeatmapBucket",ln,{omit:["layers"]});var La={get paint(){return Va=Va||new Ue({"heatmap-radius":new es(re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new es(re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Po(re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new rc(re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Po(re.paint_heatmap["heatmap-opacity"])})}};function Ea(W,{width:D,height:$},he,Ee){if(Ee){if(Ee instanceof Uint8ClampedArray)Ee=new Uint8Array(Ee.buffer);else if(Ee.length!==D*$*he)throw new RangeError(`mismatched image size. expected: ${Ee.length} but got: ${D*$*he}`)}else Ee=new Uint8Array(D*$*he);return W.width=D,W.height=$,W.data=Ee,W}function on(W,{width:D,height:$},he){if(D===W.width&&$===W.height)return;let Ee=Ea({},{width:D,height:$},he);Pn(W,Ee,{x:0,y:0},{x:0,y:0},{width:Math.min(W.width,D),height:Math.min(W.height,$)},he),W.width=D,W.height=$,W.data=Ee.data}function Pn(W,D,$,he,Ee,je){if(Ee.width===0||Ee.height===0)return D;if(Ee.width>W.width||Ee.height>W.height||$.x>W.width-Ee.width||$.y>W.height-Ee.height)throw new RangeError("out of range source coordinates for image copy");if(Ee.width>D.width||Ee.height>D.height||he.x>D.width-Ee.width||he.y>D.height-Ee.height)throw new RangeError("out of range destination coordinates for image copy");let We=W.data,ct=D.data;if(We===ct)throw new Error("srcData equals dstData, so image is already copied");for(let St=0;St<Ee.height;St++){let Nt=(($.y+St)*W.width+$.x)*je,sr=((he.y+St)*D.width+he.x)*je;for(let Er=0;Er<Ee.width*je;Er++)ct[sr+Er]=We[Nt+Er]}return D}class Zn{constructor(D,$){Ea(this,D,1,$)}resize(D){on(this,D,1)}clone(){return new Zn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(D,$,he,Ee,je){Pn(D,$,he,Ee,je,1)}}class ja{constructor(D,$){Ea(this,D,4,$)}resize(D){on(this,D,4)}replace(D,$){$?this.data.set(D):this.data=D instanceof Uint8ClampedArray?new Uint8Array(D.buffer):D}clone(){return new ja({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(D,$,he,Ee,je){Pn(D,$,he,Ee,je,4)}}function gn(W){let D={},$=W.resolution||256,he=W.clips?W.clips.length:1,Ee=W.image||new ja({width:$,height:he});if(Math.log($)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${$}`);let je=(We,ct,St)=>{D[W.evaluationKey]=St;let Nt=W.expression.evaluate(D);Ee.data[We+ct+0]=Math.floor(255*Nt.r/Nt.a),Ee.data[We+ct+1]=Math.floor(255*Nt.g/Nt.a),Ee.data[We+ct+2]=Math.floor(255*Nt.b/Nt.a),Ee.data[We+ct+3]=Math.floor(255*Nt.a)};if(W.clips)for(let We=0,ct=0;We<he;++We,ct+=4*$)for(let St=0,Nt=0;St<$;St++,Nt+=4){let sr=St/($-1),{start:Er,end:Fr}=W.clips[We];je(ct,Nt,Er*(1-sr)+Fr*sr)}else for(let We=0,ct=0;We<$;We++,ct+=4)je(0,ct,We/($-1));return Ee}Ta("AlphaImage",Zn),Ta("RGBAImage",ja);let Wn="big-fb";class $n extends ae{createBucket(D){return new ln(D)}constructor(D){super(D,La),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(D){D==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=gn({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Wn)&&this.heatmapFbos.delete(Wn)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let fo;var Ks={get paint(){return fo=fo||new Ue({"hillshade-illumination-direction":new Po(re.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Po(re.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Po(re.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Po(re.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Po(re.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Po(re.paint_hillshade["hillshade-accent-color"])})}};class Rl extends ae{constructor(D){super(D,Ks)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let Ro=ht([{name:"a_pos",components:2,type:"Int16"}],4),{members:ru}=Ro;function Cs(W,D,$=2){let he=D&&D.length,Ee=he?D[0]*$:W.length,je=Ol(W,0,Ee,$,!0),We=[];if(!je||je.next===je.prev)return We;let ct,St,Nt;if(he&&(je=function(sr,Er,Fr,Xr){let ni=[];for(let gi=0,Zi=Er.length;gi<Zi;gi++){let aa=Ol(sr,Er[gi]*Xr,gi<Zi-1?Er[gi+1]*Xr:sr.length,Xr,!1);aa===aa.next&&(aa.steiner=!0),ni.push(ge(aa))}ni.sort(jl);for(let gi=0;gi<ni.length;gi++)Fr=$o(ni[gi],Fr);return Fr}(W,D,je,$)),W.length>80*$){ct=1/0,St=1/0;let sr=-1/0,Er=-1/0;for(let Fr=$;Fr<Ee;Fr+=$){let Xr=W[Fr],ni=W[Fr+1];Xr<ct&&(ct=Xr),ni<St&&(St=ni),Xr>sr&&(sr=Xr),ni>Er&&(Er=ni)}Nt=Math.max(sr-ct,Er-St),Nt=Nt!==0?32767/Nt:0}return cu(je,We,$,ct,St,Nt,0),We}function Ol(W,D,$,he,Ee){let je;if(Ee===function(We,ct,St,Nt){let sr=0;for(let Er=ct,Fr=St-Nt;Er<St;Er+=Nt)sr+=(We[Fr]-We[Er])*(We[Er+1]+We[Fr+1]),Fr=Er;return sr}(W,D,$,he)>0)for(let We=D;We<$;We+=he)je=vr(We/he|0,W[We],W[We+1],je);else for(let We=$-he;We>=D;We-=he)je=vr(We/he|0,W[We],W[We+1],je);return je&&Ce(je,je.next)&&(mt(je),je=je.next),je}function Ul(W,D){if(!W)return W;D||(D=W);let $,he=W;do if($=!1,he.steiner||!Ce(he,he.next)&&He(he.prev,he,he.next)!==0)he=he.next;else{if(mt(he),he=D=he.prev,he===he.next)break;$=!0}while($||he!==D);return D}function cu(W,D,$,he,Ee,je,We){if(!W)return;!We&&je&&function(St,Nt,sr,Er){let Fr=St;do Fr.z===0&&(Fr.z=K(Fr.x,Fr.y,Nt,sr,Er)),Fr.prevZ=Fr.prev,Fr.nextZ=Fr.next,Fr=Fr.next;while(Fr!==St);Fr.prevZ.nextZ=null,Fr.prevZ=null,function(Xr){let ni,gi=1;do{let Zi,aa=Xr;Xr=null;let nn=null;for(ni=0;aa;){ni++;let Aa=aa,Ja=0;for(let no=0;no<gi&&(Ja++,Aa=Aa.nextZ,Aa);no++);let dn=gi;for(;Ja>0||dn>0&&Aa;)Ja!==0&&(dn===0||!Aa||aa.z<=Aa.z)?(Zi=aa,aa=aa.nextZ,Ja--):(Zi=Aa,Aa=Aa.nextZ,dn--),nn?nn.nextZ=Zi:Xr=Zi,Zi.prevZ=nn,nn=Zi;aa=Aa}nn.nextZ=null,gi*=2}while(ni>1)}(Fr)}(W,he,Ee,je);let ct=W;for(;W.prev!==W.next;){let St=W.prev,Nt=W.next;if(je?El(W,he,Ee,je):il(W))D.push(St.i,W.i,Nt.i),mt(W),W=Nt.next,ct=Nt.next;else if((W=Nt)===ct){We?We===1?cu(W=Dl(Ul(W),D),D,$,he,Ee,je,2):We===2&&ho(W,D,$,he,Ee,je):cu(Ul(W),D,$,he,Ee,je,1);break}}}function il(W){let D=W.prev,$=W,he=W.next;if(He(D,$,he)>=0)return!1;let Ee=D.x,je=$.x,We=he.x,ct=D.y,St=$.y,Nt=he.y,sr=Ee<je?Ee<We?Ee:We:je<We?je:We,Er=ct<St?ct<Nt?ct:Nt:St<Nt?St:Nt,Fr=Ee>je?Ee>We?Ee:We:je>We?je:We,Xr=ct>St?ct>Nt?ct:Nt:St>Nt?St:Nt,ni=he.next;for(;ni!==D;){if(ni.x>=sr&&ni.x<=Fr&&ni.y>=Er&&ni.y<=Xr&&te(Ee,ct,je,St,We,Nt,ni.x,ni.y)&&He(ni.prev,ni,ni.next)>=0)return!1;ni=ni.next}return!0}function El(W,D,$,he){let Ee=W.prev,je=W,We=W.next;if(He(Ee,je,We)>=0)return!1;let ct=Ee.x,St=je.x,Nt=We.x,sr=Ee.y,Er=je.y,Fr=We.y,Xr=ct<St?ct<Nt?ct:Nt:St<Nt?St:Nt,ni=sr<Er?sr<Fr?sr:Fr:Er<Fr?Er:Fr,gi=ct>St?ct>Nt?ct:Nt:St>Nt?St:Nt,Zi=sr>Er?sr>Fr?sr:Fr:Er>Fr?Er:Fr,aa=K(Xr,ni,D,$,he),nn=K(gi,Zi,D,$,he),Aa=W.prevZ,Ja=W.nextZ;for(;Aa&&Aa.z>=aa&&Ja&&Ja.z<=nn;){if(Aa.x>=Xr&&Aa.x<=gi&&Aa.y>=ni&&Aa.y<=Zi&&Aa!==Ee&&Aa!==We&&te(ct,sr,St,Er,Nt,Fr,Aa.x,Aa.y)&&He(Aa.prev,Aa,Aa.next)>=0||(Aa=Aa.prevZ,Ja.x>=Xr&&Ja.x<=gi&&Ja.y>=ni&&Ja.y<=Zi&&Ja!==Ee&&Ja!==We&&te(ct,sr,St,Er,Nt,Fr,Ja.x,Ja.y)&&He(Ja.prev,Ja,Ja.next)>=0))return!1;Ja=Ja.nextZ}for(;Aa&&Aa.z>=aa;){if(Aa.x>=Xr&&Aa.x<=gi&&Aa.y>=ni&&Aa.y<=Zi&&Aa!==Ee&&Aa!==We&&te(ct,sr,St,Er,Nt,Fr,Aa.x,Aa.y)&&He(Aa.prev,Aa,Aa.next)>=0)return!1;Aa=Aa.prevZ}for(;Ja&&Ja.z<=nn;){if(Ja.x>=Xr&&Ja.x<=gi&&Ja.y>=ni&&Ja.y<=Zi&&Ja!==Ee&&Ja!==We&&te(ct,sr,St,Er,Nt,Fr,Ja.x,Ja.y)&&He(Ja.prev,Ja,Ja.next)>=0)return!1;Ja=Ja.nextZ}return!0}function Dl(W,D){let $=W;do{let he=$.prev,Ee=$.next.next;!Ce(he,Ee)&&Ke(he,$,$.next,Ee)&&Tr(he,Ee)&&Tr(Ee,he)&&(D.push(he.i,$.i,Ee.i),mt($),mt($.next),$=W=Ee),$=$.next}while($!==W);return Ul($)}function ho(W,D,$,he,Ee,je){let We=W;do{let ct=We.next.next;for(;ct!==We.prev;){if(We.i!==ct.i&&pe(We,ct)){let St=Ur(We,ct);return We=Ul(We,We.next),St=Ul(St,St.next),cu(We,D,$,he,Ee,je,0),void cu(St,D,$,he,Ee,je,0)}ct=ct.next}We=We.next}while(We!==W)}function jl(W,D){return W.x-D.x}function $o(W,D){let $=function(Ee,je){let We=je,ct=Ee.x,St=Ee.y,Nt,sr=-1/0;do{if(St<=We.y&&St>=We.next.y&&We.next.y!==We.y){let gi=We.x+(St-We.y)*(We.next.x-We.x)/(We.next.y-We.y);if(gi<=ct&&gi>sr&&(sr=gi,Nt=We.x<We.next.x?We:We.next,gi===ct))return Nt}We=We.next}while(We!==je);if(!Nt)return null;let Er=Nt,Fr=Nt.x,Xr=Nt.y,ni=1/0;We=Nt;do{if(ct>=We.x&&We.x>=Fr&&ct!==We.x&&te(St<Xr?ct:sr,St,Fr,Xr,St<Xr?sr:ct,St,We.x,We.y)){let gi=Math.abs(St-We.y)/(ct-We.x);Tr(We,Ee)&&(gi<ni||gi===ni&&(We.x>Nt.x||We.x===Nt.x&&ve(Nt,We)))&&(Nt=We,ni=gi)}We=We.next}while(We!==Er);return Nt}(W,D);if(!$)return D;let he=Ur($,W);return Ul(he,he.next),Ul($,$.next)}function ve(W,D){return He(W.prev,W,D.prev)<0&&He(D.next,W,W.next)<0}function K(W,D,$,he,Ee){return(W=1431655765&((W=858993459&((W=252645135&((W=16711935&((W=(W-$)*Ee|0)|W<<8))|W<<4))|W<<2))|W<<1))|(D=1431655765&((D=858993459&((D=252645135&((D=16711935&((D=(D-he)*Ee|0)|D<<8))|D<<4))|D<<2))|D<<1))<<1}function ge(W){let D=W,$=W;do(D.x<$.x||D.x===$.x&&D.y<$.y)&&($=D),D=D.next;while(D!==W);return $}function te(W,D,$,he,Ee,je,We,ct){return(Ee-We)*(D-ct)>=(W-We)*(je-ct)&&(W-We)*(he-ct)>=($-We)*(D-ct)&&($-We)*(je-ct)>=(Ee-We)*(he-ct)}function pe(W,D){return W.next.i!==D.i&&W.prev.i!==D.i&&!function($,he){let Ee=$;do{if(Ee.i!==$.i&&Ee.next.i!==$.i&&Ee.i!==he.i&&Ee.next.i!==he.i&&Ke(Ee,Ee.next,$,he))return!0;Ee=Ee.next}while(Ee!==$);return!1}(W,D)&&(Tr(W,D)&&Tr(D,W)&&function($,he){let Ee=$,je=!1,We=($.x+he.x)/2,ct=($.y+he.y)/2;do Ee.y>ct!=Ee.next.y>ct&&Ee.next.y!==Ee.y&&We<(Ee.next.x-Ee.x)*(ct-Ee.y)/(Ee.next.y-Ee.y)+Ee.x&&(je=!je),Ee=Ee.next;while(Ee!==$);return je}(W,D)&&(He(W.prev,W,D.prev)||He(W,D.prev,D))||Ce(W,D)&&He(W.prev,W,W.next)>0&&He(D.prev,D,D.next)>0)}function He(W,D,$){return(D.y-W.y)*($.x-D.x)-(D.x-W.x)*($.y-D.y)}function Ce(W,D){return W.x===D.x&&W.y===D.y}function Ke(W,D,$,he){let Ee=Ut(He(W,D,$)),je=Ut(He(W,D,he)),We=Ut(He($,he,W)),ct=Ut(He($,he,D));return Ee!==je&&We!==ct||!(Ee!==0||!pt(W,$,D))||!(je!==0||!pt(W,he,D))||!(We!==0||!pt($,W,he))||!(ct!==0||!pt($,D,he))}function pt(W,D,$){return D.x<=Math.max(W.x,$.x)&&D.x>=Math.min(W.x,$.x)&&D.y<=Math.max(W.y,$.y)&&D.y>=Math.min(W.y,$.y)}function Ut(W){return W>0?1:W<0?-1:0}function Tr(W,D){return He(W.prev,W,W.next)<0?He(W,D,W.next)>=0&&He(W,W.prev,D)>=0:He(W,D,W.prev)<0||He(W,W.next,D)<0}function Ur(W,D){let $=Et(W.i,W.x,W.y),he=Et(D.i,D.x,D.y),Ee=W.next,je=D.prev;return W.next=D,D.prev=W,$.next=Ee,Ee.prev=$,he.next=$,$.prev=he,je.next=he,he.prev=je,he}function vr(W,D,$,he){let Ee=Et(W,D,$);return he?(Ee.next=he.next,Ee.prev=he,he.next.prev=Ee,he.next=Ee):(Ee.prev=Ee,Ee.next=Ee),Ee}function mt(W){W.next.prev=W.prev,W.prev.next=W.next,W.prevZ&&(W.prevZ.nextZ=W.nextZ),W.nextZ&&(W.nextZ.prevZ=W.prevZ)}function Et(W,D,$){return{i:W,x:D,y:$,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Bt(W,D,$){let he=$.patternDependencies,Ee=!1;for(let je of D){let We=je.paint.get(`${W}-pattern`);We.isConstant()||(Ee=!0);let ct=We.constantOr(null);ct&&(Ee=!0,he[ct.to]=!0,he[ct.from]=!0)}return Ee}function or(W,D,$,he,Ee){let je=Ee.patternDependencies;for(let We of D){let ct=We.paint.get(`${W}-pattern`).value;if(ct.kind!=="constant"){let St=ct.evaluate({zoom:he-1},$,{},Ee.availableImages),Nt=ct.evaluate({zoom:he},$,{},Ee.availableImages),sr=ct.evaluate({zoom:he+1},$,{},Ee.availableImages);St=St&&St.name?St.name:St,Nt=Nt&&Nt.name?Nt.name:Nt,sr=sr&&sr.name?sr.name:sr,je[St]=!0,je[Nt]=!0,je[sr]=!0,$.patterns[We.id]={min:St,mid:Nt,max:sr}}}return $}class dr{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map($=>$.id),this.index=D.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ql,this.indexArray=new Fe,this.indexArray2=new Je,this.programConfigurations=new ml(D.layers,D.zoom),this.segments=new At,this.segments2=new At,this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(D,$,he){this.hasPattern=Bt("fill",this.layers,$);let Ee=this.layers[0].layout.get("fill-sort-key"),je=!Ee.isConstant(),We=[];for(let{feature:ct,id:St,index:Nt,sourceLayerIndex:sr}of D){let Er=this.layers[0]._featureFilter.needGeometry,Fr=tu(ct,Er);if(!this.layers[0]._featureFilter.filter(new Zs(this.zoom),Fr,he))continue;let Xr=je?Ee.evaluate(Fr,{},he,$.availableImages):void 0,ni={id:St,properties:ct.properties,type:ct.type,sourceLayerIndex:sr,index:Nt,geometry:Er?Fr.geometry:Bl(ct),patterns:{},sortKey:Xr};We.push(ni)}je&&We.sort((ct,St)=>ct.sortKey-St.sortKey);for(let ct of We){let{geometry:St,index:Nt,sourceLayerIndex:sr}=ct;if(this.hasPattern){let Er=or("fill",this.layers,ct,this.zoom,$);this.patternFeatures.push(Er)}else this.addFeature(ct,St,Nt,he,{});$.featureIndex.insert(D[Nt].feature,St,Nt,sr,this.index)}}update(D,$,he){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,$,this.stateDependentLayers,he)}addFeatures(D,$,he){for(let Ee of this.patternFeatures)this.addFeature(Ee,Ee.geometry,Ee.index,$,he)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(D){this.uploaded||(this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,ru),this.indexBuffer=D.createIndexBuffer(this.indexArray),this.indexBuffer2=D.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(D),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(D,$,he,Ee,je){for(let We of kc($,500)){let ct=0;for(let Xr of We)ct+=Xr.length;let St=this.segments.prepareSegment(ct,this.layoutVertexArray,this.indexArray),Nt=St.vertexLength,sr=[],Er=[];for(let Xr of We){if(Xr.length===0)continue;Xr!==We[0]&&Er.push(sr.length/2);let ni=this.segments2.prepareSegment(Xr.length,this.layoutVertexArray,this.indexArray2),gi=ni.vertexLength;this.layoutVertexArray.emplaceBack(Xr[0].x,Xr[0].y),this.indexArray2.emplaceBack(gi+Xr.length-1,gi),sr.push(Xr[0].x),sr.push(Xr[0].y);for(let Zi=1;Zi<Xr.length;Zi++)this.layoutVertexArray.emplaceBack(Xr[Zi].x,Xr[Zi].y),this.indexArray2.emplaceBack(gi+Zi-1,gi+Zi),sr.push(Xr[Zi].x),sr.push(Xr[Zi].y);ni.vertexLength+=Xr.length,ni.primitiveLength+=Xr.length}let Fr=Cs(sr,Er);for(let Xr=0;Xr<Fr.length;Xr+=3)this.indexArray.emplaceBack(Nt+Fr[Xr],Nt+Fr[Xr+1],Nt+Fr[Xr+2]);St.vertexLength+=ct,St.primitiveLength+=Fr.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,he,je,Ee)}}let ur,pr;Ta("FillBucket",dr,{omit:["layers","patternFeatures"]});var cr={get paint(){return pr=pr||new Ue({"fill-antialias":new Po(re.paint_fill["fill-antialias"]),"fill-opacity":new es(re.paint_fill["fill-opacity"]),"fill-color":new es(re.paint_fill["fill-color"]),"fill-outline-color":new es(re.paint_fill["fill-outline-color"]),"fill-translate":new Po(re.paint_fill["fill-translate"]),"fill-translate-anchor":new Po(re.paint_fill["fill-translate-anchor"]),"fill-pattern":new Nc(re.paint_fill["fill-pattern"])})},get layout(){return ur=ur||new Ue({"fill-sort-key":new es(re.layout_fill["fill-sort-key"])})}};class Gt extends ae{constructor(D){super(D,cr)}recalculate(D,$){super.recalculate(D,$);let he=this.paint._values["fill-outline-color"];he.value.kind==="constant"&&he.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(D){return new dr(D)}queryRadius(){return Fn(this.paint.get("fill-translate"))}queryIntersectsFeature(D,$,he,Ee,je,We,ct){return Yt(Ha(D,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),We.angle,ct),Ee)}isTileClipped(){return!0}}let lr=ht([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),qt=ht([{name:"a_centroid",components:2,type:"Int16"}],4),{members:zr}=lr;var $r={},Ai=o,wa=Ji;function Ji(W,D,$,he,Ee){this.properties={},this.extent=$,this.type=0,this._pbf=W,this._geometry=-1,this._keys=he,this._values=Ee,W.readFields(fa,this,D)}function fa(W,D,$){W==1?D.id=$.readVarint():W==2?function(he,Ee){for(var je=he.readVarint()+he.pos;he.pos<je;){var We=Ee._keys[he.readVarint()],ct=Ee._values[he.readVarint()];Ee.properties[We]=ct}}($,D):W==3?D.type=$.readVarint():W==4&&(D._geometry=$.pos)}function sn(W){for(var D,$,he=0,Ee=0,je=W.length,We=je-1;Ee<je;We=Ee++)he+=(($=W[We]).x-(D=W[Ee]).x)*(D.y+$.y);return he}Ji.types=["Unknown","Point","LineString","Polygon"],Ji.prototype.loadGeometry=function(){var W=this._pbf;W.pos=this._geometry;for(var D,$=W.readVarint()+W.pos,he=1,Ee=0,je=0,We=0,ct=[];W.pos<$;){if(Ee<=0){var St=W.readVarint();he=7&St,Ee=St>>3}if(Ee--,he===1||he===2)je+=W.readSVarint(),We+=W.readSVarint(),he===1&&(D&&ct.push(D),D=[]),D.push(new Ai(je,We));else{if(he!==7)throw new Error("unknown command "+he);D&&D.push(D[0].clone())}}return D&&ct.push(D),ct},Ji.prototype.bbox=function(){var W=this._pbf;W.pos=this._geometry;for(var D=W.readVarint()+W.pos,$=1,he=0,Ee=0,je=0,We=1/0,ct=-1/0,St=1/0,Nt=-1/0;W.pos<D;){if(he<=0){var sr=W.readVarint();$=7&sr,he=sr>>3}if(he--,$===1||$===2)(Ee+=W.readSVarint())<We&&(We=Ee),Ee>ct&&(ct=Ee),(je+=W.readSVarint())<St&&(St=je),je>Nt&&(Nt=je);else if($!==7)throw new Error("unknown command "+$)}return[We,St,ct,Nt]},Ji.prototype.toGeoJSON=function(W,D,$){var he,Ee,je=this.extent*Math.pow(2,$),We=this.extent*W,ct=this.extent*D,St=this.loadGeometry(),Nt=Ji.types[this.type];function sr(Xr){for(var ni=0;ni<Xr.length;ni++){var gi=Xr[ni];Xr[ni]=[360*(gi.x+We)/je-180,360/Math.PI*Math.atan(Math.exp((180-360*(gi.y+ct)/je)*Math.PI/180))-90]}}switch(this.type){case 1:var Er=[];for(he=0;he<St.length;he++)Er[he]=St[he][0];sr(St=Er);break;case 2:for(he=0;he<St.length;he++)sr(St[he]);break;case 3:for(St=function(Xr){var ni=Xr.length;if(ni<=1)return[Xr];for(var gi,Zi,aa=[],nn=0;nn<ni;nn++){var Aa=sn(Xr[nn]);Aa!==0&&(Zi===void 0&&(Zi=Aa<0),Zi===Aa<0?(gi&&aa.push(gi),gi=[Xr[nn]]):gi.push(Xr[nn]))}return gi&&aa.push(gi),aa}(St),he=0;he<St.length;he++)for(Ee=0;Ee<St[he].length;Ee++)sr(St[he][Ee])}St.length===1?St=St[0]:Nt="Multi"+Nt;var Fr={type:"Feature",geometry:{type:Nt,coordinates:St},properties:this.properties};return"id"in this&&(Fr.id=this.id),Fr};var Ga=wa,ma=Ma;function Ma(W,D){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=W,this._keys=[],this._values=[],this._features=[],W.readFields(Pa,this,D),this.length=this._features.length}function Pa(W,D,$){W===15?D.version=$.readVarint():W===1?D.name=$.readString():W===5?D.extent=$.readVarint():W===2?D._features.push($.pos):W===3?D._keys.push($.readString()):W===4&&D._values.push(function(he){for(var Ee=null,je=he.readVarint()+he.pos;he.pos<je;){var We=he.readVarint()>>3;Ee=We===1?he.readString():We===2?he.readFloat():We===3?he.readDouble():We===4?he.readVarint64():We===5?he.readVarint():We===6?he.readSVarint():We===7?he.readBoolean():null}return Ee}($))}Ma.prototype.feature=function(W){if(W<0||W>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[W];var D=this._pbf.readVarint()+this._pbf.pos;return new Ga(this._pbf,D,this.extent,this._keys,this._values)};var Ka=ma;function Sn(W,D,$){if(W===3){var he=new Ka($,$.readVarint()+$.pos);he.length&&(D[he.name]=he)}}$r.VectorTile=function(W,D){this.layers=W.readFields(Sn,{},D)},$r.VectorTileFeature=wa,$r.VectorTileLayer=ma;let No=$r.VectorTileFeature.types,os=Math.pow(2,13);function Xs(W,D,$,he,Ee,je,We,ct){W.emplaceBack(D,$,2*Math.floor(he*os)+We,Ee*os*2,je*os*2,Math.round(ct))}class ts{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map($=>$.id),this.index=D.index,this.hasPattern=!1,this.layoutVertexArray=new uu,this.centroidVertexArray=new ms,this.indexArray=new Fe,this.programConfigurations=new ml(D.layers,D.zoom),this.segments=new At,this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(D,$,he){this.features=[],this.hasPattern=Bt("fill-extrusion",this.layers,$);for(let{feature:Ee,id:je,index:We,sourceLayerIndex:ct}of D){let St=this.layers[0]._featureFilter.needGeometry,Nt=tu(Ee,St);if(!this.layers[0]._featureFilter.filter(new Zs(this.zoom),Nt,he))continue;let sr={id:je,sourceLayerIndex:ct,index:We,geometry:St?Nt.geometry:Bl(Ee),properties:Ee.properties,type:Ee.type,patterns:{}};this.hasPattern?this.features.push(or("fill-extrusion",this.layers,sr,this.zoom,$)):this.addFeature(sr,sr.geometry,We,he,{}),$.featureIndex.insert(Ee,sr.geometry,We,ct,this.index,!0)}}addFeatures(D,$,he){for(let Ee of this.features){let{geometry:je}=Ee;this.addFeature(Ee,je,Ee.index,$,he)}}update(D,$,he){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,$,this.stateDependentLayers,he)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(D){this.uploaded||(this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,zr),this.centroidVertexBuffer=D.createVertexBuffer(this.centroidVertexArray,qt.members,!0),this.indexBuffer=D.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(D),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(D,$,he,Ee,je){for(let We of kc($,500)){let ct={x:0,y:0,vertexCount:0},St=0;for(let ni of We)St+=ni.length;let Nt=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let ni of We){if(ni.length===0||ll(ni))continue;let gi=0;for(let Zi=0;Zi<ni.length;Zi++){let aa=ni[Zi];if(Zi>=1){let nn=ni[Zi-1];if(!Vs(aa,nn)){Nt.vertexLength+4>At.MAX_VERTEX_ARRAY_LENGTH&&(Nt=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let Aa=aa.sub(nn)._perp()._unit(),Ja=nn.dist(aa);gi+Ja>32768&&(gi=0),Xs(this.layoutVertexArray,aa.x,aa.y,Aa.x,Aa.y,0,0,gi),Xs(this.layoutVertexArray,aa.x,aa.y,Aa.x,Aa.y,0,1,gi),ct.x+=2*aa.x,ct.y+=2*aa.y,ct.vertexCount+=2,gi+=Ja,Xs(this.layoutVertexArray,nn.x,nn.y,Aa.x,Aa.y,0,0,gi),Xs(this.layoutVertexArray,nn.x,nn.y,Aa.x,Aa.y,0,1,gi),ct.x+=2*nn.x,ct.y+=2*nn.y,ct.vertexCount+=2;let dn=Nt.vertexLength;this.indexArray.emplaceBack(dn,dn+2,dn+1),this.indexArray.emplaceBack(dn+1,dn+2,dn+3),Nt.vertexLength+=4,Nt.primitiveLength+=2}}}}if(Nt.vertexLength+St>At.MAX_VERTEX_ARRAY_LENGTH&&(Nt=this.segments.prepareSegment(St,this.layoutVertexArray,this.indexArray)),No[D.type]!=="Polygon")continue;let sr=[],Er=[],Fr=Nt.vertexLength;for(let ni of We)if(ni.length!==0){ni!==We[0]&&Er.push(sr.length/2);for(let gi=0;gi<ni.length;gi++){let Zi=ni[gi];Xs(this.layoutVertexArray,Zi.x,Zi.y,0,0,1,1,0),ct.x+=Zi.x,ct.y+=Zi.y,ct.vertexCount+=1,sr.push(Zi.x),sr.push(Zi.y)}}let Xr=Cs(sr,Er);for(let ni=0;ni<Xr.length;ni+=3)this.indexArray.emplaceBack(Fr+Xr[ni],Fr+Xr[ni+2],Fr+Xr[ni+1]);Nt.primitiveLength+=Xr.length/3,Nt.vertexLength+=St;for(let ni=0;ni<ct.vertexCount;ni++){let gi=Math.floor(ct.x/ct.vertexCount),Zi=Math.floor(ct.y/ct.vertexCount);this.centroidVertexArray.emplaceBack(gi,Zi)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,he,je,Ee)}}function Vs(W,D){return W.x===D.x&&(W.x<0||W.x>zo)||W.y===D.y&&(W.y<0||W.y>zo)}function ll(W){return W.every(D=>D.x<0)||W.every(D=>D.x>zo)||W.every(D=>D.y<0)||W.every(D=>D.y>zo)}let Mu;Ta("FillExtrusionBucket",ts,{omit:["layers","features"]});var rd={get paint(){return Mu=Mu||new Ue({"fill-extrusion-opacity":new Po(re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new es(re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Po(re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Po(re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Nc(re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new es(re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new es(re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Po(re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class id extends ae{constructor(D){super(D,rd)}createBucket(D){return new ts(D)}queryRadius(){return Fn(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(D,$,he,Ee,je,We,ct,St){let Nt=Ha(D,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),We.angle,ct),sr=this.paint.get("fill-extrusion-height").evaluate($,he),Er=this.paint.get("fill-extrusion-base").evaluate($,he),Fr=function(ni,gi,Zi,aa){let nn=[];for(let Aa of ni){let Ja=[Aa.x,Aa.y,0,1];kn(Ja,Ja,gi),nn.push(new n(Ja[0]/Ja[3],Ja[1]/Ja[3]))}return nn}(Nt,St),Xr=function(ni,gi,Zi,aa){let nn=[],Aa=[],Ja=aa[8]*gi,dn=aa[9]*gi,no=aa[10]*gi,Zo=aa[11]*gi,Ds=aa[8]*Zi,Fo=aa[9]*Zi,Jn=aa[10]*Zi,_s=aa[11]*Zi;for(let ls of ni){let is=[],Nn=[];for(let Ts of ls){let as=Ts.x,Ws=Ts.y,ic=aa[0]*as+aa[4]*Ws+aa[12],Yu=aa[1]*as+aa[5]*Ws+aa[13],Kf=aa[2]*as+aa[6]*Ws+aa[14],pd=aa[3]*as+aa[7]*Ws+aa[15],gh=Kf+no,$f=pd+Zo,Fh=ic+Ds,Bh=Yu+Fo,Oh=Kf+Jn,pf=pd+_s,Jf=new n((ic+Ja)/$f,(Yu+dn)/$f);Jf.z=gh/$f,is.push(Jf);let Sh=new n(Fh/pf,Bh/pf);Sh.z=Oh/pf,Nn.push(Sh)}nn.push(is),Aa.push(Nn)}return[nn,Aa]}(Ee,Er,sr,St);return function(ni,gi,Zi){let aa=1/0;Yt(Zi,gi)&&(aa=hd(Zi,gi[0]));for(let nn=0;nn<gi.length;nn++){let Aa=gi[nn],Ja=ni[nn];for(let dn=0;dn<Aa.length-1;dn++){let no=Aa[dn],Zo=[no,Aa[dn+1],Ja[dn+1],Ja[dn],no];Tc(Zi,Zo)&&(aa=Math.min(aa,hd(Zi,Zo)))}}return aa!==1/0&&aa}(Xr[0],Xr[1],Fr)}}function xh(W,D){return W.x*D.x+W.y*D.y}function hd(W,D){if(W.length===1){let $=0,he=D[$++],Ee;for(;!Ee||he.equals(Ee);)if(Ee=D[$++],!Ee)return 1/0;for(;$<D.length;$++){let je=D[$],We=W[0],ct=Ee.sub(he),St=je.sub(he),Nt=We.sub(he),sr=xh(ct,ct),Er=xh(ct,St),Fr=xh(St,St),Xr=xh(Nt,ct),ni=xh(Nt,St),gi=sr*Fr-Er*Er,Zi=(Fr*Xr-Er*ni)/gi,aa=(sr*ni-Er*Xr)/gi,nn=he.z*(1-Zi-aa)+Ee.z*Zi+je.z*aa;if(isFinite(nn))return nn}return 1/0}{let $=1/0;for(let he of D)$=Math.min($,he.z);return $}}let ev=ht([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Md}=ev,bh=ht([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ed}=bh,zh=$r.VectorTileFeature.types,wh=Math.cos(Math.PI/180*37.5),ad=Math.pow(2,14)/.5;class dd{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map($=>$.id),this.index=D.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach($=>{this.gradients[$.id]={}}),this.layoutVertexArray=new Uu,this.layoutVertexArray2=new Su,this.indexArray=new Fe,this.programConfigurations=new ml(D.layers,D.zoom),this.segments=new At,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id)}populate(D,$,he){this.hasPattern=Bt("line",this.layers,$);let Ee=this.layers[0].layout.get("line-sort-key"),je=!Ee.isConstant(),We=[];for(let{feature:ct,id:St,index:Nt,sourceLayerIndex:sr}of D){let Er=this.layers[0]._featureFilter.needGeometry,Fr=tu(ct,Er);if(!this.layers[0]._featureFilter.filter(new Zs(this.zoom),Fr,he))continue;let Xr=je?Ee.evaluate(Fr,{},he):void 0,ni={id:St,properties:ct.properties,type:ct.type,sourceLayerIndex:sr,index:Nt,geometry:Er?Fr.geometry:Bl(ct),patterns:{},sortKey:Xr};We.push(ni)}je&&We.sort((ct,St)=>ct.sortKey-St.sortKey);for(let ct of We){let{geometry:St,index:Nt,sourceLayerIndex:sr}=ct;if(this.hasPattern){let Er=or("line",this.layers,ct,this.zoom,$);this.patternFeatures.push(Er)}else this.addFeature(ct,St,Nt,he,{});$.featureIndex.insert(D[Nt].feature,St,Nt,sr,this.index)}}update(D,$,he){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,$,this.stateDependentLayers,he)}addFeatures(D,$,he){for(let Ee of this.patternFeatures)this.addFeature(Ee,Ee.geometry,Ee.index,$,he)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(D){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=D.createVertexBuffer(this.layoutVertexArray2,Ed)),this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,Md),this.indexBuffer=D.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(D),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(D){if(D.properties&&Object.prototype.hasOwnProperty.call(D.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(D.properties,"mapbox_clip_end"))return{start:+D.properties.mapbox_clip_start,end:+D.properties.mapbox_clip_end}}addFeature(D,$,he,Ee,je){let We=this.layers[0].layout,ct=We.get("line-join").evaluate(D,{}),St=We.get("line-cap"),Nt=We.get("line-miter-limit"),sr=We.get("line-round-limit");this.lineClips=this.lineFeatureClips(D);for(let Er of $)this.addLine(Er,D,ct,St,Nt,sr);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,he,je,Ee)}addLine(D,$,he,Ee,je,We){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let aa=0;aa<D.length-1;aa++)this.totalDistance+=D[aa].dist(D[aa+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let ct=zh[$.type]==="Polygon",St=D.length;for(;St>=2&&D[St-1].equals(D[St-2]);)St--;let Nt=0;for(;Nt<St-1&&D[Nt].equals(D[Nt+1]);)Nt++;if(St<(ct?3:2))return;he==="bevel"&&(je=1.05);let sr=this.overscaling<=16?15*zo/(512*this.overscaling):0,Er=this.segments.prepareSegment(10*St,this.layoutVertexArray,this.indexArray),Fr,Xr,ni,gi,Zi;this.e1=this.e2=-1,ct&&(Fr=D[St-2],Zi=D[Nt].sub(Fr)._unit()._perp());for(let aa=Nt;aa<St;aa++){if(ni=aa===St-1?ct?D[Nt+1]:void 0:D[aa+1],ni&&D[aa].equals(ni))continue;Zi&&(gi=Zi),Fr&&(Xr=Fr),Fr=D[aa],Zi=ni?ni.sub(Fr)._unit()._perp():gi,gi=gi||Zi;let nn=gi.add(Zi);nn.x===0&&nn.y===0||nn._unit();let Aa=gi.x*Zi.x+gi.y*Zi.y,Ja=nn.x*Zi.x+nn.y*Zi.y,dn=Ja!==0?1/Ja:1/0,no=2*Math.sqrt(2-2*Ja),Zo=Ja<wh&&Xr&&ni,Ds=gi.x*Zi.y-gi.y*Zi.x>0;if(Zo&&aa>Nt){let _s=Fr.dist(Xr);if(_s>2*sr){let ls=Fr.sub(Fr.sub(Xr)._mult(sr/_s)._round());this.updateDistance(Xr,ls),this.addCurrentVertex(ls,gi,0,0,Er),Xr=ls}}let Fo=Xr&&ni,Jn=Fo?he:ct?"butt":Ee;if(Fo&&Jn==="round"&&(dn<We?Jn="miter":dn<=2&&(Jn="fakeround")),Jn==="miter"&&dn>je&&(Jn="bevel"),Jn==="bevel"&&(dn>2&&(Jn="flipbevel"),dn<je&&(Jn="miter")),Xr&&this.updateDistance(Xr,Fr),Jn==="miter")nn._mult(dn),this.addCurrentVertex(Fr,nn,0,0,Er);else if(Jn==="flipbevel"){if(dn>100)nn=Zi.mult(-1);else{let _s=dn*gi.add(Zi).mag()/gi.sub(Zi).mag();nn._perp()._mult(_s*(Ds?-1:1))}this.addCurrentVertex(Fr,nn,0,0,Er),this.addCurrentVertex(Fr,nn.mult(-1),0,0,Er)}else if(Jn==="bevel"||Jn==="fakeround"){let _s=-Math.sqrt(dn*dn-1),ls=Ds?_s:0,is=Ds?0:_s;if(Xr&&this.addCurrentVertex(Fr,gi,ls,is,Er),Jn==="fakeround"){let Nn=Math.round(180*no/Math.PI/20);for(let Ts=1;Ts<Nn;Ts++){let as=Ts/Nn;if(as!==.5){let ic=as-.5;as+=as*ic*(as-1)*((1.0904+Aa*(Aa*(3.55645-1.43519*Aa)-3.2452))*ic*ic+(.848013+Aa*(.215638*Aa-1.06021)))}let Ws=Zi.sub(gi)._mult(as)._add(gi)._unit()._mult(Ds?-1:1);this.addHalfVertex(Fr,Ws.x,Ws.y,!1,Ds,0,Er)}}ni&&this.addCurrentVertex(Fr,Zi,-ls,-is,Er)}else if(Jn==="butt")this.addCurrentVertex(Fr,nn,0,0,Er);else if(Jn==="square"){let _s=Xr?1:-1;this.addCurrentVertex(Fr,nn,_s,_s,Er)}else Jn==="round"&&(Xr&&(this.addCurrentVertex(Fr,gi,0,0,Er),this.addCurrentVertex(Fr,gi,1,1,Er,!0)),ni&&(this.addCurrentVertex(Fr,Zi,-1,-1,Er,!0),this.addCurrentVertex(Fr,Zi,0,0,Er)));if(Zo&&aa<St-1){let _s=Fr.dist(ni);if(_s>2*sr){let ls=Fr.add(ni.sub(Fr)._mult(sr/_s)._round());this.updateDistance(Fr,ls),this.addCurrentVertex(ls,Zi,0,0,Er),Fr=ls}}}}addCurrentVertex(D,$,he,Ee,je,We=!1){let ct=$.y*Ee-$.x,St=-$.y-$.x*Ee;this.addHalfVertex(D,$.x+$.y*he,$.y-$.x*he,We,!1,he,je),this.addHalfVertex(D,ct,St,We,!0,-Ee,je),this.distance>ad/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(D,$,he,Ee,je,We))}addHalfVertex({x:D,y:$},he,Ee,je,We,ct,St){let Nt=.5*(this.lineClips?this.scaledDistance*(ad-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((D<<1)+(je?1:0),($<<1)+(We?1:0),Math.round(63*he)+128,Math.round(63*Ee)+128,1+(ct===0?0:ct<0?-1:1)|(63&Nt)<<2,Nt>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let sr=St.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,sr),St.primitiveLength++),We?this.e2=sr:this.e1=sr}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(D,$){this.distance+=D.dist($),this.updateScaledDistance()}}let nd,jv;Ta("LineBucket",dd,{omit:["layers","patternFeatures"]});var tv={get paint(){return jv=jv||new Ue({"line-opacity":new es(re.paint_line["line-opacity"]),"line-color":new es(re.paint_line["line-color"]),"line-translate":new Po(re.paint_line["line-translate"]),"line-translate-anchor":new Po(re.paint_line["line-translate-anchor"]),"line-width":new es(re.paint_line["line-width"]),"line-gap-width":new es(re.paint_line["line-gap-width"]),"line-offset":new es(re.paint_line["line-offset"]),"line-blur":new es(re.paint_line["line-blur"]),"line-dasharray":new hc(re.paint_line["line-dasharray"]),"line-pattern":new Nc(re.paint_line["line-pattern"]),"line-gradient":new rc(re.paint_line["line-gradient"])})},get layout(){return nd=nd||new Ue({"line-cap":new Po(re.layout_line["line-cap"]),"line-join":new es(re.layout_line["line-join"]),"line-miter-limit":new Po(re.layout_line["line-miter-limit"]),"line-round-limit":new Po(re.layout_line["line-round-limit"]),"line-sort-key":new es(re.layout_line["line-sort-key"])})}};class Uf extends es{possiblyEvaluate(D,$){return $=new Zs(Math.floor($.zoom),{now:$.now,fadeDuration:$.fadeDuration,zoomHistory:$.zoomHistory,transition:$.transition}),super.possiblyEvaluate(D,$)}evaluate(D,$,he,Ee){return $=M({},$,{zoom:Math.floor($.zoom)}),super.evaluate(D,$,he,Ee)}}let rv;class Vv extends ae{constructor(D){super(D,tv),this.gradientVersion=0,rv||(rv=new Uf(tv.paint.properties["line-width"].specification),rv.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(D){if(D==="line-gradient"){let $=this.gradientExpression();this.stepInterpolant=!!function(he){return he._styleExpression!==void 0}($)&&$._styleExpression.expression instanceof Li,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(D,$){super.recalculate(D,$),this.paint._values["line-floorwidth"]=rv.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,D)}createBucket(D){return new dd(D)}queryRadius(D){let $=D,he=oh(va("line-width",this,$),va("line-gap-width",this,$)),Ee=va("line-offset",this,$);return he/2+Math.abs(Ee)+Fn(this.paint.get("line-translate"))}queryIntersectsFeature(D,$,he,Ee,je,We,ct){let St=Ha(D,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),We.angle,ct),Nt=ct/2*oh(this.paint.get("line-width").evaluate($,he),this.paint.get("line-gap-width").evaluate($,he)),sr=this.paint.get("line-offset").evaluate($,he);return sr&&(Ee=function(Er,Fr){let Xr=[];for(let ni=0;ni<Er.length;ni++){let gi=Er[ni],Zi=[];for(let aa=0;aa<gi.length;aa++){let nn=gi[aa-1],Aa=gi[aa],Ja=gi[aa+1],dn=aa===0?new n(0,0):Aa.sub(nn)._unit()._perp(),no=aa===gi.length-1?new n(0,0):Ja.sub(Aa)._unit()._perp(),Zo=dn._add(no)._unit(),Ds=Zo.x*no.x+Zo.y*no.y;Ds!==0&&Zo._mult(1/Ds),Zi.push(Zo._mult(Fr)._add(Aa))}Xr.push(Zi)}return Xr}(Ee,sr*ct)),function(Er,Fr,Xr){for(let ni=0;ni<Fr.length;ni++){let gi=Fr[ni];if(Er.length>=3){for(let Zi=0;Zi<gi.length;Zi++)if(ka(Er,gi[Zi]))return!0}if(hr(Er,gi,Xr))return!0}return!1}(St,Ee,Nt)}isTileClipped(){return!0}}function oh(W,D){return D>0?D+2*W:W}let xv=ht([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),xp=ht([{name:"a_projected_pos",components:3,type:"Float32"}],4);ht([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let bp=ht([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ht([{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 qv=ht([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bv=ht([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function wv(W,D,$){return W.sections.forEach(he=>{he.text=function(Ee,je,We){let ct=je.layout.get("text-transform").evaluate(We,{});return ct==="uppercase"?Ee=Ee.toLocaleUpperCase():ct==="lowercase"&&(Ee=Ee.toLocaleLowerCase()),cl.applyArabicShaping&&(Ee=cl.applyArabicShaping(Ee)),Ee}(he.text,D,$)}),W}ht([{name:"triangle",components:3,type:"Uint16"}]),ht([{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"}]),ht([{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"}]),ht([{type:"Float32",name:"offsetX"}]),ht([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ht([{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 _u=24,Th=Du,Hv=function(W,D,$,he,Ee){var je,We,ct=8*Ee-he-1,St=(1<<ct)-1,Nt=St>>1,sr=-7,Er=$?Ee-1:0,Fr=$?-1:1,Xr=W[D+Er];for(Er+=Fr,je=Xr&(1<<-sr)-1,Xr>>=-sr,sr+=ct;sr>0;je=256*je+W[D+Er],Er+=Fr,sr-=8);for(We=je&(1<<-sr)-1,je>>=-sr,sr+=he;sr>0;We=256*We+W[D+Er],Er+=Fr,sr-=8);if(je===0)je=1-Nt;else{if(je===St)return We?NaN:1/0*(Xr?-1:1);We+=Math.pow(2,he),je-=Nt}return(Xr?-1:1)*We*Math.pow(2,je-he)},wp=function(W,D,$,he,Ee,je){var We,ct,St,Nt=8*je-Ee-1,sr=(1<<Nt)-1,Er=sr>>1,Fr=Ee===23?Math.pow(2,-24)-Math.pow(2,-77):0,Xr=he?0:je-1,ni=he?1:-1,gi=D<0||D===0&&1/D<0?1:0;for(D=Math.abs(D),isNaN(D)||D===1/0?(ct=isNaN(D)?1:0,We=sr):(We=Math.floor(Math.log(D)/Math.LN2),D*(St=Math.pow(2,-We))<1&&(We--,St*=2),(D+=We+Er>=1?Fr/St:Fr*Math.pow(2,1-Er))*St>=2&&(We++,St/=2),We+Er>=sr?(ct=0,We=sr):We+Er>=1?(ct=(D*St-1)*Math.pow(2,Ee),We+=Er):(ct=D*Math.pow(2,Er-1)*Math.pow(2,Ee),We=0));Ee>=8;W[$+Xr]=255&ct,Xr+=ni,ct/=256,Ee-=8);for(We=We<<Ee|ct,Nt+=Ee;Nt>0;W[$+Xr]=255&We,Xr+=ni,We/=256,Nt-=8);W[$+Xr-ni]|=128*gi};function Du(W){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(W)?W:new Uint8Array(W||0),this.pos=0,this.type=0,this.length=this.buf.length}Du.Varint=0,Du.Fixed64=1,Du.Bytes=2,Du.Fixed32=5;var h0=4294967296,Tv=1/h0,fm=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function od(W){return W.type===Du.Bytes?W.readVarint()+W.pos:W.pos+1}function Av(W,D,$){return $?4294967296*D+(W>>>0):4294967296*(D>>>0)+(W>>>0)}function hm(W,D,$){var he=D<=16383?1:D<=2097151?2:D<=268435455?3:Math.floor(Math.log(D)/(7*Math.LN2));$.realloc(he);for(var Ee=$.pos-1;Ee>=W;Ee--)$.buf[Ee+he]=$.buf[Ee]}function d0(W,D){for(var $=0;$<W.length;$++)D.writeVarint(W[$])}function Vb(W,D){for(var $=0;$<W.length;$++)D.writeSVarint(W[$])}function qb(W,D){for(var $=0;$<W.length;$++)D.writeFloat(W[$])}function Hb(W,D){for(var $=0;$<W.length;$++)D.writeDouble(W[$])}function Gb(W,D){for(var $=0;$<W.length;$++)D.writeBoolean(W[$])}function KA(W,D){for(var $=0;$<W.length;$++)D.writeFixed32(W[$])}function Wb(W,D){for(var $=0;$<W.length;$++)D.writeSFixed32(W[$])}function Xb(W,D){for(var $=0;$<W.length;$++)D.writeFixed64(W[$])}function Yb(W,D){for(var $=0;$<W.length;$++)D.writeSFixed64(W[$])}function Gv(W,D){return(W[D]|W[D+1]<<8|W[D+2]<<16)+16777216*W[D+3]}function v0(W,D,$){W[$]=D,W[$+1]=D>>>8,W[$+2]=D>>>16,W[$+3]=D>>>24}function h1(W,D){return(W[D]|W[D+1]<<8|W[D+2]<<16)+(W[D+3]<<24)}Du.prototype={destroy:function(){this.buf=null},readFields:function(W,D,$){for($=$||this.length;this.pos<$;){var he=this.readVarint(),Ee=he>>3,je=this.pos;this.type=7&he,W(Ee,D,this),this.pos===je&&this.skip(he)}return D},readMessage:function(W,D){return this.readFields(W,D,this.readVarint()+this.pos)},readFixed32:function(){var W=Gv(this.buf,this.pos);return this.pos+=4,W},readSFixed32:function(){var W=h1(this.buf,this.pos);return this.pos+=4,W},readFixed64:function(){var W=Gv(this.buf,this.pos)+Gv(this.buf,this.pos+4)*h0;return this.pos+=8,W},readSFixed64:function(){var W=Gv(this.buf,this.pos)+h1(this.buf,this.pos+4)*h0;return this.pos+=8,W},readFloat:function(){var W=Hv(this.buf,this.pos,!0,23,4);return this.pos+=4,W},readDouble:function(){var W=Hv(this.buf,this.pos,!0,52,8);return this.pos+=8,W},readVarint:function(W){var D,$,he=this.buf;return D=127&($=he[this.pos++]),$<128?D:(D|=(127&($=he[this.pos++]))<<7,$<128?D:(D|=(127&($=he[this.pos++]))<<14,$<128?D:(D|=(127&($=he[this.pos++]))<<21,$<128?D:function(Ee,je,We){var ct,St,Nt=We.buf;if(ct=(112&(St=Nt[We.pos++]))>>4,St<128||(ct|=(127&(St=Nt[We.pos++]))<<3,St<128)||(ct|=(127&(St=Nt[We.pos++]))<<10,St<128)||(ct|=(127&(St=Nt[We.pos++]))<<17,St<128)||(ct|=(127&(St=Nt[We.pos++]))<<24,St<128)||(ct|=(1&(St=Nt[We.pos++]))<<31,St<128))return Av(Ee,ct,je);throw new Error("Expected varint not more than 10 bytes")}(D|=(15&($=he[this.pos]))<<28,W,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var W=this.readVarint();return W%2==1?(W+1)/-2:W/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var W=this.readVarint()+this.pos,D=this.pos;return this.pos=W,W-D>=12&&fm?function($,he,Ee){return fm.decode($.subarray(he,Ee))}(this.buf,D,W):function($,he,Ee){for(var je="",We=he;We<Ee;){var ct,St,Nt,sr=$[We],Er=null,Fr=sr>239?4:sr>223?3:sr>191?2:1;if(We+Fr>Ee)break;Fr===1?sr<128&&(Er=sr):Fr===2?(192&(ct=$[We+1]))==128&&(Er=(31&sr)<<6|63&ct)<=127&&(Er=null):Fr===3?(St=$[We+2],(192&(ct=$[We+1]))==128&&(192&St)==128&&((Er=(15&sr)<<12|(63&ct)<<6|63&St)<=2047||Er>=55296&&Er<=57343)&&(Er=null)):Fr===4&&(St=$[We+2],Nt=$[We+3],(192&(ct=$[We+1]))==128&&(192&St)==128&&(192&Nt)==128&&((Er=(15&sr)<<18|(63&ct)<<12|(63&St)<<6|63&Nt)<=65535||Er>=1114112)&&(Er=null)),Er===null?(Er=65533,Fr=1):Er>65535&&(Er-=65536,je+=String.fromCharCode(Er>>>10&1023|55296),Er=56320|1023&Er),je+=String.fromCharCode(Er),We+=Fr}return je}(this.buf,D,W)},readBytes:function(){var W=this.readVarint()+this.pos,D=this.buf.subarray(this.pos,W);return this.pos=W,D},readPackedVarint:function(W,D){if(this.type!==Du.Bytes)return W.push(this.readVarint(D));var $=od(this);for(W=W||[];this.pos<$;)W.push(this.readVarint(D));return W},readPackedSVarint:function(W){if(this.type!==Du.Bytes)return W.push(this.readSVarint());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readSVarint());return W},readPackedBoolean:function(W){if(this.type!==Du.Bytes)return W.push(this.readBoolean());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readBoolean());return W},readPackedFloat:function(W){if(this.type!==Du.Bytes)return W.push(this.readFloat());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readFloat());return W},readPackedDouble:function(W){if(this.type!==Du.Bytes)return W.push(this.readDouble());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readDouble());return W},readPackedFixed32:function(W){if(this.type!==Du.Bytes)return W.push(this.readFixed32());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readFixed32());return W},readPackedSFixed32:function(W){if(this.type!==Du.Bytes)return W.push(this.readSFixed32());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readSFixed32());return W},readPackedFixed64:function(W){if(this.type!==Du.Bytes)return W.push(this.readFixed64());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readFixed64());return W},readPackedSFixed64:function(W){if(this.type!==Du.Bytes)return W.push(this.readSFixed64());var D=od(this);for(W=W||[];this.pos<D;)W.push(this.readSFixed64());return W},skip:function(W){var D=7&W;if(D===Du.Varint)for(;this.buf[this.pos++]>127;);else if(D===Du.Bytes)this.pos=this.readVarint()+this.pos;else if(D===Du.Fixed32)this.pos+=4;else{if(D!==Du.Fixed64)throw new Error("Unimplemented type: "+D);this.pos+=8}},writeTag:function(W,D){this.writeVarint(W<<3|D)},realloc:function(W){for(var D=this.length||16;D<this.pos+W;)D*=2;if(D!==this.length){var $=new Uint8Array(D);$.set(this.buf),this.buf=$,this.length=D}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(W){this.realloc(4),v0(this.buf,W,this.pos),this.pos+=4},writeSFixed32:function(W){this.realloc(4),v0(this.buf,W,this.pos),this.pos+=4},writeFixed64:function(W){this.realloc(8),v0(this.buf,-1&W,this.pos),v0(this.buf,Math.floor(W*Tv),this.pos+4),this.pos+=8},writeSFixed64:function(W){this.realloc(8),v0(this.buf,-1&W,this.pos),v0(this.buf,Math.floor(W*Tv),this.pos+4),this.pos+=8},writeVarint:function(W){(W=+W||0)>268435455||W<0?function(D,$){var he,Ee;if(D>=0?(he=D%4294967296|0,Ee=D/4294967296|0):(Ee=~(-D/4294967296),4294967295^(he=~(-D%4294967296))?he=he+1|0:(he=0,Ee=Ee+1|0)),D>=18446744073709552e3||D<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");$.realloc(10),function(je,We,ct){ct.buf[ct.pos++]=127&je|128,je>>>=7,ct.buf[ct.pos++]=127&je|128,je>>>=7,ct.buf[ct.pos++]=127&je|128,je>>>=7,ct.buf[ct.pos++]=127&je|128,ct.buf[ct.pos]=127&(je>>>=7)}(he,0,$),function(je,We){var ct=(7&je)<<4;We.buf[We.pos++]|=ct|((je>>>=3)?128:0),je&&(We.buf[We.pos++]=127&je|((je>>>=7)?128:0),je&&(We.buf[We.pos++]=127&je|((je>>>=7)?128:0),je&&(We.buf[We.pos++]=127&je|((je>>>=7)?128:0),je&&(We.buf[We.pos++]=127&je|((je>>>=7)?128:0),je&&(We.buf[We.pos++]=127&je)))))}(Ee,$)}(W,this):(this.realloc(4),this.buf[this.pos++]=127&W|(W>127?128:0),W<=127||(this.buf[this.pos++]=127&(W>>>=7)|(W>127?128:0),W<=127||(this.buf[this.pos++]=127&(W>>>=7)|(W>127?128:0),W<=127||(this.buf[this.pos++]=W>>>7&127))))},writeSVarint:function(W){this.writeVarint(W<0?2*-W-1:2*W)},writeBoolean:function(W){this.writeVarint(!!W)},writeString:function(W){W=String(W),this.realloc(4*W.length),this.pos++;var D=this.pos;this.pos=function(he,Ee,je){for(var We,ct,St=0;St<Ee.length;St++){if((We=Ee.charCodeAt(St))>55295&&We<57344){if(!ct){We>56319||St+1===Ee.length?(he[je++]=239,he[je++]=191,he[je++]=189):ct=We;continue}if(We<56320){he[je++]=239,he[je++]=191,he[je++]=189,ct=We;continue}We=ct-55296<<10|We-56320|65536,ct=null}else ct&&(he[je++]=239,he[je++]=191,he[je++]=189,ct=null);We<128?he[je++]=We:(We<2048?he[je++]=We>>6|192:(We<65536?he[je++]=We>>12|224:(he[je++]=We>>18|240,he[je++]=We>>12&63|128),he[je++]=We>>6&63|128),he[je++]=63&We|128)}return je}(this.buf,W,this.pos);var $=this.pos-D;$>=128&&hm(D,$,this),this.pos=D-1,this.writeVarint($),this.pos+=$},writeFloat:function(W){this.realloc(4),wp(this.buf,W,this.pos,!0,23,4),this.pos+=4},writeDouble:function(W){this.realloc(8),wp(this.buf,W,this.pos,!0,52,8),this.pos+=8},writeBytes:function(W){var D=W.length;this.writeVarint(D),this.realloc(D);for(var $=0;$<D;$++)this.buf[this.pos++]=W[$]},writeRawMessage:function(W,D){this.pos++;var $=this.pos;W(D,this);var he=this.pos-$;he>=128&&hm($,he,this),this.pos=$-1,this.writeVarint(he),this.pos+=he},writeMessage:function(W,D,$){this.writeTag(W,Du.Bytes),this.writeRawMessage(D,$)},writePackedVarint:function(W,D){D.length&&this.writeMessage(W,d0,D)},writePackedSVarint:function(W,D){D.length&&this.writeMessage(W,Vb,D)},writePackedBoolean:function(W,D){D.length&&this.writeMessage(W,Gb,D)},writePackedFloat:function(W,D){D.length&&this.writeMessage(W,qb,D)},writePackedDouble:function(W,D){D.length&&this.writeMessage(W,Hb,D)},writePackedFixed32:function(W,D){D.length&&this.writeMessage(W,KA,D)},writePackedSFixed32:function(W,D){D.length&&this.writeMessage(W,Wb,D)},writePackedFixed64:function(W,D){D.length&&this.writeMessage(W,Xb,D)},writePackedSFixed64:function(W,D){D.length&&this.writeMessage(W,Yb,D)},writeBytesField:function(W,D){this.writeTag(W,Du.Bytes),this.writeBytes(D)},writeFixed32Field:function(W,D){this.writeTag(W,Du.Fixed32),this.writeFixed32(D)},writeSFixed32Field:function(W,D){this.writeTag(W,Du.Fixed32),this.writeSFixed32(D)},writeFixed64Field:function(W,D){this.writeTag(W,Du.Fixed64),this.writeFixed64(D)},writeSFixed64Field:function(W,D){this.writeTag(W,Du.Fixed64),this.writeSFixed64(D)},writeVarintField:function(W,D){this.writeTag(W,Du.Varint),this.writeVarint(D)},writeSVarintField:function(W,D){this.writeTag(W,Du.Varint),this.writeSVarint(D)},writeStringField:function(W,D){this.writeTag(W,Du.Bytes),this.writeString(D)},writeFloatField:function(W,D){this.writeTag(W,Du.Fixed32),this.writeFloat(D)},writeDoubleField:function(W,D){this.writeTag(W,Du.Fixed64),this.writeDouble(D)},writeBooleanField:function(W,D){this.writeVarintField(W,!!D)}};var Sg=r(Th);let Mg=3;function $A(W,D,$){W===1&&$.readMessage(Zb,D)}function Zb(W,D,$){if(W===3){let{id:he,bitmap:Ee,width:je,height:We,left:ct,top:St,advance:Nt}=$.readMessage(d1,{});D.push({id:he,bitmap:new Zn({width:je+2*Mg,height:We+2*Mg},Ee),metrics:{width:je,height:We,left:ct,top:St,advance:Nt}})}}function d1(W,D,$){W===1?D.id=$.readVarint():W===2?D.bitmap=$.readBytes():W===3?D.width=$.readVarint():W===4?D.height=$.readVarint():W===5?D.left=$.readSVarint():W===6?D.top=$.readSVarint():W===7&&(D.advance=$.readVarint())}let v1=Mg;function Eg(W){let D=0,$=0;for(let We of W)D+=We.w*We.h,$=Math.max($,We.w);W.sort((We,ct)=>ct.h-We.h);let he=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(D/.95)),$),h:1/0}],Ee=0,je=0;for(let We of W)for(let ct=he.length-1;ct>=0;ct--){let St=he[ct];if(!(We.w>St.w||We.h>St.h)){if(We.x=St.x,We.y=St.y,je=Math.max(je,We.y+We.h),Ee=Math.max(Ee,We.x+We.w),We.w===St.w&&We.h===St.h){let Nt=he.pop();ct<he.length&&(he[ct]=Nt)}else We.h===St.h?(St.x+=We.w,St.w-=We.w):We.w===St.w?(St.y+=We.h,St.h-=We.h):(he.push({x:St.x+We.w,y:St.y,w:St.w-We.w,h:We.h}),St.y+=We.h,St.h-=We.h);break}}return{w:Ee,h:je,fill:D/(Ee*je)||0}}let Ah=1;class dm{constructor(D,{pixelRatio:$,version:he,stretchX:Ee,stretchY:je,content:We,textFitWidth:ct,textFitHeight:St}){this.paddedRect=D,this.pixelRatio=$,this.stretchX=Ee,this.stretchY=je,this.content=We,this.version=he,this.textFitWidth=ct,this.textFitHeight=St}get tl(){return[this.paddedRect.x+Ah,this.paddedRect.y+Ah]}get br(){return[this.paddedRect.x+this.paddedRect.w-Ah,this.paddedRect.y+this.paddedRect.h-Ah]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Ah)/this.pixelRatio,(this.paddedRect.h-2*Ah)/this.pixelRatio]}}class vm{constructor(D,$){let he={},Ee={};this.haveRenderCallbacks=[];let je=[];this.addImages(D,he,je),this.addImages($,Ee,je);let{w:We,h:ct}=Eg(je),St=new ja({width:We||1,height:ct||1});for(let Nt in D){let sr=D[Nt],Er=he[Nt].paddedRect;ja.copy(sr.data,St,{x:0,y:0},{x:Er.x+Ah,y:Er.y+Ah},sr.data)}for(let Nt in $){let sr=$[Nt],Er=Ee[Nt].paddedRect,Fr=Er.x+Ah,Xr=Er.y+Ah,ni=sr.data.width,gi=sr.data.height;ja.copy(sr.data,St,{x:0,y:0},{x:Fr,y:Xr},sr.data),ja.copy(sr.data,St,{x:0,y:gi-1},{x:Fr,y:Xr-1},{width:ni,height:1}),ja.copy(sr.data,St,{x:0,y:0},{x:Fr,y:Xr+gi},{width:ni,height:1}),ja.copy(sr.data,St,{x:ni-1,y:0},{x:Fr-1,y:Xr},{width:1,height:gi}),ja.copy(sr.data,St,{x:0,y:0},{x:Fr+ni,y:Xr},{width:1,height:gi})}this.image=St,this.iconPositions=he,this.patternPositions=Ee}addImages(D,$,he){for(let Ee in D){let je=D[Ee],We={x:0,y:0,w:je.data.width+2*Ah,h:je.data.height+2*Ah};he.push(We),$[Ee]=new dm(We,je),je.hasRenderCallback&&this.haveRenderCallbacks.push(Ee)}}patchUpdatedImages(D,$){D.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let he in D.updatedImages)this.patchUpdatedImage(this.iconPositions[he],D.getImage(he),$),this.patchUpdatedImage(this.patternPositions[he],D.getImage(he),$)}patchUpdatedImage(D,$,he){if(!D||!$||D.version===$.version)return;D.version=$.version;let[Ee,je]=D.tl;he.update($.data,void 0,{x:Ee,y:je})}}var sd;Ta("ImagePosition",dm),Ta("ImageAtlas",vm),e.ah=void 0,(sd=e.ah||(e.ah={}))[sd.none=0]="none",sd[sd.horizontal=1]="horizontal",sd[sd.vertical=2]="vertical",sd[sd.horizontalOnly=3]="horizontalOnly";let Zf=-17;class p0{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(D,$){let he=new p0;return he.scale=D||1,he.fontStack=$,he}static forImage(D){let $=new p0;return $.imageName=D,$}}class Tp{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(D,$){let he=new Tp;for(let Ee=0;Ee<D.sections.length;Ee++){let je=D.sections[Ee];je.image?he.addImageSection(je):he.addTextSection(je,$)}return he}length(){return this.text.length}getSection(D){return this.sections[this.sectionIndex[D]]}getSectionIndex(D){return this.sectionIndex[D]}getCharCode(D){return this.text.charCodeAt(D)}verticalizePunctuation(){this.text=function(D){let $="";for(let he=0;he<D.length;he++){let Ee=D.charCodeAt(he+1)||null,je=D.charCodeAt(he-1)||null;$+=Ee&&Wl(Ee)&&!vc[D[he+1]]||je&&Wl(je)&&!vc[D[he-1]]||!vc[D[he]]?D[he]:vc[D[he]]}return $}(this.text)}trim(){let D=0;for(let he=0;he<this.text.length&&pm[this.text.charCodeAt(he)];he++)D++;let $=this.text.length;for(let he=this.text.length-1;he>=0&&he>=D&&pm[this.text.charCodeAt(he)];he--)$--;this.text=this.text.substring(D,$),this.sectionIndex=this.sectionIndex.slice(D,$)}substring(D,$){let he=new Tp;return he.text=this.text.substring(D,$),he.sectionIndex=this.sectionIndex.slice(D,$),he.sections=this.sections,he}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((D,$)=>Math.max(D,this.sections[$].scale),0)}addTextSection(D,$){this.text+=D.text,this.sections.push(p0.forText(D.scale,D.fontStack||$));let he=this.sections.length-1;for(let Ee=0;Ee<D.text.length;++Ee)this.sectionIndex.push(he)}addImageSection(D){let $=D.image?D.image.name:"";if($.length===0)return void f("Can't add FormattedSection with an empty image.");let he=this.getNextImageSectionCharCode();he?(this.text+=String.fromCharCode(he),this.sections.push(p0.forImage($)),this.sectionIndex.push(this.sections.length-1)):f("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function m0(W,D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni){let gi=Tp.fromFeature(W,Ee),Zi;Er===e.ah.vertical&&gi.verticalizePunctuation();let{processBidirectionalText:aa,processStyledBidirectionalText:nn}=cl;if(aa&&gi.sections.length===1){Zi=[];let dn=aa(gi.toString(),Ap(gi,Nt,je,D,he,Xr));for(let no of dn){let Zo=new Tp;Zo.text=no,Zo.sections=gi.sections;for(let Ds=0;Ds<no.length;Ds++)Zo.sectionIndex.push(0);Zi.push(Zo)}}else if(nn){Zi=[];let dn=nn(gi.text,gi.sectionIndex,Ap(gi,Nt,je,D,he,Xr));for(let no of dn){let Zo=new Tp;Zo.text=no[0],Zo.sectionIndex=no[1],Zo.sections=gi.sections,Zi.push(Zo)}}else Zi=function(dn,no){let Zo=[],Ds=dn.text,Fo=0;for(let Jn of no)Zo.push(dn.substring(Fo,Jn)),Fo=Jn;return Fo<Ds.length&&Zo.push(dn.substring(Fo,Ds.length)),Zo}(gi,Ap(gi,Nt,je,D,he,Xr));let Aa=[],Ja={positionedLines:Aa,text:gi.toString(),top:sr[1],bottom:sr[1],left:sr[0],right:sr[0],writingMode:Er,iconsInText:!1,verticalizable:!1};return function(dn,no,Zo,Ds,Fo,Jn,_s,ls,is,Nn,Ts,as){let Ws=0,ic=Zf,Yu=0,Kf=0,pd=ls==="right"?1:ls==="left"?0:.5,gh=0;for(let pf of Fo){pf.trim();let Jf=pf.getMaxScale(),Sh=(Jf-1)*_u,yh={positionedGlyphs:[],lineOffset:0};dn.positionedLines[gh]=yh;let sh=yh.positionedGlyphs,bf=0;if(!pf.length()){ic+=Jn,++gh;continue}for(let Hh=0;Hh<pf.length();Hh++){let xu=pf.getSection(Hh),pc=pf.getSectionIndex(Hh),ac=pf.getCharCode(Hh),ud=0,rf=null,Lp=null,jd=null,Rd=_u,md=!(is===e.ah.horizontal||!Ts&&!Bs(ac)||Ts&&(pm[ac]||($f=ac,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint($f)))));if(xu.imageName){let Uc=Ds[xu.imageName];if(!Uc)continue;jd=xu.imageName,dn.iconsInText=dn.iconsInText||!0,Lp=Uc.paddedRect;let If=Uc.displaySize;xu.scale=xu.scale*_u/as,rf={width:If[0],height:If[1],left:Ah,top:-v1,advance:md?If[1]:If[0]},ud=Sh+(_u-If[1]*xu.scale),Rd=rf.advance;let gd=md?If[0]*xu.scale-_u*Jf:If[1]*xu.scale-_u*Jf;gd>0&&gd>bf&&(bf=gd)}else{let Uc=Zo[xu.fontStack],If=Uc&&Uc[ac];if(If&&If.rect)Lp=If.rect,rf=If.metrics;else{let gd=no[xu.fontStack],ov=gd&&gd[ac];if(!ov)continue;rf=ov.metrics}ud=(Jf-xu.scale)*_u}md?(dn.verticalizable=!0,sh.push({glyph:ac,imageName:jd,x:Ws,y:ic+ud,vertical:md,scale:xu.scale,fontStack:xu.fontStack,sectionIndex:pc,metrics:rf,rect:Lp}),Ws+=Rd*xu.scale+Nn):(sh.push({glyph:ac,imageName:jd,x:Ws,y:ic+ud,vertical:md,scale:xu.scale,fontStack:xu.fontStack,sectionIndex:pc,metrics:rf,rect:Lp}),Ws+=rf.advance*xu.scale+Nn)}sh.length!==0&&(Yu=Math.max(Ws-Nn,Yu),Sv(sh,0,sh.length-1,pd,bf)),Ws=0;let ld=Jn*Jf+bf;yh.lineOffset=Math.max(bf,Sh),ic+=ld,Kf=Math.max(ld,Kf),++gh}var $f;let Fh=ic-Zf,{horizontalAlign:Bh,verticalAlign:Oh}=gm(_s);(function(pf,Jf,Sh,yh,sh,bf,ld,Hh,xu){let pc=(Jf-Sh)*sh,ac=0;ac=bf!==ld?-Hh*yh-Zf:(-yh*xu+.5)*ld;for(let ud of pf)for(let rf of ud.positionedGlyphs)rf.x+=pc,rf.y+=ac})(dn.positionedLines,pd,Bh,Oh,Yu,Kf,Jn,Fh,Fo.length),dn.top+=-Oh*Fh,dn.bottom=dn.top+Fh,dn.left+=-Bh*Yu,dn.right=dn.left+Yu}(Ja,D,$,he,Zi,We,ct,St,Er,Nt,Fr,ni),!function(dn){for(let no of dn)if(no.positionedGlyphs.length!==0)return!1;return!0}(Aa)&&Ja}let pm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Kb={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},$b={40:!0};function p1(W,D,$,he,Ee,je){if(D.imageName){let We=he[D.imageName];return We?We.displaySize[0]*D.scale*_u/je+Ee:0}{let We=$[D.fontStack],ct=We&&We[W];return ct?ct.metrics.advance*D.scale+Ee:0}}function m1(W,D,$,he){let Ee=Math.pow(W-D,2);return he?W<D?Ee/2:2*Ee:Ee+Math.abs($)*$}function Jb(W,D,$){let he=0;return W===10&&(he-=1e4),$&&(he+=150),W!==40&&W!==65288||(he+=50),D!==41&&D!==65289||(he+=50),he}function mm(W,D,$,he,Ee,je){let We=null,ct=m1(D,$,Ee,je);for(let St of he){let Nt=m1(D-St.x,$,Ee,je)+St.badness;Nt<=ct&&(We=St,ct=Nt)}return{index:W,x:D,priorBreak:We,badness:ct}}function g1(W){return W?g1(W.priorBreak).concat(W.index):[]}function Ap(W,D,$,he,Ee,je){if(!W)return[];let We=[],ct=function(Er,Fr,Xr,ni,gi,Zi){let aa=0;for(let nn=0;nn<Er.length();nn++){let Aa=Er.getSection(nn);aa+=p1(Er.getCharCode(nn),Aa,ni,gi,Fr,Zi)}return aa/Math.max(1,Math.ceil(aa/Xr))}(W,D,$,he,Ee,je),St=W.text.indexOf("\u200B")>=0,Nt=0;for(let Er=0;Er<W.length();Er++){let Fr=W.getSection(Er),Xr=W.getCharCode(Er);if(pm[Xr]||(Nt+=p1(Xr,Fr,he,Ee,D,je)),Er<W.length()-1){let ni=!((sr=Xr)<11904)&&(!!wn["CJK Compatibility Forms"](sr)||!!wn["CJK Compatibility"](sr)||!!wn["CJK Strokes"](sr)||!!wn["CJK Symbols and Punctuation"](sr)||!!wn["Enclosed CJK Letters and Months"](sr)||!!wn["Halfwidth and Fullwidth Forms"](sr)||!!wn["Ideographic Description Characters"](sr)||!!wn["Vertical Forms"](sr)||hl.test(String.fromCodePoint(sr)));(Kb[Xr]||ni||Fr.imageName||Er!==W.length()-2&&$b[W.getCharCode(Er+1)])&&We.push(mm(Er+1,Nt,ct,We,Jb(Xr,W.getCharCode(Er+1),ni&&St),!1))}}var sr;return g1(mm(W.length(),Nt,ct,We,0,!0))}function gm(W){let D=.5,$=.5;switch(W){case"right":case"top-right":case"bottom-right":D=1;break;case"left":case"top-left":case"bottom-left":D=0}switch(W){case"bottom":case"bottom-right":case"bottom-left":$=1;break;case"top":case"top-right":case"top-left":$=0}return{horizontalAlign:D,verticalAlign:$}}function Sv(W,D,$,he,Ee){if(!he&&!Ee)return;let je=W[$],We=(W[$].x+je.metrics.advance*je.scale)*he;for(let ct=D;ct<=$;ct++)W[ct].x-=We,W[ct].y+=Ee}function g0(W,D,$){let{horizontalAlign:he,verticalAlign:Ee}=gm($),je=D[0]-W.displaySize[0]*he,We=D[1]-W.displaySize[1]*Ee;return{image:W,top:We,bottom:We+W.displaySize[1],left:je,right:je+W.displaySize[0]}}function y1(W){var D,$;let he=W.left,Ee=W.top,je=W.right-he,We=W.bottom-Ee,ct=(D=W.image.textFitWidth)!==null&&D!==void 0?D:"stretchOrShrink",St=($=W.image.textFitHeight)!==null&&$!==void 0?$:"stretchOrShrink",Nt=(W.image.content[2]-W.image.content[0])/(W.image.content[3]-W.image.content[1]);if(St==="proportional"){if(ct==="stretchOnly"&&je/We<Nt||ct==="proportional"){let sr=Math.ceil(We*Nt);he*=sr/je,je=sr}}else if(ct==="proportional"&&St==="stretchOnly"&&Nt!==0&&je/We>Nt){let sr=Math.ceil(je/Nt);Ee*=sr/We,We=sr}return{x1:he,y1:Ee,x2:he+je,y2:Ee+We}}function _1(W,D,$,he,Ee,je){let We=W.image,ct;if(We.content){let Zi=We.content,aa=We.pixelRatio||1;ct=[Zi[0]/aa,Zi[1]/aa,We.displaySize[0]-Zi[2]/aa,We.displaySize[1]-Zi[3]/aa]}let St=D.left*je,Nt=D.right*je,sr,Er,Fr,Xr;$==="width"||$==="both"?(Xr=Ee[0]+St-he[3],Er=Ee[0]+Nt+he[1]):(Xr=Ee[0]+(St+Nt-We.displaySize[0])/2,Er=Xr+We.displaySize[0]);let ni=D.top*je,gi=D.bottom*je;return $==="height"||$==="both"?(sr=Ee[1]+ni-he[0],Fr=Ee[1]+gi+he[2]):(sr=Ee[1]+(ni+gi-We.displaySize[1])/2,Fr=sr+We.displaySize[1]),{image:We,top:sr,right:Er,bottom:Fr,left:Xr,collisionPadding:ct}}let y0=255,Ud=128,Mv=y0*Ud;function x1(W,D){let{expression:$}=D;if($.kind==="constant")return{kind:"constant",layoutSize:$.evaluate(new Zs(W+1))};if($.kind==="source")return{kind:"source"};{let{zoomStops:he,interpolationType:Ee}=$,je=0;for(;je<he.length&&he[je]<=W;)je++;je=Math.max(0,je-1);let We=je;for(;We<he.length&&he[We]<W+1;)We++;We=Math.min(he.length-1,We);let ct=he[je],St=he[We];return $.kind==="composite"?{kind:"composite",minZoom:ct,maxZoom:St,interpolationType:Ee}:{kind:"camera",minZoom:ct,maxZoom:St,minSize:$.evaluate(new Zs(ct)),maxSize:$.evaluate(new Zs(St)),interpolationType:Ee}}}function kg(W,D,$){let he="never",Ee=W.get(D);return Ee?he=Ee:W.get($)&&(he="always"),he}let Qb=$r.VectorTileFeature.types,ew=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ym(W,D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr){let Xr=ct?Math.min(Mv,Math.round(ct[0])):0,ni=ct?Math.min(Mv,Math.round(ct[1])):0;W.emplaceBack(D,$,Math.round(32*he),Math.round(32*Ee),je,We,(Xr<<1)+(St?1:0),ni,16*Nt,16*sr,256*Er,256*Fr)}function Cg(W,D,$){W.emplaceBack(D.x,D.y,$),W.emplaceBack(D.x,D.y,$),W.emplaceBack(D.x,D.y,$),W.emplaceBack(D.x,D.y,$)}function Lg(W){for(let D of W.sections)if(Jo(D.text))return!0;return!1}class Ig{constructor(D){this.layoutVertexArray=new yu,this.indexArray=new Fe,this.programConfigurations=D,this.segments=new At,this.dynamicLayoutVertexArray=new dc,this.opacityVertexArray=new Ql,this.hasVisibleVertices=!1,this.placedSymbolArray=new po}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(D,$,he,Ee){this.isEmpty()||(he&&(this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,xv.members),this.indexBuffer=D.createIndexBuffer(this.indexArray,$),this.dynamicLayoutVertexBuffer=D.createVertexBuffer(this.dynamicLayoutVertexArray,xp.members,!0),this.opacityVertexBuffer=D.createVertexBuffer(this.opacityVertexArray,ew,!0),this.opacityVertexBuffer.itemSize=1),(he||Ee)&&this.programConfigurations.upload(D))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ta("SymbolBuffers",Ig);class Ev{constructor(D,$,he){this.layoutVertexArray=new D,this.layoutAttributes=$,this.indexArray=new he,this.segments=new At,this.collisionVertexArray=new de}upload(D){this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=D.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=D.createVertexBuffer(this.collisionVertexArray,bp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ta("CollisionBuffers",Ev);class Sp{constructor(D){this.collisionBoxArray=D.collisionBoxArray,this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map(We=>We.id),this.index=D.index,this.pixelRatio=D.pixelRatio,this.sourceLayerIndex=D.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ba([]),this.placementViewportMatrix=ba([]);let $=this.layers[0]._unevaluatedLayout._values;this.textSizeData=x1(this.zoom,$["text-size"]),this.iconSizeData=x1(this.zoom,$["icon-size"]);let he=this.layers[0].layout,Ee=he.get("symbol-sort-key"),je=he.get("symbol-z-order");this.canOverlap=kg(he,"text-overlap","text-allow-overlap")!=="never"||kg(he,"icon-overlap","icon-allow-overlap")!=="never"||he.get("text-ignore-placement")||he.get("icon-ignore-placement"),this.sortFeaturesByKey=je!=="viewport-y"&&!Ee.isConstant(),this.sortFeaturesByY=(je==="viewport-y"||je==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,he.get("symbol-placement")==="point"&&(this.writingModes=he.get("text-writing-mode").map(We=>e.ah[We])),this.stateDependentLayerIds=this.layers.filter(We=>We.isStateDependent()).map(We=>We.id),this.sourceID=D.sourceID}createArrays(){this.text=new Ig(new ml(this.layers,this.zoom,D=>/^text/.test(D))),this.icon=new Ig(new ml(this.layers,this.zoom,D=>/^icon/.test(D))),this.glyphOffsetArray=new bs,this.lineVertexArray=new Ho,this.symbolInstances=new Vo,this.textAnchorOffsets=new Is}calculateGlyphDependencies(D,$,he,Ee,je){for(let We=0;We<D.length;We++)if($[D.charCodeAt(We)]=!0,(he||Ee)&&je){let ct=vc[D.charAt(We)];ct&&($[ct.charCodeAt(0)]=!0)}}populate(D,$,he){let Ee=this.layers[0],je=Ee.layout,We=je.get("text-font"),ct=je.get("text-field"),St=je.get("icon-image"),Nt=(ct.value.kind!=="constant"||ct.value.value instanceof ii&&!ct.value.value.isEmpty()||ct.value.value.toString().length>0)&&(We.value.kind!=="constant"||We.value.value.length>0),sr=St.value.kind!=="constant"||!!St.value.value||Object.keys(St.parameters).length>0,Er=je.get("symbol-sort-key");if(this.features=[],!Nt&&!sr)return;let Fr=$.iconDependencies,Xr=$.glyphDependencies,ni=$.availableImages,gi=new Zs(this.zoom);for(let{feature:Zi,id:aa,index:nn,sourceLayerIndex:Aa}of D){let Ja=Ee._featureFilter.needGeometry,dn=tu(Zi,Ja);if(!Ee._featureFilter.filter(gi,dn,he))continue;let no,Zo;if(Ja||(dn.geometry=Bl(Zi)),Nt){let Fo=Ee.getValueAndResolveTokens("text-field",dn,he,ni),Jn=ii.factory(Fo),_s=this.hasRTLText=this.hasRTLText||Lg(Jn);(!_s||cl.getRTLTextPluginStatus()==="unavailable"||_s&&cl.isParsed())&&(no=wv(Jn,Ee,dn))}if(sr){let Fo=Ee.getValueAndResolveTokens("icon-image",dn,he,ni);Zo=Fo instanceof ra?Fo:ra.fromString(Fo)}if(!no&&!Zo)continue;let Ds=this.sortFeaturesByKey?Er.evaluate(dn,{},he):void 0;if(this.features.push({id:aa,text:no,icon:Zo,index:nn,sourceLayerIndex:Aa,geometry:dn.geometry,properties:Zi.properties,type:Qb[Zi.type],sortKey:Ds}),Zo&&(Fr[Zo.name]=!0),no){let Fo=We.evaluate(dn,{},he).join(","),Jn=je.get("text-rotation-alignment")!=="viewport"&&je.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.ah.vertical)>=0;for(let _s of no.sections)if(_s.image)Fr[_s.image.name]=!0;else{let ls=Oo(no.toString()),is=_s.fontStack||Fo,Nn=Xr[is]=Xr[is]||{};this.calculateGlyphDependencies(_s.text,Nn,Jn,this.allowVerticalPlacement,ls)}}}je.get("symbol-placement")==="line"&&(this.features=function(Zi){let aa={},nn={},Aa=[],Ja=0;function dn(Fo){Aa.push(Zi[Fo]),Ja++}function no(Fo,Jn,_s){let ls=nn[Fo];return delete nn[Fo],nn[Jn]=ls,Aa[ls].geometry[0].pop(),Aa[ls].geometry[0]=Aa[ls].geometry[0].concat(_s[0]),ls}function Zo(Fo,Jn,_s){let ls=aa[Jn];return delete aa[Jn],aa[Fo]=ls,Aa[ls].geometry[0].shift(),Aa[ls].geometry[0]=_s[0].concat(Aa[ls].geometry[0]),ls}function Ds(Fo,Jn,_s){let ls=_s?Jn[0][Jn[0].length-1]:Jn[0][0];return`${Fo}:${ls.x}:${ls.y}`}for(let Fo=0;Fo<Zi.length;Fo++){let Jn=Zi[Fo],_s=Jn.geometry,ls=Jn.text?Jn.text.toString():null;if(!ls){dn(Fo);continue}let is=Ds(ls,_s),Nn=Ds(ls,_s,!0);if(is in nn&&Nn in aa&&nn[is]!==aa[Nn]){let Ts=Zo(is,Nn,_s),as=no(is,Nn,Aa[Ts].geometry);delete aa[is],delete nn[Nn],nn[Ds(ls,Aa[as].geometry,!0)]=as,Aa[Ts].geometry=null}else is in nn?no(is,Nn,_s):Nn in aa?Zo(is,Nn,_s):(dn(Fo),aa[is]=Ja-1,nn[Nn]=Ja-1)}return Aa.filter(Fo=>Fo.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Zi,aa)=>Zi.sortKey-aa.sortKey)}update(D,$,he){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(D,$,this.layers,he),this.icon.programConfigurations.updatePaintArrays(D,$,this.layers,he))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(D){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(D),this.iconCollisionBox.upload(D)),this.text.upload(D,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(D,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(D,$){let he=this.lineVertexArray.length;if(D.segment!==void 0){let Ee=D.dist($[D.segment+1]),je=D.dist($[D.segment]),We={};for(let ct=D.segment+1;ct<$.length;ct++)We[ct]={x:$[ct].x,y:$[ct].y,tileUnitDistanceFromAnchor:Ee},ct<$.length-1&&(Ee+=$[ct+1].dist($[ct]));for(let ct=D.segment||0;ct>=0;ct--)We[ct]={x:$[ct].x,y:$[ct].y,tileUnitDistanceFromAnchor:je},ct>0&&(je+=$[ct-1].dist($[ct]));for(let ct=0;ct<$.length;ct++){let St=We[ct];this.lineVertexArray.emplaceBack(St.x,St.y,St.tileUnitDistanceFromAnchor)}}return{lineStartIndex:he,lineLength:this.lineVertexArray.length-he}}addSymbols(D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr){let Xr=D.indexArray,ni=D.layoutVertexArray,gi=D.segments.prepareSegment(4*$.length,ni,Xr,this.canOverlap?We.sortKey:void 0),Zi=this.glyphOffsetArray.length,aa=gi.vertexLength,nn=this.allowVerticalPlacement&&ct===e.ah.vertical?Math.PI/2:0,Aa=We.text&&We.text.sections;for(let Ja=0;Ja<$.length;Ja++){let{tl:dn,tr:no,bl:Zo,br:Ds,tex:Fo,pixelOffsetTL:Jn,pixelOffsetBR:_s,minFontScaleX:ls,minFontScaleY:is,glyphOffset:Nn,isSDF:Ts,sectionIndex:as}=$[Ja],Ws=gi.vertexLength,ic=Nn[1];ym(ni,St.x,St.y,dn.x,ic+dn.y,Fo.x,Fo.y,he,Ts,Jn.x,Jn.y,ls,is),ym(ni,St.x,St.y,no.x,ic+no.y,Fo.x+Fo.w,Fo.y,he,Ts,_s.x,Jn.y,ls,is),ym(ni,St.x,St.y,Zo.x,ic+Zo.y,Fo.x,Fo.y+Fo.h,he,Ts,Jn.x,_s.y,ls,is),ym(ni,St.x,St.y,Ds.x,ic+Ds.y,Fo.x+Fo.w,Fo.y+Fo.h,he,Ts,_s.x,_s.y,ls,is),Cg(D.dynamicLayoutVertexArray,St,nn),Xr.emplaceBack(Ws,Ws+1,Ws+2),Xr.emplaceBack(Ws+1,Ws+2,Ws+3),gi.vertexLength+=4,gi.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Nn[0]),Ja!==$.length-1&&as===$[Ja+1].sectionIndex||D.programConfigurations.populatePaintArrays(ni.length,We,We.index,{},Fr,Aa&&Aa[as])}D.placedSymbolArray.emplaceBack(St.x,St.y,Zi,this.glyphOffsetArray.length-Zi,aa,Nt,sr,St.segment,he?he[0]:0,he?he[1]:0,Ee[0],Ee[1],ct,0,!1,0,Er)}_addCollisionDebugVertex(D,$,he,Ee,je,We){return $.emplaceBack(0,0),D.emplaceBack(he.x,he.y,Ee,je,Math.round(We.x),Math.round(We.y))}addCollisionDebugVertices(D,$,he,Ee,je,We,ct){let St=je.segments.prepareSegment(4,je.layoutVertexArray,je.indexArray),Nt=St.vertexLength,sr=je.layoutVertexArray,Er=je.collisionVertexArray,Fr=ct.anchorX,Xr=ct.anchorY;this._addCollisionDebugVertex(sr,Er,We,Fr,Xr,new n(D,$)),this._addCollisionDebugVertex(sr,Er,We,Fr,Xr,new n(he,$)),this._addCollisionDebugVertex(sr,Er,We,Fr,Xr,new n(he,Ee)),this._addCollisionDebugVertex(sr,Er,We,Fr,Xr,new n(D,Ee)),St.vertexLength+=4;let ni=je.indexArray;ni.emplaceBack(Nt,Nt+1),ni.emplaceBack(Nt+1,Nt+2),ni.emplaceBack(Nt+2,Nt+3),ni.emplaceBack(Nt+3,Nt),St.primitiveLength+=4}addDebugCollisionBoxes(D,$,he,Ee){for(let je=D;je<$;je++){let We=this.collisionBoxArray.get(je);this.addCollisionDebugVertices(We.x1,We.y1,We.x2,We.y2,Ee?this.textCollisionBox:this.iconCollisionBox,We.anchorPoint,he)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ev(eu,qv.members,Je),this.iconCollisionBox=new Ev(eu,qv.members,Je);for(let D=0;D<this.symbolInstances.length;D++){let $=this.symbolInstances.get(D);this.addDebugCollisionBoxes($.textBoxStartIndex,$.textBoxEndIndex,$,!0),this.addDebugCollisionBoxes($.verticalTextBoxStartIndex,$.verticalTextBoxEndIndex,$,!0),this.addDebugCollisionBoxes($.iconBoxStartIndex,$.iconBoxEndIndex,$,!1),this.addDebugCollisionBoxes($.verticalIconBoxStartIndex,$.verticalIconBoxEndIndex,$,!1)}}_deserializeCollisionBoxesForSymbol(D,$,he,Ee,je,We,ct,St,Nt){let sr={};for(let Er=$;Er<he;Er++){let Fr=D.get(Er);sr.textBox={x1:Fr.x1,y1:Fr.y1,x2:Fr.x2,y2:Fr.y2,anchorPointX:Fr.anchorPointX,anchorPointY:Fr.anchorPointY},sr.textFeatureIndex=Fr.featureIndex;break}for(let Er=Ee;Er<je;Er++){let Fr=D.get(Er);sr.verticalTextBox={x1:Fr.x1,y1:Fr.y1,x2:Fr.x2,y2:Fr.y2,anchorPointX:Fr.anchorPointX,anchorPointY:Fr.anchorPointY},sr.verticalTextFeatureIndex=Fr.featureIndex;break}for(let Er=We;Er<ct;Er++){let Fr=D.get(Er);sr.iconBox={x1:Fr.x1,y1:Fr.y1,x2:Fr.x2,y2:Fr.y2,anchorPointX:Fr.anchorPointX,anchorPointY:Fr.anchorPointY},sr.iconFeatureIndex=Fr.featureIndex;break}for(let Er=St;Er<Nt;Er++){let Fr=D.get(Er);sr.verticalIconBox={x1:Fr.x1,y1:Fr.y1,x2:Fr.x2,y2:Fr.y2,anchorPointX:Fr.anchorPointX,anchorPointY:Fr.anchorPointY},sr.verticalIconFeatureIndex=Fr.featureIndex;break}return sr}deserializeCollisionBoxes(D){this.collisionArrays=[];for(let $=0;$<this.symbolInstances.length;$++){let he=this.symbolInstances.get($);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(D,he.textBoxStartIndex,he.textBoxEndIndex,he.verticalTextBoxStartIndex,he.verticalTextBoxEndIndex,he.iconBoxStartIndex,he.iconBoxEndIndex,he.verticalIconBoxStartIndex,he.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(D,$){let he=D.placedSymbolArray.get($),Ee=he.vertexStartIndex+4*he.numGlyphs;for(let je=he.vertexStartIndex;je<Ee;je+=4)D.indexArray.emplaceBack(je,je+1,je+2),D.indexArray.emplaceBack(je+1,je+2,je+3)}getSortedSymbolIndexes(D){if(this.sortedAngle===D&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let $=Math.sin(D),he=Math.cos(D),Ee=[],je=[],We=[];for(let ct=0;ct<this.symbolInstances.length;++ct){We.push(ct);let St=this.symbolInstances.get(ct);Ee.push(0|Math.round($*St.anchorX+he*St.anchorY)),je.push(St.featureIndex)}return We.sort((ct,St)=>Ee[ct]-Ee[St]||je[St]-je[ct]),We}addToSortKeyRanges(D,$){let he=this.sortKeyRanges[this.sortKeyRanges.length-1];he&&he.sortKey===$?he.symbolInstanceEnd=D+1:this.sortKeyRanges.push({sortKey:$,symbolInstanceStart:D,symbolInstanceEnd:D+1})}sortFeatures(D){if(this.sortFeaturesByY&&this.sortedAngle!==D&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(D),this.sortedAngle=D,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let $ of this.symbolInstanceIndexes){let he=this.symbolInstances.get($);this.featureSortOrder.push(he.featureIndex),[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach((Ee,je,We)=>{Ee>=0&&We.indexOf(Ee)===je&&this.addIndicesForPlacedSymbol(this.text,Ee)}),he.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,he.verticalPlacedTextSymbolIndex),he.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,he.placedIconSymbolIndex),he.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,he.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let vf,_0;Ta("SymbolBucket",Sp,{omit:["layers","collisionBoxArray","features","compareText"]}),Sp.MAX_GLYPHS=65535,Sp.addDynamicAttributes=Cg;var _m={get paint(){return _0=_0||new Ue({"icon-opacity":new es(re.paint_symbol["icon-opacity"]),"icon-color":new es(re.paint_symbol["icon-color"]),"icon-halo-color":new es(re.paint_symbol["icon-halo-color"]),"icon-halo-width":new es(re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new es(re.paint_symbol["icon-halo-blur"]),"icon-translate":new Po(re.paint_symbol["icon-translate"]),"icon-translate-anchor":new Po(re.paint_symbol["icon-translate-anchor"]),"text-opacity":new es(re.paint_symbol["text-opacity"]),"text-color":new es(re.paint_symbol["text-color"],{runtimeType:Vt,getOverride:W=>W.textColor,hasOverride:W=>!!W.textColor}),"text-halo-color":new es(re.paint_symbol["text-halo-color"]),"text-halo-width":new es(re.paint_symbol["text-halo-width"]),"text-halo-blur":new es(re.paint_symbol["text-halo-blur"]),"text-translate":new Po(re.paint_symbol["text-translate"]),"text-translate-anchor":new Po(re.paint_symbol["text-translate-anchor"])})},get layout(){return vf=vf||new Ue({"symbol-placement":new Po(re.layout_symbol["symbol-placement"]),"symbol-spacing":new Po(re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Po(re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new es(re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Po(re.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Po(re.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Po(re.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Po(re.layout_symbol["icon-ignore-placement"]),"icon-optional":new Po(re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Po(re.layout_symbol["icon-rotation-alignment"]),"icon-size":new es(re.layout_symbol["icon-size"]),"icon-text-fit":new Po(re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Po(re.layout_symbol["icon-text-fit-padding"]),"icon-image":new es(re.layout_symbol["icon-image"]),"icon-rotate":new es(re.layout_symbol["icon-rotate"]),"icon-padding":new es(re.layout_symbol["icon-padding"]),"icon-keep-upright":new Po(re.layout_symbol["icon-keep-upright"]),"icon-offset":new es(re.layout_symbol["icon-offset"]),"icon-anchor":new es(re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Po(re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Po(re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Po(re.layout_symbol["text-rotation-alignment"]),"text-field":new es(re.layout_symbol["text-field"]),"text-font":new es(re.layout_symbol["text-font"]),"text-size":new es(re.layout_symbol["text-size"]),"text-max-width":new es(re.layout_symbol["text-max-width"]),"text-line-height":new Po(re.layout_symbol["text-line-height"]),"text-letter-spacing":new es(re.layout_symbol["text-letter-spacing"]),"text-justify":new es(re.layout_symbol["text-justify"]),"text-radial-offset":new es(re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Po(re.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new es(re.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new es(re.layout_symbol["text-anchor"]),"text-max-angle":new Po(re.layout_symbol["text-max-angle"]),"text-writing-mode":new Po(re.layout_symbol["text-writing-mode"]),"text-rotate":new es(re.layout_symbol["text-rotate"]),"text-padding":new Po(re.layout_symbol["text-padding"]),"text-keep-upright":new Po(re.layout_symbol["text-keep-upright"]),"text-transform":new es(re.layout_symbol["text-transform"]),"text-offset":new es(re.layout_symbol["text-offset"]),"text-allow-overlap":new Po(re.layout_symbol["text-allow-overlap"]),"text-overlap":new Po(re.layout_symbol["text-overlap"]),"text-ignore-placement":new Po(re.layout_symbol["text-ignore-placement"]),"text-optional":new Po(re.layout_symbol["text-optional"])})}};class x0{constructor(D){if(D.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=D.property.overrides?D.property.overrides.runtimeType:at,this.defaultValue=D}evaluate(D){if(D.formattedSection){let $=this.defaultValue.property.overrides;if($&&$.hasOverride(D.formattedSection))return $.getOverride(D.formattedSection)}return D.feature&&D.featureState?this.defaultValue.evaluate(D.feature,D.featureState):this.defaultValue.property.specification.default}eachChild(D){this.defaultValue.isConstant()||D(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ta("FormatSectionOverride",x0,{omit:["defaultValue"]});class Wv extends ae{constructor(D){super(D,_m)}recalculate(D,$){if(super.recalculate(D,$),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 he=this.layout.get("text-writing-mode");if(he){let Ee=[];for(let je of he)Ee.indexOf(je)<0&&Ee.push(je);this.layout._values["text-writing-mode"]=Ee}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(D,$,he,Ee){let je=this.layout.get(D).evaluate($,{},he,Ee),We=this._unevaluatedLayout._values[D];return We.isDataDriven()||Ic(We.value)||!je?je:function(ct,St){return St.replace(/{([^{}]+)}/g,(Nt,sr)=>ct&&sr in ct?String(ct[sr]):"")}($.properties,je)}createBucket(D){return new Sp(D)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let D of _m.paint.overridableProperties){if(!Wv.hasPaintOverride(this.layout,D))continue;let $=this.paint.get(D),he=new x0($),Ee=new Bu(he,$.property.specification),je=null;je=$.value.kind==="constant"||$.value.kind==="source"?new _c("source",Ee):new Eu("composite",Ee,$.value.zoomStops),this.paint._values[D]=new Pu($.property,je,$.parameters)}}_handleOverridablePaintPropertyUpdate(D,$,he){return!(!this.layout||$.isDataDriven()||he.isDataDriven())&&Wv.hasPaintOverride(this.layout,D)}static hasPaintOverride(D,$){let he=D.get("text-field"),Ee=_m.paint.properties[$],je=!1,We=ct=>{for(let St of ct)if(Ee.overrides&&Ee.overrides.hasOverride(St))return void(je=!0)};if(he.value.kind==="constant"&&he.value.value instanceof ii)We(he.value.value.sections);else if(he.value.kind==="source"){let ct=Nt=>{je||(Nt instanceof _n&&ji(Nt.value)===qr?We(Nt.value.sections):Nt instanceof Ms?We(Nt.sections):Nt.eachChild(ct))},St=he.value;St._styleExpression&&ct(St._styleExpression.expression)}return je}}let b1;var b0={get paint(){return b1=b1||new Ue({"background-color":new Po(re.paint_background["background-color"]),"background-pattern":new hc(re.paint_background["background-pattern"]),"background-opacity":new Po(re.paint_background["background-opacity"])})}};class tw extends ae{constructor(D){super(D,b0)}}let Pg;var w1={get paint(){return Pg=Pg||new Ue({"raster-opacity":new Po(re.paint_raster["raster-opacity"]),"raster-hue-rotate":new Po(re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Po(re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Po(re.paint_raster["raster-brightness-max"]),"raster-saturation":new Po(re.paint_raster["raster-saturation"]),"raster-contrast":new Po(re.paint_raster["raster-contrast"]),"raster-resampling":new Po(re.paint_raster["raster-resampling"]),"raster-fade-duration":new Po(re.paint_raster["raster-fade-duration"])})}};class w0 extends ae{constructor(D){super(D,w1)}}class Rg extends ae{constructor(D){super(D,{}),this.onAdd=$=>{this.implementation.onAdd&&this.implementation.onAdd($,$.painter.context.gl)},this.onRemove=$=>{this.implementation.onRemove&&this.implementation.onRemove($,$.painter.context.gl)},this.implementation=D}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 Dg{constructor(D){this._methodToThrottle=D,this._triggered=!1,typeof MessageChannel<"u"&&(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 zg=63710088e-1;class iv{constructor(D,$){if(isNaN(D)||isNaN($))throw new Error(`Invalid LngLat object: (${D}, ${$})`);if(this.lng=+D,this.lat=+$,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new iv(A(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(D){let $=Math.PI/180,he=this.lat*$,Ee=D.lat*$,je=Math.sin(he)*Math.sin(Ee)+Math.cos(he)*Math.cos(Ee)*Math.cos((D.lng-this.lng)*$);return zg*Math.acos(Math.min(je,1))}static convert(D){if(D instanceof iv)return D;if(Array.isArray(D)&&(D.length===2||D.length===3))return new iv(Number(D[0]),Number(D[1]));if(!Array.isArray(D)&&typeof D=="object"&&D!==null)return new iv(Number("lng"in D?D.lng:D.lon),Number(D.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 Mp=2*Math.PI*zg;function T1(W){return Mp*Math.cos(W*Math.PI/180)}function xm(W){return(180+W)/360}function A1(W){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+W*Math.PI/360)))/360}function bm(W,D){return W/T1(D)}function T0(W){return 360/Math.PI*Math.atan(Math.exp((180-360*W)*Math.PI/180))-90}class A0{constructor(D,$,he=0){this.x=+D,this.y=+$,this.z=+he}static fromLngLat(D,$=0){let he=iv.convert(D);return new A0(xm(he.lng),A1(he.lat),bm($,he.lat))}toLngLat(){return new iv(360*this.x-180,T0(this.y))}toAltitude(){return this.z*T1(T0(this.y))}meterInMercatorCoordinateUnits(){return 1/Mp*(D=T0(this.y),1/Math.cos(D*Math.PI/180));var D}}function kd(W,D,$){var he=2*Math.PI*6378137/256/Math.pow(2,$);return[W*he-2*Math.PI*6378137/2,D*he-2*Math.PI*6378137/2]}class Fg{constructor(D,$,he){if(!function(Ee,je,We){return!(Ee<0||Ee>25||We<0||We>=Math.pow(2,Ee)||je<0||je>=Math.pow(2,Ee))}(D,$,he))throw new Error(`x=${$}, y=${he}, z=${D} outside of bounds. 0<=x<${Math.pow(2,D)}, 0<=y<${Math.pow(2,D)} 0<=z<=25 `);this.z=D,this.x=$,this.y=he,this.key=S0(0,D,D,$,he)}equals(D){return this.z===D.z&&this.x===D.x&&this.y===D.y}url(D,$,he){let Ee=(We=this.y,ct=this.z,St=kd(256*(je=this.x),256*(We=Math.pow(2,ct)-We-1),ct),Nt=kd(256*(je+1),256*(We+1),ct),St[0]+","+St[1]+","+Nt[0]+","+Nt[1]);var je,We,ct,St,Nt;let sr=function(Er,Fr,Xr){let ni,gi="";for(let Zi=Er;Zi>0;Zi--)ni=1<<Zi-1,gi+=(Fr&ni?1:0)+(Xr&ni?2:0);return gi}(this.z,this.x,this.y);return D[(this.x+this.y)%D.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(he==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,$>1?"@2x":"").replace(/{quadkey}/g,sr).replace(/{bbox-epsg-3857}/g,Ee)}isChildOf(D){let $=this.z-D.z;return $>0&&D.x===this.x>>$&&D.y===this.y>>$}getTilePoint(D){let $=Math.pow(2,this.z);return new n((D.x*$-this.x)*zo,(D.y*$-this.y)*zo)}toString(){return`${this.z}/${this.x}/${this.y}`}}class S1{constructor(D,$){this.wrap=D,this.canonical=$,this.key=S0(D,$.z,$.z,$.x,$.y)}}class vd{constructor(D,$,he,Ee,je){if(D<he)throw new Error(`overscaledZ should be >= z; overscaledZ = ${D}; z = ${he}`);this.overscaledZ=D,this.wrap=$,this.canonical=new Fg(he,+Ee,+je),this.key=S0($,D,he,Ee,je)}clone(){return new vd(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(D){return this.overscaledZ===D.overscaledZ&&this.wrap===D.wrap&&this.canonical.equals(D.canonical)}scaledTo(D){if(D>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${D}; overscaledZ = ${this.overscaledZ}`);let $=this.canonical.z-D;return D>this.canonical.z?new vd(D,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new vd(D,this.wrap,D,this.canonical.x>>$,this.canonical.y>>$)}calculateScaledKey(D,$){if(D>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${D}; overscaledZ = ${this.overscaledZ}`);let he=this.canonical.z-D;return D>this.canonical.z?S0(this.wrap*+$,D,this.canonical.z,this.canonical.x,this.canonical.y):S0(this.wrap*+$,D,D,this.canonical.x>>he,this.canonical.y>>he)}isChildOf(D){if(D.wrap!==this.wrap)return!1;let $=this.canonical.z-D.canonical.z;return D.overscaledZ===0||D.overscaledZ<this.overscaledZ&&D.canonical.x===this.canonical.x>>$&&D.canonical.y===this.canonical.y>>$}children(D){if(this.overscaledZ>=D)return[new vd(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let $=this.canonical.z+1,he=2*this.canonical.x,Ee=2*this.canonical.y;return[new vd($,this.wrap,$,he,Ee),new vd($,this.wrap,$,he+1,Ee),new vd($,this.wrap,$,he,Ee+1),new vd($,this.wrap,$,he+1,Ee+1)]}isLessThan(D){return this.wrap<D.wrap||!(this.wrap>D.wrap)&&(this.overscaledZ<D.overscaledZ||!(this.overscaledZ>D.overscaledZ)&&(this.canonical.x<D.canonical.x||!(this.canonical.x>D.canonical.x)&&this.canonical.y<D.canonical.y))}wrapped(){return new vd(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(D){return new vd(this.overscaledZ,D,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new S1(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(D){return this.canonical.getTilePoint(new A0(D.x-this.wrap,D.y))}}function S0(W,D,$,he,Ee){(W*=2)<0&&(W=-1*W-1);let je=1<<$;return(je*je*W+je*Ee+he).toString(36)+$.toString(36)+D.toString(36)}Ta("CanonicalTileID",Fg),Ta("OverscaledTileID",vd,{omit:["posMatrix"]});class M1{constructor(D,$,he,Ee=1,je=1,We=1,ct=0){if(this.uid=D,$.height!==$.width)throw new RangeError("DEM tiles must be square");if(he&&!["mapbox","terrarium","custom"].includes(he))return void f(`"${he}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=$.height;let St=this.dim=$.height-2;switch(this.data=new Uint32Array($.data.buffer),he){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=Ee,this.greenFactor=je,this.blueFactor=We,this.baseShift=ct;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let Nt=0;Nt<St;Nt++)this.data[this._idx(-1,Nt)]=this.data[this._idx(0,Nt)],this.data[this._idx(St,Nt)]=this.data[this._idx(St-1,Nt)],this.data[this._idx(Nt,-1)]=this.data[this._idx(Nt,0)],this.data[this._idx(Nt,St)]=this.data[this._idx(Nt,St-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(St,-1)]=this.data[this._idx(St-1,0)],this.data[this._idx(-1,St)]=this.data[this._idx(0,St-1)],this.data[this._idx(St,St)]=this.data[this._idx(St-1,St-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let Nt=0;Nt<St;Nt++)for(let sr=0;sr<St;sr++){let Er=this.get(Nt,sr);Er>this.max&&(this.max=Er),Er<this.min&&(this.min=Er)}}get(D,$){let he=new Uint8Array(this.data.buffer),Ee=4*this._idx(D,$);return this.unpack(he[Ee],he[Ee+1],he[Ee+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(D,$){if(D<-1||D>=this.dim+1||$<-1||$>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return($+1)*this.stride+(D+1)}unpack(D,$,he){return D*this.redFactor+$*this.greenFactor+he*this.blueFactor-this.baseShift}getPixels(){return new ja({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(D,$,he){if(this.dim!==D.dim)throw new Error("dem dimension mismatch");let Ee=$*this.dim,je=$*this.dim+this.dim,We=he*this.dim,ct=he*this.dim+this.dim;switch($){case-1:Ee=je-1;break;case 1:je=Ee+1}switch(he){case-1:We=ct-1;break;case 1:ct=We+1}let St=-$*this.dim,Nt=-he*this.dim;for(let sr=We;sr<ct;sr++)for(let Er=Ee;Er<je;Er++)this.data[this._idx(Er,sr)]=D.data[this._idx(Er+St,sr+Nt)]}}Ta("DEMData",M1);class E1{constructor(D){this._stringToNumber={},this._numberToString=[];for(let $=0;$<D.length;$++){let he=D[$];this._stringToNumber[he]=$,this._numberToString[$]=he}}encode(D){return this._stringToNumber[D]}decode(D){if(D>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${D} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[D]}}class Bg{constructor(D,$,he,Ee,je){this.type="Feature",this._vectorTileFeature=D,D._z=$,D._x=he,D._y=Ee,this.properties=D.properties,this.id=je}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(D){this._geometry=D}toJSON(){let D={geometry:this.geometry};for(let $ in this)$!=="_geometry"&&$!=="_vectorTileFeature"&&(D[$]=this[$]);return D}}class Xv{constructor(D,$){this.tileID=D,this.x=D.canonical.x,this.y=D.canonical.y,this.z=D.canonical.z,this.grid=new qa(zo,16,0),this.grid3D=new qa(zo,16,0),this.featureIndexArray=new dl,this.promoteId=$}insert(D,$,he,Ee,je,We){let ct=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(he,Ee,je);let St=We?this.grid3D:this.grid;for(let Nt=0;Nt<$.length;Nt++){let sr=$[Nt],Er=[1/0,1/0,-1/0,-1/0];for(let Fr=0;Fr<sr.length;Fr++){let Xr=sr[Fr];Er[0]=Math.min(Er[0],Xr.x),Er[1]=Math.min(Er[1],Xr.y),Er[2]=Math.max(Er[2],Xr.x),Er[3]=Math.max(Er[3],Xr.y)}Er[0]<zo&&Er[1]<zo&&Er[2]>=0&&Er[3]>=0&&St.insert(ct,Er[0],Er[1],Er[2],Er[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new $r.VectorTile(new Sg(this.rawTileData)).layers,this.sourceLayerCoder=new E1(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(D,$,he,Ee){this.loadVTLayers();let je=D.params||{},We=zo/D.tileSize/D.scale,ct=Pc(je.filter),St=D.queryGeometry,Nt=D.queryPadding*We,sr=C1(St),Er=this.grid.query(sr.minX-Nt,sr.minY-Nt,sr.maxX+Nt,sr.maxY+Nt),Fr=C1(D.cameraQueryGeometry),Xr=this.grid3D.query(Fr.minX-Nt,Fr.minY-Nt,Fr.maxX+Nt,Fr.maxY+Nt,(Zi,aa,nn,Aa)=>function(Ja,dn,no,Zo,Ds){for(let Jn of Ja)if(dn<=Jn.x&&no<=Jn.y&&Zo>=Jn.x&&Ds>=Jn.y)return!0;let Fo=[new n(dn,no),new n(dn,Ds),new n(Zo,Ds),new n(Zo,no)];if(Ja.length>2){for(let Jn of Fo)if(ka(Ja,Jn))return!0}for(let Jn=0;Jn<Ja.length-1;Jn++)if(Sa(Ja[Jn],Ja[Jn+1],Fo))return!0;return!1}(D.cameraQueryGeometry,Zi-Nt,aa-Nt,nn+Nt,Aa+Nt));for(let Zi of Xr)Er.push(Zi);Er.sort(rw);let ni={},gi;for(let Zi=0;Zi<Er.length;Zi++){let aa=Er[Zi];if(aa===gi)continue;gi=aa;let nn=this.featureIndexArray.get(aa),Aa=null;this.loadMatchingFeature(ni,nn.bucketIndex,nn.sourceLayerIndex,nn.featureIndex,ct,je.layers,je.availableImages,$,he,Ee,(Ja,dn,no)=>(Aa||(Aa=Bl(Ja)),dn.queryIntersectsFeature(St,Ja,no,Aa,this.z,D.transform,We,D.pixelPosMatrix)))}return ni}loadMatchingFeature(D,$,he,Ee,je,We,ct,St,Nt,sr,Er){let Fr=this.bucketLayerIDs[$];if(We&&!function(Zi,aa){for(let nn=0;nn<Zi.length;nn++)if(aa.indexOf(Zi[nn])>=0)return!0;return!1}(We,Fr))return;let Xr=this.sourceLayerCoder.decode(he),ni=this.vtLayers[Xr].feature(Ee);if(je.needGeometry){let Zi=tu(ni,!0);if(!je.filter(new Zs(this.tileID.overscaledZ),Zi,this.tileID.canonical))return}else if(!je.filter(new Zs(this.tileID.overscaledZ),ni))return;let gi=this.getId(ni,Xr);for(let Zi=0;Zi<Fr.length;Zi++){let aa=Fr[Zi];if(We&&We.indexOf(aa)<0)continue;let nn=St[aa];if(!nn)continue;let Aa={};gi&&sr&&(Aa=sr.getState(nn.sourceLayer||"_geojsonTileLayer",gi));let Ja=M({},Nt[aa]);Ja.paint=k1(Ja.paint,nn.paint,ni,Aa,ct),Ja.layout=k1(Ja.layout,nn.layout,ni,Aa,ct);let dn=!Er||Er(ni,nn,Aa);if(!dn)continue;let no=new Bg(ni,this.z,this.x,this.y,gi);no.layer=Ja;let Zo=D[aa];Zo===void 0&&(Zo=D[aa]=[]),Zo.push({featureIndex:Ee,feature:no,intersectionZ:dn})}}lookupSymbolFeatures(D,$,he,Ee,je,We,ct,St){let Nt={};this.loadVTLayers();let sr=Pc(je);for(let Er of D)this.loadMatchingFeature(Nt,he,Ee,Er,sr,We,ct,St,$);return Nt}hasLayer(D){for(let $ of this.bucketLayerIDs)for(let he of $)if(D===he)return!0;return!1}getId(D,$){let he=D.id;return this.promoteId&&(he=D.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[$]],typeof he=="boolean"&&(he=Number(he))),he}}function k1(W,D,$,he,Ee){return b(W,(je,We)=>{let ct=D instanceof wc?D.get(We):null;return ct&&ct.evaluate?ct.evaluate($,he,Ee):ct})}function C1(W){let D=1/0,$=1/0,he=-1/0,Ee=-1/0;for(let je of W)D=Math.min(D,je.x),$=Math.min($,je.y),he=Math.max(he,je.x),Ee=Math.max(Ee,je.y);return{minX:D,minY:$,maxX:he,maxY:Ee}}function rw(W,D){return D-W}function L1(W,D,$,he,Ee){let je=[];for(let We=0;We<W.length;We++){let ct=W[We],St;for(let Nt=0;Nt<ct.length-1;Nt++){let sr=ct[Nt],Er=ct[Nt+1];sr.x<D&&Er.x<D||(sr.x<D?sr=new n(D,sr.y+(D-sr.x)/(Er.x-sr.x)*(Er.y-sr.y))._round():Er.x<D&&(Er=new n(D,sr.y+(D-sr.x)/(Er.x-sr.x)*(Er.y-sr.y))._round()),sr.y<$&&Er.y<$||(sr.y<$?sr=new n(sr.x+($-sr.y)/(Er.y-sr.y)*(Er.x-sr.x),$)._round():Er.y<$&&(Er=new n(sr.x+($-sr.y)/(Er.y-sr.y)*(Er.x-sr.x),$)._round()),sr.x>=he&&Er.x>=he||(sr.x>=he?sr=new n(he,sr.y+(he-sr.x)/(Er.x-sr.x)*(Er.y-sr.y))._round():Er.x>=he&&(Er=new n(he,sr.y+(he-sr.x)/(Er.x-sr.x)*(Er.y-sr.y))._round()),sr.y>=Ee&&Er.y>=Ee||(sr.y>=Ee?sr=new n(sr.x+(Ee-sr.y)/(Er.y-sr.y)*(Er.x-sr.x),Ee)._round():Er.y>=Ee&&(Er=new n(sr.x+(Ee-sr.y)/(Er.y-sr.y)*(Er.x-sr.x),Ee)._round()),St&&sr.equals(St[St.length-1])||(St=[sr],je.push(St)),St.push(Er)))))}}return je}Ta("FeatureIndex",Xv,{omit:["rawTileData","sourceLayerCoder"]});class av extends n{constructor(D,$,he,Ee){super(D,$),this.angle=he,Ee!==void 0&&(this.segment=Ee)}clone(){return new av(this.x,this.y,this.angle,this.segment)}}function Og(W,D,$,he,Ee){if(D.segment===void 0||$===0)return!0;let je=D,We=D.segment+1,ct=0;for(;ct>-$/2;){if(We--,We<0)return!1;ct-=W[We].dist(je),je=W[We]}ct+=W[We].dist(W[We+1]),We++;let St=[],Nt=0;for(;ct<$/2;){let sr=W[We],Er=W[We+1];if(!Er)return!1;let Fr=W[We-1].angleTo(sr)-sr.angleTo(Er);for(Fr=Math.abs((Fr+3*Math.PI)%(2*Math.PI)-Math.PI),St.push({distance:ct,angleDelta:Fr}),Nt+=Fr;ct-St[0].distance>he;)Nt-=St.shift().angleDelta;if(Nt>Ee)return!1;We++,ct+=sr.dist(Er)}return!0}function I1(W){let D=0;for(let $=0;$<W.length-1;$++)D+=W[$].dist(W[$+1]);return D}function P1(W,D,$){return W?.6*D*$:0}function R1(W,D){return Math.max(W?W.right-W.left:0,D?D.right-D.left:0)}function iw(W,D,$,he,Ee,je){let We=P1($,Ee,je),ct=R1($,he)*je,St=0,Nt=I1(W)/2;for(let sr=0;sr<W.length-1;sr++){let Er=W[sr],Fr=W[sr+1],Xr=Er.dist(Fr);if(St+Xr>Nt){let ni=(Nt-St)/Xr,gi=eo.number(Er.x,Fr.x,ni),Zi=eo.number(Er.y,Fr.y,ni),aa=new av(gi,Zi,Fr.angleTo(Er),sr);return aa._round(),!We||Og(W,aa,ct,We,D)?aa:void 0}St+=Xr}}function aw(W,D,$,he,Ee,je,We,ct,St){let Nt=P1(he,je,We),sr=R1(he,Ee),Er=sr*We,Fr=W[0].x===0||W[0].x===St||W[0].y===0||W[0].y===St;return D-Er<D/4&&(D=Er+D/4),D1(W,Fr?D/2*ct%D:(sr/2+2*je)*We*ct%D,D,Nt,$,Er,Fr,!1,St)}function D1(W,D,$,he,Ee,je,We,ct,St){let Nt=je/2,sr=I1(W),Er=0,Fr=D-$,Xr=[];for(let ni=0;ni<W.length-1;ni++){let gi=W[ni],Zi=W[ni+1],aa=gi.dist(Zi),nn=Zi.angleTo(gi);for(;Fr+$<Er+aa;){Fr+=$;let Aa=(Fr-Er)/aa,Ja=eo.number(gi.x,Zi.x,Aa),dn=eo.number(gi.y,Zi.y,Aa);if(Ja>=0&&Ja<St&&dn>=0&&dn<St&&Fr-Nt>=0&&Fr+Nt<=sr){let no=new av(Ja,dn,nn,ni);no._round(),he&&!Og(W,no,je,he,Ee)||Xr.push(no)}}Er+=aa}return ct||Xr.length||We||(Xr=D1(W,Er/2,$,he,Ee,je,We,!0,St)),Xr}Ta("Anchor",av);let Ep=Ah;function z1(W,D,$,he){let Ee=[],je=W.image,We=je.pixelRatio,ct=je.paddedRect.w-2*Ep,St=je.paddedRect.h-2*Ep,Nt={x1:W.left,y1:W.top,x2:W.right,y2:W.bottom},sr=je.stretchX||[[0,ct]],Er=je.stretchY||[[0,St]],Fr=(Nn,Ts)=>Nn+Ts[1]-Ts[0],Xr=sr.reduce(Fr,0),ni=Er.reduce(Fr,0),gi=ct-Xr,Zi=St-ni,aa=0,nn=Xr,Aa=0,Ja=ni,dn=0,no=gi,Zo=0,Ds=Zi;if(je.content&&he){let Nn=je.content,Ts=Nn[2]-Nn[0],as=Nn[3]-Nn[1];(je.textFitWidth||je.textFitHeight)&&(Nt=y1(W)),aa=nv(sr,0,Nn[0]),Aa=nv(Er,0,Nn[1]),nn=nv(sr,Nn[0],Nn[2]),Ja=nv(Er,Nn[1],Nn[3]),dn=Nn[0]-aa,Zo=Nn[1]-Aa,no=Ts-nn,Ds=as-Ja}let Fo=Nt.x1,Jn=Nt.y1,_s=Nt.x2-Fo,ls=Nt.y2-Jn,is=(Nn,Ts,as,Ws)=>{let ic=wm(Nn.stretch-aa,nn,_s,Fo),Yu=kp(Nn.fixed-dn,no,Nn.stretch,Xr),Kf=wm(Ts.stretch-Aa,Ja,ls,Jn),pd=kp(Ts.fixed-Zo,Ds,Ts.stretch,ni),gh=wm(as.stretch-aa,nn,_s,Fo),$f=kp(as.fixed-dn,no,as.stretch,Xr),Fh=wm(Ws.stretch-Aa,Ja,ls,Jn),Bh=kp(Ws.fixed-Zo,Ds,Ws.stretch,ni),Oh=new n(ic,Kf),pf=new n(gh,Kf),Jf=new n(gh,Fh),Sh=new n(ic,Fh),yh=new n(Yu/We,pd/We),sh=new n($f/We,Bh/We),bf=D*Math.PI/180;if(bf){let xu=Math.sin(bf),pc=Math.cos(bf),ac=[pc,-xu,xu,pc];Oh._matMult(ac),pf._matMult(ac),Sh._matMult(ac),Jf._matMult(ac)}let ld=Nn.stretch+Nn.fixed,Hh=Ts.stretch+Ts.fixed;return{tl:Oh,tr:pf,bl:Sh,br:Jf,tex:{x:je.paddedRect.x+Ep+ld,y:je.paddedRect.y+Ep+Hh,w:as.stretch+as.fixed-ld,h:Ws.stretch+Ws.fixed-Hh},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:yh,pixelOffsetBR:sh,minFontScaleX:no/We/_s,minFontScaleY:Ds/We/ls,isSDF:$}};if(he&&(je.stretchX||je.stretchY)){let Nn=F1(sr,gi,Xr),Ts=F1(Er,Zi,ni);for(let as=0;as<Nn.length-1;as++){let Ws=Nn[as],ic=Nn[as+1];for(let Yu=0;Yu<Ts.length-1;Yu++)Ee.push(is(Ws,Ts[Yu],ic,Ts[Yu+1]))}}else Ee.push(is({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:ct+1},{fixed:0,stretch:St+1}));return Ee}function nv(W,D,$){let he=0;for(let Ee of W)he+=Math.max(D,Math.min($,Ee[1]))-Math.max(D,Math.min($,Ee[0]));return he}function F1(W,D,$){let he=[{fixed:-Ep,stretch:0}];for(let[Ee,je]of W){let We=he[he.length-1];he.push({fixed:Ee-We.stretch,stretch:We.stretch}),he.push({fixed:Ee-We.stretch,stretch:We.stretch+(je-Ee)})}return he.push({fixed:D+Ep,stretch:$}),he}function wm(W,D,$,he){return W/D*$+he}function kp(W,D,$,he){return W-D*$/he}class kv{constructor(D,$,he,Ee,je,We,ct,St,Nt,sr){var Er;if(this.boxStartIndex=D.length,Nt){let Fr=We.top,Xr=We.bottom,ni=We.collisionPadding;ni&&(Fr-=ni[1],Xr+=ni[3]);let gi=Xr-Fr;gi>0&&(gi=Math.max(10,gi),this.circleDiameter=gi)}else{let Fr=!((Er=We.image)===null||Er===void 0)&&Er.content&&(We.image.textFitWidth||We.image.textFitHeight)?y1(We):{x1:We.left,y1:We.top,x2:We.right,y2:We.bottom};Fr.y1=Fr.y1*ct-St[0],Fr.y2=Fr.y2*ct+St[2],Fr.x1=Fr.x1*ct-St[3],Fr.x2=Fr.x2*ct+St[1];let Xr=We.collisionPadding;if(Xr&&(Fr.x1-=Xr[0]*ct,Fr.y1-=Xr[1]*ct,Fr.x2+=Xr[2]*ct,Fr.y2+=Xr[3]*ct),sr){let ni=new n(Fr.x1,Fr.y1),gi=new n(Fr.x2,Fr.y1),Zi=new n(Fr.x1,Fr.y2),aa=new n(Fr.x2,Fr.y2),nn=sr*Math.PI/180;ni._rotate(nn),gi._rotate(nn),Zi._rotate(nn),aa._rotate(nn),Fr.x1=Math.min(ni.x,gi.x,Zi.x,aa.x),Fr.x2=Math.max(ni.x,gi.x,Zi.x,aa.x),Fr.y1=Math.min(ni.y,gi.y,Zi.y,aa.y),Fr.y2=Math.max(ni.y,gi.y,Zi.y,aa.y)}D.emplaceBack($.x,$.y,Fr.x1,Fr.y1,Fr.x2,Fr.y2,he,Ee,je)}this.boxEndIndex=D.length}}class Pd{constructor(D=[],$=(he,Ee)=>he<Ee?-1:he>Ee?1:0){if(this.data=D,this.length=this.data.length,this.compare=$,this.length>0)for(let he=(this.length>>1)-1;he>=0;he--)this._down(he)}push(D){this.data.push(D),this._up(this.length++)}pop(){if(this.length===0)return;let D=this.data[0],$=this.data.pop();return--this.length>0&&(this.data[0]=$,this._down(0)),D}peek(){return this.data[0]}_up(D){let{data:$,compare:he}=this,Ee=$[D];for(;D>0;){let je=D-1>>1,We=$[je];if(he(Ee,We)>=0)break;$[D]=We,D=je}$[D]=Ee}_down(D){let{data:$,compare:he}=this,Ee=this.length>>1,je=$[D];for(;D<Ee;){let We=1+(D<<1),ct=We+1;if(ct<this.length&&he($[ct],$[We])<0&&(We=ct),he($[We],je)>=0)break;$[D]=$[We],D=We}$[D]=je}}function nw(W,D=1,$=!1){let he=1/0,Ee=1/0,je=-1/0,We=-1/0,ct=W[0];for(let Xr=0;Xr<ct.length;Xr++){let ni=ct[Xr];(!Xr||ni.x<he)&&(he=ni.x),(!Xr||ni.y<Ee)&&(Ee=ni.y),(!Xr||ni.x>je)&&(je=ni.x),(!Xr||ni.y>We)&&(We=ni.y)}let St=Math.min(je-he,We-Ee),Nt=St/2,sr=new Pd([],ow);if(St===0)return new n(he,Ee);for(let Xr=he;Xr<je;Xr+=St)for(let ni=Ee;ni<We;ni+=St)sr.push(new Cp(Xr+Nt,ni+Nt,Nt,W));let Er=function(Xr){let ni=0,gi=0,Zi=0,aa=Xr[0];for(let nn=0,Aa=aa.length,Ja=Aa-1;nn<Aa;Ja=nn++){let dn=aa[nn],no=aa[Ja],Zo=dn.x*no.y-no.x*dn.y;gi+=(dn.x+no.x)*Zo,Zi+=(dn.y+no.y)*Zo,ni+=3*Zo}return new Cp(gi/ni,Zi/ni,0,Xr)}(W),Fr=sr.length;for(;sr.length;){let Xr=sr.pop();(Xr.d>Er.d||!Er.d)&&(Er=Xr,$&&console.log("found best %d after %d probes",Math.round(1e4*Xr.d)/1e4,Fr)),Xr.max-Er.d<=D||(Nt=Xr.h/2,sr.push(new Cp(Xr.p.x-Nt,Xr.p.y-Nt,Nt,W)),sr.push(new Cp(Xr.p.x+Nt,Xr.p.y-Nt,Nt,W)),sr.push(new Cp(Xr.p.x-Nt,Xr.p.y+Nt,Nt,W)),sr.push(new Cp(Xr.p.x+Nt,Xr.p.y+Nt,Nt,W)),Fr+=4)}return $&&(console.log(`num probes: ${Fr}`),console.log(`best distance: ${Er.d}`)),Er.p}function ow(W,D){return D.max-W.max}function Cp(W,D,$,he){this.p=new n(W,D),this.h=$,this.d=function(Ee,je){let We=!1,ct=1/0;for(let St=0;St<je.length;St++){let Nt=je[St];for(let sr=0,Er=Nt.length,Fr=Er-1;sr<Er;Fr=sr++){let Xr=Nt[sr],ni=Nt[Fr];Xr.y>Ee.y!=ni.y>Ee.y&&Ee.x<(ni.x-Xr.x)*(Ee.y-Xr.y)/(ni.y-Xr.y)+Xr.x&&(We=!We),ct=Math.min(ct,Mi(Ee,Xr,ni))}}return(We?1:-1)*Math.sqrt(ct)}(this.p,he),this.max=this.d+this.h*Math.SQRT2}var mh;e.aq=void 0,(mh=e.aq||(e.aq={}))[mh.center=1]="center",mh[mh.left=2]="left",mh[mh.right=3]="right",mh[mh.top=4]="top",mh[mh.bottom=5]="bottom",mh[mh["top-left"]=6]="top-left",mh[mh["top-right"]=7]="top-right",mh[mh["bottom-left"]=8]="bottom-left",mh[mh["bottom-right"]=9]="bottom-right";let Cv=7,Yv=Number.POSITIVE_INFINITY;function Ng(W,D){return D[1]!==Yv?function($,he,Ee){let je=0,We=0;switch(he=Math.abs(he),Ee=Math.abs(Ee),$){case"top-right":case"top-left":case"top":We=Ee-Cv;break;case"bottom-right":case"bottom-left":case"bottom":We=-Ee+Cv}switch($){case"top-right":case"bottom-right":case"right":je=-he;break;case"top-left":case"bottom-left":case"left":je=he}return[je,We]}(W,D[0],D[1]):function($,he){let Ee=0,je=0;he<0&&(he=0);let We=he/Math.SQRT2;switch($){case"top-right":case"top-left":je=We-Cv;break;case"bottom-right":case"bottom-left":je=-We+Cv;break;case"bottom":je=-he+Cv;break;case"top":je=he-Cv}switch($){case"top-right":case"bottom-right":Ee=-We;break;case"top-left":case"bottom-left":Ee=We;break;case"left":Ee=he;break;case"right":Ee=-he}return[Ee,je]}(W,D[0])}function B1(W,D,$){var he;let Ee=W.layout,je=(he=Ee.get("text-variable-anchor-offset"))===null||he===void 0?void 0:he.evaluate(D,{},$);if(je){let ct=je.values,St=[];for(let Nt=0;Nt<ct.length;Nt+=2){let sr=St[Nt]=ct[Nt],Er=ct[Nt+1].map(Fr=>Fr*_u);sr.startsWith("top")?Er[1]-=Cv:sr.startsWith("bottom")&&(Er[1]+=Cv),St[Nt+1]=Er}return new oa(St)}let We=Ee.get("text-variable-anchor");if(We){let ct;ct=W._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[Ee.get("text-radial-offset").evaluate(D,{},$)*_u,Yv]:Ee.get("text-offset").evaluate(D,{},$).map(Nt=>Nt*_u);let St=[];for(let Nt of We)St.push(Nt,Ng(Nt,ct));return new oa(St)}return null}function Ug(W){switch(W){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function sw(W,D,$,he,Ee,je,We,ct,St,Nt,sr){let Er=je.textMaxSize.evaluate(D,{});Er===void 0&&(Er=We);let Fr=W.layers[0].layout,Xr=Fr.get("icon-offset").evaluate(D,{},sr),ni=N1($.horizontal),gi=We/24,Zi=W.tilePixelRatio*gi,aa=W.tilePixelRatio*Er/24,nn=W.tilePixelRatio*ct,Aa=W.tilePixelRatio*Fr.get("symbol-spacing"),Ja=Fr.get("text-padding")*W.tilePixelRatio,dn=function(Nn,Ts,as,Ws=1){let ic=Nn.get("icon-padding").evaluate(Ts,{},as),Yu=ic&&ic.values;return[Yu[0]*Ws,Yu[1]*Ws,Yu[2]*Ws,Yu[3]*Ws]}(Fr,D,sr,W.tilePixelRatio),no=Fr.get("text-max-angle")/180*Math.PI,Zo=Fr.get("text-rotation-alignment")!=="viewport"&&Fr.get("symbol-placement")!=="point",Ds=Fr.get("icon-rotation-alignment")==="map"&&Fr.get("symbol-placement")!=="point",Fo=Fr.get("symbol-placement"),Jn=Aa/2,_s=Fr.get("icon-text-fit"),ls;he&&_s!=="none"&&(W.allowVerticalPlacement&&$.vertical&&(ls=_1(he,$.vertical,_s,Fr.get("icon-text-fit-padding"),Xr,gi)),ni&&(he=_1(he,ni,_s,Fr.get("icon-text-fit-padding"),Xr,gi)));let is=(Nn,Ts)=>{Ts.x<0||Ts.x>=zo||Ts.y<0||Ts.y>=zo||function(as,Ws,ic,Yu,Kf,pd,gh,$f,Fh,Bh,Oh,pf,Jf,Sh,yh,sh,bf,ld,Hh,xu,pc,ac,ud,rf,Lp){let jd=as.addToLineVertexArray(Ws,ic),Rd,md,Uc,If,gd=0,ov=0,Gh=0,Ip=0,Gg=-1,Mm=-1,Vd={},Zv=ua("");if(as.allowVerticalPlacement&&Yu.vertical){let Mh=$f.layout.get("text-rotate").evaluate(pc,{},rf)+90;Uc=new kv(Fh,Ws,Bh,Oh,pf,Yu.vertical,Jf,Sh,yh,Mh),gh&&(If=new kv(Fh,Ws,Bh,Oh,pf,gh,bf,ld,yh,Mh))}if(Kf){let Mh=$f.layout.get("icon-rotate").evaluate(pc,{}),yd=$f.layout.get("icon-text-fit")!=="none",Lv=z1(Kf,Mh,ud,yd),Nh=gh?z1(gh,Mh,ud,yd):void 0;md=new kv(Fh,Ws,Bh,Oh,pf,Kf,bf,ld,!1,Mh),gd=4*Lv.length;let Eh=as.iconSizeData,Ld=null;Eh.kind==="source"?(Ld=[Ud*$f.layout.get("icon-size").evaluate(pc,{})],Ld[0]>Mv&&f(`${as.layerIds[0]}: Value for "icon-size" is >= ${y0}. Reduce your "icon-size".`)):Eh.kind==="composite"&&(Ld=[Ud*ac.compositeIconSizes[0].evaluate(pc,{},rf),Ud*ac.compositeIconSizes[1].evaluate(pc,{},rf)],(Ld[0]>Mv||Ld[1]>Mv)&&f(`${as.layerIds[0]}: Value for "icon-size" is >= ${y0}. Reduce your "icon-size".`)),as.addSymbols(as.icon,Lv,Ld,xu,Hh,pc,e.ah.none,Ws,jd.lineStartIndex,jd.lineLength,-1,rf),Gg=as.icon.placedSymbolArray.length-1,Nh&&(ov=4*Nh.length,as.addSymbols(as.icon,Nh,Ld,xu,Hh,pc,e.ah.vertical,Ws,jd.lineStartIndex,jd.lineLength,-1,rf),Mm=as.icon.placedSymbolArray.length-1)}let lh=Object.keys(Yu.horizontal);for(let Mh of lh){let yd=Yu.horizontal[Mh];if(!Rd){Zv=ua(yd.text);let Nh=$f.layout.get("text-rotate").evaluate(pc,{},rf);Rd=new kv(Fh,Ws,Bh,Oh,pf,yd,Jf,Sh,yh,Nh)}let Lv=yd.positionedLines.length===1;if(Gh+=O1(as,Ws,yd,pd,$f,yh,pc,sh,jd,Yu.vertical?e.ah.horizontal:e.ah.horizontalOnly,Lv?lh:[Mh],Vd,Gg,ac,rf),Lv)break}Yu.vertical&&(Ip+=O1(as,Ws,Yu.vertical,pd,$f,yh,pc,sh,jd,e.ah.vertical,["vertical"],Vd,Mm,ac,rf));let cw=Rd?Rd.boxStartIndex:as.collisionBoxArray.length,Em=Rd?Rd.boxEndIndex:as.collisionBoxArray.length,qd=Uc?Uc.boxStartIndex:as.collisionBoxArray.length,Wh=Uc?Uc.boxEndIndex:as.collisionBoxArray.length,q1=md?md.boxStartIndex:as.collisionBoxArray.length,fw=md?md.boxEndIndex:as.collisionBoxArray.length,H1=If?If.boxStartIndex:as.collisionBoxArray.length,hw=If?If.boxEndIndex:as.collisionBoxArray.length,Cd=-1,k0=(Mh,yd)=>Mh&&Mh.circleDiameter?Math.max(Mh.circleDiameter,yd):yd;Cd=k0(Rd,Cd),Cd=k0(Uc,Cd),Cd=k0(md,Cd),Cd=k0(If,Cd);let km=Cd>-1?1:0;km&&(Cd*=Lp/_u),as.glyphOffsetArray.length>=Sp.MAX_GLYPHS&&f("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),pc.sortKey!==void 0&&as.addToSortKeyRanges(as.symbolInstances.length,pc.sortKey);let Wg=B1($f,pc,rf),[dw,vw]=function(Mh,yd){let Lv=Mh.length,Nh=yd?.values;if(Nh?.length>0)for(let Eh=0;Eh<Nh.length;Eh+=2){let Ld=Nh[Eh+1];Mh.emplaceBack(e.aq[Nh[Eh]],Ld[0],Ld[1])}return[Lv,Mh.length]}(as.textAnchorOffsets,Wg);as.symbolInstances.emplaceBack(Ws.x,Ws.y,Vd.right>=0?Vd.right:-1,Vd.center>=0?Vd.center:-1,Vd.left>=0?Vd.left:-1,Vd.vertical||-1,Gg,Mm,Zv,cw,Em,qd,Wh,q1,fw,H1,hw,Bh,Gh,Ip,gd,ov,km,0,Jf,Cd,dw,vw)}(W,Ts,Nn,$,he,Ee,ls,W.layers[0],W.collisionBoxArray,D.index,D.sourceLayerIndex,W.index,Zi,[Ja,Ja,Ja,Ja],Zo,St,nn,dn,Ds,Xr,D,je,Nt,sr,We)};if(Fo==="line")for(let Nn of L1(D.geometry,0,0,zo,zo)){let Ts=aw(Nn,Aa,no,$.vertical||ni,he,24,aa,W.overscaling,zo);for(let as of Ts)ni&&lw(W,ni.text,Jn,as)||is(Nn,as)}else if(Fo==="line-center"){for(let Nn of D.geometry)if(Nn.length>1){let Ts=iw(Nn,no,$.vertical||ni,he,24,aa);Ts&&is(Nn,Ts)}}else if(D.type==="Polygon")for(let Nn of kc(D.geometry,0)){let Ts=nw(Nn,16);is(Nn[0],new av(Ts.x,Ts.y,0))}else if(D.type==="LineString")for(let Nn of D.geometry)is(Nn,new av(Nn[0].x,Nn[0].y,0));else if(D.type==="Point")for(let Nn of D.geometry)for(let Ts of Nn)is([Ts],new av(Ts.x,Ts.y,0))}function O1(W,D,$,he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni){let gi=function(nn,Aa,Ja,dn,no,Zo,Ds,Fo){let Jn=dn.layout.get("text-rotate").evaluate(Zo,{})*Math.PI/180,_s=[];for(let ls of Aa.positionedLines)for(let is of ls.positionedGlyphs){if(!is.rect)continue;let Nn=is.rect||{},Ts=v1+1,as=!0,Ws=1,ic=0,Yu=(no||Fo)&&is.vertical,Kf=is.metrics.advance*is.scale/2;if(Fo&&Aa.verticalizable&&(ic=ls.lineOffset/2-(is.imageName?-(_u-is.metrics.width*is.scale)/2:(is.scale-1)*_u)),is.imageName){let xu=Ds[is.imageName];as=xu.sdf,Ws=xu.pixelRatio,Ts=Ah/Ws}let pd=no?[is.x+Kf,is.y]:[0,0],gh=no?[0,0]:[is.x+Kf+Ja[0],is.y+Ja[1]-ic],$f=[0,0];Yu&&($f=gh,gh=[0,0]);let Fh=is.metrics.isDoubleResolution?2:1,Bh=(is.metrics.left-Ts)*is.scale-Kf+gh[0],Oh=(-is.metrics.top-Ts)*is.scale+gh[1],pf=Bh+Nn.w/Fh*is.scale/Ws,Jf=Oh+Nn.h/Fh*is.scale/Ws,Sh=new n(Bh,Oh),yh=new n(pf,Oh),sh=new n(Bh,Jf),bf=new n(pf,Jf);if(Yu){let xu=new n(-Kf,Kf-Zf),pc=-Math.PI/2,ac=_u/2-Kf,ud=new n(5-Zf-ac,-(is.imageName?ac:0)),rf=new n(...$f);Sh._rotateAround(pc,xu)._add(ud)._add(rf),yh._rotateAround(pc,xu)._add(ud)._add(rf),sh._rotateAround(pc,xu)._add(ud)._add(rf),bf._rotateAround(pc,xu)._add(ud)._add(rf)}if(Jn){let xu=Math.sin(Jn),pc=Math.cos(Jn),ac=[pc,-xu,xu,pc];Sh._matMult(ac),yh._matMult(ac),sh._matMult(ac),bf._matMult(ac)}let ld=new n(0,0),Hh=new n(0,0);_s.push({tl:Sh,tr:yh,bl:sh,br:bf,tex:Nn,writingMode:Aa.writingMode,glyphOffset:pd,sectionIndex:is.sectionIndex,isSDF:as,pixelOffsetTL:ld,pixelOffsetBR:Hh,minFontScaleX:0,minFontScaleY:0})}return _s}(0,$,ct,Ee,je,We,he,W.allowVerticalPlacement),Zi=W.textSizeData,aa=null;Zi.kind==="source"?(aa=[Ud*Ee.layout.get("text-size").evaluate(We,{})],aa[0]>Mv&&f(`${W.layerIds[0]}: Value for "text-size" is >= ${y0}. Reduce your "text-size".`)):Zi.kind==="composite"&&(aa=[Ud*Xr.compositeTextSizes[0].evaluate(We,{},ni),Ud*Xr.compositeTextSizes[1].evaluate(We,{},ni)],(aa[0]>Mv||aa[1]>Mv)&&f(`${W.layerIds[0]}: Value for "text-size" is >= ${y0}. Reduce your "text-size".`)),W.addSymbols(W.text,gi,aa,ct,je,We,Nt,D,St.lineStartIndex,St.lineLength,Fr,ni);for(let nn of sr)Er[nn]=W.text.placedSymbolArray.length-1;return 4*gi.length}function N1(W){for(let D in W)return W[D];return null}function lw(W,D,$,he){let Ee=W.compareText;if(D in Ee){let je=Ee[D];for(let We=je.length-1;We>=0;We--)if(he.dist(je[We])<$)return!0}else Ee[D]=[];return Ee[D].push(he),!1}let U1=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class jg{static from(D){if(!(D instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[$,he]=new Uint8Array(D,0,2);if($!==219)throw new Error("Data does not appear to be in a KDBush format.");let Ee=he>>4;if(Ee!==1)throw new Error(`Got v${Ee} data when expected v1.`);let je=U1[15&he];if(!je)throw new Error("Unrecognized array type.");let[We]=new Uint16Array(D,2,1),[ct]=new Uint32Array(D,4,1);return new jg(ct,We,je,D)}constructor(D,$=64,he=Float64Array,Ee){if(isNaN(D)||D<0)throw new Error(`Unpexpected numItems value: ${D}.`);this.numItems=+D,this.nodeSize=Math.min(Math.max(+$,2),65535),this.ArrayType=he,this.IndexArrayType=D<65536?Uint16Array:Uint32Array;let je=U1.indexOf(this.ArrayType),We=2*D*this.ArrayType.BYTES_PER_ELEMENT,ct=D*this.IndexArrayType.BYTES_PER_ELEMENT,St=(8-ct%8)%8;if(je<0)throw new Error(`Unexpected typed array class: ${he}.`);Ee&&Ee instanceof ArrayBuffer?(this.data=Ee,this.ids=new this.IndexArrayType(this.data,8,D),this.coords=new this.ArrayType(this.data,8+ct+St,2*D),this._pos=2*D,this._finished=!0):(this.data=new ArrayBuffer(8+We+ct+St),this.ids=new this.IndexArrayType(this.data,8,D),this.coords=new this.ArrayType(this.data,8+ct+St,2*D),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+je]),new Uint16Array(this.data,2,1)[0]=$,new Uint32Array(this.data,4,1)[0]=D)}add(D,$){let he=this._pos>>1;return this.ids[he]=he,this.coords[this._pos++]=D,this.coords[this._pos++]=$,he}finish(){let D=this._pos>>1;if(D!==this.numItems)throw new Error(`Added ${D} items when expected ${this.numItems}.`);return Tm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(D,$,he,Ee){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:je,coords:We,nodeSize:ct}=this,St=[0,je.length-1,0],Nt=[];for(;St.length;){let sr=St.pop()||0,Er=St.pop()||0,Fr=St.pop()||0;if(Er-Fr<=ct){for(let Zi=Fr;Zi<=Er;Zi++){let aa=We[2*Zi],nn=We[2*Zi+1];aa>=D&&aa<=he&&nn>=$&&nn<=Ee&&Nt.push(je[Zi])}continue}let Xr=Fr+Er>>1,ni=We[2*Xr],gi=We[2*Xr+1];ni>=D&&ni<=he&&gi>=$&&gi<=Ee&&Nt.push(je[Xr]),(sr===0?D<=ni:$<=gi)&&(St.push(Fr),St.push(Xr-1),St.push(1-sr)),(sr===0?he>=ni:Ee>=gi)&&(St.push(Xr+1),St.push(Er),St.push(1-sr))}return Nt}within(D,$,he){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:Ee,coords:je,nodeSize:We}=this,ct=[0,Ee.length-1,0],St=[],Nt=he*he;for(;ct.length;){let sr=ct.pop()||0,Er=ct.pop()||0,Fr=ct.pop()||0;if(Er-Fr<=We){for(let Zi=Fr;Zi<=Er;Zi++)V1(je[2*Zi],je[2*Zi+1],D,$)<=Nt&&St.push(Ee[Zi]);continue}let Xr=Fr+Er>>1,ni=je[2*Xr],gi=je[2*Xr+1];V1(ni,gi,D,$)<=Nt&&St.push(Ee[Xr]),(sr===0?D-he<=ni:$-he<=gi)&&(ct.push(Fr),ct.push(Xr-1),ct.push(1-sr)),(sr===0?D+he>=ni:$+he>=gi)&&(ct.push(Xr+1),ct.push(Er),ct.push(1-sr))}return St}}function Tm(W,D,$,he,Ee,je){if(Ee-he<=$)return;let We=he+Ee>>1;j1(W,D,We,he,Ee,je),Tm(W,D,$,he,We-1,1-je),Tm(W,D,$,We+1,Ee,1-je)}function j1(W,D,$,he,Ee,je){for(;Ee>he;){if(Ee-he>600){let Nt=Ee-he+1,sr=$-he+1,Er=Math.log(Nt),Fr=.5*Math.exp(2*Er/3),Xr=.5*Math.sqrt(Er*Fr*(Nt-Fr)/Nt)*(sr-Nt/2<0?-1:1);j1(W,D,$,Math.max(he,Math.floor($-sr*Fr/Nt+Xr)),Math.min(Ee,Math.floor($+(Nt-sr)*Fr/Nt+Xr)),je)}let We=D[2*$+je],ct=he,St=Ee;for(M0(W,D,he,$),D[2*Ee+je]>We&&M0(W,D,he,Ee);ct<St;){for(M0(W,D,ct,St),ct++,St--;D[2*ct+je]<We;)ct++;for(;D[2*St+je]>We;)St--}D[2*he+je]===We?M0(W,D,he,St):(St++,M0(W,D,St,Ee)),St<=$&&(he=St+1),$<=St&&(Ee=St-1)}}function M0(W,D,$,he){Vg(W,$,he),Vg(D,2*$,2*he),Vg(D,2*$+1,2*he+1)}function Vg(W,D,$){let he=W[D];W[D]=W[$],W[$]=he}function V1(W,D,$,he){let Ee=W-$,je=D-he;return Ee*Ee+je*je}var Am;e.bg=void 0,(Am=e.bg||(e.bg={})).create="create",Am.load="load",Am.fullLoad="fullLoad";let E0=null,jf=[],qg=1e3/60,Hg="loadTime",Sm="fullLoadTime",uw={mark(W){performance.mark(W)},frame(W){let D=W;E0!=null&&jf.push(D-E0),E0=D},clearMetrics(){E0=null,jf=[],performance.clearMeasures(Hg),performance.clearMeasures(Sm);for(let W in e.bg)performance.clearMarks(e.bg[W])},getPerformanceMetrics(){performance.measure(Hg,e.bg.create,e.bg.load),performance.measure(Sm,e.bg.create,e.bg.fullLoad);let W=performance.getEntriesByName(Hg)[0].duration,D=performance.getEntriesByName(Sm)[0].duration,$=jf.length,he=1/(jf.reduce((je,We)=>je+We,0)/$/1e3),Ee=jf.filter(je=>je>qg).reduce((je,We)=>je+(We-qg)/qg,0);return{loadTime:W,fullLoadTime:D,fps:he,percentDroppedFrames:Ee/($+Ee)*100,totalFrames:$}}};e.$=class extends Ar{},e.A=la,e.B=an,e.C=function(W){if(z==null){let D=W.navigator?W.navigator.userAgent:null;z=!!W.safari||!(!D||!(/\b(iPad|iPhone|iPod)\b/.test(D)||D.match("Safari")&&!D.match("Chrome")))}return z},e.D=Po,e.E=Q,e.F=class{constructor(W,D){this.target=W,this.mapId=D,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Dg(()=>this.process()),this.subscription=function($,he,Ee,je){return $.addEventListener(he,Ee,!1),{unsubscribe:()=>{$.removeEventListener(he,Ee,!1)}}}(this.target,"message",$=>this.receive($)),this.globalScope=L(self)?W:window}registerMessageHandler(W,D){this.messageHandlers[W]=D}sendAsync(W,D){return new Promise(($,he)=>{let Ee=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[Ee]={resolve:$,reject:he},D&&D.signal.addEventListener("abort",()=>{delete this.resolveRejects[Ee];let ct={id:Ee,type:"<cancel>",origin:location.origin,targetMapId:W.targetMapId,sourceMapId:this.mapId};this.target.postMessage(ct)},{once:!0});let je=[],We=Object.assign(Object.assign({},W),{id:Ee,sourceMapId:this.mapId,origin:location.origin,data:yo(W.data,je)});this.target.postMessage(We,{transfer:je})})}receive(W){let D=W.data,$=D.id;if(!(D.origin!=="file://"&&location.origin!=="file://"&&D.origin!=="resource://android"&&location.origin!=="resource://android"&&D.origin!==location.origin||D.targetMapId&&this.mapId!==D.targetMapId)){if(D.type==="<cancel>"){delete this.tasks[$];let he=this.abortControllers[$];return delete this.abortControllers[$],void(he&&he.abort())}if(L(self)||D.mustQueue)return this.tasks[$]=D,this.taskQueue.push($),void this.invoker.trigger();this.processTask($,D)}}process(){if(this.taskQueue.length===0)return;let W=this.taskQueue.shift(),D=this.tasks[W];delete this.tasks[W],this.taskQueue.length>0&&this.invoker.trigger(),D&&this.processTask(W,D)}processTask(W,D){return t(this,void 0,void 0,function*(){if(D.type==="<response>"){let Ee=this.resolveRejects[W];return delete this.resolveRejects[W],Ee?void(D.error?Ee.reject(Io(D.error)):Ee.resolve(Io(D.data))):void 0}if(!this.messageHandlers[D.type])return void this.completeTask(W,new Error(`Could not find a registered handler for ${D.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let $=Io(D.data),he=new AbortController;this.abortControllers[W]=he;try{let Ee=yield this.messageHandlers[D.type](D.sourceMapId,$,he);this.completeTask(W,null,Ee)}catch(Ee){this.completeTask(W,Ee)}})}completeTask(W,D,$){let he=[];delete this.abortControllers[W];let Ee={id:W,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:D?yo(D):null,data:yo($,he)};this.target.postMessage(Ee,{transfer:he})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.G=le,e.H=function(){var W=new la(16);return la!=Float32Array&&(W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[11]=0,W[12]=0,W[13]=0,W[14]=0),W[0]=1,W[5]=1,W[10]=1,W[15]=1,W},e.I=dm,e.J=function(W,D,$){var he,Ee,je,We,ct,St,Nt,sr,Er,Fr,Xr,ni,gi=$[0],Zi=$[1],aa=$[2];return D===W?(W[12]=D[0]*gi+D[4]*Zi+D[8]*aa+D[12],W[13]=D[1]*gi+D[5]*Zi+D[9]*aa+D[13],W[14]=D[2]*gi+D[6]*Zi+D[10]*aa+D[14],W[15]=D[3]*gi+D[7]*Zi+D[11]*aa+D[15]):(Ee=D[1],je=D[2],We=D[3],ct=D[4],St=D[5],Nt=D[6],sr=D[7],Er=D[8],Fr=D[9],Xr=D[10],ni=D[11],W[0]=he=D[0],W[1]=Ee,W[2]=je,W[3]=We,W[4]=ct,W[5]=St,W[6]=Nt,W[7]=sr,W[8]=Er,W[9]=Fr,W[10]=Xr,W[11]=ni,W[12]=he*gi+ct*Zi+Er*aa+D[12],W[13]=Ee*gi+St*Zi+Fr*aa+D[13],W[14]=je*gi+Nt*Zi+Xr*aa+D[14],W[15]=We*gi+sr*Zi+ni*aa+D[15]),W},e.K=function(W,D,$){var he=$[0],Ee=$[1],je=$[2];return W[0]=D[0]*he,W[1]=D[1]*he,W[2]=D[2]*he,W[3]=D[3]*he,W[4]=D[4]*Ee,W[5]=D[5]*Ee,W[6]=D[6]*Ee,W[7]=D[7]*Ee,W[8]=D[8]*je,W[9]=D[9]*je,W[10]=D[10]*je,W[11]=D[11]*je,W[12]=D[12],W[13]=D[13],W[14]=D[14],W[15]=D[15],W},e.L=$i,e.M=function(W,D){let $={};for(let he=0;he<D.length;he++){let Ee=D[he];Ee in W&&($[Ee]=W[Ee])}return $},e.N=iv,e.O=xm,e.P=n,e.Q=A1,e.R=ja,e.S=vd,e.T=tc,e.U=d,e.V=T,e.W=B,e.X=zo,e.Y=ht,e.Z=A0,e._=t,e.a=J,e.a$=function(W,D){var $=W[0],he=W[1],Ee=W[2],je=W[3],We=W[4],ct=W[5],St=W[6],Nt=W[7],sr=W[8],Er=W[9],Fr=W[10],Xr=W[11],ni=W[12],gi=W[13],Zi=W[14],aa=W[15],nn=D[0],Aa=D[1],Ja=D[2],dn=D[3],no=D[4],Zo=D[5],Ds=D[6],Fo=D[7],Jn=D[8],_s=D[9],ls=D[10],is=D[11],Nn=D[12],Ts=D[13],as=D[14],Ws=D[15];return Math.abs($-nn)<=zi*Math.max(1,Math.abs($),Math.abs(nn))&&Math.abs(he-Aa)<=zi*Math.max(1,Math.abs(he),Math.abs(Aa))&&Math.abs(Ee-Ja)<=zi*Math.max(1,Math.abs(Ee),Math.abs(Ja))&&Math.abs(je-dn)<=zi*Math.max(1,Math.abs(je),Math.abs(dn))&&Math.abs(We-no)<=zi*Math.max(1,Math.abs(We),Math.abs(no))&&Math.abs(ct-Zo)<=zi*Math.max(1,Math.abs(ct),Math.abs(Zo))&&Math.abs(St-Ds)<=zi*Math.max(1,Math.abs(St),Math.abs(Ds))&&Math.abs(Nt-Fo)<=zi*Math.max(1,Math.abs(Nt),Math.abs(Fo))&&Math.abs(sr-Jn)<=zi*Math.max(1,Math.abs(sr),Math.abs(Jn))&&Math.abs(Er-_s)<=zi*Math.max(1,Math.abs(Er),Math.abs(_s))&&Math.abs(Fr-ls)<=zi*Math.max(1,Math.abs(Fr),Math.abs(ls))&&Math.abs(Xr-is)<=zi*Math.max(1,Math.abs(Xr),Math.abs(is))&&Math.abs(ni-Nn)<=zi*Math.max(1,Math.abs(ni),Math.abs(Nn))&&Math.abs(gi-Ts)<=zi*Math.max(1,Math.abs(gi),Math.abs(Ts))&&Math.abs(Zi-as)<=zi*Math.max(1,Math.abs(Zi),Math.abs(as))&&Math.abs(aa-Ws)<=zi*Math.max(1,Math.abs(aa),Math.abs(Ws))},e.a0=At,e.a1=Fg,e.a2=me,e.a3=W=>{let D=window.document.createElement("video");return D.muted=!0,new Promise($=>{D.onloadstart=()=>{$(D)};for(let he of W){let Ee=window.document.createElement("source");ee(he)||(D.crossOrigin="Anonymous"),Ee.src=he,D.appendChild(Ee)}})},e.a4=function(){return g++},e.a5=yn,e.a6=Sp,e.a7=Pc,e.a8=tu,e.a9=Bg,e.aA=function(W){if(W.type==="custom")return new Rg(W);switch(W.type){case"background":return new tw(W);case"circle":return new Qi(W);case"fill":return new Gt(W);case"fill-extrusion":return new id(W);case"heatmap":return new $n(W);case"hillshade":return new Rl(W);case"line":return new Vv(W);case"raster":return new w0(W);case"symbol":return new Wv(W)}},e.aB=u,e.aC=function(W,D){if(!W)return[{command:"setStyle",args:[D]}];let $=[];try{if(!we(W.version,D.version))return[{command:"setStyle",args:[D]}];we(W.center,D.center)||$.push({command:"setCenter",args:[D.center]}),we(W.zoom,D.zoom)||$.push({command:"setZoom",args:[D.zoom]}),we(W.bearing,D.bearing)||$.push({command:"setBearing",args:[D.bearing]}),we(W.pitch,D.pitch)||$.push({command:"setPitch",args:[D.pitch]}),we(W.sprite,D.sprite)||$.push({command:"setSprite",args:[D.sprite]}),we(W.glyphs,D.glyphs)||$.push({command:"setGlyphs",args:[D.glyphs]}),we(W.transition,D.transition)||$.push({command:"setTransition",args:[D.transition]}),we(W.light,D.light)||$.push({command:"setLight",args:[D.light]}),we(W.terrain,D.terrain)||$.push({command:"setTerrain",args:[D.terrain]}),we(W.sky,D.sky)||$.push({command:"setSky",args:[D.sky]}),we(W.projection,D.projection)||$.push({command:"setProjection",args:[D.projection]});let he={},Ee=[];(function(We,ct,St,Nt){let sr;for(sr in ct=ct||{},We=We||{})Object.prototype.hasOwnProperty.call(We,sr)&&(Object.prototype.hasOwnProperty.call(ct,sr)||Xe(sr,St,Nt));for(sr in ct)Object.prototype.hasOwnProperty.call(ct,sr)&&(Object.prototype.hasOwnProperty.call(We,sr)?we(We[sr],ct[sr])||(We[sr].type==="geojson"&&ct[sr].type==="geojson"&&it(We,ct,sr)?Re(St,{command:"setGeoJSONSourceData",args:[sr,ct[sr].data]}):tt(sr,ct,St,Nt)):ze(sr,ct,St))})(W.sources,D.sources,Ee,he);let je=[];W.layers&&W.layers.forEach(We=>{"source"in We&&he[We.source]?$.push({command:"removeLayer",args:[We.id]}):je.push(We)}),$=$.concat(Ee),function(We,ct,St){ct=ct||[];let Nt=(We=We||[]).map(nt),sr=ct.map(nt),Er=We.reduce(Ae,{}),Fr=ct.reduce(Ae,{}),Xr=Nt.slice(),ni=Object.create(null),gi,Zi,aa,nn,Aa;for(let Ja=0,dn=0;Ja<Nt.length;Ja++)gi=Nt[Ja],Object.prototype.hasOwnProperty.call(Fr,gi)?dn++:(Re(St,{command:"removeLayer",args:[gi]}),Xr.splice(Xr.indexOf(gi,dn),1));for(let Ja=0,dn=0;Ja<sr.length;Ja++)gi=sr[sr.length-1-Ja],Xr[Xr.length-1-Ja]!==gi&&(Object.prototype.hasOwnProperty.call(Er,gi)?(Re(St,{command:"removeLayer",args:[gi]}),Xr.splice(Xr.lastIndexOf(gi,Xr.length-dn),1)):dn++,nn=Xr[Xr.length-Ja],Re(St,{command:"addLayer",args:[Fr[gi],nn]}),Xr.splice(Xr.length-Ja,0,gi),ni[gi]=!0);for(let Ja=0;Ja<sr.length;Ja++)if(gi=sr[Ja],Zi=Er[gi],aa=Fr[gi],!ni[gi]&&!we(Zi,aa))if(we(Zi.source,aa.source)&&we(Zi["source-layer"],aa["source-layer"])&&we(Zi.type,aa.type)){for(Aa in et(Zi.layout,aa.layout,St,gi,null,"setLayoutProperty"),et(Zi.paint,aa.paint,St,gi,null,"setPaintProperty"),we(Zi.filter,aa.filter)||Re(St,{command:"setFilter",args:[gi,aa.filter]}),we(Zi.minzoom,aa.minzoom)&&we(Zi.maxzoom,aa.maxzoom)||Re(St,{command:"setLayerZoomRange",args:[gi,aa.minzoom,aa.maxzoom]}),Zi)Object.prototype.hasOwnProperty.call(Zi,Aa)&&Aa!=="layout"&&Aa!=="paint"&&Aa!=="filter"&&Aa!=="metadata"&&Aa!=="minzoom"&&Aa!=="maxzoom"&&(Aa.indexOf("paint.")===0?et(Zi[Aa],aa[Aa],St,gi,Aa.slice(6),"setPaintProperty"):we(Zi[Aa],aa[Aa])||Re(St,{command:"setLayerProperty",args:[gi,Aa,aa[Aa]]}));for(Aa in aa)Object.prototype.hasOwnProperty.call(aa,Aa)&&!Object.prototype.hasOwnProperty.call(Zi,Aa)&&Aa!=="layout"&&Aa!=="paint"&&Aa!=="filter"&&Aa!=="metadata"&&Aa!=="minzoom"&&Aa!=="maxzoom"&&(Aa.indexOf("paint.")===0?et(Zi[Aa],aa[Aa],St,gi,Aa.slice(6),"setPaintProperty"):we(Zi[Aa],aa[Aa])||Re(St,{command:"setLayerProperty",args:[gi,Aa,aa[Aa]]}))}else Re(St,{command:"removeLayer",args:[gi]}),nn=Xr[Xr.lastIndexOf(gi)+1],Re(St,{command:"addLayer",args:[aa,nn]})}(je,D.layers,$)}catch(he){console.warn("Unable to compute style diff:",he),$=[{command:"setStyle",args:[D]}]}return $},e.aD=function(W){let D=[],$=W.id;return $===void 0&&D.push({message:`layers.${$}: missing required property "id"`}),W.render===void 0&&D.push({message:`layers.${$}: missing required method "render"`}),W.renderingMode&&W.renderingMode!=="2d"&&W.renderingMode!=="3d"&&D.push({message:`layers.${$}: property "renderingMode" must be either "2d" or "3d"`}),D},e.aE=function W(D,$){if(Array.isArray(D)){if(!Array.isArray($)||D.length!==$.length)return!1;for(let he=0;he<D.length;he++)if(!W(D[he],$[he]))return!1;return!0}if(typeof D=="object"&&D!==null&&$!==null){if(typeof $!="object"||Object.keys(D).length!==Object.keys($).length)return!1;for(let he in D)if(!W(D[he],$[he]))return!1;return!0}return D===$},e.aF=b,e.aG=v,e.aH=class extends da{constructor(W,D){super(W,D),this.current=0}set(W){this.current!==W&&(this.current=W,this.gl.uniform1i(this.location,W))}},e.aI=Oi,e.aJ=class extends da{constructor(W,D){super(W,D),this.current=In}set(W){if(W[12]!==this.current[12]||W[0]!==this.current[0])return this.current=W,void this.gl.uniformMatrix4fv(this.location,!1,W);for(let D=1;D<16;D++)if(W[D]!==this.current[D]){this.current=W,this.gl.uniformMatrix4fv(this.location,!1,W);break}}},e.aK=xn,e.aL=mn,e.aM=Jt,e.aN=class extends da{constructor(W,D){super(W,D),this.current=[0,0,0]}set(W){W[0]===this.current[0]&&W[1]===this.current[1]&&W[2]===this.current[2]||(this.current=W,this.gl.uniform3f(this.location,W[0],W[1],W[2]))}},e.aO=class extends da{constructor(W,D){super(W,D),this.current=[0,0]}set(W){W[0]===this.current[0]&&W[1]===this.current[1]||(this.current=W,this.gl.uniform2f(this.location,W[0],W[1]))}},e.aP=function(W,D,$,he,Ee,je,We){var ct=1/(D-$),St=1/(he-Ee),Nt=1/(je-We);return W[0]=-2*ct,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=-2*St,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=2*Nt,W[11]=0,W[12]=(D+$)*ct,W[13]=(Ee+he)*St,W[14]=(We+je)*Nt,W[15]=1,W},e.aQ=Oa,e.aR=class extends Dt{},e.aS=bv,e.aT=class extends _r{},e.aU=Wn,e.aV=function(W){return W<=1?1:Math.pow(2,Math.ceil(Math.log(W)/Math.LN2))},e.aW=gn,e.aX=ms,e.aY=Fe,e.aZ=class extends ga{},e.a_=function(W,D){return W[0]===D[0]&&W[1]===D[1]&&W[2]===D[2]&&W[3]===D[3]&&W[4]===D[4]&&W[5]===D[5]&&W[6]===D[6]&&W[7]===D[7]&&W[8]===D[8]&&W[9]===D[9]&&W[10]===D[10]&&W[11]===D[11]&&W[12]===D[12]&&W[13]===D[13]&&W[14]===D[14]&&W[15]===D[15]},e.aa=function(W){let D={};if(W.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,($,he,Ee,je)=>{let We=Ee||je;return D[he]=!We||We.toLowerCase(),""}),D["max-age"]){let $=parseInt(D["max-age"],10);isNaN($)?delete D["max-age"]:D["max-age"]=$}return D},e.ab=function(W,D){let $=[];for(let he in W)he in D||$.push(he);return $},e.ac=w,e.ad=function(W,D,$){var he=Math.sin($),Ee=Math.cos($),je=D[0],We=D[1],ct=D[2],St=D[3],Nt=D[4],sr=D[5],Er=D[6],Fr=D[7];return D!==W&&(W[8]=D[8],W[9]=D[9],W[10]=D[10],W[11]=D[11],W[12]=D[12],W[13]=D[13],W[14]=D[14],W[15]=D[15]),W[0]=je*Ee+Nt*he,W[1]=We*Ee+sr*he,W[2]=ct*Ee+Er*he,W[3]=St*Ee+Fr*he,W[4]=Nt*Ee-je*he,W[5]=sr*Ee-We*he,W[6]=Er*Ee-ct*he,W[7]=Fr*Ee-St*he,W},e.ae=function(W){var D=new la(16);return D[0]=W[0],D[1]=W[1],D[2]=W[2],D[3]=W[3],D[4]=W[4],D[5]=W[5],D[6]=W[6],D[7]=W[7],D[8]=W[8],D[9]=W[9],D[10]=W[10],D[11]=W[11],D[12]=W[12],D[13]=W[13],D[14]=W[14],D[15]=W[15],D},e.af=kn,e.ag=function(W,D){let $=0,he=0;if(W.kind==="constant")he=W.layoutSize;else if(W.kind!=="source"){let{interpolationType:Ee,minZoom:je,maxZoom:We}=W,ct=Ee?w(Ao.interpolationFactor(Ee,D,je,We),0,1):0;W.kind==="camera"?he=eo.number(W.minSize,W.maxSize,ct):$=ct}return{uSizeT:$,uSize:he}},e.ai=function(W,{uSize:D,uSizeT:$},{lowerSize:he,upperSize:Ee}){return W.kind==="source"?he/Ud:W.kind==="composite"?eo.number(he/Ud,Ee/Ud,$):D},e.aj=Cg,e.ak=function(W,D,$,he){let Ee=D.y-W.y,je=D.x-W.x,We=he.y-$.y,ct=he.x-$.x,St=We*je-ct*Ee;if(St===0)return null;let Nt=(ct*(W.y-$.y)-We*(W.x-$.x))/St;return new n(W.x+Nt*je,W.y+Nt*Ee)},e.al=L1,e.am=Tc,e.an=ba,e.ao=function(W){let D=1/0,$=1/0,he=-1/0,Ee=-1/0;for(let je of W)D=Math.min(D,je.x),$=Math.min($,je.y),he=Math.max(he,je.x),Ee=Math.max(Ee,je.y);return[D,$,he,Ee]},e.ap=_u,e.ar=kg,e.as=function(W,D){var $=D[0],he=D[1],Ee=D[2],je=D[3],We=D[4],ct=D[5],St=D[6],Nt=D[7],sr=D[8],Er=D[9],Fr=D[10],Xr=D[11],ni=D[12],gi=D[13],Zi=D[14],aa=D[15],nn=$*ct-he*We,Aa=$*St-Ee*We,Ja=$*Nt-je*We,dn=he*St-Ee*ct,no=he*Nt-je*ct,Zo=Ee*Nt-je*St,Ds=sr*gi-Er*ni,Fo=sr*Zi-Fr*ni,Jn=sr*aa-Xr*ni,_s=Er*Zi-Fr*gi,ls=Er*aa-Xr*gi,is=Fr*aa-Xr*Zi,Nn=nn*is-Aa*ls+Ja*_s+dn*Jn-no*Fo+Zo*Ds;return Nn?(W[0]=(ct*is-St*ls+Nt*_s)*(Nn=1/Nn),W[1]=(Ee*ls-he*is-je*_s)*Nn,W[2]=(gi*Zo-Zi*no+aa*dn)*Nn,W[3]=(Fr*no-Er*Zo-Xr*dn)*Nn,W[4]=(St*Jn-We*is-Nt*Fo)*Nn,W[5]=($*is-Ee*Jn+je*Fo)*Nn,W[6]=(Zi*Ja-ni*Zo-aa*Aa)*Nn,W[7]=(sr*Zo-Fr*Ja+Xr*Aa)*Nn,W[8]=(We*ls-ct*Jn+Nt*Ds)*Nn,W[9]=(he*Jn-$*ls-je*Ds)*Nn,W[10]=(ni*no-gi*Ja+aa*nn)*Nn,W[11]=(Er*Ja-sr*no-Xr*nn)*Nn,W[12]=(ct*Fo-We*_s-St*Ds)*Nn,W[13]=($*_s-he*Fo+Ee*Ds)*Nn,W[14]=(gi*Aa-ni*dn-Zi*nn)*Nn,W[15]=(sr*dn-Er*Aa+Fr*nn)*Nn,W):null},e.at=Ug,e.au=gm,e.av=jg,e.aw=function(){let W={},D=re.$version;for(let $ in re.$root){let he=re.$root[$];if(he.required){let Ee=null;Ee=$==="version"?D:he.type==="array"?[]:{},Ee!=null&&(W[$]=Ee)}}return W},e.ax=Vn,e.ay=q,e.az=function(W){W=W.slice();let D=Object.create(null);for(let $=0;$<W.length;$++)D[W[$].id]=W[$];for(let $=0;$<W.length;$++)"ref"in W[$]&&(W[$]=_e(W[$],D[W[$].ref]));return W},e.b=F,e.b0=function(W,D){return W[0]=D[0],W[1]=D[1],W[2]=D[2],W[3]=D[3],W[4]=D[4],W[5]=D[5],W[6]=D[6],W[7]=D[7],W[8]=D[8],W[9]=D[9],W[10]=D[10],W[11]=D[11],W[12]=D[12],W[13]=D[13],W[14]=D[14],W[15]=D[15],W},e.b1=function(W,D,$){return W[0]=D[0]*$[0],W[1]=D[1]*$[1],W[2]=D[2]*$[2],W[3]=D[3]*$[3],W},e.b2=function(W,D){return W[0]*D[0]+W[1]*D[1]+W[2]*D[2]+W[3]*D[3]},e.b3=A,e.b4=S1,e.b5=bm,e.b6=function(W,D,$,he,Ee){var je,We=1/Math.tan(D/2);return W[0]=We/$,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=We,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[11]=-1,W[12]=0,W[13]=0,W[15]=0,Ee!=null&&Ee!==1/0?(W[10]=(Ee+he)*(je=1/(he-Ee)),W[14]=2*Ee*he*je):(W[10]=-1,W[14]=-2*he),W},e.b7=function(W,D,$){var he=Math.sin($),Ee=Math.cos($),je=D[4],We=D[5],ct=D[6],St=D[7],Nt=D[8],sr=D[9],Er=D[10],Fr=D[11];return D!==W&&(W[0]=D[0],W[1]=D[1],W[2]=D[2],W[3]=D[3],W[12]=D[12],W[13]=D[13],W[14]=D[14],W[15]=D[15]),W[4]=je*Ee+Nt*he,W[5]=We*Ee+sr*he,W[6]=ct*Ee+Er*he,W[7]=St*Ee+Fr*he,W[8]=Nt*Ee-je*he,W[9]=sr*Ee-We*he,W[10]=Er*Ee-ct*he,W[11]=Fr*Ee-St*he,W},e.b8=l,e.b9=_,e.bA=Th,e.bB=function(W){return W.message===O},e.bC=xl,e.bD=cl,e.ba=function(W){return W*Math.PI/180},e.bb=function(W,D){let{x:$,y:he}=A0.fromLngLat(D);return!(W<0||W>25||he<0||he>=1||$<0||$>=1)},e.bc=function(W,D){return W[0]=D[0],W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=D[1],W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=D[2],W[11]=0,W[12]=0,W[13]=0,W[14]=0,W[15]=1,W},e.bd=class extends Qt{},e.be=zg,e.bf=uw,e.bh=ce,e.bi=function(W,D){J.REGISTERED_PROTOCOLS[W]=D},e.bj=function(W){delete J.REGISTERED_PROTOCOLS[W]},e.bk=function(W,D){let $={};for(let Ee=0;Ee<W.length;Ee++){let je=D&&D[W[Ee].id]||nh(W[Ee]);D&&(D[W[Ee].id]=je);let We=$[je];We||(We=$[je]=[]),We.push(W[Ee])}let he=[];for(let Ee in $)he.push($[Ee]);return he},e.bl=Ta,e.bm=E1,e.bn=Xv,e.bo=vm,e.bp=function(W){W.bucket.createArrays(),W.bucket.tilePixelRatio=zo/(512*W.bucket.overscaling),W.bucket.compareText={},W.bucket.iconsNeedLinear=!1;let D=W.bucket.layers[0],$=D.layout,he=D._unevaluatedLayout._values,Ee={layoutIconSize:he["icon-size"].possiblyEvaluate(new Zs(W.bucket.zoom+1),W.canonical),layoutTextSize:he["text-size"].possiblyEvaluate(new Zs(W.bucket.zoom+1),W.canonical),textMaxSize:he["text-size"].possiblyEvaluate(new Zs(18))};if(W.bucket.textSizeData.kind==="composite"){let{minZoom:Nt,maxZoom:sr}=W.bucket.textSizeData;Ee.compositeTextSizes=[he["text-size"].possiblyEvaluate(new Zs(Nt),W.canonical),he["text-size"].possiblyEvaluate(new Zs(sr),W.canonical)]}if(W.bucket.iconSizeData.kind==="composite"){let{minZoom:Nt,maxZoom:sr}=W.bucket.iconSizeData;Ee.compositeIconSizes=[he["icon-size"].possiblyEvaluate(new Zs(Nt),W.canonical),he["icon-size"].possiblyEvaluate(new Zs(sr),W.canonical)]}let je=$.get("text-line-height")*_u,We=$.get("text-rotation-alignment")!=="viewport"&&$.get("symbol-placement")!=="point",ct=$.get("text-keep-upright"),St=$.get("text-size");for(let Nt of W.bucket.features){let sr=$.get("text-font").evaluate(Nt,{},W.canonical).join(","),Er=St.evaluate(Nt,{},W.canonical),Fr=Ee.layoutTextSize.evaluate(Nt,{},W.canonical),Xr=Ee.layoutIconSize.evaluate(Nt,{},W.canonical),ni={horizontal:{},vertical:void 0},gi=Nt.text,Zi,aa=[0,0];if(gi){let Ja=gi.toString(),dn=$.get("text-letter-spacing").evaluate(Nt,{},W.canonical)*_u,no=ps(Ja)?dn:0,Zo=$.get("text-anchor").evaluate(Nt,{},W.canonical),Ds=B1(D,Nt,W.canonical);if(!Ds){let ls=$.get("text-radial-offset").evaluate(Nt,{},W.canonical);aa=ls?Ng(Zo,[ls*_u,Yv]):$.get("text-offset").evaluate(Nt,{},W.canonical).map(is=>is*_u)}let Fo=We?"center":$.get("text-justify").evaluate(Nt,{},W.canonical),Jn=$.get("symbol-placement")==="point"?$.get("text-max-width").evaluate(Nt,{},W.canonical)*_u:1/0,_s=()=>{W.bucket.allowVerticalPlacement&&Oo(Ja)&&(ni.vertical=m0(gi,W.glyphMap,W.glyphPositions,W.imagePositions,sr,Jn,je,Zo,"left",no,aa,e.ah.vertical,!0,Fr,Er))};if(!We&&Ds){let ls=new Set;if(Fo==="auto")for(let Nn=0;Nn<Ds.values.length;Nn+=2)ls.add(Ug(Ds.values[Nn]));else ls.add(Fo);let is=!1;for(let Nn of ls)if(!ni.horizontal[Nn])if(is)ni.horizontal[Nn]=ni.horizontal[0];else{let Ts=m0(gi,W.glyphMap,W.glyphPositions,W.imagePositions,sr,Jn,je,"center",Nn,no,aa,e.ah.horizontal,!1,Fr,Er);Ts&&(ni.horizontal[Nn]=Ts,is=Ts.positionedLines.length===1)}_s()}else{Fo==="auto"&&(Fo=Ug(Zo));let ls=m0(gi,W.glyphMap,W.glyphPositions,W.imagePositions,sr,Jn,je,Zo,Fo,no,aa,e.ah.horizontal,!1,Fr,Er);ls&&(ni.horizontal[Fo]=ls),_s(),Oo(Ja)&&We&&ct&&(ni.vertical=m0(gi,W.glyphMap,W.glyphPositions,W.imagePositions,sr,Jn,je,Zo,Fo,no,aa,e.ah.vertical,!1,Fr,Er))}}let nn=!1;if(Nt.icon&&Nt.icon.name){let Ja=W.imageMap[Nt.icon.name];Ja&&(Zi=g0(W.imagePositions[Nt.icon.name],$.get("icon-offset").evaluate(Nt,{},W.canonical),$.get("icon-anchor").evaluate(Nt,{},W.canonical)),nn=!!Ja.sdf,W.bucket.sdfIcons===void 0?W.bucket.sdfIcons=nn:W.bucket.sdfIcons!==nn&&f("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Ja.pixelRatio!==W.bucket.pixelRatio||$.get("icon-rotate").constantOr(1)!==0)&&(W.bucket.iconsNeedLinear=!0))}let Aa=N1(ni.horizontal)||ni.vertical;W.bucket.iconsInText=!!Aa&&Aa.iconsInText,(Aa||Zi)&&sw(W.bucket,Nt,ni,Zi,W.imageMap,Ee,Fr,Xr,aa,nn,W.canonical)}W.showCollisionBoxes&&W.bucket.generateCollisionDebugBuffers()},e.bq=dd,e.br=dr,e.bs=ts,e.bt=$r,e.bu=Sg,e.bv=class{constructor(W){this._marks={start:[W.url,"start"].join("#"),end:[W.url,"end"].join("#"),measure:W.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let W=performance.getEntriesByName(this._marks.measure);return W.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),W=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),W}},e.bw=function(W,D,$,he,Ee){return t(this,void 0,void 0,function*(){if(T())try{return yield B(W,D,$,he,Ee)}catch{}return function(je,We,ct,St,Nt){let sr=je.width,Er=je.height;I&&U||(I=new OffscreenCanvas(sr,Er),U=I.getContext("2d",{willReadFrequently:!0})),I.width=sr,I.height=Er,U.drawImage(je,0,0,sr,Er);let Fr=U.getImageData(We,ct,St,Nt);return U.clearRect(0,0,sr,Er),Fr.data}(W,D,$,he,Ee)})},e.bx=M1,e.by=r,e.bz=o,e.c=X,e.d=W=>t(void 0,void 0,void 0,function*(){if(W.byteLength===0)return createImageBitmap(new ImageData(1,1));let D=new Blob([new Uint8Array(W)],{type:"image/png"});try{return createImageBitmap(D)}catch($){throw new Error(`Could not load image because of ${$.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),e.e=M,e.f=W=>new Promise((D,$)=>{let he=new Image;he.onload=()=>{D(he),URL.revokeObjectURL(he.src),he.onload=null,window.requestAnimationFrame(()=>{he.src=N})},he.onerror=()=>$(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 Ee=new Blob([new Uint8Array(W)],{type:"image/png"});he.src=W.byteLength?URL.createObjectURL(Ee):N}),e.g=se,e.h=(W,D)=>Z(M(W,{type:"json"}),D),e.i=L,e.j=j,e.k=ie,e.l=(W,D)=>Z(M(W,{type:"arrayBuffer"}),D),e.m=Z,e.n=function(W){return new Sg(W).readFields($A,[])},e.o=Zn,e.p=Eg,e.q=Ue,e.r=Ba,e.s=ee,e.t=Na,e.u=pa,e.v=re,e.w=f,e.x=function([W,D,$]){return D+=90,D*=Math.PI/180,$*=Math.PI/180,{x:W*Math.cos(D)*Math.sin($),y:W*Math.sin(D)*Math.sin($),z:W*Math.cos($)}},e.y=eo,e.z=Zs}),S("worker",["./shared"],function(e){"use strict";class t{constructor(Ne){this.keyCache={},Ne&&this.replace(Ne)}replace(Ne){this._layerConfigs={},this._layers={},this.update(Ne,[])}update(Ne,Ye){for(let Ie of Ne){this._layerConfigs[Ie.id]=Ie;let qe=this._layers[Ie.id]=e.aA(Ie);qe._featureFilter=e.a7(qe.filter),this.keyCache[Ie.id]&&delete this.keyCache[Ie.id]}for(let Ie of Ye)delete this.keyCache[Ie],delete this._layerConfigs[Ie],delete this._layers[Ie];this.familiesBySource={};let be=e.bk(Object.values(this._layerConfigs),this.keyCache);for(let Ie of be){let qe=Ie.map(gt=>this._layers[gt.id]),ke=qe[0];if(ke.visibility==="none")continue;let Me=ke.source||"",Le=this.familiesBySource[Me];Le||(Le=this.familiesBySource[Me]={});let ut=ke.sourceLayer||"_geojsonTileLayer",lt=Le[ut];lt||(lt=Le[ut]=[]),lt.push(qe)}}}class r{constructor(Ne){let Ye={},be=[];for(let Me in Ne){let Le=Ne[Me],ut=Ye[Me]={};for(let lt in Le){let gt=Le[+lt];if(!gt||gt.bitmap.width===0||gt.bitmap.height===0)continue;let kt={x:0,y:0,w:gt.bitmap.width+2,h:gt.bitmap.height+2};be.push(kt),ut[lt]={rect:kt,metrics:gt.metrics}}}let{w:Ie,h:qe}=e.p(be),ke=new e.o({width:Ie||1,height:qe||1});for(let Me in Ne){let Le=Ne[Me];for(let ut in Le){let lt=Le[+ut];if(!lt||lt.bitmap.width===0||lt.bitmap.height===0)continue;let gt=Ye[Me][ut].rect;e.o.copy(lt.bitmap,ke,{x:0,y:0},{x:gt.x+1,y:gt.y+1},lt.bitmap)}}this.image=ke,this.positions=Ye}}e.bl("GlyphAtlas",r);class o{constructor(Ne){this.tileID=new e.S(Ne.tileID.overscaledZ,Ne.tileID.wrap,Ne.tileID.canonical.z,Ne.tileID.canonical.x,Ne.tileID.canonical.y),this.uid=Ne.uid,this.zoom=Ne.zoom,this.pixelRatio=Ne.pixelRatio,this.tileSize=Ne.tileSize,this.source=Ne.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Ne.showCollisionBoxes,this.collectResourceTiming=!!Ne.collectResourceTiming,this.returnDependencies=!!Ne.returnDependencies,this.promoteId=Ne.promoteId,this.inFlightDependencies=[]}parse(Ne,Ye,be,Ie){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=Ne,this.collisionBoxArray=new e.a5;let qe=new e.bm(Object.keys(Ne.layers).sort()),ke=new e.bn(this.tileID,this.promoteId);ke.bucketLayerIDs=[];let Me={},Le={featureIndex:ke,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:be},ut=Ye.familiesBySource[this.source];for(let ea in ut){let Bi=Ne.layers[ea];if(!Bi)continue;Bi.version===1&&e.w(`Vector tile source "${this.source}" layer "${ea}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let _a=qe.encode(ea),Ca=[];for(let Kt=0;Kt<Bi.length;Kt++){let zt=Bi.feature(Kt),Zt=ke.getId(zt,ea);Ca.push({feature:zt,id:Zt,index:Kt,sourceLayerIndex:_a})}for(let Kt of ut[ea]){let zt=Kt[0];zt.source!==this.source&&e.w(`layer.source = ${zt.source} does not equal this.source = ${this.source}`),zt.minzoom&&this.zoom<Math.floor(zt.minzoom)||zt.maxzoom&&this.zoom>=zt.maxzoom||zt.visibility!=="none"&&(i(Kt,this.zoom,be),(Me[zt.id]=zt.createBucket({index:ke.bucketLayerIDs.length,layers:Kt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_a,sourceID:this.source})).populate(Ca,Le,this.tileID.canonical),ke.bucketLayerIDs.push(Kt.map(Zt=>Zt.id)))}}let lt=e.aF(Le.glyphDependencies,ea=>Object.keys(ea).map(Number));this.inFlightDependencies.forEach(ea=>ea?.abort()),this.inFlightDependencies=[];let gt=Promise.resolve({});if(Object.keys(lt).length){let ea=new AbortController;this.inFlightDependencies.push(ea),gt=Ie.sendAsync({type:"GG",data:{stacks:lt,source:this.source,tileID:this.tileID,type:"glyphs"}},ea)}let kt=Object.keys(Le.iconDependencies),nr=Promise.resolve({});if(kt.length){let ea=new AbortController;this.inFlightDependencies.push(ea),nr=Ie.sendAsync({type:"GI",data:{icons:kt,source:this.source,tileID:this.tileID,type:"icons"}},ea)}let ir=Object.keys(Le.patternDependencies),tr=Promise.resolve({});if(ir.length){let ea=new AbortController;this.inFlightDependencies.push(ea),tr=Ie.sendAsync({type:"GI",data:{icons:ir,source:this.source,tileID:this.tileID,type:"patterns"}},ea)}let[Ir,vi,Vi]=yield Promise.all([gt,nr,tr]),Ui=new r(Ir),Ki=new e.bo(vi,Vi);for(let ea in Me){let Bi=Me[ea];Bi instanceof e.a6?(i(Bi.layers,this.zoom,be),e.bp({bucket:Bi,glyphMap:Ir,glyphPositions:Ui.positions,imageMap:vi,imagePositions:Ki.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Bi.hasPattern&&(Bi instanceof e.bq||Bi instanceof e.br||Bi instanceof e.bs)&&(i(Bi.layers,this.zoom,be),Bi.addFeatures(Le,this.tileID.canonical,Ki.patternPositions))}return this.status="done",{buckets:Object.values(Me).filter(ea=>!ea.isEmpty()),featureIndex:ke,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ui.image,imageAtlas:Ki,glyphMap:this.returnDependencies?Ir:null,iconMap:this.returnDependencies?vi:null,glyphPositions:this.returnDependencies?Ui.positions:null}})}}function i(xt,Ne,Ye){let be=new e.z(Ne);for(let Ie of xt)Ie.recalculate(be,Ye)}class n{constructor(Ne,Ye,be){this.actor=Ne,this.layerIndex=Ye,this.availableImages=be,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Ne,Ye){return e._(this,void 0,void 0,function*(){let be=yield e.l(Ne.request,Ye);try{return{vectorTile:new e.bt.VectorTile(new e.bu(be.data)),rawData:be.data,cacheControl:be.cacheControl,expires:be.expires}}catch(Ie){let qe=new Uint8Array(be.data),ke=`Unable to parse the tile at ${Ne.request.url}, `;throw ke+=qe[0]===31&&qe[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Ie.message}`,new Error(ke)}})}loadTile(Ne){return e._(this,void 0,void 0,function*(){let Ye=Ne.uid,be=!!(Ne&&Ne.request&&Ne.request.collectResourceTiming)&&new e.bv(Ne.request),Ie=new o(Ne);this.loading[Ye]=Ie;let qe=new AbortController;Ie.abort=qe;try{let ke=yield this.loadVectorTile(Ne,qe);if(delete this.loading[Ye],!ke)return null;let Me=ke.rawData,Le={};ke.expires&&(Le.expires=ke.expires),ke.cacheControl&&(Le.cacheControl=ke.cacheControl);let ut={};if(be){let gt=be.finish();gt&&(ut.resourceTiming=JSON.parse(JSON.stringify(gt)))}Ie.vectorTile=ke.vectorTile;let lt=Ie.parse(ke.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[Ye]=Ie,this.fetching[Ye]={rawTileData:Me,cacheControl:Le,resourceTiming:ut};try{let gt=yield lt;return e.e({rawTileData:Me.slice(0)},gt,Le,ut)}finally{delete this.fetching[Ye]}}catch(ke){throw delete this.loading[Ye],Ie.status="done",this.loaded[Ye]=Ie,ke}})}reloadTile(Ne){return e._(this,void 0,void 0,function*(){let Ye=Ne.uid;if(!this.loaded||!this.loaded[Ye])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let be=this.loaded[Ye];if(be.showCollisionBoxes=Ne.showCollisionBoxes,be.status==="parsing"){let Ie=yield be.parse(be.vectorTile,this.layerIndex,this.availableImages,this.actor),qe;if(this.fetching[Ye]){let{rawTileData:ke,cacheControl:Me,resourceTiming:Le}=this.fetching[Ye];delete this.fetching[Ye],qe=e.e({rawTileData:ke.slice(0)},Ie,Me,Le)}else qe=Ie;return qe}if(be.status==="done"&&be.vectorTile)return be.parse(be.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(Ne){return e._(this,void 0,void 0,function*(){let Ye=this.loading,be=Ne.uid;Ye&&Ye[be]&&Ye[be].abort&&(Ye[be].abort.abort(),delete Ye[be])})}removeTile(Ne){return e._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Ne.uid]&&delete this.loaded[Ne.uid]})}}class a{constructor(){this.loaded={}}loadTile(Ne){return e._(this,void 0,void 0,function*(){let{uid:Ye,encoding:be,rawImageData:Ie,redFactor:qe,greenFactor:ke,blueFactor:Me,baseShift:Le}=Ne,ut=Ie.width+2,lt=Ie.height+2,gt=e.b(Ie)?new e.R({width:ut,height:lt},yield e.bw(Ie,-1,-1,ut,lt)):Ie,kt=new e.bx(Ye,gt,be,qe,ke,Me,Le);return this.loaded=this.loaded||{},this.loaded[Ye]=kt,kt})}removeTile(Ne){let Ye=this.loaded,be=Ne.uid;Ye&&Ye[be]&&delete Ye[be]}}function s(xt,Ne){if(xt.length!==0){h(xt[0],Ne);for(var Ye=1;Ye<xt.length;Ye++)h(xt[Ye],!Ne)}}function h(xt,Ne){for(var Ye=0,be=0,Ie=0,qe=xt.length,ke=qe-1;Ie<qe;ke=Ie++){var Me=(xt[Ie][0]-xt[ke][0])*(xt[ke][1]+xt[Ie][1]),Le=Ye+Me;be+=Math.abs(Ye)>=Math.abs(Me)?Ye-Le+Me:Me-Le+Ye,Ye=Le}Ye+be>=0!=!!Ne&&xt.reverse()}var c=e.by(function xt(Ne,Ye){var be,Ie=Ne&&Ne.type;if(Ie==="FeatureCollection")for(be=0;be<Ne.features.length;be++)xt(Ne.features[be],Ye);else if(Ie==="GeometryCollection")for(be=0;be<Ne.geometries.length;be++)xt(Ne.geometries[be],Ye);else if(Ie==="Feature")xt(Ne.geometry,Ye);else if(Ie==="Polygon")s(Ne.coordinates,Ye);else if(Ie==="MultiPolygon")for(be=0;be<Ne.coordinates.length;be++)s(Ne.coordinates[be],Ye);return Ne});let m=e.bt.VectorTileFeature.prototype.toGeoJSON;var d={exports:{}},T=e.bz,l=e.bt.VectorTileFeature,_=w;function w(xt,Ne){this.options=Ne||{},this.features=xt,this.length=xt.length}function A(xt,Ne){this.id=typeof xt.id=="number"?xt.id:void 0,this.type=xt.type,this.rawGeometry=xt.type===1?[xt.geometry]:xt.geometry,this.properties=xt.tags,this.extent=Ne||4096}w.prototype.feature=function(xt){return new A(this.features[xt],this.options.extent)},A.prototype.loadGeometry=function(){var xt=this.rawGeometry;this.geometry=[];for(var Ne=0;Ne<xt.length;Ne++){for(var Ye=xt[Ne],be=[],Ie=0;Ie<Ye.length;Ie++)be.push(new T(Ye[Ie][0],Ye[Ie][1]));this.geometry.push(be)}return this.geometry},A.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var xt=this.geometry,Ne=1/0,Ye=-1/0,be=1/0,Ie=-1/0,qe=0;qe<xt.length;qe++)for(var ke=xt[qe],Me=0;Me<ke.length;Me++){var Le=ke[Me];Ne=Math.min(Ne,Le.x),Ye=Math.max(Ye,Le.x),be=Math.min(be,Le.y),Ie=Math.max(Ie,Le.y)}return[Ne,be,Ye,Ie]},A.prototype.toGeoJSON=l.prototype.toGeoJSON;var M=e.bA,g=_;function b(xt){var Ne=new M;return function(Ye,be){for(var Ie in Ye.layers)be.writeMessage(3,v,Ye.layers[Ie])}(xt,Ne),Ne.finish()}function v(xt,Ne){var Ye;Ne.writeVarintField(15,xt.version||1),Ne.writeStringField(1,xt.name||""),Ne.writeVarintField(5,xt.extent||4096);var be={keys:[],values:[],keycache:{},valuecache:{}};for(Ye=0;Ye<xt.length;Ye++)be.feature=xt.feature(Ye),Ne.writeMessage(2,u,be);var Ie=be.keys;for(Ye=0;Ye<Ie.length;Ye++)Ne.writeStringField(3,Ie[Ye]);var qe=be.values;for(Ye=0;Ye<qe.length;Ye++)Ne.writeMessage(4,z,qe[Ye])}function u(xt,Ne){var Ye=xt.feature;Ye.id!==void 0&&Ne.writeVarintField(1,Ye.id),Ne.writeMessage(2,y,xt),Ne.writeVarintField(3,Ye.type),Ne.writeMessage(4,L,Ye)}function y(xt,Ne){var Ye=xt.feature,be=xt.keys,Ie=xt.values,qe=xt.keycache,ke=xt.valuecache;for(var Me in Ye.properties){var Le=Ye.properties[Me],ut=qe[Me];if(Le!==null){ut===void 0&&(be.push(Me),qe[Me]=ut=be.length-1),Ne.writeVarint(ut);var lt=typeof Le;lt!=="string"&&lt!=="boolean"&&lt!=="number"&&(Le=JSON.stringify(Le));var gt=lt+":"+Le,kt=ke[gt];kt===void 0&&(Ie.push(Le),ke[gt]=kt=Ie.length-1),Ne.writeVarint(kt)}}}function f(xt,Ne){return(Ne<<3)+(7&xt)}function R(xt){return xt<<1^xt>>31}function L(xt,Ne){for(var Ye=xt.loadGeometry(),be=xt.type,Ie=0,qe=0,ke=Ye.length,Me=0;Me<ke;Me++){var Le=Ye[Me],ut=1;be===1&&(ut=Le.length),Ne.writeVarint(f(1,ut));for(var lt=be===3?Le.length-1:Le.length,gt=0;gt<lt;gt++){gt===1&&be!==1&&Ne.writeVarint(f(2,lt-1));var kt=Le[gt].x-Ie,nr=Le[gt].y-qe;Ne.writeVarint(R(kt)),Ne.writeVarint(R(nr)),Ie+=kt,qe+=nr}be===3&&Ne.writeVarint(f(7,1))}}function z(xt,Ne){var Ye=typeof xt;Ye==="string"?Ne.writeStringField(1,xt):Ye==="boolean"?Ne.writeBooleanField(7,xt):Ye==="number"&&(xt%1!=0?Ne.writeDoubleField(3,xt):xt<0?Ne.writeSVarintField(6,xt):Ne.writeVarintField(5,xt))}d.exports=b,d.exports.fromVectorTileJs=b,d.exports.fromGeojsonVt=function(xt,Ne){Ne=Ne||{};var Ye={};for(var be in xt)Ye[be]=new g(xt[be].features,Ne),Ye[be].name=be,Ye[be].version=Ne.version,Ye[be].extent=Ne.extent;return b({layers:Ye})},d.exports.GeoJSONWrapper=g;var F=e.by(d.exports);let N={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:xt=>xt},B=Math.fround||(I=new Float32Array(1),xt=>(I[0]=+xt,I[0]));var I;let U=3,O=5,X=6;class J{constructor(Ne){this.options=Object.assign(Object.create(N),Ne),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Ne){let{log:Ye,minZoom:be,maxZoom:Ie}=this.options;Ye&&console.time("total time");let qe=`prepare ${Ne.length} points`;Ye&&console.time(qe),this.points=Ne;let ke=[];for(let Le=0;Le<Ne.length;Le++){let ut=Ne[Le];if(!ut.geometry)continue;let[lt,gt]=ut.geometry.coordinates,kt=B(ce(lt)),nr=B(q(gt));ke.push(kt,nr,1/0,Le,-1,1),this.options.reduce&&ke.push(0)}let Me=this.trees[Ie+1]=this._createTree(ke);Ye&&console.timeEnd(qe);for(let Le=Ie;Le>=be;Le--){let ut=+Date.now();Me=this.trees[Le]=this._createTree(this._cluster(Me,Le)),Ye&&console.log("z%d: %d clusters in %dms",Le,Me.numItems,+Date.now()-ut)}return Ye&&console.timeEnd("total time"),this}getClusters(Ne,Ye){let be=((Ne[0]+180)%360+360)%360-180,Ie=Math.max(-90,Math.min(90,Ne[1])),qe=Ne[2]===180?180:((Ne[2]+180)%360+360)%360-180,ke=Math.max(-90,Math.min(90,Ne[3]));if(Ne[2]-Ne[0]>=360)be=-180,qe=180;else if(be>qe){let gt=this.getClusters([be,Ie,180,ke],Ye),kt=this.getClusters([-180,Ie,qe,ke],Ye);return gt.concat(kt)}let Me=this.trees[this._limitZoom(Ye)],Le=Me.range(ce(be),q(ke),ce(qe),q(Ie)),ut=Me.data,lt=[];for(let gt of Le){let kt=this.stride*gt;lt.push(ut[kt+O]>1?se(ut,kt,this.clusterProps):this.points[ut[kt+U]])}return lt}getChildren(Ne){let Ye=this._getOriginId(Ne),be=this._getOriginZoom(Ne),Ie="No cluster with the specified id.",qe=this.trees[be];if(!qe)throw new Error(Ie);let ke=qe.data;if(Ye*this.stride>=ke.length)throw new Error(Ie);let Me=this.options.radius/(this.options.extent*Math.pow(2,be-1)),Le=qe.within(ke[Ye*this.stride],ke[Ye*this.stride+1],Me),ut=[];for(let lt of Le){let gt=lt*this.stride;ke[gt+4]===Ne&&ut.push(ke[gt+O]>1?se(ke,gt,this.clusterProps):this.points[ke[gt+U]])}if(ut.length===0)throw new Error(Ie);return ut}getLeaves(Ne,Ye,be){let Ie=[];return this._appendLeaves(Ie,Ne,Ye=Ye||10,be=be||0,0),Ie}getTile(Ne,Ye,be){let Ie=this.trees[this._limitZoom(Ne)],qe=Math.pow(2,Ne),{extent:ke,radius:Me}=this.options,Le=Me/ke,ut=(be-Le)/qe,lt=(be+1+Le)/qe,gt={features:[]};return this._addTileFeatures(Ie.range((Ye-Le)/qe,ut,(Ye+1+Le)/qe,lt),Ie.data,Ye,be,qe,gt),Ye===0&&this._addTileFeatures(Ie.range(1-Le/qe,ut,1,lt),Ie.data,qe,be,qe,gt),Ye===qe-1&&this._addTileFeatures(Ie.range(0,ut,Le/qe,lt),Ie.data,-1,be,qe,gt),gt.features.length?gt:null}getClusterExpansionZoom(Ne){let Ye=this._getOriginZoom(Ne)-1;for(;Ye<=this.options.maxZoom;){let be=this.getChildren(Ne);if(Ye++,be.length!==1)break;Ne=be[0].properties.cluster_id}return Ye}_appendLeaves(Ne,Ye,be,Ie,qe){let ke=this.getChildren(Ye);for(let Me of ke){let Le=Me.properties;if(Le&&Le.cluster?qe+Le.point_count<=Ie?qe+=Le.point_count:qe=this._appendLeaves(Ne,Le.cluster_id,be,Ie,qe):qe<Ie?qe++:Ne.push(Me),Ne.length===be)break}return qe}_createTree(Ne){let Ye=new e.av(Ne.length/this.stride|0,this.options.nodeSize,Float32Array);for(let be=0;be<Ne.length;be+=this.stride)Ye.add(Ne[be],Ne[be+1]);return Ye.finish(),Ye.data=Ne,Ye}_addTileFeatures(Ne,Ye,be,Ie,qe,ke){for(let Me of Ne){let Le=Me*this.stride,ut=Ye[Le+O]>1,lt,gt,kt;if(ut)lt=le(Ye,Le,this.clusterProps),gt=Ye[Le],kt=Ye[Le+1];else{let tr=this.points[Ye[Le+U]];lt=tr.properties;let[Ir,vi]=tr.geometry.coordinates;gt=ce(Ir),kt=q(vi)}let nr={type:1,geometry:[[Math.round(this.options.extent*(gt*qe-be)),Math.round(this.options.extent*(kt*qe-Ie))]],tags:lt},ir;ir=ut||this.options.generateId?Ye[Le+U]:this.points[Ye[Le+U]].id,ir!==void 0&&(nr.id=ir),ke.features.push(nr)}}_limitZoom(Ne){return Math.max(this.options.minZoom,Math.min(Math.floor(+Ne),this.options.maxZoom+1))}_cluster(Ne,Ye){let{radius:be,extent:Ie,reduce:qe,minPoints:ke}=this.options,Me=be/(Ie*Math.pow(2,Ye)),Le=Ne.data,ut=[],lt=this.stride;for(let gt=0;gt<Le.length;gt+=lt){if(Le[gt+2]<=Ye)continue;Le[gt+2]=Ye;let kt=Le[gt],nr=Le[gt+1],ir=Ne.within(Le[gt],Le[gt+1],Me),tr=Le[gt+O],Ir=tr;for(let vi of ir){let Vi=vi*lt;Le[Vi+2]>Ye&&(Ir+=Le[Vi+O])}if(Ir>tr&&Ir>=ke){let vi,Vi=kt*tr,Ui=nr*tr,Ki=-1,ea=((gt/lt|0)<<5)+(Ye+1)+this.points.length;for(let Bi of ir){let _a=Bi*lt;if(Le[_a+2]<=Ye)continue;Le[_a+2]=Ye;let Ca=Le[_a+O];Vi+=Le[_a]*Ca,Ui+=Le[_a+1]*Ca,Le[_a+4]=ea,qe&&(vi||(vi=this._map(Le,gt,!0),Ki=this.clusterProps.length,this.clusterProps.push(vi)),qe(vi,this._map(Le,_a)))}Le[gt+4]=ea,ut.push(Vi/Ir,Ui/Ir,1/0,ea,-1,Ir),qe&&ut.push(Ki)}else{for(let vi=0;vi<lt;vi++)ut.push(Le[gt+vi]);if(Ir>1)for(let vi of ir){let Vi=vi*lt;if(!(Le[Vi+2]<=Ye)){Le[Vi+2]=Ye;for(let Ui=0;Ui<lt;Ui++)ut.push(Le[Vi+Ui])}}}}return ut}_getOriginId(Ne){return Ne-this.points.length>>5}_getOriginZoom(Ne){return(Ne-this.points.length)%32}_map(Ne,Ye,be){if(Ne[Ye+O]>1){let ke=this.clusterProps[Ne[Ye+X]];return be?Object.assign({},ke):ke}let Ie=this.points[Ne[Ye+U]].properties,qe=this.options.map(Ie);return be&&qe===Ie?Object.assign({},qe):qe}}function se(xt,Ne,Ye){return{type:"Feature",id:xt[Ne+U],properties:le(xt,Ne,Ye),geometry:{type:"Point",coordinates:[(be=xt[Ne],360*(be-.5)),Z(xt[Ne+1])]}};var be}function le(xt,Ne,Ye){let be=xt[Ne+O],Ie=be>=1e4?`${Math.round(be/1e3)}k`:be>=1e3?Math.round(be/100)/10+"k":be,qe=xt[Ne+X],ke=qe===-1?{}:Object.assign({},Ye[qe]);return Object.assign(ke,{cluster:!0,cluster_id:xt[Ne+U],point_count:be,point_count_abbreviated:Ie})}function ce(xt){return xt/360+.5}function q(xt){let Ne=Math.sin(xt*Math.PI/180),Ye=.5-.25*Math.log((1+Ne)/(1-Ne))/Math.PI;return Ye<0?0:Ye>1?1:Ye}function Z(xt){let Ne=(180-360*xt)*Math.PI/180;return 360*Math.atan(Math.exp(Ne))/Math.PI-90}function ee(xt,Ne,Ye,be){let Ie=be,qe=Ne+(Ye-Ne>>1),ke,Me=Ye-Ne,Le=xt[Ne],ut=xt[Ne+1],lt=xt[Ye],gt=xt[Ye+1];for(let kt=Ne+3;kt<Ye;kt+=3){let nr=V(xt[kt],xt[kt+1],Le,ut,lt,gt);if(nr>Ie)ke=kt,Ie=nr;else if(nr===Ie){let ir=Math.abs(kt-qe);ir<Me&&(ke=kt,Me=ir)}}Ie>be&&(ke-Ne>3&&ee(xt,Ne,ke,be),xt[ke+2]=Ie,Ye-ke>3&&ee(xt,ke,Ye,be))}function V(xt,Ne,Ye,be,Ie,qe){let ke=Ie-Ye,Me=qe-be;if(ke!==0||Me!==0){let Le=((xt-Ye)*ke+(Ne-be)*Me)/(ke*ke+Me*Me);Le>1?(Ye=Ie,be=qe):Le>0&&(Ye+=ke*Le,be+=Me*Le)}return ke=xt-Ye,Me=Ne-be,ke*ke+Me*Me}function oe(xt,Ne,Ye,be){let Ie={id:xt??null,type:Ne,geometry:Ye,tags:be,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Ne==="Point"||Ne==="MultiPoint"||Ne==="LineString")ie(Ie,Ye);else if(Ne==="Polygon")ie(Ie,Ye[0]);else if(Ne==="MultiLineString")for(let qe of Ye)ie(Ie,qe);else if(Ne==="MultiPolygon")for(let qe of Ye)ie(Ie,qe[0]);return Ie}function ie(xt,Ne){for(let Ye=0;Ye<Ne.length;Ye+=3)xt.minX=Math.min(xt.minX,Ne[Ye]),xt.minY=Math.min(xt.minY,Ne[Ye+1]),xt.maxX=Math.max(xt.maxX,Ne[Ye]),xt.maxY=Math.max(xt.maxY,Ne[Ye+1])}function j(xt,Ne,Ye,be){if(!Ne.geometry)return;let Ie=Ne.geometry.coordinates;if(Ie&&Ie.length===0)return;let qe=Ne.geometry.type,ke=Math.pow(Ye.tolerance/((1<<Ye.maxZoom)*Ye.extent),2),Me=[],Le=Ne.id;if(Ye.promoteId?Le=Ne.properties[Ye.promoteId]:Ye.generateId&&(Le=be||0),qe==="Point")Q(Ie,Me);else if(qe==="MultiPoint")for(let ut of Ie)Q(ut,Me);else if(qe==="LineString")re(Ie,Me,ke,!1);else if(qe==="MultiLineString"){if(Ye.lineMetrics){for(let ut of Ie)Me=[],re(ut,Me,ke,!1),xt.push(oe(Le,"LineString",Me,Ne.properties));return}ue(Ie,Me,ke,!1)}else if(qe==="Polygon")ue(Ie,Me,ke,!0);else{if(qe!=="MultiPolygon"){if(qe==="GeometryCollection"){for(let ut of Ne.geometry.geometries)j(xt,{id:Le,geometry:ut,properties:Ne.properties},Ye,be);return}throw new Error("Input data is not a valid GeoJSON object.")}for(let ut of Ie){let lt=[];ue(ut,lt,ke,!0),Me.push(lt)}}xt.push(oe(Le,qe,Me,Ne.properties))}function Q(xt,Ne){Ne.push(_e(xt[0]),we(xt[1]),0)}function re(xt,Ne,Ye,be){let Ie,qe,ke=0;for(let Le=0;Le<xt.length;Le++){let ut=_e(xt[Le][0]),lt=we(xt[Le][1]);Ne.push(ut,lt,0),Le>0&&(ke+=be?(Ie*lt-ut*qe)/2:Math.sqrt(Math.pow(ut-Ie,2)+Math.pow(lt-qe,2))),Ie=ut,qe=lt}let Me=Ne.length-3;Ne[2]=1,ee(Ne,0,Me,Ye),Ne[Me+2]=1,Ne.size=Math.abs(ke),Ne.start=0,Ne.end=Ne.size}function ue(xt,Ne,Ye,be){for(let Ie=0;Ie<xt.length;Ie++){let qe=[];re(xt[Ie],qe,Ye,be),Ne.push(qe)}}function _e(xt){return xt/360+.5}function we(xt){let Ne=Math.sin(xt*Math.PI/180),Ye=.5-.25*Math.log((1+Ne)/(1-Ne))/Math.PI;return Ye<0?0:Ye>1?1:Ye}function Re(xt,Ne,Ye,be,Ie,qe,ke,Me){if(be/=Ne,qe>=(Ye/=Ne)&&ke<be)return xt;if(ke<Ye||qe>=be)return null;let Le=[];for(let ut of xt){let lt=ut.geometry,gt=ut.type,kt=Ie===0?ut.minX:ut.minY,nr=Ie===0?ut.maxX:ut.maxY;if(kt>=Ye&&nr<be){Le.push(ut);continue}if(nr<Ye||kt>=be)continue;let ir=[];if(gt==="Point"||gt==="MultiPoint")ze(lt,ir,Ye,be,Ie);else if(gt==="LineString")Xe(lt,ir,Ye,be,Ie,!1,Me.lineMetrics);else if(gt==="MultiLineString")it(lt,ir,Ye,be,Ie,!1);else if(gt==="Polygon")it(lt,ir,Ye,be,Ie,!0);else if(gt==="MultiPolygon")for(let tr of lt){let Ir=[];it(tr,Ir,Ye,be,Ie,!0),Ir.length&&ir.push(Ir)}if(ir.length){if(Me.lineMetrics&&gt==="LineString"){for(let tr of ir)Le.push(oe(ut.id,gt,tr,ut.tags));continue}gt!=="LineString"&&gt!=="MultiLineString"||(ir.length===1?(gt="LineString",ir=ir[0]):gt="MultiLineString"),gt!=="Point"&&gt!=="MultiPoint"||(gt=ir.length===3?"Point":"MultiPoint"),Le.push(oe(ut.id,gt,ir,ut.tags))}}return Le.length?Le:null}function ze(xt,Ne,Ye,be,Ie){for(let qe=0;qe<xt.length;qe+=3){let ke=xt[qe+Ie];ke>=Ye&&ke<=be&&et(Ne,xt[qe],xt[qe+1],xt[qe+2])}}function Xe(xt,Ne,Ye,be,Ie,qe,ke){let Me=tt(xt),Le=Ie===0?nt:Ae,ut,lt,gt=xt.start;for(let Ir=0;Ir<xt.length-3;Ir+=3){let vi=xt[Ir],Vi=xt[Ir+1],Ui=xt[Ir+2],Ki=xt[Ir+3],ea=xt[Ir+4],Bi=Ie===0?vi:Vi,_a=Ie===0?Ki:ea,Ca=!1;ke&&(ut=Math.sqrt(Math.pow(vi-Ki,2)+Math.pow(Vi-ea,2))),Bi<Ye?_a>Ye&&(lt=Le(Me,vi,Vi,Ki,ea,Ye),ke&&(Me.start=gt+ut*lt)):Bi>be?_a<be&&(lt=Le(Me,vi,Vi,Ki,ea,be),ke&&(Me.start=gt+ut*lt)):et(Me,vi,Vi,Ui),_a<Ye&&Bi>=Ye&&(lt=Le(Me,vi,Vi,Ki,ea,Ye),Ca=!0),_a>be&&Bi<=be&&(lt=Le(Me,vi,Vi,Ki,ea,be),Ca=!0),!qe&&Ca&&(ke&&(Me.end=gt+ut*lt),Ne.push(Me),Me=tt(xt)),ke&&(gt+=ut)}let kt=xt.length-3,nr=xt[kt],ir=xt[kt+1],tr=Ie===0?nr:ir;tr>=Ye&&tr<=be&&et(Me,nr,ir,xt[kt+2]),kt=Me.length-3,qe&&kt>=3&&(Me[kt]!==Me[0]||Me[kt+1]!==Me[1])&&et(Me,Me[0],Me[1],Me[2]),Me.length&&Ne.push(Me)}function tt(xt){let Ne=[];return Ne.size=xt.size,Ne.start=xt.start,Ne.end=xt.end,Ne}function it(xt,Ne,Ye,be,Ie,qe){for(let ke of xt)Xe(ke,Ne,Ye,be,Ie,qe,!1)}function et(xt,Ne,Ye,be){xt.push(Ne,Ye,be)}function nt(xt,Ne,Ye,be,Ie,qe){let ke=(qe-Ne)/(be-Ne);return et(xt,qe,Ye+(Ie-Ye)*ke,1),ke}function Ae(xt,Ne,Ye,be,Ie,qe){let ke=(qe-Ye)/(Ie-Ye);return et(xt,Ne+(be-Ne)*ke,qe,1),ke}function me(xt,Ne){let Ye=[];for(let be=0;be<xt.length;be++){let Ie=xt[be],qe=Ie.type,ke;if(qe==="Point"||qe==="MultiPoint"||qe==="LineString")ke=fe(Ie.geometry,Ne);else if(qe==="MultiLineString"||qe==="Polygon"){ke=[];for(let Me of Ie.geometry)ke.push(fe(Me,Ne))}else if(qe==="MultiPolygon"){ke=[];for(let Me of Ie.geometry){let Le=[];for(let ut of Me)Le.push(fe(ut,Ne));ke.push(Le)}}Ye.push(oe(Ie.id,qe,ke,Ie.tags))}return Ye}function fe(xt,Ne){let Ye=[];Ye.size=xt.size,xt.start!==void 0&&(Ye.start=xt.start,Ye.end=xt.end);for(let be=0;be<xt.length;be+=3)Ye.push(xt[be]+Ne,xt[be+1],xt[be+2]);return Ye}function Be(xt,Ne){if(xt.transformed)return xt;let Ye=1<<xt.z,be=xt.x,Ie=xt.y;for(let qe of xt.features){let ke=qe.geometry,Me=qe.type;if(qe.geometry=[],Me===1)for(let Le=0;Le<ke.length;Le+=2)qe.geometry.push(Qe(ke[Le],ke[Le+1],Ne,Ye,be,Ie));else for(let Le=0;Le<ke.length;Le++){let ut=[];for(let lt=0;lt<ke[Le].length;lt+=2)ut.push(Qe(ke[Le][lt],ke[Le][lt+1],Ne,Ye,be,Ie));qe.geometry.push(ut)}}return xt.transformed=!0,xt}function Qe(xt,Ne,Ye,be,Ie,qe){return[Math.round(Ye*(xt*be-Ie)),Math.round(Ye*(Ne*be-qe))]}function at(xt,Ne,Ye,be,Ie){let qe=Ne===Ie.maxZoom?0:Ie.tolerance/((1<<Ne)*Ie.extent),ke={features:[],numPoints:0,numSimplified:0,numFeatures:xt.length,source:null,x:Ye,y:be,z:Ne,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let Me of xt)$e(ke,Me,qe,Ie);return ke}function $e(xt,Ne,Ye,be){let Ie=Ne.geometry,qe=Ne.type,ke=[];if(xt.minX=Math.min(xt.minX,Ne.minX),xt.minY=Math.min(xt.minY,Ne.minY),xt.maxX=Math.max(xt.maxX,Ne.maxX),xt.maxY=Math.max(xt.maxY,Ne.maxY),qe==="Point"||qe==="MultiPoint")for(let Me=0;Me<Ie.length;Me+=3)ke.push(Ie[Me],Ie[Me+1]),xt.numPoints++,xt.numSimplified++;else if(qe==="LineString")It(ke,Ie,xt,Ye,!1,!1);else if(qe==="MultiLineString"||qe==="Polygon")for(let Me=0;Me<Ie.length;Me++)It(ke,Ie[Me],xt,Ye,qe==="Polygon",Me===0);else if(qe==="MultiPolygon")for(let Me=0;Me<Ie.length;Me++){let Le=Ie[Me];for(let ut=0;ut<Le.length;ut++)It(ke,Le[ut],xt,Ye,!0,ut===0)}if(ke.length){let Me=Ne.tags||null;if(qe==="LineString"&&be.lineMetrics){Me={};for(let ut in Ne.tags)Me[ut]=Ne.tags[ut];Me.mapbox_clip_start=Ie.start/Ie.size,Me.mapbox_clip_end=Ie.end/Ie.size}let Le={geometry:ke,type:qe==="Polygon"||qe==="MultiPolygon"?3:qe==="LineString"||qe==="MultiLineString"?2:1,tags:Me};Ne.id!==null&&(Le.id=Ne.id),xt.features.push(Le)}}function It(xt,Ne,Ye,be,Ie,qe){let ke=be*be;if(be>0&&Ne.size<(Ie?ke:be))return void(Ye.numPoints+=Ne.length/3);let Me=[];for(let Le=0;Le<Ne.length;Le+=3)(be===0||Ne[Le+2]>ke)&&(Ye.numSimplified++,Me.push(Ne[Le],Ne[Le+1])),Ye.numPoints++;Ie&&function(Le,ut){let lt=0;for(let gt=0,kt=Le.length,nr=kt-2;gt<kt;nr=gt,gt+=2)lt+=(Le[gt]-Le[nr])*(Le[gt+1]+Le[nr+1]);if(lt>0===ut)for(let gt=0,kt=Le.length;gt<kt/2;gt+=2){let nr=Le[gt],ir=Le[gt+1];Le[gt]=Le[kt-2-gt],Le[gt+1]=Le[kt-1-gt],Le[kt-2-gt]=nr,Le[kt-1-gt]=ir}}(Me,qe),xt.push(Me)}let Pt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Vt{constructor(Ne,Ye){let be=(Ye=this.options=function(qe,ke){for(let Me in ke)qe[Me]=ke[Me];return qe}(Object.create(Pt),Ye)).debug;if(be&&console.time("preprocess data"),Ye.maxZoom<0||Ye.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Ye.promoteId&&Ye.generateId)throw new Error("promoteId and generateId cannot be used together.");let Ie=function(qe,ke){let Me=[];if(qe.type==="FeatureCollection")for(let Le=0;Le<qe.features.length;Le++)j(Me,qe.features[Le],ke,Le);else j(Me,qe.type==="Feature"?qe:{geometry:qe},ke);return Me}(Ne,Ye);this.tiles={},this.tileCoords=[],be&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Ye.indexMaxZoom,Ye.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Ie=function(qe,ke){let Me=ke.buffer/ke.extent,Le=qe,ut=Re(qe,1,-1-Me,Me,0,-1,2,ke),lt=Re(qe,1,1-Me,2+Me,0,-1,2,ke);return(ut||lt)&&(Le=Re(qe,1,-Me,1+Me,0,-1,2,ke)||[],ut&&(Le=me(ut,1).concat(Le)),lt&&(Le=Le.concat(me(lt,-1)))),Le}(Ie,Ye),Ie.length&&this.splitTile(Ie,0,0,0),be&&(Ie.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(Ne,Ye,be,Ie,qe,ke,Me){let Le=[Ne,Ye,be,Ie],ut=this.options,lt=ut.debug;for(;Le.length;){Ie=Le.pop(),be=Le.pop(),Ye=Le.pop(),Ne=Le.pop();let gt=1<<Ye,kt=Wt(Ye,be,Ie),nr=this.tiles[kt];if(!nr&&(lt>1&&console.time("creation"),nr=this.tiles[kt]=at(Ne,Ye,be,Ie,ut),this.tileCoords.push({z:Ye,x:be,y:Ie}),lt)){lt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ye,be,Ie,nr.numFeatures,nr.numPoints,nr.numSimplified),console.timeEnd("creation"));let Ca=`z${Ye}`;this.stats[Ca]=(this.stats[Ca]||0)+1,this.total++}if(nr.source=Ne,qe==null){if(Ye===ut.indexMaxZoom||nr.numPoints<=ut.indexMaxPoints)continue}else{if(Ye===ut.maxZoom||Ye===qe)continue;if(qe!=null){let Ca=qe-Ye;if(be!==ke>>Ca||Ie!==Me>>Ca)continue}}if(nr.source=null,Ne.length===0)continue;lt>1&&console.time("clipping");let ir=.5*ut.buffer/ut.extent,tr=.5-ir,Ir=.5+ir,vi=1+ir,Vi=null,Ui=null,Ki=null,ea=null,Bi=Re(Ne,gt,be-ir,be+Ir,0,nr.minX,nr.maxX,ut),_a=Re(Ne,gt,be+tr,be+vi,0,nr.minX,nr.maxX,ut);Ne=null,Bi&&(Vi=Re(Bi,gt,Ie-ir,Ie+Ir,1,nr.minY,nr.maxY,ut),Ui=Re(Bi,gt,Ie+tr,Ie+vi,1,nr.minY,nr.maxY,ut),Bi=null),_a&&(Ki=Re(_a,gt,Ie-ir,Ie+Ir,1,nr.minY,nr.maxY,ut),ea=Re(_a,gt,Ie+tr,Ie+vi,1,nr.minY,nr.maxY,ut),_a=null),lt>1&&console.timeEnd("clipping"),Le.push(Vi||[],Ye+1,2*be,2*Ie),Le.push(Ui||[],Ye+1,2*be,2*Ie+1),Le.push(Ki||[],Ye+1,2*be+1,2*Ie),Le.push(ea||[],Ye+1,2*be+1,2*Ie+1)}}getTile(Ne,Ye,be){Ne=+Ne,Ye=+Ye,be=+be;let Ie=this.options,{extent:qe,debug:ke}=Ie;if(Ne<0||Ne>24)return null;let Me=1<<Ne,Le=Wt(Ne,Ye=Ye+Me&Me-1,be);if(this.tiles[Le])return Be(this.tiles[Le],qe);ke>1&&console.log("drilling down to z%d-%d-%d",Ne,Ye,be);let ut,lt=Ne,gt=Ye,kt=be;for(;!ut&&lt>0;)lt--,gt>>=1,kt>>=1,ut=this.tiles[Wt(lt,gt,kt)];return ut&&ut.source?(ke>1&&(console.log("found parent tile z%d-%d-%d",lt,gt,kt),console.time("drilling down")),this.splitTile(ut.source,lt,gt,kt,Ne,Ye,be),ke>1&&console.timeEnd("drilling down"),this.tiles[Le]?Be(this.tiles[Le],qe):null):null}}function Wt(xt,Ne,Ye){return 32*((1<<xt)*Ye+Ne)+xt}function Cr(xt,Ne){return Ne?xt.properties[Ne]:xt.id}function yr(xt,Ne){if(xt==null)return!0;if(xt.type==="Feature")return Cr(xt,Ne)!=null;if(xt.type==="FeatureCollection"){let Ye=new Set;for(let be of xt.features){let Ie=Cr(be,Ne);if(Ie==null||Ye.has(Ie))return!1;Ye.add(Ie)}return!0}return!1}function qr(xt,Ne){let Ye=new Map;if(xt!=null)if(xt.type==="Feature")Ye.set(Cr(xt,Ne),xt);else for(let be of xt.features)Ye.set(Cr(be,Ne),be);return Ye}class Mr extends n{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(Ne,Ye){return e._(this,void 0,void 0,function*(){let be=Ne.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let Ie=this._geoJSONIndex.getTile(be.z,be.x,be.y);if(!Ie)return null;let qe=new class{constructor(Me){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.X,this.length=Me.length,this._features=Me}feature(Me){return new class{constructor(Le){this._feature=Le,this.extent=e.X,this.type=Le.type,this.properties=Le.tags,"id"in Le&&!isNaN(Le.id)&&(this.id=parseInt(Le.id,10))}loadGeometry(){if(this._feature.type===1){let Le=[];for(let ut of this._feature.geometry)Le.push([new e.P(ut[0],ut[1])]);return Le}{let Le=[];for(let ut of this._feature.geometry){let lt=[];for(let gt of ut)lt.push(new e.P(gt[0],gt[1]));Le.push(lt)}return Le}}toGeoJSON(Le,ut,lt){return m.call(this,Le,ut,lt)}}(this._features[Me])}}(Ie.features),ke=F(qe);return ke.byteOffset===0&&ke.byteLength===ke.buffer.byteLength||(ke=new Uint8Array(ke)),{vectorTile:qe,rawData:ke.buffer}})}loadData(Ne){return e._(this,void 0,void 0,function*(){var Ye;(Ye=this._pendingRequest)===null||Ye===void 0||Ye.abort();let be=!!(Ne&&Ne.request&&Ne.request.collectResourceTiming)&&new e.bv(Ne.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(Ne,this._pendingRequest),this._geoJSONIndex=Ne.cluster?new J(function({superclusterOptions:ke,clusterProperties:Me}){if(!Me||!ke)return ke;let Le={},ut={},lt={accumulated:null,zoom:0},gt={properties:null},kt=Object.keys(Me);for(let nr of kt){let[ir,tr]=Me[nr],Ir=e.bC(tr),vi=e.bC(typeof ir=="string"?[ir,["accumulated"],["get",nr]]:ir);Le[nr]=Ir.value,ut[nr]=vi.value}return ke.map=nr=>{gt.properties=nr;let ir={};for(let tr of kt)ir[tr]=Le[tr].evaluate(lt,gt);return ir},ke.reduce=(nr,ir)=>{gt.properties=ir;for(let tr of kt)lt.accumulated=nr[tr],nr[tr]=ut[tr].evaluate(lt,gt)},ke}(Ne)).load((yield this._pendingData).features):(Ie=yield this._pendingData,new Vt(Ie,Ne.geojsonVtOptions)),this.loaded={};let qe={};if(be){let ke=be.finish();ke&&(qe.resourceTiming={},qe.resourceTiming[Ne.source]=JSON.parse(JSON.stringify(ke)))}return qe}catch(qe){if(delete this._pendingRequest,e.bB(qe))return{abandoned:!0};throw qe}var Ie})}getData(){return e._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(Ne){let Ye=this.loaded;return Ye&&Ye[Ne.uid]?super.reloadTile(Ne):this.loadTile(Ne)}loadAndProcessGeoJSON(Ne,Ye){return e._(this,void 0,void 0,function*(){let be=yield this.loadGeoJSON(Ne,Ye);if(delete this._pendingRequest,typeof be!="object")throw new Error(`Input data given to '${Ne.source}' is not a valid GeoJSON object.`);if(c(be,!0),Ne.filter){let Ie=e.bC(Ne.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ie.result==="error")throw new Error(Ie.value.map(ke=>`${ke.key}: ${ke.message}`).join(", "));be={type:"FeatureCollection",features:be.features.filter(ke=>Ie.value.evaluate({zoom:0},ke))}}return be})}loadGeoJSON(Ne,Ye){return e._(this,void 0,void 0,function*(){let{promoteId:be}=Ne;if(Ne.request){let Ie=yield e.h(Ne.request,Ye);return this._dataUpdateable=yr(Ie.data,be)?qr(Ie.data,be):void 0,Ie.data}if(typeof Ne.data=="string")try{let Ie=JSON.parse(Ne.data);return this._dataUpdateable=yr(Ie,be)?qr(Ie,be):void 0,Ie}catch{throw new Error(`Input data given to '${Ne.source}' is not a valid GeoJSON object.`)}if(!Ne.dataDiff)throw new Error(`Input data given to '${Ne.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Ne.source}`);return function(Ie,qe,ke){var Me,Le,ut,lt;if(qe.removeAll&&Ie.clear(),qe.remove)for(let gt of qe.remove)Ie.delete(gt);if(qe.add)for(let gt of qe.add){let kt=Cr(gt,ke);kt!=null&&Ie.set(kt,gt)}if(qe.update)for(let gt of qe.update){let kt=Ie.get(gt.id);if(kt==null)continue;let nr=!gt.removeAllProperties&&(((Me=gt.removeProperties)===null||Me===void 0?void 0:Me.length)>0||((Le=gt.addOrUpdateProperties)===null||Le===void 0?void 0:Le.length)>0);if((gt.newGeometry||gt.removeAllProperties||nr)&&(kt=Object.assign({},kt),Ie.set(gt.id,kt),nr&&(kt.properties=Object.assign({},kt.properties))),gt.newGeometry&&(kt.geometry=gt.newGeometry),gt.removeAllProperties)kt.properties={};else if(((ut=gt.removeProperties)===null||ut===void 0?void 0:ut.length)>0)for(let ir of gt.removeProperties)Object.prototype.hasOwnProperty.call(kt.properties,ir)&&delete kt.properties[ir];if(((lt=gt.addOrUpdateProperties)===null||lt===void 0?void 0:lt.length)>0)for(let{key:ir,value:tr}of gt.addOrUpdateProperties)kt.properties[ir]=tr}}(this._dataUpdateable,Ne.dataDiff,be),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(Ne){return e._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(Ne){return this._geoJSONIndex.getClusterExpansionZoom(Ne.clusterId)}getClusterChildren(Ne){return this._geoJSONIndex.getChildren(Ne.clusterId)}getClusterLeaves(Ne){return this._geoJSONIndex.getLeaves(Ne.clusterId,Ne.limit,Ne.offset)}}class Dr{constructor(Ne){this.self=Ne,this.actor=new e.F(Ne),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Ye,be)=>{if(this.externalWorkerSourceTypes[Ye])throw new Error(`Worker source with name "${Ye}" already registered.`);this.externalWorkerSourceTypes[Ye]=be},this.self.addProtocol=e.bi,this.self.removeProtocol=e.bj,this.self.registerRTLTextPlugin=Ye=>{if(e.bD.isParsed())throw new Error("RTL text plugin already registered.");e.bD.setMethods(Ye)},this.actor.registerMessageHandler("LDT",(Ye,be)=>this._getDEMWorkerSource(Ye,be.source).loadTile(be)),this.actor.registerMessageHandler("RDT",(Ye,be)=>e._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Ye,be.source).removeTile(be)})),this.actor.registerMessageHandler("GCEZ",(Ye,be)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(Ye,be.type,be.source).getClusterExpansionZoom(be)})),this.actor.registerMessageHandler("GCC",(Ye,be)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(Ye,be.type,be.source).getClusterChildren(be)})),this.actor.registerMessageHandler("GCL",(Ye,be)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(Ye,be.type,be.source).getClusterLeaves(be)})),this.actor.registerMessageHandler("LD",(Ye,be)=>this._getWorkerSource(Ye,be.type,be.source).loadData(be)),this.actor.registerMessageHandler("GD",(Ye,be)=>this._getWorkerSource(Ye,be.type,be.source).getData()),this.actor.registerMessageHandler("LT",(Ye,be)=>this._getWorkerSource(Ye,be.type,be.source).loadTile(be)),this.actor.registerMessageHandler("RT",(Ye,be)=>this._getWorkerSource(Ye,be.type,be.source).reloadTile(be)),this.actor.registerMessageHandler("AT",(Ye,be)=>this._getWorkerSource(Ye,be.type,be.source).abortTile(be)),this.actor.registerMessageHandler("RMT",(Ye,be)=>this._getWorkerSource(Ye,be.type,be.source).removeTile(be)),this.actor.registerMessageHandler("RS",(Ye,be)=>e._(this,void 0,void 0,function*(){if(!this.workerSources[Ye]||!this.workerSources[Ye][be.type]||!this.workerSources[Ye][be.type][be.source])return;let Ie=this.workerSources[Ye][be.type][be.source];delete this.workerSources[Ye][be.type][be.source],Ie.removeSource!==void 0&&Ie.removeSource(be)})),this.actor.registerMessageHandler("RM",Ye=>e._(this,void 0,void 0,function*(){delete this.layerIndexes[Ye],delete this.availableImages[Ye],delete this.workerSources[Ye],delete this.demWorkerSources[Ye]})),this.actor.registerMessageHandler("SR",(Ye,be)=>e._(this,void 0,void 0,function*(){this.referrer=be})),this.actor.registerMessageHandler("SRPS",(Ye,be)=>this._syncRTLPluginState(Ye,be)),this.actor.registerMessageHandler("IS",(Ye,be)=>e._(this,void 0,void 0,function*(){this.self.importScripts(be)})),this.actor.registerMessageHandler("SI",(Ye,be)=>this._setImages(Ye,be)),this.actor.registerMessageHandler("UL",(Ye,be)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(Ye).update(be.layers,be.removedIds)})),this.actor.registerMessageHandler("SL",(Ye,be)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(Ye).replace(be)}))}_setImages(Ne,Ye){return e._(this,void 0,void 0,function*(){this.availableImages[Ne]=Ye;for(let be in this.workerSources[Ne]){let Ie=this.workerSources[Ne][be];for(let qe in Ie)Ie[qe].availableImages=Ye}})}_syncRTLPluginState(Ne,Ye){return e._(this,void 0,void 0,function*(){if(e.bD.isParsed())return e.bD.getState();if(Ye.pluginStatus!=="loading")return e.bD.setState(Ye),Ye;let be=Ye.pluginURL;if(this.self.importScripts(be),e.bD.isParsed()){let Ie={pluginStatus:"loaded",pluginURL:be};return e.bD.setState(Ie),Ie}throw e.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${be}`)})}_getAvailableImages(Ne){let Ye=this.availableImages[Ne];return Ye||(Ye=[]),Ye}_getLayerIndex(Ne){let Ye=this.layerIndexes[Ne];return Ye||(Ye=this.layerIndexes[Ne]=new t),Ye}_getWorkerSource(Ne,Ye,be){if(this.workerSources[Ne]||(this.workerSources[Ne]={}),this.workerSources[Ne][Ye]||(this.workerSources[Ne][Ye]={}),!this.workerSources[Ne][Ye][be]){let Ie={sendAsync:(qe,ke)=>(qe.targetMapId=Ne,this.actor.sendAsync(qe,ke))};switch(Ye){case"vector":this.workerSources[Ne][Ye][be]=new n(Ie,this._getLayerIndex(Ne),this._getAvailableImages(Ne));break;case"geojson":this.workerSources[Ne][Ye][be]=new Mr(Ie,this._getLayerIndex(Ne),this._getAvailableImages(Ne));break;default:this.workerSources[Ne][Ye][be]=new this.externalWorkerSourceTypes[Ye](Ie,this._getLayerIndex(Ne),this._getAvailableImages(Ne))}}return this.workerSources[Ne][Ye][be]}_getDEMWorkerSource(Ne,Ye){return this.demWorkerSources[Ne]||(this.demWorkerSources[Ne]={}),this.demWorkerSources[Ne][Ye]||(this.demWorkerSources[Ne][Ye]=new a),this.demWorkerSources[Ne][Ye]}}return e.i(self)&&(self.worker=new Dr(self)),Dr}),S("index",["exports","./shared"],function(e,t){"use strict";var r="4.7.1";let o,i,n={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:Ue=>new Promise((P,ae)=>{let xe=requestAnimationFrame(P);Ue.signal.addEventListener("abort",()=>{cancelAnimationFrame(xe),ae(t.c())})}),getImageData(Ue,P=0){return this.getImageCanvasContext(Ue).getImageData(-P,-P,Ue.width+2*P,Ue.height+2*P)},getImageCanvasContext(Ue){let P=window.document.createElement("canvas"),ae=P.getContext("2d",{willReadFrequently:!0});if(!ae)throw new Error("failed to create canvas 2d context");return P.width=Ue.width,P.height=Ue.height,ae.drawImage(Ue,0,0,Ue.width,Ue.height),ae},resolveURL:Ue=>(o||(o=document.createElement("a")),o.href=Ue,o.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(i==null&&(i=matchMedia("(prefers-reduced-motion: reduce)")),i.matches)}};class a{static testProp(P){if(!a.docStyle)return P[0];for(let ae=0;ae<P.length;ae++)if(P[ae]in a.docStyle)return P[ae];return P[0]}static create(P,ae,xe){let Te=window.document.createElement(P);return ae!==void 0&&(Te.className=ae),xe&&xe.appendChild(Te),Te}static createNS(P,ae){return window.document.createElementNS(P,ae)}static disableDrag(){a.docStyle&&a.selectProp&&(a.userSelect=a.docStyle[a.selectProp],a.docStyle[a.selectProp]="none")}static enableDrag(){a.docStyle&&a.selectProp&&(a.docStyle[a.selectProp]=a.userSelect)}static setTransform(P,ae){P.style[a.transformProp]=ae}static addEventListener(P,ae,xe,Te={}){P.addEventListener(ae,xe,"passive"in Te?Te:Te.capture)}static removeEventListener(P,ae,xe,Te={}){P.removeEventListener(ae,xe,"passive"in Te?Te:Te.capture)}static suppressClickInternal(P){P.preventDefault(),P.stopPropagation(),window.removeEventListener("click",a.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",a.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",a.suppressClickInternal,!0)},0)}static getScale(P){let ae=P.getBoundingClientRect();return{x:ae.width/P.offsetWidth||1,y:ae.height/P.offsetHeight||1,boundingClientRect:ae}}static getPoint(P,ae,xe){let Te=ae.boundingClientRect;return new t.P((xe.clientX-Te.left)/ae.x-P.clientLeft,(xe.clientY-Te.top)/ae.y-P.clientTop)}static mousePos(P,ae){let xe=a.getScale(P);return a.getPoint(P,xe,ae)}static touchPos(P,ae){let xe=[],Te=a.getScale(P);for(let Oe=0;Oe<ae.length;Oe++)xe.push(a.getPoint(P,Te,ae[Oe]));return xe}static mouseButton(P){return P.button}static remove(P){P.parentNode&&P.parentNode.removeChild(P)}}a.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,a.selectProp=a.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),a.transformProp=a.testProp(["transform","WebkitTransform"]);let s={supported:!1,testSupport:function(Ue){!m&&c&&(d?T(Ue):h=Ue)}},h,c,m=!1,d=!1;function T(Ue){let P=Ue.createTexture();Ue.bindTexture(Ue.TEXTURE_2D,P);try{if(Ue.texImage2D(Ue.TEXTURE_2D,0,Ue.RGBA,Ue.RGBA,Ue.UNSIGNED_BYTE,c),Ue.isContextLost())return;s.supported=!0}catch{}Ue.deleteTexture(P),m=!0}var l;typeof document<"u"&&(c=document.createElement("img"),c.onload=()=>{h&&T(h),h=null,d=!0},c.onerror=()=>{m=!0,h=null},c.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(Ue){let P,ae,xe,Te;Ue.resetRequestQueue=()=>{P=[],ae=0,xe=0,Te={}},Ue.addThrottleControl=Ot=>{let Qt=xe++;return Te[Qt]=Ot,Qt},Ue.removeThrottleControl=Ot=>{delete Te[Ot],ht()},Ue.getImage=(Ot,Qt,Ar=!0)=>new Promise((Sr,Kr)=>{s.supported&&(Ot.headers||(Ot.headers={}),Ot.headers.accept="image/webp,*/*"),t.e(Ot,{type:"image"}),P.push({abortController:Qt,requestParameters:Ot,supportImageRefresh:Ar,state:"queued",onError:oi=>{Kr(oi)},onSuccess:oi=>{Sr(oi)}}),ht()});let Oe=Ot=>t._(this,void 0,void 0,function*(){Ot.state="running";let{requestParameters:Qt,supportImageRefresh:Ar,onError:Sr,onSuccess:Kr,abortController:oi}=Ot,Ge=Ar===!1&&!t.i(self)&&!t.g(Qt.url)&&(!Qt.headers||Object.keys(Qt.headers).reduce((dt,Ct)=>dt&&Ct==="accept",!0));ae++;let Ze=Ge?Tt(Qt,oi):t.m(Qt,oi);try{let dt=yield Ze;delete Ot.abortController,Ot.state="completed",dt.data instanceof HTMLImageElement||t.b(dt.data)?Kr(dt):dt.data&&Kr({data:yield(ot=dt.data,typeof createImageBitmap=="function"?t.d(ot):t.f(ot)),cacheControl:dt.cacheControl,expires:dt.expires})}catch(dt){delete Ot.abortController,Sr(dt)}finally{ae--,ht()}var ot}),ht=()=>{let Ot=(()=>{for(let Qt of Object.keys(Te))if(Te[Qt]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let Qt=ae;Qt<Ot&&P.length>0;Qt++){let Ar=P.shift();Ar.abortController.signal.aborted?Qt--:Oe(Ar)}},Tt=(Ot,Qt)=>new Promise((Ar,Sr)=>{let Kr=new Image,oi=Ot.url,Ge=Ot.credentials;Ge&&Ge==="include"?Kr.crossOrigin="use-credentials":(Ge&&Ge==="same-origin"||!t.s(oi))&&(Kr.crossOrigin="anonymous"),Qt.signal.addEventListener("abort",()=>{Kr.src="",Sr(t.c())}),Kr.fetchPriority="high",Kr.onload=()=>{Kr.onerror=Kr.onload=null,Ar({data:Kr})},Kr.onerror=()=>{Kr.onerror=Kr.onload=null,Qt.signal.aborted||Sr(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."))},Kr.src=oi})}(l||(l={})),l.resetRequestQueue();class _{constructor(P){this._transformRequestFn=P}transformRequest(P,ae){return this._transformRequestFn&&this._transformRequestFn(P,ae)||{url:P}}setTransformRequest(P){this._transformRequestFn=P}}function w(Ue){var P=new t.A(3);return P[0]=Ue[0],P[1]=Ue[1],P[2]=Ue[2],P}var A,M=function(Ue,P,ae){return Ue[0]=P[0]-ae[0],Ue[1]=P[1]-ae[1],Ue[2]=P[2]-ae[2],Ue};A=new t.A(3),t.A!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0);var g=function(Ue){var P=Ue[0],ae=Ue[1];return P*P+ae*ae};function b(Ue){let P=[];if(typeof Ue=="string")P.push({id:"default",url:Ue});else if(Ue&&Ue.length>0){let ae=[];for(let{id:xe,url:Te}of Ue){let Oe=`${xe}${Te}`;ae.indexOf(Oe)===-1&&(ae.push(Oe),P.push({id:xe,url:Te}))}}return P}function v(Ue,P,ae){let xe=Ue.split("?");return xe[0]+=`${P}${ae}`,xe.join("?")}(function(){var Ue=new t.A(2);t.A!=Float32Array&&(Ue[0]=0,Ue[1]=0)})();class u{constructor(P,ae,xe,Te){this.context=P,this.format=xe,this.texture=P.gl.createTexture(),this.update(ae,Te)}update(P,ae,xe){let{width:Te,height:Oe}=P,ht=!(this.size&&this.size[0]===Te&&this.size[1]===Oe||xe),{context:Tt}=this,{gl:Ot}=Tt;if(this.useMipmap=!!(ae&&ae.useMipmap),Ot.bindTexture(Ot.TEXTURE_2D,this.texture),Tt.pixelStoreUnpackFlipY.set(!1),Tt.pixelStoreUnpack.set(1),Tt.pixelStoreUnpackPremultiplyAlpha.set(this.format===Ot.RGBA&&(!ae||ae.premultiply!==!1)),ht)this.size=[Te,Oe],P instanceof HTMLImageElement||P instanceof HTMLCanvasElement||P instanceof HTMLVideoElement||P instanceof ImageData||t.b(P)?Ot.texImage2D(Ot.TEXTURE_2D,0,this.format,this.format,Ot.UNSIGNED_BYTE,P):Ot.texImage2D(Ot.TEXTURE_2D,0,this.format,Te,Oe,0,this.format,Ot.UNSIGNED_BYTE,P.data);else{let{x:Qt,y:Ar}=xe||{x:0,y:0};P instanceof HTMLImageElement||P instanceof HTMLCanvasElement||P instanceof HTMLVideoElement||P instanceof ImageData||t.b(P)?Ot.texSubImage2D(Ot.TEXTURE_2D,0,Qt,Ar,Ot.RGBA,Ot.UNSIGNED_BYTE,P):Ot.texSubImage2D(Ot.TEXTURE_2D,0,Qt,Ar,Te,Oe,Ot.RGBA,Ot.UNSIGNED_BYTE,P.data)}this.useMipmap&&this.isSizePowerOfTwo()&&Ot.generateMipmap(Ot.TEXTURE_2D)}bind(P,ae,xe){let{context:Te}=this,{gl:Oe}=Te;Oe.bindTexture(Oe.TEXTURE_2D,this.texture),xe!==Oe.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(xe=Oe.LINEAR),P!==this.filter&&(Oe.texParameteri(Oe.TEXTURE_2D,Oe.TEXTURE_MAG_FILTER,P),Oe.texParameteri(Oe.TEXTURE_2D,Oe.TEXTURE_MIN_FILTER,xe||P),this.filter=P),ae!==this.wrap&&(Oe.texParameteri(Oe.TEXTURE_2D,Oe.TEXTURE_WRAP_S,ae),Oe.texParameteri(Oe.TEXTURE_2D,Oe.TEXTURE_WRAP_T,ae),this.wrap=ae)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:P}=this.context;P.deleteTexture(this.texture),this.texture=null}}function y(Ue){let{userImage:P}=Ue;return!!(P&&P.render&&P.render())&&(Ue.data.replace(new Uint8Array(P.data.buffer)),!0)}class f extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(P){if(this.loaded!==P&&(this.loaded=P,P)){for(let{ids:ae,promiseResolve:xe}of this.requestors)xe(this._getImagesForIds(ae));this.requestors=[]}}getImage(P){let ae=this.images[P];if(ae&&!ae.data&&ae.spriteData){let xe=ae.spriteData;ae.data=new t.R({width:xe.width,height:xe.height},xe.context.getImageData(xe.x,xe.y,xe.width,xe.height).data),ae.spriteData=null}return ae}addImage(P,ae){if(this.images[P])throw new Error(`Image id ${P} already exist, use updateImage instead`);this._validate(P,ae)&&(this.images[P]=ae)}_validate(P,ae){let xe=!0,Te=ae.data||ae.spriteData;return this._validateStretch(ae.stretchX,Te&&Te.width)||(this.fire(new t.j(new Error(`Image "${P}" has invalid "stretchX" value`))),xe=!1),this._validateStretch(ae.stretchY,Te&&Te.height)||(this.fire(new t.j(new Error(`Image "${P}" has invalid "stretchY" value`))),xe=!1),this._validateContent(ae.content,ae)||(this.fire(new t.j(new Error(`Image "${P}" has invalid "content" value`))),xe=!1),xe}_validateStretch(P,ae){if(!P)return!0;let xe=0;for(let Te of P){if(Te[0]<xe||Te[1]<Te[0]||ae<Te[1])return!1;xe=Te[1]}return!0}_validateContent(P,ae){if(!P)return!0;if(P.length!==4)return!1;let xe=ae.spriteData,Te=xe&&xe.width||ae.data.width,Oe=xe&&xe.height||ae.data.height;return!(P[0]<0||Te<P[0]||P[1]<0||Oe<P[1]||P[2]<0||Te<P[2]||P[3]<0||Oe<P[3]||P[2]<P[0]||P[3]<P[1])}updateImage(P,ae,xe=!0){let Te=this.getImage(P);if(xe&&(Te.data.width!==ae.data.width||Te.data.height!==ae.data.height))throw new Error(`size mismatch between old image (${Te.data.width}x${Te.data.height}) and new image (${ae.data.width}x${ae.data.height}).`);ae.version=Te.version+1,this.images[P]=ae,this.updatedImages[P]=!0}removeImage(P){let ae=this.images[P];delete this.images[P],delete this.patterns[P],ae.userImage&&ae.userImage.onRemove&&ae.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(P){return new Promise((ae,xe)=>{let Te=!0;if(!this.isLoaded())for(let Oe of P)this.images[Oe]||(Te=!1);this.isLoaded()||Te?ae(this._getImagesForIds(P)):this.requestors.push({ids:P,promiseResolve:ae})})}_getImagesForIds(P){let ae={};for(let xe of P){let Te=this.getImage(xe);Te||(this.fire(new t.k("styleimagemissing",{id:xe})),Te=this.getImage(xe)),Te?ae[xe]={data:Te.data.clone(),pixelRatio:Te.pixelRatio,sdf:Te.sdf,version:Te.version,stretchX:Te.stretchX,stretchY:Te.stretchY,content:Te.content,textFitWidth:Te.textFitWidth,textFitHeight:Te.textFitHeight,hasRenderCallback:!!(Te.userImage&&Te.userImage.render)}:t.w(`Image "${xe}" 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 ae}getPixelSize(){let{width:P,height:ae}=this.atlasImage;return{width:P,height:ae}}getPattern(P){let ae=this.patterns[P],xe=this.getImage(P);if(!xe)return null;if(ae&&ae.position.version===xe.version)return ae.position;if(ae)ae.position.version=xe.version;else{let Te={w:xe.data.width+2,h:xe.data.height+2,x:0,y:0},Oe=new t.I(Te,xe);this.patterns[P]={bin:Te,position:Oe}}return this._updatePatternAtlas(),this.patterns[P].position}bind(P){let ae=P.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new u(P,this.atlasImage,ae.RGBA),this.atlasTexture.bind(ae.LINEAR,ae.CLAMP_TO_EDGE)}_updatePatternAtlas(){let P=[];for(let Oe in this.patterns)P.push(this.patterns[Oe].bin);let{w:ae,h:xe}=t.p(P),Te=this.atlasImage;Te.resize({width:ae||1,height:xe||1});for(let Oe in this.patterns){let{bin:ht}=this.patterns[Oe],Tt=ht.x+1,Ot=ht.y+1,Qt=this.getImage(Oe).data,Ar=Qt.width,Sr=Qt.height;t.R.copy(Qt,Te,{x:0,y:0},{x:Tt,y:Ot},{width:Ar,height:Sr}),t.R.copy(Qt,Te,{x:0,y:Sr-1},{x:Tt,y:Ot-1},{width:Ar,height:1}),t.R.copy(Qt,Te,{x:0,y:0},{x:Tt,y:Ot+Sr},{width:Ar,height:1}),t.R.copy(Qt,Te,{x:Ar-1,y:0},{x:Tt-1,y:Ot},{width:1,height:Sr}),t.R.copy(Qt,Te,{x:0,y:0},{x:Tt+Ar,y:Ot},{width:1,height:Sr})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(P){for(let ae of P){if(this.callbackDispatchedThisFrame[ae])continue;this.callbackDispatchedThisFrame[ae]=!0;let xe=this.getImage(ae);xe||t.w(`Image with ID: "${ae}" was not found`),y(xe)&&this.updateImage(ae,xe)}}}let R=1e20;function L(Ue,P,ae,xe,Te,Oe,ht,Tt,Ot){for(let Qt=P;Qt<P+xe;Qt++)z(Ue,ae*Oe+Qt,Oe,Te,ht,Tt,Ot);for(let Qt=ae;Qt<ae+Te;Qt++)z(Ue,Qt*Oe+P,1,xe,ht,Tt,Ot)}function z(Ue,P,ae,xe,Te,Oe,ht){Oe[0]=0,ht[0]=-R,ht[1]=R,Te[0]=Ue[P];for(let Tt=1,Ot=0,Qt=0;Tt<xe;Tt++){Te[Tt]=Ue[P+Tt*ae];let Ar=Tt*Tt;do{let Sr=Oe[Ot];Qt=(Te[Tt]-Te[Sr]+Ar-Sr*Sr)/(Tt-Sr)/2}while(Qt<=ht[Ot]&&--Ot>-1);Ot++,Oe[Ot]=Tt,ht[Ot]=Qt,ht[Ot+1]=R}for(let Tt=0,Ot=0;Tt<xe;Tt++){for(;ht[Ot+1]<Tt;)Ot++;let Qt=Oe[Ot],Ar=Tt-Qt;Ue[P+Tt*ae]=Te[Qt]+Ar*Ar}}class F{constructor(P,ae){this.requestManager=P,this.localIdeographFontFamily=ae,this.entries={}}setURL(P){this.url=P}getGlyphs(P){return t._(this,void 0,void 0,function*(){let ae=[];for(let Oe in P)for(let ht of P[Oe])ae.push(this._getAndCacheGlyphsPromise(Oe,ht));let xe=yield Promise.all(ae),Te={};for(let{stack:Oe,id:ht,glyph:Tt}of xe)Te[Oe]||(Te[Oe]={}),Te[Oe][ht]=Tt&&{id:Tt.id,bitmap:Tt.bitmap.clone(),metrics:Tt.metrics};return Te})}_getAndCacheGlyphsPromise(P,ae){return t._(this,void 0,void 0,function*(){let xe=this.entries[P];xe||(xe=this.entries[P]={glyphs:{},requests:{},ranges:{}});let Te=xe.glyphs[ae];if(Te!==void 0)return{stack:P,id:ae,glyph:Te};if(Te=this._tinySDF(xe,P,ae),Te)return xe.glyphs[ae]=Te,{stack:P,id:ae,glyph:Te};let Oe=Math.floor(ae/256);if(256*Oe>65535)throw new Error("glyphs > 65535 not supported");if(xe.ranges[Oe])return{stack:P,id:ae,glyph:Te};if(!this.url)throw new Error("glyphsUrl is not set");if(!xe.requests[Oe]){let Tt=F.loadGlyphRange(P,Oe,this.url,this.requestManager);xe.requests[Oe]=Tt}let ht=yield xe.requests[Oe];for(let Tt in ht)this._doesCharSupportLocalGlyph(+Tt)||(xe.glyphs[+Tt]=ht[+Tt]);return xe.ranges[Oe]=!0,{stack:P,id:ae,glyph:ht[ae]||null}})}_doesCharSupportLocalGlyph(P){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(P))}_tinySDF(P,ae,xe){let Te=this.localIdeographFontFamily;if(!Te||!this._doesCharSupportLocalGlyph(xe))return;let Oe=P.tinySDF;if(!Oe){let Tt="400";/bold/i.test(ae)?Tt="900":/medium/i.test(ae)?Tt="500":/light/i.test(ae)&&(Tt="200"),Oe=P.tinySDF=new F.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:Te,fontWeight:Tt})}let ht=Oe.draw(String.fromCharCode(xe));return{id:xe,bitmap:new t.o({width:ht.width||60,height:ht.height||60},ht.data),metrics:{width:ht.glyphWidth/2||24,height:ht.glyphHeight/2||24,left:ht.glyphLeft/2+.5||0,top:ht.glyphTop/2-27.5||-8,advance:ht.glyphAdvance/2||24,isDoubleResolution:!0}}}}F.loadGlyphRange=function(Ue,P,ae,xe){return t._(this,void 0,void 0,function*(){let Te=256*P,Oe=Te+255,ht=xe.transformRequest(ae.replace("{fontstack}",Ue).replace("{range}",`${Te}-${Oe}`),"Glyphs"),Tt=yield t.l(ht,new AbortController);if(!Tt||!Tt.data)throw new Error(`Could not load glyph range. range: ${P}, ${Te}-${Oe}`);let Ot={};for(let Qt of t.n(Tt.data))Ot[Qt.id]=Qt;return Ot})},F.TinySDF=class{constructor({fontSize:Ue=24,buffer:P=3,radius:ae=8,cutoff:xe=.25,fontFamily:Te="sans-serif",fontWeight:Oe="normal",fontStyle:ht="normal"}={}){this.buffer=P,this.cutoff=xe,this.radius=ae;let Tt=this.size=Ue+4*P,Ot=this._createCanvas(Tt),Qt=this.ctx=Ot.getContext("2d",{willReadFrequently:!0});Qt.font=`${ht} ${Oe} ${Ue}px ${Te}`,Qt.textBaseline="alphabetic",Qt.textAlign="left",Qt.fillStyle="black",this.gridOuter=new Float64Array(Tt*Tt),this.gridInner=new Float64Array(Tt*Tt),this.f=new Float64Array(Tt),this.z=new Float64Array(Tt+1),this.v=new Uint16Array(Tt)}_createCanvas(Ue){let P=document.createElement("canvas");return P.width=P.height=Ue,P}draw(Ue){let{width:P,actualBoundingBoxAscent:ae,actualBoundingBoxDescent:xe,actualBoundingBoxLeft:Te,actualBoundingBoxRight:Oe}=this.ctx.measureText(Ue),ht=Math.ceil(ae),Tt=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(Oe-Te))),Ot=Math.min(this.size-this.buffer,ht+Math.ceil(xe)),Qt=Tt+2*this.buffer,Ar=Ot+2*this.buffer,Sr=Math.max(Qt*Ar,0),Kr=new Uint8ClampedArray(Sr),oi={data:Kr,width:Qt,height:Ar,glyphWidth:Tt,glyphHeight:Ot,glyphTop:ht,glyphLeft:0,glyphAdvance:P};if(Tt===0||Ot===0)return oi;let{ctx:Ge,buffer:Ze,gridInner:ot,gridOuter:dt}=this;Ge.clearRect(Ze,Ze,Tt,Ot),Ge.fillText(Ue,Ze,Ze+ht);let Ct=Ge.getImageData(Ze,Ze,Tt,Ot);dt.fill(R,0,Sr),ot.fill(0,0,Sr);for(let wt=0;wt<Ot;wt++)for(let Dt=0;Dt<Tt;Dt++){let fr=Ct.data[4*(wt*Tt+Dt)+3]/255;if(fr===0)continue;let _r=(wt+Ze)*Qt+Dt+Ze;if(fr===1)dt[_r]=0,ot[_r]=R;else{let kr=.5-fr;dt[_r]=kr>0?kr*kr:0,ot[_r]=kr<0?kr*kr:0}}L(dt,0,0,Qt,Ar,Qt,this.f,this.v,this.z),L(ot,Ze,Ze,Tt,Ot,Qt,this.f,this.v,this.z);for(let wt=0;wt<Sr;wt++){let Dt=Math.sqrt(dt[wt])-Math.sqrt(ot[wt]);Kr[wt]=Math.round(255-255*(Dt/this.radius+this.cutoff))}return oi}};class N{constructor(){this.specification=t.v.light.position}possiblyEvaluate(P,ae){return t.x(P.expression.evaluate(ae))}interpolate(P,ae,xe){return{x:t.y.number(P.x,ae.x,xe),y:t.y.number(P.y,ae.y,xe),z:t.y.number(P.z,ae.z,xe)}}}let B;class I extends t.E{constructor(P){super(),B=B||new t.q({anchor:new t.D(t.v.light.anchor),position:new N,color:new t.D(t.v.light.color),intensity:new t.D(t.v.light.intensity)}),this._transitionable=new t.T(B),this.setLight(P),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(P,ae={}){if(!this._validate(t.r,P,ae))for(let xe in P){let Te=P[xe];xe.endsWith("-transition")?this._transitionable.setTransition(xe.slice(0,-11),Te):this._transitionable.setValue(xe,Te)}}updateTransitions(P){this._transitioning=this._transitionable.transitioned(P,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(P){this.properties=this._transitioning.possiblyEvaluate(P)}_validate(P,ae,xe){return(!xe||xe.validate!==!1)&&t.t(this,P.call(t.u,{value:ae,style:{glyphs:!0,sprite:!0},styleSpec:t.v}))}}let U=new t.q({"sky-color":new t.D(t.v.sky["sky-color"]),"horizon-color":new t.D(t.v.sky["horizon-color"]),"fog-color":new t.D(t.v.sky["fog-color"]),"fog-ground-blend":new t.D(t.v.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.v.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.v.sky["atmosphere-blend"])});class O extends t.E{constructor(P){super(),this._transitionable=new t.T(U),this.setSky(P),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.z(0))}setSky(P,ae={}){if(!this._validate(t.B,P,ae)){P||(P={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let xe in P){let Te=P[xe];xe.endsWith("-transition")?this._transitionable.setTransition(xe.slice(0,-11),Te):this._transitionable.setValue(xe,Te)}}}getSky(){return this._transitionable.serialize()}updateTransitions(P){this._transitioning=this._transitionable.transitioned(P,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(P){this.properties=this._transitioning.possiblyEvaluate(P)}_validate(P,ae,xe={}){return xe?.validate!==!1&&t.t(this,P.call(t.u,t.e({value:ae,style:{glyphs:!0,sprite:!0},styleSpec:t.v})))}calculateFogBlendOpacity(P){return P<60?0:P<70?(P-60)/10:1}}class X{constructor(P,ae){this.width=P,this.height=ae,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(P,ae){let xe=P.join(",")+String(ae);return this.dashEntry[xe]||(this.dashEntry[xe]=this.addDash(P,ae)),this.dashEntry[xe]}getDashRanges(P,ae,xe){let Te=[],Oe=P.length%2==1?-P[P.length-1]*xe:0,ht=P[0]*xe,Tt=!0;Te.push({left:Oe,right:ht,isDash:Tt,zeroLength:P[0]===0});let Ot=P[0];for(let Qt=1;Qt<P.length;Qt++){Tt=!Tt;let Ar=P[Qt];Oe=Ot*xe,Ot+=Ar,ht=Ot*xe,Te.push({left:Oe,right:ht,isDash:Tt,zeroLength:Ar===0})}return Te}addRoundDash(P,ae,xe){let Te=ae/2;for(let Oe=-xe;Oe<=xe;Oe++){let ht=this.width*(this.nextRow+xe+Oe),Tt=0,Ot=P[Tt];for(let Qt=0;Qt<this.width;Qt++){Qt/Ot.right>1&&(Ot=P[++Tt]);let Ar=Math.abs(Qt-Ot.left),Sr=Math.abs(Qt-Ot.right),Kr=Math.min(Ar,Sr),oi,Ge=Oe/xe*(Te+1);if(Ot.isDash){let Ze=Te-Math.abs(Ge);oi=Math.sqrt(Kr*Kr+Ze*Ze)}else oi=Te-Math.sqrt(Kr*Kr+Ge*Ge);this.data[ht+Qt]=Math.max(0,Math.min(255,oi+128))}}}addRegularDash(P){for(let Tt=P.length-1;Tt>=0;--Tt){let Ot=P[Tt],Qt=P[Tt+1];Ot.zeroLength?P.splice(Tt,1):Qt&&Qt.isDash===Ot.isDash&&(Qt.left=Ot.left,P.splice(Tt,1))}let ae=P[0],xe=P[P.length-1];ae.isDash===xe.isDash&&(ae.left=xe.left-this.width,xe.right=ae.right+this.width);let Te=this.width*this.nextRow,Oe=0,ht=P[Oe];for(let Tt=0;Tt<this.width;Tt++){Tt/ht.right>1&&(ht=P[++Oe]);let Ot=Math.abs(Tt-ht.left),Qt=Math.abs(Tt-ht.right),Ar=Math.min(Ot,Qt);this.data[Te+Tt]=Math.max(0,Math.min(255,(ht.isDash?Ar:-Ar)+128))}}addDash(P,ae){let xe=ae?7:0,Te=2*xe+1;if(this.nextRow+Te>this.height)return t.w("LineAtlas out of space"),null;let Oe=0;for(let Tt=0;Tt<P.length;Tt++)Oe+=P[Tt];if(Oe!==0){let Tt=this.width/Oe,Ot=this.getDashRanges(P,this.width,Tt);ae?this.addRoundDash(Ot,Tt,xe):this.addRegularDash(Ot)}let ht={y:(this.nextRow+xe+.5)/this.height,height:2*xe/this.height,width:Oe};return this.nextRow+=Te,this.dirty=!0,ht}bind(P){let ae=P.gl;this.texture?(ae.bindTexture(ae.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,ae.texSubImage2D(ae.TEXTURE_2D,0,0,0,this.width,this.height,ae.ALPHA,ae.UNSIGNED_BYTE,this.data))):(this.texture=ae.createTexture(),ae.bindTexture(ae.TEXTURE_2D,this.texture),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_WRAP_S,ae.REPEAT),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_WRAP_T,ae.REPEAT),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_MIN_FILTER,ae.LINEAR),ae.texParameteri(ae.TEXTURE_2D,ae.TEXTURE_MAG_FILTER,ae.LINEAR),ae.texImage2D(ae.TEXTURE_2D,0,ae.ALPHA,this.width,this.height,0,ae.ALPHA,ae.UNSIGNED_BYTE,this.data))}}let J="maplibre_preloaded_worker_pool";class se{constructor(){this.active={}}acquire(P){if(!this.workers)for(this.workers=[];this.workers.length<se.workerCount;)this.workers.push(new Worker(t.a.WORKER_URL));return this.active[P]=!0,this.workers.slice()}release(P){delete this.active[P],this.numActive()===0&&(this.workers.forEach(ae=>{ae.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[J]}numActive(){return Object.keys(this.active).length}}let le=Math.floor(n.hardwareConcurrency/2),ce,q;function Z(){return ce||(ce=new se),ce}se.workerCount=t.C(globalThis)?Math.max(Math.min(le,3),1):1;class ee{constructor(P,ae){this.workerPool=P,this.actors=[],this.currentActor=0,this.id=ae;let xe=this.workerPool.acquire(ae);for(let Te=0;Te<xe.length;Te++){let Oe=new t.F(xe[Te],ae);Oe.name=`Worker ${Te}`,this.actors.push(Oe)}if(!this.actors.length)throw new Error("No actors found")}broadcast(P,ae){let xe=[];for(let Te of this.actors)xe.push(Te.sendAsync({type:P,data:ae}));return Promise.all(xe)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(P=!0){this.actors.forEach(ae=>{ae.remove()}),this.actors=[],P&&this.workerPool.release(this.id)}registerMessageHandler(P,ae){for(let xe of this.actors)xe.registerMessageHandler(P,ae)}}function V(){return q||(q=new ee(Z(),t.G),q.registerMessageHandler("GR",(Ue,P,ae)=>t.m(P,ae))),q}function oe(Ue,P){let ae=t.H();return t.J(ae,ae,[1,1,0]),t.K(ae,ae,[.5*Ue.width,.5*Ue.height,1]),t.L(ae,ae,Ue.calculatePosMatrix(P.toUnwrapped()))}function ie(Ue,P,ae,xe,Te,Oe){let ht=function(Sr,Kr,oi){if(Sr)for(let Ge of Sr){let Ze=Kr[Ge];if(Ze&&Ze.source===oi&&Ze.type==="fill-extrusion")return!0}else for(let Ge in Kr){let Ze=Kr[Ge];if(Ze.source===oi&&Ze.type==="fill-extrusion")return!0}return!1}(Te&&Te.layers,P,Ue.id),Tt=Oe.maxPitchScaleFactor(),Ot=Ue.tilesIn(xe,Tt,ht);Ot.sort(j);let Qt=[];for(let Sr of Ot)Qt.push({wrappedTileID:Sr.tileID.wrapped().key,queryResults:Sr.tile.queryRenderedFeatures(P,ae,Ue._state,Sr.queryGeometry,Sr.cameraQueryGeometry,Sr.scale,Te,Oe,Tt,oe(Ue.transform,Sr.tileID))});let Ar=function(Sr){let Kr={},oi={};for(let Ge of Sr){let Ze=Ge.queryResults,ot=Ge.wrappedTileID,dt=oi[ot]=oi[ot]||{};for(let Ct in Ze){let wt=Ze[Ct],Dt=dt[Ct]=dt[Ct]||{},fr=Kr[Ct]=Kr[Ct]||[];for(let _r of wt)Dt[_r.featureIndex]||(Dt[_r.featureIndex]=!0,fr.push(_r))}}return Kr}(Qt);for(let Sr in Ar)Ar[Sr].forEach(Kr=>{let oi=Kr.feature,Ge=Ue.getFeatureState(oi.layer["source-layer"],oi.id);oi.source=oi.layer.source,oi.layer["source-layer"]&&(oi.sourceLayer=oi.layer["source-layer"]),oi.state=Ge});return Ar}function j(Ue,P){let ae=Ue.tileID,xe=P.tileID;return ae.overscaledZ-xe.overscaledZ||ae.canonical.y-xe.canonical.y||ae.wrap-xe.wrap||ae.canonical.x-xe.canonical.x}function Q(Ue,P,ae){return t._(this,void 0,void 0,function*(){let xe=Ue;if(Ue.url?xe=(yield t.h(P.transformRequest(Ue.url,"Source"),ae)).data:yield n.frameAsync(ae),!xe)return null;let Te=t.M(t.e(xe,Ue),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in xe&&xe.vector_layers&&(Te.vectorLayerIds=xe.vector_layers.map(Oe=>Oe.id)),Te})}class re{constructor(P,ae){P&&(ae?this.setSouthWest(P).setNorthEast(ae):Array.isArray(P)&&(P.length===4?this.setSouthWest([P[0],P[1]]).setNorthEast([P[2],P[3]]):this.setSouthWest(P[0]).setNorthEast(P[1])))}setNorthEast(P){return this._ne=P instanceof t.N?new t.N(P.lng,P.lat):t.N.convert(P),this}setSouthWest(P){return this._sw=P instanceof t.N?new t.N(P.lng,P.lat):t.N.convert(P),this}extend(P){let ae=this._sw,xe=this._ne,Te,Oe;if(P instanceof t.N)Te=P,Oe=P;else{if(!(P instanceof re))return Array.isArray(P)?P.length===4||P.every(Array.isArray)?this.extend(re.convert(P)):this.extend(t.N.convert(P)):P&&("lng"in P||"lon"in P)&&"lat"in P?this.extend(t.N.convert(P)):this;if(Te=P._sw,Oe=P._ne,!Te||!Oe)return this}return ae||xe?(ae.lng=Math.min(Te.lng,ae.lng),ae.lat=Math.min(Te.lat,ae.lat),xe.lng=Math.max(Oe.lng,xe.lng),xe.lat=Math.max(Oe.lat,xe.lat)):(this._sw=new t.N(Te.lng,Te.lat),this._ne=new t.N(Oe.lng,Oe.lat)),this}getCenter(){return new t.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 t.N(this.getWest(),this.getNorth())}getSouthEast(){return new t.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(P){let{lng:ae,lat:xe}=t.N.convert(P),Te=this._sw.lng<=ae&&ae<=this._ne.lng;return this._sw.lng>this._ne.lng&&(Te=this._sw.lng>=ae&&ae>=this._ne.lng),this._sw.lat<=xe&&xe<=this._ne.lat&&Te}static convert(P){return P instanceof re?P:P&&new re(P)}static fromLngLat(P,ae=0){let xe=360*ae/40075017,Te=xe/Math.cos(Math.PI/180*P.lat);return new re(new t.N(P.lng-Te,P.lat-xe),new t.N(P.lng+Te,P.lat+xe))}adjustAntiMeridian(){let P=new t.N(this._sw.lng,this._sw.lat),ae=new t.N(this._ne.lng,this._ne.lat);return new re(P,P.lng>ae.lng?new t.N(ae.lng+360,ae.lat):ae)}}class ue{constructor(P,ae,xe){this.bounds=re.convert(this.validateBounds(P)),this.minzoom=ae||0,this.maxzoom=xe||24}validateBounds(P){return Array.isArray(P)&&P.length===4?[Math.max(-180,P[0]),Math.max(-90,P[1]),Math.min(180,P[2]),Math.min(90,P[3])]:[-180,-90,180,90]}contains(P){let ae=Math.pow(2,P.z),xe=Math.floor(t.O(this.bounds.getWest())*ae),Te=Math.floor(t.Q(this.bounds.getNorth())*ae),Oe=Math.ceil(t.O(this.bounds.getEast())*ae),ht=Math.ceil(t.Q(this.bounds.getSouth())*ae);return P.x>=xe&&P.x<Oe&&P.y>=Te&&P.y<ht}}class _e extends t.E{constructor(P,ae,xe,Te){if(super(),this.id=P,this.dispatcher=xe,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.M(ae,["url","scheme","tileSize","promoteId"])),this._options=t.e({type:"vector"},ae),this._collectResourceTiming=ae.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(Te)}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let P=yield Q(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),P&&(t.e(this,P),P.bounds&&(this.tileBounds=new ue(P.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})))}catch(P){this._tileJSONRequest=null,this.fire(new t.j(P))}})}loaded(){return this._loaded}hasTile(P){return!this.tileBounds||this.tileBounds.contains(P.canonical)}onAdd(P){this.map=P,this.load()}setSourceProperty(P){this._tileJSONRequest&&this._tileJSONRequest.abort(),P(),this.load()}setTiles(P){return this.setSourceProperty(()=>{this._options.tiles=P}),this}setUrl(P){return this.setSourceProperty(()=>{this.url=P,this._options.url=P}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(P){return t._(this,void 0,void 0,function*(){let ae=P.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),xe={request:this.map._requestManager.transformRequest(ae,"Tile"),uid:P.uid,tileID:P.tileID,zoom:P.tileID.overscaledZ,tileSize:this.tileSize*P.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};xe.request.collectResourceTiming=this._collectResourceTiming;let Te="RT";if(P.actor&&P.state!=="expired"){if(P.state==="loading")return new Promise((Oe,ht)=>{P.reloadPromise={resolve:Oe,reject:ht}})}else P.actor=this.dispatcher.getActor(),Te="LT";P.abortController=new AbortController;try{let Oe=yield P.actor.sendAsync({type:Te,data:xe},P.abortController);if(delete P.abortController,P.aborted)return;this._afterTileLoadWorkerResponse(P,Oe)}catch(Oe){if(delete P.abortController,P.aborted)return;if(Oe&&Oe.status!==404)throw Oe;this._afterTileLoadWorkerResponse(P,null)}})}_afterTileLoadWorkerResponse(P,ae){if(ae&&ae.resourceTiming&&(P.resourceTiming=ae.resourceTiming),ae&&this.map._refreshExpiredTiles&&P.setExpiryData(ae),P.loadVectorData(ae,this.map.painter),P.reloadPromise){let xe=P.reloadPromise;P.reloadPromise=null,this.loadTile(P).then(xe.resolve).catch(xe.reject)}}abortTile(P){return t._(this,void 0,void 0,function*(){P.abortController&&(P.abortController.abort(),delete P.abortController),P.actor&&(yield P.actor.sendAsync({type:"AT",data:{uid:P.uid,type:this.type,source:this.id}}))})}unloadTile(P){return t._(this,void 0,void 0,function*(){P.unloadVectorData(),P.actor&&(yield P.actor.sendAsync({type:"RMT",data:{uid:P.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class we extends t.E{constructor(P,ae,xe,Te){super(),this.id=P,this.dispatcher=xe,this.setEventedParent(Te),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},ae),t.e(this,t.M(ae,["url","scheme","tileSize"]))}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let P=yield Q(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,P&&(t.e(this,P),P.bounds&&(this.tileBounds=new ue(P.bounds,this.minzoom,this.maxzoom)),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})))}catch(P){this._tileJSONRequest=null,this.fire(new t.j(P))}})}loaded(){return this._loaded}onAdd(P){this.map=P,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(P){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),P(),this.load()}setTiles(P){return this.setSourceProperty(()=>{this._options.tiles=P}),this}setUrl(P){return this.setSourceProperty(()=>{this.url=P,this._options.url=P}),this}serialize(){return t.e({},this._options)}hasTile(P){return!this.tileBounds||this.tileBounds.contains(P.canonical)}loadTile(P){return t._(this,void 0,void 0,function*(){let ae=P.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);P.abortController=new AbortController;try{let xe=yield l.getImage(this.map._requestManager.transformRequest(ae,"Tile"),P.abortController,this.map._refreshExpiredTiles);if(delete P.abortController,P.aborted)return void(P.state="unloaded");if(xe&&xe.data){this.map._refreshExpiredTiles&&xe.cacheControl&&xe.expires&&P.setExpiryData({cacheControl:xe.cacheControl,expires:xe.expires});let Te=this.map.painter.context,Oe=Te.gl,ht=xe.data;P.texture=this.map.painter.getTileTexture(ht.width),P.texture?P.texture.update(ht,{useMipmap:!0}):(P.texture=new u(Te,ht,Oe.RGBA,{useMipmap:!0}),P.texture.bind(Oe.LINEAR,Oe.CLAMP_TO_EDGE,Oe.LINEAR_MIPMAP_NEAREST)),P.state="loaded"}}catch(xe){if(delete P.abortController,P.aborted)P.state="unloaded";else if(xe)throw P.state="errored",xe}})}abortTile(P){return t._(this,void 0,void 0,function*(){P.abortController&&(P.abortController.abort(),delete P.abortController)})}unloadTile(P){return t._(this,void 0,void 0,function*(){P.texture&&this.map.painter.saveTileTexture(P.texture)})}hasTransition(){return!1}}class Re extends we{constructor(P,ae,xe,Te){super(P,ae,xe,Te),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},ae),this.encoding=ae.encoding||"mapbox",this.redFactor=ae.redFactor,this.greenFactor=ae.greenFactor,this.blueFactor=ae.blueFactor,this.baseShift=ae.baseShift}loadTile(P){return t._(this,void 0,void 0,function*(){let ae=P.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),xe=this.map._requestManager.transformRequest(ae,"Tile");P.neighboringTiles=this._getNeighboringTiles(P.tileID),P.abortController=new AbortController;try{let Te=yield l.getImage(xe,P.abortController,this.map._refreshExpiredTiles);if(delete P.abortController,P.aborted)return void(P.state="unloaded");if(Te&&Te.data){let Oe=Te.data;this.map._refreshExpiredTiles&&Te.cacheControl&&Te.expires&&P.setExpiryData({cacheControl:Te.cacheControl,expires:Te.expires});let ht=t.b(Oe)&&t.U()?Oe:yield this.readImageNow(Oe),Tt={type:this.type,uid:P.uid,source:this.id,rawImageData:ht,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!P.actor||P.state==="expired"){P.actor=this.dispatcher.getActor();let Ot=yield P.actor.sendAsync({type:"LDT",data:Tt});P.dem=Ot,P.needsHillshadePrepare=!0,P.needsTerrainPrepare=!0,P.state="loaded"}}}catch(Te){if(delete P.abortController,P.aborted)P.state="unloaded";else if(Te)throw P.state="errored",Te}})}readImageNow(P){return t._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&t.V()){let ae=P.width+2,xe=P.height+2;try{return new t.R({width:ae,height:xe},yield t.W(P,-1,-1,ae,xe))}catch{}}return n.getImageData(P,1)})}_getNeighboringTiles(P){let ae=P.canonical,xe=Math.pow(2,ae.z),Te=(ae.x-1+xe)%xe,Oe=ae.x===0?P.wrap-1:P.wrap,ht=(ae.x+1+xe)%xe,Tt=ae.x+1===xe?P.wrap+1:P.wrap,Ot={};return Ot[new t.S(P.overscaledZ,Oe,ae.z,Te,ae.y).key]={backfilled:!1},Ot[new t.S(P.overscaledZ,Tt,ae.z,ht,ae.y).key]={backfilled:!1},ae.y>0&&(Ot[new t.S(P.overscaledZ,Oe,ae.z,Te,ae.y-1).key]={backfilled:!1},Ot[new t.S(P.overscaledZ,P.wrap,ae.z,ae.x,ae.y-1).key]={backfilled:!1},Ot[new t.S(P.overscaledZ,Tt,ae.z,ht,ae.y-1).key]={backfilled:!1}),ae.y+1<xe&&(Ot[new t.S(P.overscaledZ,Oe,ae.z,Te,ae.y+1).key]={backfilled:!1},Ot[new t.S(P.overscaledZ,P.wrap,ae.z,ae.x,ae.y+1).key]={backfilled:!1},Ot[new t.S(P.overscaledZ,Tt,ae.z,ht,ae.y+1).key]={backfilled:!1}),Ot}unloadTile(P){return t._(this,void 0,void 0,function*(){P.demTexture&&this.map.painter.saveTileTexture(P.demTexture),P.fbo&&(P.fbo.destroy(),delete P.fbo),P.dem&&delete P.dem,delete P.neighboringTiles,P.state="unloaded",P.actor&&(yield P.actor.sendAsync({type:"RDT",data:{type:this.type,uid:P.uid,source:this.id}}))})}}class ze extends t.E{constructor(P,ae,xe,Te){super(),this.id=P,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=xe.getActor(),this.setEventedParent(Te),this._data=ae.data,this._options=t.e({},ae),this._collectResourceTiming=ae.collectResourceTiming,ae.maxzoom!==void 0&&(this.maxzoom=ae.maxzoom),ae.type&&(this.type=ae.type),ae.attribution&&(this.attribution=ae.attribution),this.promoteId=ae.promoteId;let Oe=t.X/this.tileSize;ae.clusterMaxZoom!==void 0&&this.maxzoom<=ae.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${ae.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:ae.cluster||!1,geojsonVtOptions:{buffer:(ae.buffer!==void 0?ae.buffer:128)*Oe,tolerance:(ae.tolerance!==void 0?ae.tolerance:.375)*Oe,extent:t.X,maxZoom:this.maxzoom,lineMetrics:ae.lineMetrics||!1,generateId:ae.generateId||!1},superclusterOptions:{maxZoom:ae.clusterMaxZoom!==void 0?ae.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,ae.clusterMinPoints||2),extent:t.X,radius:(ae.clusterRadius||50)*Oe,log:!1,generateId:ae.generateId||!1},clusterProperties:ae.clusterProperties,filter:ae.filter},ae.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return t._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(P){this.map=P,this.load()}setData(P){return this._data=P,this._updateWorkerData(),this}updateData(P){return this._updateWorkerData(P),this}getData(){return t._(this,void 0,void 0,function*(){let P=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:P})})}setClusterOptions(P){return this.workerOptions.cluster=P.cluster,P&&(P.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=P.clusterRadius),P.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=P.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(P){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:P,source:this.id}})}getClusterChildren(P){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:P,source:this.id}})}getClusterLeaves(P,ae,xe){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:P,limit:ae,offset:xe}})}_updateWorkerData(P){return t._(this,void 0,void 0,function*(){let ae=t.e({type:this.type},this.workerOptions);P?ae.dataDiff=P:typeof this._data=="string"?(ae.request=this.map._requestManager.transformRequest(n.resolveURL(this._data),"Source"),ae.request.collectResourceTiming=this._collectResourceTiming):ae.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.k("dataloading",{dataType:"source"}));try{let xe=yield this.actor.sendAsync({type:"LD",data:ae});if(this._pendingLoads--,this._removed||xe.abandoned)return void this.fire(new t.k("dataabort",{dataType:"source"}));let Te=null;xe.resourceTiming&&xe.resourceTiming[this.id]&&(Te=xe.resourceTiming[this.id].slice(0));let Oe={dataType:"source"};this._collectResourceTiming&&Te&&Te.length>0&&t.e(Oe,{resourceTiming:Te}),this.fire(new t.k("data",Object.assign(Object.assign({},Oe),{sourceDataType:"metadata"}))),this.fire(new t.k("data",Object.assign(Object.assign({},Oe),{sourceDataType:"content"})))}catch(xe){if(this._pendingLoads--,this._removed)return void this.fire(new t.k("dataabort",{dataType:"source"}));this.fire(new t.j(xe))}})}loaded(){return this._pendingLoads===0}loadTile(P){return t._(this,void 0,void 0,function*(){let ae=P.actor?"RT":"LT";P.actor=this.actor;let xe={type:this.type,uid:P.uid,tileID:P.tileID,zoom:P.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};P.abortController=new AbortController;let Te=yield this.actor.sendAsync({type:ae,data:xe},P.abortController);delete P.abortController,P.unloadVectorData(),P.aborted||P.loadVectorData(Te,this.map.painter,ae==="RT")})}abortTile(P){return t._(this,void 0,void 0,function*(){P.abortController&&(P.abortController.abort(),delete P.abortController),P.aborted=!0})}unloadTile(P){return t._(this,void 0,void 0,function*(){P.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:P.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 t.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Xe=t.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class tt extends t.E{constructor(P,ae,xe,Te){super(),this.id=P,this.dispatcher=xe,this.coordinates=ae.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(Te),this.options=ae}load(P){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let ae=yield l.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,ae&&ae.data&&(this.image=ae.data,P&&(this.coordinates=P),this._finishLoading())}catch(ae){this._request=null,this._loaded=!0,this.fire(new t.j(ae))}})}loaded(){return this._loaded}updateImage(P){return P.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=P.url,this.load(P.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(P){this.map=P,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(P){this.coordinates=P;let ae=P.map(t.Z.fromLngLat);this.tileID=function(Te){let Oe=1/0,ht=1/0,Tt=-1/0,Ot=-1/0;for(let Kr of Te)Oe=Math.min(Oe,Kr.x),ht=Math.min(ht,Kr.y),Tt=Math.max(Tt,Kr.x),Ot=Math.max(Ot,Kr.y);let Qt=Math.max(Tt-Oe,Ot-ht),Ar=Math.max(0,Math.floor(-Math.log(Qt)/Math.LN2)),Sr=Math.pow(2,Ar);return new t.a1(Ar,Math.floor((Oe+Tt)/2*Sr),Math.floor((ht+Ot)/2*Sr))}(ae),this.minzoom=this.maxzoom=this.tileID.z;let xe=ae.map(Te=>this.tileID.getTilePoint(Te)._round());return this._boundsArray=new t.$,this._boundsArray.emplaceBack(xe[0].x,xe[0].y,0,0),this._boundsArray.emplaceBack(xe[1].x,xe[1].y,t.X,0),this._boundsArray.emplaceBack(xe[3].x,xe[3].y,0,t.X),this._boundsArray.emplaceBack(xe[2].x,xe[2].y,t.X,t.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let P=this.map.painter.context,ae=P.gl;this.boundsBuffer||(this.boundsBuffer=P.createVertexBuffer(this._boundsArray,Xe.members)),this.boundsSegments||(this.boundsSegments=t.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new u(P,this.image,ae.RGBA),this.texture.bind(ae.LINEAR,ae.CLAMP_TO_EDGE));let xe=!1;for(let Te in this.tiles){let Oe=this.tiles[Te];Oe.state!=="loaded"&&(Oe.state="loaded",Oe.texture=this.texture,xe=!0)}xe&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(P){return t._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(P.tileID.canonical)?(this.tiles[String(P.tileID.wrap)]=P,P.buckets={}):P.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class it extends tt{constructor(P,ae,xe,Te){super(P,ae,xe,Te),this.roundZoom=!0,this.type="video",this.options=ae}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1;let P=this.options;this.urls=[];for(let ae of P.urls)this.urls.push(this.map._requestManager.transformRequest(ae,"Source").url);try{let ae=yield t.a3(this.urls);if(this._loaded=!0,!ae)return;this.video=ae,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(ae){this.fire(new t.j(ae))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(P){if(this.video){let ae=this.video.seekable;P<ae.start(0)||P>ae.end(0)?this.fire(new t.j(new t.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${ae.start(0)} and ${ae.end(0)}-second mark.`))):this.video.currentTime=P}}getVideo(){return this.video}onAdd(P){this.map||(this.map=P,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 P=this.map.painter.context,ae=P.gl;this.boundsBuffer||(this.boundsBuffer=P.createVertexBuffer(this._boundsArray,Xe.members)),this.boundsSegments||(this.boundsSegments=t.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(ae.LINEAR,ae.CLAMP_TO_EDGE),ae.texSubImage2D(ae.TEXTURE_2D,0,0,0,ae.RGBA,ae.UNSIGNED_BYTE,this.video)):(this.texture=new u(P,this.video,ae.RGBA),this.texture.bind(ae.LINEAR,ae.CLAMP_TO_EDGE));let xe=!1;for(let Te in this.tiles){let Oe=this.tiles[Te];Oe.state!=="loaded"&&(Oe.state="loaded",Oe.texture=this.texture,xe=!0)}xe&&this.fire(new t.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 et extends tt{constructor(P,ae,xe,Te){super(P,ae,xe,Te),ae.coordinates?Array.isArray(ae.coordinates)&&ae.coordinates.length===4&&!ae.coordinates.some(Oe=>!Array.isArray(Oe)||Oe.length!==2||Oe.some(ht=>typeof ht!="number"))||this.fire(new t.j(new t.a2(`sources.${P}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.j(new t.a2(`sources.${P}`,null,'missing required property "coordinates"'))),ae.animate&&typeof ae.animate!="boolean"&&this.fire(new t.j(new t.a2(`sources.${P}`,null,'optional "animate" property must be a boolean value'))),ae.canvas?typeof ae.canvas=="string"||ae.canvas instanceof HTMLCanvasElement||this.fire(new t.j(new t.a2(`sources.${P}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.j(new t.a2(`sources.${P}`,null,'missing required property "canvas"'))),this.options=ae,this.animate=ae.animate===void 0||ae.animate}load(){return t._(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 t.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(P){this.map=P,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let P=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,P=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,P=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let ae=this.map.painter.context,xe=ae.gl;this.boundsBuffer||(this.boundsBuffer=ae.createVertexBuffer(this._boundsArray,Xe.members)),this.boundsSegments||(this.boundsSegments=t.a0.simpleSegment(0,0,4,2)),this.texture?(P||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new u(ae,this.canvas,xe.RGBA,{premultiply:!0});let Te=!1;for(let Oe in this.tiles){let ht=this.tiles[Oe];ht.state!=="loaded"&&(ht.state="loaded",ht.texture=this.texture,Te=!0)}Te&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let P of[this.canvas.width,this.canvas.height])if(isNaN(P)||P<=0)return!0;return!1}}let nt={},Ae=Ue=>{switch(Ue){case"geojson":return ze;case"image":return tt;case"raster":return we;case"raster-dem":return Re;case"vector":return _e;case"video":return it;case"canvas":return et}return nt[Ue]},me="RTLPluginLoaded";class fe extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=V()}_syncState(P){return this.status=P,this.dispatcher.broadcast("SRPS",{pluginStatus:P,pluginURL:this.url}).catch(ae=>{throw this.status="error",ae})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(P){return t._(this,arguments,void 0,function*(ae,xe=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=n.resolveURL(ae),!this.url)throw new Error(`requested url ${ae} is invalid`);if(this.status==="unavailable"){if(!xe)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return t._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.k(me))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Be=null;function Qe(){return Be||(Be=new fe),Be}class at{constructor(P,ae){this.timeAdded=0,this.fadeEndTime=0,this.tileID=P,this.uid=t.a4(),this.uses=0,this.tileSize=ae,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(P){let ae=P+this.timeAdded;ae<this.fadeEndTime||(this.fadeEndTime=ae)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(P){this.demTexture&&P.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(P,ae,xe){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",P){P.featureIndex&&(this.latestFeatureIndex=P.featureIndex,P.rawTileData?(this.latestRawTileData=P.rawTileData,this.latestFeatureIndex.rawTileData=P.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=P.collisionBoxArray,this.buckets=function(Te,Oe){let ht={};if(!Oe)return ht;for(let Tt of Te){let Ot=Tt.layerIds.map(Qt=>Oe.getLayer(Qt)).filter(Boolean);if(Ot.length!==0){Tt.layers=Ot,Tt.stateDependentLayerIds&&(Tt.stateDependentLayers=Tt.stateDependentLayerIds.map(Qt=>Ot.filter(Ar=>Ar.id===Qt)[0]));for(let Qt of Ot)ht[Qt.id]=Tt}}return ht}(P.buckets,ae.style),this.hasSymbolBuckets=!1;for(let Te in this.buckets){let Oe=this.buckets[Te];if(Oe instanceof t.a6){if(this.hasSymbolBuckets=!0,!xe)break;Oe.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let Te in this.buckets){let Oe=this.buckets[Te];if(Oe instanceof t.a6&&Oe.hasRTLText){this.hasRTLText=!0,Qe().lazyLoad();break}}this.queryPadding=0;for(let Te in this.buckets){let Oe=this.buckets[Te];this.queryPadding=Math.max(this.queryPadding,ae.style.getLayer(Te).queryRadius(Oe))}P.imageAtlas&&(this.imageAtlas=P.imageAtlas),P.glyphAtlasImage&&(this.glyphAtlasImage=P.glyphAtlasImage)}else this.collisionBoxArray=new t.a5}unloadVectorData(){for(let P in this.buckets)this.buckets[P].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(P){return this.buckets[P.id]}upload(P){for(let xe in this.buckets){let Te=this.buckets[xe];Te.uploadPending()&&Te.upload(P)}let ae=P.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new u(P,this.imageAtlas.image,ae.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new u(P,this.glyphAtlasImage,ae.ALPHA),this.glyphAtlasImage=null)}prepare(P){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(P,this.imageAtlasTexture)}queryRenderedFeatures(P,ae,xe,Te,Oe,ht,Tt,Ot,Qt,Ar){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:Te,cameraQueryGeometry:Oe,scale:ht,tileSize:this.tileSize,pixelPosMatrix:Ar,transform:Ot,params:Tt,queryPadding:this.queryPadding*Qt},P,ae,xe):{}}querySourceFeatures(P,ae){let xe=this.latestFeatureIndex;if(!xe||!xe.rawTileData)return;let Te=xe.loadVTLayers(),Oe=ae&&ae.sourceLayer?ae.sourceLayer:"",ht=Te._geojsonTileLayer||Te[Oe];if(!ht)return;let Tt=t.a7(ae&&ae.filter),{z:Ot,x:Qt,y:Ar}=this.tileID.canonical,Sr={z:Ot,x:Qt,y:Ar};for(let Kr=0;Kr<ht.length;Kr++){let oi=ht.feature(Kr);if(Tt.needGeometry){let ot=t.a8(oi,!0);if(!Tt.filter(new t.z(this.tileID.overscaledZ),ot,this.tileID.canonical))continue}else if(!Tt.filter(new t.z(this.tileID.overscaledZ),oi))continue;let Ge=xe.getId(oi,Oe),Ze=new t.a9(oi,Ot,Qt,Ar,Ge);Ze.tile=Sr,P.push(Ze)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(P){let ae=this.expirationTime;if(P.cacheControl){let xe=t.aa(P.cacheControl);xe["max-age"]&&(this.expirationTime=Date.now()+1e3*xe["max-age"])}else P.expires&&(this.expirationTime=new Date(P.expires).getTime());if(this.expirationTime){let xe=Date.now(),Te=!1;if(this.expirationTime>xe)Te=!1;else if(ae)if(this.expirationTime<ae)Te=!0;else{let Oe=this.expirationTime-ae;Oe?this.expirationTime=xe+Math.max(Oe,3e4):Te=!0}else Te=!0;Te?(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(P,ae){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(P).length===0)return;let xe=this.latestFeatureIndex.loadVTLayers();for(let Te in this.buckets){if(!ae.style.hasLayer(Te))continue;let Oe=this.buckets[Te],ht=Oe.layers[0].sourceLayer||"_geojsonTileLayer",Tt=xe[ht],Ot=P[ht];if(!Tt||!Ot||Object.keys(Ot).length===0)continue;Oe.update(Ot,Tt,this.imageAtlas&&this.imageAtlas.patternPositions||{});let Qt=ae&&ae.style&&ae.style.getLayer(Te);Qt&&(this.queryPadding=Math.max(this.queryPadding,Qt.queryRadius(Oe)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<n.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(P){this.symbolFadeHoldUntil=n.now()+P}setDependencies(P,ae){let xe={};for(let Te of ae)xe[Te]=!0;this.dependencies[P]=xe}hasDependency(P,ae){for(let xe of P){let Te=this.dependencies[xe];if(Te){for(let Oe of ae)if(Te[Oe])return!0}}return!1}}class $e{constructor(P,ae){this.max=P,this.onRemove=ae,this.reset()}reset(){for(let P in this.data)for(let ae of this.data[P])ae.timeout&&clearTimeout(ae.timeout),this.onRemove(ae.value);return this.data={},this.order=[],this}add(P,ae,xe){let Te=P.wrapped().key;this.data[Te]===void 0&&(this.data[Te]=[]);let Oe={value:ae,timeout:void 0};if(xe!==void 0&&(Oe.timeout=setTimeout(()=>{this.remove(P,Oe)},xe)),this.data[Te].push(Oe),this.order.push(Te),this.order.length>this.max){let ht=this._getAndRemoveByKey(this.order[0]);ht&&this.onRemove(ht)}return this}has(P){return P.wrapped().key in this.data}getAndRemove(P){return this.has(P)?this._getAndRemoveByKey(P.wrapped().key):null}_getAndRemoveByKey(P){let ae=this.data[P].shift();return ae.timeout&&clearTimeout(ae.timeout),this.data[P].length===0&&delete this.data[P],this.order.splice(this.order.indexOf(P),1),ae.value}getByKey(P){let ae=this.data[P];return ae?ae[0].value:null}get(P){return this.has(P)?this.data[P.wrapped().key][0].value:null}remove(P,ae){if(!this.has(P))return this;let xe=P.wrapped().key,Te=ae===void 0?0:this.data[xe].indexOf(ae),Oe=this.data[xe][Te];return this.data[xe].splice(Te,1),Oe.timeout&&clearTimeout(Oe.timeout),this.data[xe].length===0&&delete this.data[xe],this.onRemove(Oe.value),this.order.splice(this.order.indexOf(xe),1),this}setMaxSize(P){for(this.max=P;this.order.length>this.max;){let ae=this._getAndRemoveByKey(this.order[0]);ae&&this.onRemove(ae)}return this}filter(P){let ae=[];for(let xe in this.data)for(let Te of this.data[xe])P(Te.value)||ae.push(Te);for(let xe of ae)this.remove(xe.value.tileID,xe)}}class It{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(P,ae,xe){let Te=String(ae);if(this.stateChanges[P]=this.stateChanges[P]||{},this.stateChanges[P][Te]=this.stateChanges[P][Te]||{},t.e(this.stateChanges[P][Te],xe),this.deletedStates[P]===null){this.deletedStates[P]={};for(let Oe in this.state[P])Oe!==Te&&(this.deletedStates[P][Oe]=null)}else if(this.deletedStates[P]&&this.deletedStates[P][Te]===null){this.deletedStates[P][Te]={};for(let Oe in this.state[P][Te])xe[Oe]||(this.deletedStates[P][Te][Oe]=null)}else for(let Oe in xe)this.deletedStates[P]&&this.deletedStates[P][Te]&&this.deletedStates[P][Te][Oe]===null&&delete this.deletedStates[P][Te][Oe]}removeFeatureState(P,ae,xe){if(this.deletedStates[P]===null)return;let Te=String(ae);if(this.deletedStates[P]=this.deletedStates[P]||{},xe&&ae!==void 0)this.deletedStates[P][Te]!==null&&(this.deletedStates[P][Te]=this.deletedStates[P][Te]||{},this.deletedStates[P][Te][xe]=null);else if(ae!==void 0)if(this.stateChanges[P]&&this.stateChanges[P][Te])for(xe in this.deletedStates[P][Te]={},this.stateChanges[P][Te])this.deletedStates[P][Te][xe]=null;else this.deletedStates[P][Te]=null;else this.deletedStates[P]=null}getState(P,ae){let xe=String(ae),Te=t.e({},(this.state[P]||{})[xe],(this.stateChanges[P]||{})[xe]);if(this.deletedStates[P]===null)return{};if(this.deletedStates[P]){let Oe=this.deletedStates[P][ae];if(Oe===null)return{};for(let ht in Oe)delete Te[ht]}return Te}initializeTileState(P,ae){P.setFeatureState(this.state,ae)}coalesceChanges(P,ae){let xe={};for(let Te in this.stateChanges){this.state[Te]=this.state[Te]||{};let Oe={};for(let ht in this.stateChanges[Te])this.state[Te][ht]||(this.state[Te][ht]={}),t.e(this.state[Te][ht],this.stateChanges[Te][ht]),Oe[ht]=this.state[Te][ht];xe[Te]=Oe}for(let Te in this.deletedStates){this.state[Te]=this.state[Te]||{};let Oe={};if(this.deletedStates[Te]===null)for(let ht in this.state[Te])Oe[ht]={},this.state[Te][ht]={};else for(let ht in this.deletedStates[Te]){if(this.deletedStates[Te][ht]===null)this.state[Te][ht]={};else for(let Tt of Object.keys(this.deletedStates[Te][ht]))delete this.state[Te][ht][Tt];Oe[ht]=this.state[Te][ht]}xe[Te]=xe[Te]||{},t.e(xe[Te],Oe)}if(this.stateChanges={},this.deletedStates={},Object.keys(xe).length!==0)for(let Te in P)P[Te].setFeatureState(xe,ae)}}class Pt extends t.E{constructor(P,ae,xe){super(),this.id=P,this.dispatcher=xe,this.on("data",Te=>this._dataHandler(Te)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((Te,Oe,ht,Tt)=>{let Ot=new(Ae(Oe.type))(Te,Oe,ht,Tt);if(Ot.id!==Te)throw new Error(`Expected Source id to be ${Te} instead of ${Ot.id}`);return Ot})(P,ae,xe,this),this._tiles={},this._cache=new $e(0,Te=>this._unloadTile(Te)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new It,this._didEmitContent=!1,this._updated=!1}onAdd(P){this.map=P,this._maxTileCacheSize=P?P._maxTileCacheSize:null,this._maxTileCacheZoomLevels=P?P._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(P)}onRemove(P){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(P)}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 P in this._tiles){let ae=this._tiles[P];if(ae.state!=="loaded"&&ae.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let P=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,P&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(P,ae,xe){return t._(this,void 0,void 0,function*(){try{yield this._source.loadTile(P),this._tileLoaded(P,ae,xe)}catch(Te){P.state="errored",Te.status!==404?this._source.fire(new t.j(Te,{tile:P})):this.update(this.transform,this.terrain)}})}_unloadTile(P){this._source.unloadTile&&this._source.unloadTile(P)}_abortTile(P){this._source.abortTile&&this._source.abortTile(P),this._source.fire(new t.k("dataabort",{tile:P,coord:P.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(P){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let ae in this._tiles){let xe=this._tiles[ae];xe.upload(P),xe.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(P=>P.tileID).sort(Vt).map(P=>P.key)}getRenderableIds(P){let ae=[];for(let xe in this._tiles)this._isIdRenderable(xe,P)&&ae.push(this._tiles[xe]);return P?ae.sort((xe,Te)=>{let Oe=xe.tileID,ht=Te.tileID,Tt=new t.P(Oe.canonical.x,Oe.canonical.y)._rotate(this.transform.angle),Ot=new t.P(ht.canonical.x,ht.canonical.y)._rotate(this.transform.angle);return Oe.overscaledZ-ht.overscaledZ||Ot.y-Tt.y||Ot.x-Tt.x}).map(xe=>xe.tileID.key):ae.map(xe=>xe.tileID).sort(Vt).map(xe=>xe.key)}hasRenderableParent(P){let ae=this.findLoadedParent(P,0);return!!ae&&this._isIdRenderable(ae.tileID.key)}_isIdRenderable(P,ae){return this._tiles[P]&&this._tiles[P].hasData()&&!this._coveredTiles[P]&&(ae||!this._tiles[P].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let P in this._tiles)this._tiles[P].state!=="errored"&&this._reloadTile(P,"reloading")}}_reloadTile(P,ae){return t._(this,void 0,void 0,function*(){let xe=this._tiles[P];xe&&(xe.state!=="loading"&&(xe.state=ae),yield this._loadTile(xe,P,ae))})}_tileLoaded(P,ae,xe){P.timeAdded=n.now(),xe==="expired"&&(P.refreshedUponExpiration=!0),this._setTileReloadTimer(ae,P),this.getSource().type==="raster-dem"&&P.dem&&this._backfillDEM(P),this._state.initializeTileState(P,this.map?this.map.painter:null),P.aborted||this._source.fire(new t.k("data",{dataType:"source",tile:P,coord:P.tileID}))}_backfillDEM(P){let ae=this.getRenderableIds();for(let Te=0;Te<ae.length;Te++){let Oe=ae[Te];if(P.neighboringTiles&&P.neighboringTiles[Oe]){let ht=this.getTileByID(Oe);xe(P,ht),xe(ht,P)}}function xe(Te,Oe){Te.needsHillshadePrepare=!0,Te.needsTerrainPrepare=!0;let ht=Oe.tileID.canonical.x-Te.tileID.canonical.x,Tt=Oe.tileID.canonical.y-Te.tileID.canonical.y,Ot=Math.pow(2,Te.tileID.canonical.z),Qt=Oe.tileID.key;ht===0&&Tt===0||Math.abs(Tt)>1||(Math.abs(ht)>1&&(Math.abs(ht+Ot)===1?ht+=Ot:Math.abs(ht-Ot)===1&&(ht-=Ot)),Oe.dem&&Te.dem&&(Te.dem.backfillBorder(Oe.dem,ht,Tt),Te.neighboringTiles&&Te.neighboringTiles[Qt]&&(Te.neighboringTiles[Qt].backfilled=!0)))}}getTile(P){return this.getTileByID(P.key)}getTileByID(P){return this._tiles[P]}_retainLoadedChildren(P,ae,xe,Te){for(let Oe in this._tiles){let ht=this._tiles[Oe];if(Te[Oe]||!ht.hasData()||ht.tileID.overscaledZ<=ae||ht.tileID.overscaledZ>xe)continue;let Tt=ht.tileID;for(;ht&&ht.tileID.overscaledZ>ae+1;){let Qt=ht.tileID.scaledTo(ht.tileID.overscaledZ-1);ht=this._tiles[Qt.key],ht&&ht.hasData()&&(Tt=Qt)}let Ot=Tt;for(;Ot.overscaledZ>ae;)if(Ot=Ot.scaledTo(Ot.overscaledZ-1),P[Ot.key]){Te[Tt.key]=Tt;break}}}findLoadedParent(P,ae){if(P.key in this._loadedParentTiles){let xe=this._loadedParentTiles[P.key];return xe&&xe.tileID.overscaledZ>=ae?xe:null}for(let xe=P.overscaledZ-1;xe>=ae;xe--){let Te=P.scaledTo(xe),Oe=this._getLoadedTile(Te);if(Oe)return Oe}}findLoadedSibling(P){return this._getLoadedTile(P)}_getLoadedTile(P){let ae=this._tiles[P.key];return ae&&ae.hasData()?ae:this._cache.getByKey(P.wrapped().key)}updateCacheSize(P){let ae=Math.ceil(P.width/this._source.tileSize)+1,xe=Math.ceil(P.height/this._source.tileSize)+1,Te=Math.floor(ae*xe*(this._maxTileCacheZoomLevels===null?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),Oe=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,Te):Te;this._cache.setMaxSize(Oe)}handleWrapJump(P){let ae=Math.round((P-(this._prevLng===void 0?P:this._prevLng))/360);if(this._prevLng=P,ae){let xe={};for(let Te in this._tiles){let Oe=this._tiles[Te];Oe.tileID=Oe.tileID.unwrapTo(Oe.tileID.wrap+ae),xe[Oe.tileID.key]=Oe}this._tiles=xe;for(let Te in this._timers)clearTimeout(this._timers[Te]),delete this._timers[Te];for(let Te in this._tiles)this._setTileReloadTimer(Te,this._tiles[Te])}}_updateCoveredAndRetainedTiles(P,ae,xe,Te,Oe,ht){let Tt={},Ot={},Qt=Object.keys(P),Ar=n.now();for(let Sr of Qt){let Kr=P[Sr],oi=this._tiles[Sr];if(!oi||oi.fadeEndTime!==0&&oi.fadeEndTime<=Ar)continue;let Ge=this.findLoadedParent(Kr,ae),Ze=this.findLoadedSibling(Kr),ot=Ge||Ze||null;ot&&(this._addTile(ot.tileID),Tt[ot.tileID.key]=ot.tileID),Ot[Sr]=Kr}this._retainLoadedChildren(Ot,Te,xe,P);for(let Sr in Tt)P[Sr]||(this._coveredTiles[Sr]=!0,P[Sr]=Tt[Sr]);if(ht){let Sr={},Kr={};for(let oi of Oe)this._tiles[oi.key].hasData()?Sr[oi.key]=oi:Kr[oi.key]=oi;for(let oi in Kr){let Ge=Kr[oi].children(this._source.maxzoom);this._tiles[Ge[0].key]&&this._tiles[Ge[1].key]&&this._tiles[Ge[2].key]&&this._tiles[Ge[3].key]&&(Sr[Ge[0].key]=P[Ge[0].key]=Ge[0],Sr[Ge[1].key]=P[Ge[1].key]=Ge[1],Sr[Ge[2].key]=P[Ge[2].key]=Ge[2],Sr[Ge[3].key]=P[Ge[3].key]=Ge[3],delete Kr[oi])}for(let oi in Kr){let Ge=Kr[oi],Ze=this.findLoadedParent(Ge,this._source.minzoom),ot=this.findLoadedSibling(Ge),dt=Ze||ot||null;if(dt){Sr[dt.tileID.key]=P[dt.tileID.key]=dt.tileID;for(let Ct in Sr)Sr[Ct].isChildOf(dt.tileID)&&delete Sr[Ct]}}for(let oi in this._tiles)Sr[oi]||(this._coveredTiles[oi]=!0)}}update(P,ae){if(!this._sourceLoaded||this._paused)return;let xe;this.transform=P,this.terrain=ae,this.updateCacheSize(P),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?xe=P.getVisibleUnwrappedCoordinates(this._source.tileID).map(Ar=>new t.S(Ar.canonical.z,Ar.wrap,Ar.canonical.z,Ar.canonical.x,Ar.canonical.y)):(xe=P.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:ae}),this._source.hasTile&&(xe=xe.filter(Ar=>this._source.hasTile(Ar)))):xe=[];let Te=P.coveringZoomLevel(this._source),Oe=Math.max(Te-Pt.maxOverzooming,this._source.minzoom),ht=Math.max(Te+Pt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let Ar={};for(let Sr of xe)if(Sr.canonical.z>this._source.minzoom){let Kr=Sr.scaledTo(Sr.canonical.z-1);Ar[Kr.key]=Kr;let oi=Sr.scaledTo(Math.max(this._source.minzoom,Math.min(Sr.canonical.z,5)));Ar[oi.key]=oi}xe=xe.concat(Object.values(Ar))}let Tt=xe.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,Tt&&this.fire(new t.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let Ot=this._updateRetainedTiles(xe,Te);Wt(this._source.type)&&this._updateCoveredAndRetainedTiles(Ot,Oe,ht,Te,xe,ae);for(let Ar in Ot)this._tiles[Ar].clearFadeHold();let Qt=t.ab(this._tiles,Ot);for(let Ar of Qt){let Sr=this._tiles[Ar];Sr.hasSymbolBuckets&&!Sr.holdingForFade()?Sr.setHoldDuration(this.map._fadeDuration):Sr.hasSymbolBuckets&&!Sr.symbolFadeFinished()||this._removeTile(Ar)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let P in this._tiles)this._tiles[P].holdingForFade()&&this._removeTile(P)}_updateRetainedTiles(P,ae){var xe;let Te={},Oe={},ht=Math.max(ae-Pt.maxOverzooming,this._source.minzoom),Tt=Math.max(ae+Pt.maxUnderzooming,this._source.minzoom),Ot={};for(let Qt of P){let Ar=this._addTile(Qt);Te[Qt.key]=Qt,Ar.hasData()||ae<this._source.maxzoom&&(Ot[Qt.key]=Qt)}this._retainLoadedChildren(Ot,ae,Tt,Te);for(let Qt of P){let Ar=this._tiles[Qt.key];if(Ar.hasData())continue;if(ae+1>this._source.maxzoom){let Kr=Qt.children(this._source.maxzoom)[0],oi=this.getTile(Kr);if(oi&&oi.hasData()){Te[Kr.key]=Kr;continue}}else{let Kr=Qt.children(this._source.maxzoom);if(Te[Kr[0].key]&&Te[Kr[1].key]&&Te[Kr[2].key]&&Te[Kr[3].key])continue}let Sr=Ar.wasRequested();for(let Kr=Qt.overscaledZ-1;Kr>=ht;--Kr){let oi=Qt.scaledTo(Kr);if(Oe[oi.key])break;if(Oe[oi.key]=!0,Ar=this.getTile(oi),!Ar&&Sr&&(Ar=this._addTile(oi)),Ar){let Ge=Ar.hasData();if((Ge||!(!((xe=this.map)===null||xe===void 0)&&xe.cancelPendingTileRequestsWhileZooming)||Sr)&&(Te[oi.key]=oi),Sr=Ar.wasRequested(),Ge)break}}}return Te}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let P in this._tiles){let ae=[],xe,Te=this._tiles[P].tileID;for(;Te.overscaledZ>0;){if(Te.key in this._loadedParentTiles){xe=this._loadedParentTiles[Te.key];break}ae.push(Te.key);let Oe=Te.scaledTo(Te.overscaledZ-1);if(xe=this._getLoadedTile(Oe),xe)break;Te=Oe}for(let Oe of ae)this._loadedParentTiles[Oe]=xe}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let P in this._tiles){let ae=this._tiles[P].tileID,xe=this._getLoadedTile(ae);this._loadedSiblingTiles[ae.key]=xe}}_addTile(P){let ae=this._tiles[P.key];if(ae)return ae;ae=this._cache.getAndRemove(P),ae&&(this._setTileReloadTimer(P.key,ae),ae.tileID=P,this._state.initializeTileState(ae,this.map?this.map.painter:null),this._cacheTimers[P.key]&&(clearTimeout(this._cacheTimers[P.key]),delete this._cacheTimers[P.key],this._setTileReloadTimer(P.key,ae)));let xe=ae;return ae||(ae=new at(P,this._source.tileSize*P.overscaleFactor()),this._loadTile(ae,P.key,ae.state)),ae.uses++,this._tiles[P.key]=ae,xe||this._source.fire(new t.k("dataloading",{tile:ae,coord:ae.tileID,dataType:"source"})),ae}_setTileReloadTimer(P,ae){P in this._timers&&(clearTimeout(this._timers[P]),delete this._timers[P]);let xe=ae.getExpiryTimeout();xe&&(this._timers[P]=setTimeout(()=>{this._reloadTile(P,"expired"),delete this._timers[P]},xe))}_removeTile(P){let ae=this._tiles[P];ae&&(ae.uses--,delete this._tiles[P],this._timers[P]&&(clearTimeout(this._timers[P]),delete this._timers[P]),ae.uses>0||(ae.hasData()&&ae.state!=="reloading"?this._cache.add(ae.tileID,ae,ae.getExpiryTimeout()):(ae.aborted=!0,this._abortTile(ae),this._unloadTile(ae))))}_dataHandler(P){let ae=P.sourceDataType;P.dataType==="source"&&ae==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&P.dataType==="source"&&ae==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let P in this._tiles)this._removeTile(P);this._cache.reset()}tilesIn(P,ae,xe){let Te=[],Oe=this.transform;if(!Oe)return Te;let ht=xe?Oe.getCameraQueryGeometry(P):P,Tt=P.map(Ge=>Oe.pointCoordinate(Ge,this.terrain)),Ot=ht.map(Ge=>Oe.pointCoordinate(Ge,this.terrain)),Qt=this.getIds(),Ar=1/0,Sr=1/0,Kr=-1/0,oi=-1/0;for(let Ge of Ot)Ar=Math.min(Ar,Ge.x),Sr=Math.min(Sr,Ge.y),Kr=Math.max(Kr,Ge.x),oi=Math.max(oi,Ge.y);for(let Ge=0;Ge<Qt.length;Ge++){let Ze=this._tiles[Qt[Ge]];if(Ze.holdingForFade())continue;let ot=Ze.tileID,dt=Math.pow(2,Oe.zoom-Ze.tileID.overscaledZ),Ct=ae*Ze.queryPadding*t.X/Ze.tileSize/dt,wt=[ot.getTilePoint(new t.Z(Ar,Sr)),ot.getTilePoint(new t.Z(Kr,oi))];if(wt[0].x-Ct<t.X&&wt[0].y-Ct<t.X&&wt[1].x+Ct>=0&&wt[1].y+Ct>=0){let Dt=Tt.map(_r=>ot.getTilePoint(_r)),fr=Ot.map(_r=>ot.getTilePoint(_r));Te.push({tile:Ze,tileID:ot,queryGeometry:Dt,cameraQueryGeometry:fr,scale:dt})}}return Te}getVisibleCoordinates(P){let ae=this.getRenderableIds(P).map(xe=>this._tiles[xe].tileID);for(let xe of ae)xe.posMatrix=this.transform.calculatePosMatrix(xe.toUnwrapped());return ae}hasTransition(){if(this._source.hasTransition())return!0;if(Wt(this._source.type)){let P=n.now();for(let ae in this._tiles)if(this._tiles[ae].fadeEndTime>=P)return!0}return!1}setFeatureState(P,ae,xe){this._state.updateState(P=P||"_geojsonTileLayer",ae,xe)}removeFeatureState(P,ae,xe){this._state.removeFeatureState(P=P||"_geojsonTileLayer",ae,xe)}getFeatureState(P,ae){return this._state.getState(P=P||"_geojsonTileLayer",ae)}setDependencies(P,ae,xe){let Te=this._tiles[P];Te&&Te.setDependencies(ae,xe)}reloadTilesForDependencies(P,ae){for(let xe in this._tiles)this._tiles[xe].hasDependency(P,ae)&&this._reloadTile(xe,"reloading");this._cache.filter(xe=>!xe.hasDependency(P,ae))}}function Vt(Ue,P){let ae=Math.abs(2*Ue.wrap)-+(Ue.wrap<0),xe=Math.abs(2*P.wrap)-+(P.wrap<0);return Ue.overscaledZ-P.overscaledZ||xe-ae||P.canonical.y-Ue.canonical.y||P.canonical.x-Ue.canonical.x}function Wt(Ue){return Ue==="raster"||Ue==="image"||Ue==="video"}Pt.maxOverzooming=10,Pt.maxUnderzooming=3;class Cr{constructor(P,ae){this.reset(P,ae)}reset(P,ae){this.points=P||[],this._distances=[0];for(let xe=1;xe<this.points.length;xe++)this._distances[xe]=this._distances[xe-1]+this.points[xe].dist(this.points[xe-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(ae||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(P){if(this.points.length===1)return this.points[0];P=t.ac(P,0,1);let ae=1,xe=this._distances[ae],Te=P*this.paddedLength+this.padding;for(;xe<Te&&ae<this._distances.length;)xe=this._distances[++ae];let Oe=ae-1,ht=this._distances[Oe],Tt=xe-ht,Ot=Tt>0?(Te-ht)/Tt:0;return this.points[Oe].mult(1-Ot).add(this.points[ae].mult(Ot))}}function yr(Ue,P){let ae=!0;return Ue==="always"||Ue!=="never"&&P!=="never"||(ae=!1),ae}class qr{constructor(P,ae,xe){let Te=this.boxCells=[],Oe=this.circleCells=[];this.xCellCount=Math.ceil(P/xe),this.yCellCount=Math.ceil(ae/xe);for(let ht=0;ht<this.xCellCount*this.yCellCount;ht++)Te.push([]),Oe.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=P,this.height=ae,this.xScale=this.xCellCount/P,this.yScale=this.yCellCount/ae,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(P,ae,xe,Te,Oe){this._forEachCell(ae,xe,Te,Oe,this._insertBoxCell,this.boxUid++),this.boxKeys.push(P),this.bboxes.push(ae),this.bboxes.push(xe),this.bboxes.push(Te),this.bboxes.push(Oe)}insertCircle(P,ae,xe,Te){this._forEachCell(ae-Te,xe-Te,ae+Te,xe+Te,this._insertCircleCell,this.circleUid++),this.circleKeys.push(P),this.circles.push(ae),this.circles.push(xe),this.circles.push(Te)}_insertBoxCell(P,ae,xe,Te,Oe,ht){this.boxCells[Oe].push(ht)}_insertCircleCell(P,ae,xe,Te,Oe,ht){this.circleCells[Oe].push(ht)}_query(P,ae,xe,Te,Oe,ht,Tt){if(xe<0||P>this.width||Te<0||ae>this.height)return[];let Ot=[];if(P<=0&&ae<=0&&this.width<=xe&&this.height<=Te){if(Oe)return[{key:null,x1:P,y1:ae,x2:xe,y2:Te}];for(let Qt=0;Qt<this.boxKeys.length;Qt++)Ot.push({key:this.boxKeys[Qt],x1:this.bboxes[4*Qt],y1:this.bboxes[4*Qt+1],x2:this.bboxes[4*Qt+2],y2:this.bboxes[4*Qt+3]});for(let Qt=0;Qt<this.circleKeys.length;Qt++){let Ar=this.circles[3*Qt],Sr=this.circles[3*Qt+1],Kr=this.circles[3*Qt+2];Ot.push({key:this.circleKeys[Qt],x1:Ar-Kr,y1:Sr-Kr,x2:Ar+Kr,y2:Sr+Kr})}}else this._forEachCell(P,ae,xe,Te,this._queryCell,Ot,{hitTest:Oe,overlapMode:ht,seenUids:{box:{},circle:{}}},Tt);return Ot}query(P,ae,xe,Te){return this._query(P,ae,xe,Te,!1,null)}hitTest(P,ae,xe,Te,Oe,ht){return this._query(P,ae,xe,Te,!0,Oe,ht).length>0}hitTestCircle(P,ae,xe,Te,Oe){let ht=P-xe,Tt=P+xe,Ot=ae-xe,Qt=ae+xe;if(Tt<0||ht>this.width||Qt<0||Ot>this.height)return!1;let Ar=[];return this._forEachCell(ht,Ot,Tt,Qt,this._queryCellCircle,Ar,{hitTest:!0,overlapMode:Te,circle:{x:P,y:ae,radius:xe},seenUids:{box:{},circle:{}}},Oe),Ar.length>0}_queryCell(P,ae,xe,Te,Oe,ht,Tt,Ot){let{seenUids:Qt,hitTest:Ar,overlapMode:Sr}=Tt,Kr=this.boxCells[Oe];if(Kr!==null){let Ge=this.bboxes;for(let Ze of Kr)if(!Qt.box[Ze]){Qt.box[Ze]=!0;let ot=4*Ze,dt=this.boxKeys[Ze];if(P<=Ge[ot+2]&&ae<=Ge[ot+3]&&xe>=Ge[ot+0]&&Te>=Ge[ot+1]&&(!Ot||Ot(dt))&&(!Ar||!yr(Sr,dt.overlapMode))&&(ht.push({key:dt,x1:Ge[ot],y1:Ge[ot+1],x2:Ge[ot+2],y2:Ge[ot+3]}),Ar))return!0}}let oi=this.circleCells[Oe];if(oi!==null){let Ge=this.circles;for(let Ze of oi)if(!Qt.circle[Ze]){Qt.circle[Ze]=!0;let ot=3*Ze,dt=this.circleKeys[Ze];if(this._circleAndRectCollide(Ge[ot],Ge[ot+1],Ge[ot+2],P,ae,xe,Te)&&(!Ot||Ot(dt))&&(!Ar||!yr(Sr,dt.overlapMode))){let Ct=Ge[ot],wt=Ge[ot+1],Dt=Ge[ot+2];if(ht.push({key:dt,x1:Ct-Dt,y1:wt-Dt,x2:Ct+Dt,y2:wt+Dt}),Ar)return!0}}}return!1}_queryCellCircle(P,ae,xe,Te,Oe,ht,Tt,Ot){let{circle:Qt,seenUids:Ar,overlapMode:Sr}=Tt,Kr=this.boxCells[Oe];if(Kr!==null){let Ge=this.bboxes;for(let Ze of Kr)if(!Ar.box[Ze]){Ar.box[Ze]=!0;let ot=4*Ze,dt=this.boxKeys[Ze];if(this._circleAndRectCollide(Qt.x,Qt.y,Qt.radius,Ge[ot+0],Ge[ot+1],Ge[ot+2],Ge[ot+3])&&(!Ot||Ot(dt))&&!yr(Sr,dt.overlapMode))return ht.push(!0),!0}}let oi=this.circleCells[Oe];if(oi!==null){let Ge=this.circles;for(let Ze of oi)if(!Ar.circle[Ze]){Ar.circle[Ze]=!0;let ot=3*Ze,dt=this.circleKeys[Ze];if(this._circlesCollide(Ge[ot],Ge[ot+1],Ge[ot+2],Qt.x,Qt.y,Qt.radius)&&(!Ot||Ot(dt))&&!yr(Sr,dt.overlapMode))return ht.push(!0),!0}}}_forEachCell(P,ae,xe,Te,Oe,ht,Tt,Ot){let Qt=this._convertToXCellCoord(P),Ar=this._convertToYCellCoord(ae),Sr=this._convertToXCellCoord(xe),Kr=this._convertToYCellCoord(Te);for(let oi=Qt;oi<=Sr;oi++)for(let Ge=Ar;Ge<=Kr;Ge++)if(Oe.call(this,P,ae,xe,Te,this.xCellCount*Ge+oi,ht,Tt,Ot))return}_convertToXCellCoord(P){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(P*this.xScale)))}_convertToYCellCoord(P){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(P*this.yScale)))}_circlesCollide(P,ae,xe,Te,Oe,ht){let Tt=Te-P,Ot=Oe-ae,Qt=xe+ht;return Qt*Qt>Tt*Tt+Ot*Ot}_circleAndRectCollide(P,ae,xe,Te,Oe,ht,Tt){let Ot=(ht-Te)/2,Qt=Math.abs(P-(Te+Ot));if(Qt>Ot+xe)return!1;let Ar=(Tt-Oe)/2,Sr=Math.abs(ae-(Oe+Ar));if(Sr>Ar+xe)return!1;if(Qt<=Ot||Sr<=Ar)return!0;let Kr=Qt-Ot,oi=Sr-Ar;return Kr*Kr+oi*oi<=xe*xe}}function Mr(Ue,P,ae,xe,Te){let Oe=t.H();return P?(t.K(Oe,Oe,[1/Te,1/Te,1]),ae||t.ad(Oe,Oe,xe.angle)):t.L(Oe,xe.labelPlaneMatrix,Ue),Oe}function Dr(Ue,P,ae,xe,Te){if(P){let Oe=t.ae(Ue);return t.K(Oe,Oe,[Te,Te,1]),ae||t.ad(Oe,Oe,-xe.angle),Oe}return xe.glCoordMatrix}function xt(Ue,P,ae,xe){let Te;xe?(Te=[Ue,P,xe(Ue,P),1],t.af(Te,Te,ae)):(Te=[Ue,P,0,1],tr(Te,Te,ae));let Oe=Te[3];return{point:new t.P(Te[0]/Oe,Te[1]/Oe),signedDistanceFromCamera:Oe,isOccluded:!1}}function Ne(Ue,P){return .5+Ue/P*.5}function Ye(Ue,P){return Ue.x>=-P[0]&&Ue.x<=P[0]&&Ue.y>=-P[1]&&Ue.y<=P[1]}function be(Ue,P,ae,xe,Te,Oe,ht,Tt,Ot,Qt,Ar,Sr,Kr,oi,Ge){let Ze=xe?Ue.textSizeData:Ue.iconSizeData,ot=t.ag(Ze,ae.transform.zoom),dt=[256/ae.width*2+1,256/ae.height*2+1],Ct=xe?Ue.text.dynamicLayoutVertexArray:Ue.icon.dynamicLayoutVertexArray;Ct.clear();let wt=Ue.lineVertexArray,Dt=xe?Ue.text.placedSymbolArray:Ue.icon.placedSymbolArray,fr=ae.transform.width/ae.transform.height,_r=!1;for(let kr=0;kr<Dt.length;kr++){let Vr=Dt.get(kr);if(Vr.hidden||Vr.writingMode===t.ah.vertical&&!_r){ir(Vr.numGlyphs,Ct);continue}_r=!1;let Qr=xt(Vr.anchorX,Vr.anchorY,P,Ge);if(!Ye(Qr.point,dt)){ir(Vr.numGlyphs,Ct);continue}let _i=Ne(ae.transform.cameraToCenterDistance,Qr.signedDistanceFromCamera),Pi=t.ai(Ze,ot,Vr),qi=ht?Pi/_i:Pi*_i,ga={getElevation:Ge,labelPlaneMatrix:Te,lineVertexArray:wt,pitchWithMap:ht,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:Qt,tileAnchorPoint:new t.P(Vr.anchorX,Vr.anchorY),unwrappedTileID:Ar,width:Sr,height:Kr,translation:oi},Qa=ke(ga,Vr,qi,!1,Tt,P,Oe,Ue.glyphOffsetArray,Ct,fr,Ot);_r=Qa.useVertical,(Qa.notEnoughRoom||_r||Qa.needsFlipping&&ke(ga,Vr,qi,!0,Tt,P,Oe,Ue.glyphOffsetArray,Ct,fr,Ot).notEnoughRoom)&&ir(Vr.numGlyphs,Ct)}xe?Ue.text.dynamicLayoutVertexBuffer.updateData(Ct):Ue.icon.dynamicLayoutVertexBuffer.updateData(Ct)}function Ie(Ue,P,ae,xe,Te,Oe,ht,Tt){let Ot=Oe.glyphStartIndex+Oe.numGlyphs,Qt=Oe.lineStartIndex,Ar=Oe.lineStartIndex+Oe.lineLength,Sr=P.getoffsetX(Oe.glyphStartIndex),Kr=P.getoffsetX(Ot-1),oi=kt(Ue*Sr,ae,xe,Te,Oe.segment,Qt,Ar,Tt,ht);if(!oi)return null;let Ge=kt(Ue*Kr,ae,xe,Te,Oe.segment,Qt,Ar,Tt,ht);return Ge?Tt.projectionCache.anyProjectionOccluded?null:{first:oi,last:Ge}:null}function qe(Ue,P,ae,xe){return Ue===t.ah.horizontal&&Math.abs(ae.y-P.y)>Math.abs(ae.x-P.x)*xe?{useVertical:!0}:(Ue===t.ah.vertical?P.y<ae.y:P.x>ae.x)?{needsFlipping:!0}:null}function ke(Ue,P,ae,xe,Te,Oe,ht,Tt,Ot,Qt,Ar){let Sr=ae/24,Kr=P.lineOffsetX*Sr,oi=P.lineOffsetY*Sr,Ge;if(P.numGlyphs>1){let Ze=P.glyphStartIndex+P.numGlyphs,ot=P.lineStartIndex,dt=P.lineStartIndex+P.lineLength,Ct=Ie(Sr,Tt,Kr,oi,xe,P,Ar,Ue);if(!Ct)return{notEnoughRoom:!0};let wt=xt(Ct.first.point.x,Ct.first.point.y,ht,Ue.getElevation).point,Dt=xt(Ct.last.point.x,Ct.last.point.y,ht,Ue.getElevation).point;if(Te&&!xe){let fr=qe(P.writingMode,wt,Dt,Qt);if(fr)return fr}Ge=[Ct.first];for(let fr=P.glyphStartIndex+1;fr<Ze-1;fr++)Ge.push(kt(Sr*Tt.getoffsetX(fr),Kr,oi,xe,P.segment,ot,dt,Ue,Ar));Ge.push(Ct.last)}else{if(Te&&!xe){let ot=xt(Ue.tileAnchorPoint.x,Ue.tileAnchorPoint.y,Oe,Ue.getElevation).point,dt=P.lineStartIndex+P.segment+1,Ct=new t.P(Ue.lineVertexArray.getx(dt),Ue.lineVertexArray.gety(dt)),wt=xt(Ct.x,Ct.y,Oe,Ue.getElevation),Dt=wt.signedDistanceFromCamera>0?wt.point:function(_r,kr,Vr,Qr,_i,Pi){return Me(_r,kr,Vr,1,_i,Pi)}(Ue.tileAnchorPoint,Ct,ot,0,Oe,Ue),fr=qe(P.writingMode,ot,Dt,Qt);if(fr)return fr}let Ze=kt(Sr*Tt.getoffsetX(P.glyphStartIndex),Kr,oi,xe,P.segment,P.lineStartIndex,P.lineStartIndex+P.lineLength,Ue,Ar);if(!Ze||Ue.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};Ge=[Ze]}for(let Ze of Ge)t.aj(Ot,Ze.point,Ze.angle);return{}}function Me(Ue,P,ae,xe,Te,Oe){let ht=Ue.add(Ue.sub(P)._unit()),Tt=Te!==void 0?xt(ht.x,ht.y,Te,Oe.getElevation).point:ut(ht.x,ht.y,Oe).point,Ot=ae.sub(Tt);return ae.add(Ot._mult(xe/Ot.mag()))}function Le(Ue,P,ae){let xe=P.projectionCache;if(xe.projections[Ue])return xe.projections[Ue];let Te=new t.P(P.lineVertexArray.getx(Ue),P.lineVertexArray.gety(Ue)),Oe=ut(Te.x,Te.y,P);if(Oe.signedDistanceFromCamera>0)return xe.projections[Ue]=Oe.point,xe.anyProjectionOccluded=xe.anyProjectionOccluded||Oe.isOccluded,Oe.point;let ht=Ue-ae.direction;return function(Tt,Ot,Qt,Ar,Sr){return Me(Tt,Ot,Qt,Ar,void 0,Sr)}(ae.distanceFromAnchor===0?P.tileAnchorPoint:new t.P(P.lineVertexArray.getx(ht),P.lineVertexArray.gety(ht)),Te,ae.previousVertex,ae.absOffsetX-ae.distanceFromAnchor+1,P)}function ut(Ue,P,ae){let xe=Ue+ae.translation[0],Te=P+ae.translation[1],Oe;return!ae.pitchWithMap&&ae.projection.useSpecialProjectionForSymbols?(Oe=ae.projection.projectTileCoordinates(xe,Te,ae.unwrappedTileID,ae.getElevation),Oe.point.x=(.5*Oe.point.x+.5)*ae.width,Oe.point.y=(.5*-Oe.point.y+.5)*ae.height):(Oe=xt(xe,Te,ae.labelPlaneMatrix,ae.getElevation),Oe.isOccluded=!1),Oe}function lt(Ue,P,ae){return Ue._unit()._perp()._mult(P*ae)}function gt(Ue,P,ae,xe,Te,Oe,ht,Tt,Ot){if(Tt.projectionCache.offsets[Ue])return Tt.projectionCache.offsets[Ue];let Qt=ae.add(P);if(Ue+Ot.direction<xe||Ue+Ot.direction>=Te)return Tt.projectionCache.offsets[Ue]=Qt,Qt;let Ar=Le(Ue+Ot.direction,Tt,Ot),Sr=lt(Ar.sub(ae),ht,Ot.direction),Kr=ae.add(Sr),oi=Ar.add(Sr);return Tt.projectionCache.offsets[Ue]=t.ak(Oe,Qt,Kr,oi)||Qt,Tt.projectionCache.offsets[Ue]}function kt(Ue,P,ae,xe,Te,Oe,ht,Tt,Ot){let Qt=xe?Ue-P:Ue+P,Ar=Qt>0?1:-1,Sr=0;xe&&(Ar*=-1,Sr=Math.PI),Ar<0&&(Sr+=Math.PI);let Kr,oi=Ar>0?Oe+Te:Oe+Te+1;Tt.projectionCache.cachedAnchorPoint?Kr=Tt.projectionCache.cachedAnchorPoint:(Kr=ut(Tt.tileAnchorPoint.x,Tt.tileAnchorPoint.y,Tt).point,Tt.projectionCache.cachedAnchorPoint=Kr);let Ge,Ze,ot=Kr,dt=Kr,Ct=0,wt=0,Dt=Math.abs(Qt),fr=[],_r;for(;Ct+wt<=Dt;){if(oi+=Ar,oi<Oe||oi>=ht)return null;Ct+=wt,dt=ot,Ze=Ge;let Qr={absOffsetX:Dt,direction:Ar,distanceFromAnchor:Ct,previousVertex:dt};if(ot=Le(oi,Tt,Qr),ae===0)fr.push(dt),_r=ot.sub(dt);else{let _i,Pi=ot.sub(dt);_i=Pi.mag()===0?lt(Le(oi+Ar,Tt,Qr).sub(ot),ae,Ar):lt(Pi,ae,Ar),Ze||(Ze=dt.add(_i)),Ge=gt(oi,_i,ot,Oe,ht,Ze,ae,Tt,Qr),fr.push(Ze),_r=Ge.sub(Ze)}wt=_r.mag()}let kr=_r._mult((Dt-Ct)/wt)._add(Ze||dt),Vr=Sr+Math.atan2(ot.y-dt.y,ot.x-dt.x);return fr.push(kr),{point:kr,angle:Ot?Vr:0,path:fr}}let nr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ir(Ue,P){for(let ae=0;ae<Ue;ae++){let xe=P.length;P.resize(xe+4),P.float32.set(nr,3*xe)}}function tr(Ue,P,ae){let xe=P[0],Te=P[1];return Ue[0]=ae[0]*xe+ae[4]*Te+ae[12],Ue[1]=ae[1]*xe+ae[5]*Te+ae[13],Ue[3]=ae[3]*xe+ae[7]*Te+ae[15],Ue}let Ir=100;class vi{constructor(P,ae,xe=new qr(P.width+200,P.height+200,25),Te=new qr(P.width+200,P.height+200,25)){this.transform=P,this.mapProjection=ae,this.grid=xe,this.ignoredGrid=Te,this.pitchFactor=Math.cos(P._pitch)*P.cameraToCenterDistance,this.screenRightBoundary=P.width+Ir,this.screenBottomBoundary=P.height+Ir,this.gridRightBoundary=P.width+200,this.gridBottomBoundary=P.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(P,ae,xe,Te,Oe,ht,Tt,Ot,Qt,Ar,Sr){let Kr=P.anchorPointX+Ot[0],oi=P.anchorPointY+Ot[1],Ge=this.projectAndGetPerspectiveRatio(Te,Kr,oi,Oe,Ar),Ze=xe*Ge.perspectiveRatio,ot;if(ht||Tt)ot=this._projectCollisionBox(P,Ze,Te,Oe,ht,Tt,Ot,Ge,Ar,Sr);else{let fr=Ge.point.x+(Sr?Sr.x*Ze:0),_r=Ge.point.y+(Sr?Sr.y*Ze:0);ot={allPointsOccluded:!1,box:[fr+P.x1*Ze,_r+P.y1*Ze,fr+P.x2*Ze,_r+P.y2*Ze]}}let[dt,Ct,wt,Dt]=ot.box;return this.mapProjection.useSpecialProjectionForSymbols&&(ht?ot.allPointsOccluded:this.mapProjection.isOccluded(Kr,oi,Oe))||Ge.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(dt,Ct,wt,Dt)||ae!=="always"&&this.grid.hitTest(dt,Ct,wt,Dt,ae,Qt)?{box:[dt,Ct,wt,Dt],placeable:!1,offscreen:!1}:{box:[dt,Ct,wt,Dt],placeable:!0,offscreen:this.isOffscreen(dt,Ct,wt,Dt)}}placeCollisionCircles(P,ae,xe,Te,Oe,ht,Tt,Ot,Qt,Ar,Sr,Kr,oi,Ge,Ze,ot){let dt=[],Ct=new t.P(ae.anchorX,ae.anchorY),wt=this.getPerspectiveRatio(ht,Ct.x,Ct.y,Tt,ot),Dt=(Sr?Oe/wt:Oe*wt)/t.ap,fr={getElevation:ot,labelPlaneMatrix:Ot,lineVertexArray:xe,pitchWithMap:Sr,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Ct,unwrappedTileID:Tt,width:this.transform.width,height:this.transform.height,translation:Ze},_r=Ie(Dt,Te,ae.lineOffsetX*Dt,ae.lineOffsetY*Dt,!1,ae,!1,fr),kr=!1,Vr=!1,Qr=!0;if(_r){let _i=.5*oi*wt+Ge,Pi=new t.P(-100,-100),qi=new t.P(this.screenRightBoundary,this.screenBottomBoundary),ga=new Cr,Qa=_r.first,$a=_r.last,yn=[];for(let to=Qa.path.length-1;to>=1;to--)yn.push(Qa.path[to]);for(let to=1;to<$a.path.length;to++)yn.push($a.path[to]);let qn=2.5*_i;if(Qt){let to=this.projectPathToScreenSpace(yn,fr,Qt);yn=to.some(Vo=>Vo.signedDistanceFromCamera<=0)?[]:to.map(Vo=>Vo.point)}let po=[];if(yn.length>0){let to=yn[0].clone(),Vo=yn[0].clone();for(let bs=1;bs<yn.length;bs++)to.x=Math.min(to.x,yn[bs].x),to.y=Math.min(to.y,yn[bs].y),Vo.x=Math.max(Vo.x,yn[bs].x),Vo.y=Math.max(Vo.y,yn[bs].y);po=to.x>=Pi.x&&Vo.x<=qi.x&&to.y>=Pi.y&&Vo.y<=qi.y?[yn]:Vo.x<Pi.x||to.x>qi.x||Vo.y<Pi.y||to.y>qi.y?[]:t.al([yn],Pi.x,Pi.y,qi.x,qi.y)}for(let to of po){ga.reset(to,.25*_i);let Vo=0;Vo=ga.length<=.5*_i?1:Math.ceil(ga.paddedLength/qn)+1;for(let bs=0;bs<Vo;bs++){let Ho=bs/Math.max(Vo-1,1),ds=ga.lerp(Ho),Is=ds.x+Ir,Tl=ds.y+Ir;dt.push(Is,Tl,_i,0);let dl=Is-_i,ms=Tl-_i,gs=Is+_i,ql=Tl+_i;if(Qr=Qr&&this.isOffscreen(dl,ms,gs,ql),Vr=Vr||this.isInsideGrid(dl,ms,gs,ql),P!=="always"&&this.grid.hitTestCircle(Is,Tl,_i,P,Kr)&&(kr=!0,!Ar))return{circles:[],offscreen:!1,collisionDetected:kr}}}}return{circles:!Ar&&kr||!Vr||wt<this.perspectiveRatioCutoff?[]:dt,offscreen:Qr,collisionDetected:kr}}projectPathToScreenSpace(P,ae,xe){return P.map(Te=>xt(Te.x,Te.y,xe,ae.getElevation))}queryRenderedSymbols(P){if(P.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let ae=[],xe=1/0,Te=1/0,Oe=-1/0,ht=-1/0;for(let Ar of P){let Sr=new t.P(Ar.x+Ir,Ar.y+Ir);xe=Math.min(xe,Sr.x),Te=Math.min(Te,Sr.y),Oe=Math.max(Oe,Sr.x),ht=Math.max(ht,Sr.y),ae.push(Sr)}let Tt=this.grid.query(xe,Te,Oe,ht).concat(this.ignoredGrid.query(xe,Te,Oe,ht)),Ot={},Qt={};for(let Ar of Tt){let Sr=Ar.key;if(Ot[Sr.bucketInstanceId]===void 0&&(Ot[Sr.bucketInstanceId]={}),Ot[Sr.bucketInstanceId][Sr.featureIndex])continue;let Kr=[new t.P(Ar.x1,Ar.y1),new t.P(Ar.x2,Ar.y1),new t.P(Ar.x2,Ar.y2),new t.P(Ar.x1,Ar.y2)];t.am(ae,Kr)&&(Ot[Sr.bucketInstanceId][Sr.featureIndex]=!0,Qt[Sr.bucketInstanceId]===void 0&&(Qt[Sr.bucketInstanceId]=[]),Qt[Sr.bucketInstanceId].push(Sr.featureIndex))}return Qt}insertCollisionBox(P,ae,xe,Te,Oe,ht){(xe?this.ignoredGrid:this.grid).insert({bucketInstanceId:Te,featureIndex:Oe,collisionGroupID:ht,overlapMode:ae},P[0],P[1],P[2],P[3])}insertCollisionCircles(P,ae,xe,Te,Oe,ht){let Tt=xe?this.ignoredGrid:this.grid,Ot={bucketInstanceId:Te,featureIndex:Oe,collisionGroupID:ht,overlapMode:ae};for(let Qt=0;Qt<P.length;Qt+=4)Tt.insertCircle(Ot,P[Qt],P[Qt+1],P[Qt+2])}projectAndGetPerspectiveRatio(P,ae,xe,Te,Oe){let ht;Oe?(ht=[ae,xe,Oe(ae,xe),1],t.af(ht,ht,P)):(ht=[ae,xe,0,1],tr(ht,ht,P));let Tt=ht[3];return{point:new t.P((ht[0]/Tt+1)/2*this.transform.width+Ir,(-ht[1]/Tt+1)/2*this.transform.height+Ir),perspectiveRatio:.5+this.transform.cameraToCenterDistance/Tt*.5,isOccluded:!1,signedDistanceFromCamera:Tt}}getPerspectiveRatio(P,ae,xe,Te,Oe){let ht=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(ae,xe,Te,Oe):xt(ae,xe,P,Oe);return .5+this.transform.cameraToCenterDistance/ht.signedDistanceFromCamera*.5}isOffscreen(P,ae,xe,Te){return xe<Ir||P>=this.screenRightBoundary||Te<Ir||ae>this.screenBottomBoundary}isInsideGrid(P,ae,xe,Te){return xe>=0&&P<this.gridRightBoundary&&Te>=0&&ae<this.gridBottomBoundary}getViewportMatrix(){let P=t.an([]);return t.J(P,P,[-100,-100,0]),P}_projectCollisionBox(P,ae,xe,Te,Oe,ht,Tt,Ot,Qt,Ar){let Sr=new t.P(1,0),Kr=new t.P(0,1),oi=new t.P(P.anchorPointX+Tt[0],P.anchorPointY+Tt[1]);if(ht&&!Oe){let Qr=this.projectAndGetPerspectiveRatio(xe,oi.x+1,oi.y,Te,Qt).point.sub(Ot.point).unit(),_i=Math.atan(Qr.y/Qr.x)+(Qr.x<0?Math.PI:0),Pi=Math.sin(_i),qi=Math.cos(_i);Sr=new t.P(qi,Pi),Kr=new t.P(-Pi,qi)}else if(!ht&&Oe){let Qr=-this.transform.angle,_i=Math.sin(Qr),Pi=Math.cos(Qr);Sr=new t.P(Pi,_i),Kr=new t.P(-_i,Pi)}let Ge=Ot.point,Ze=ae;if(Oe){Ge=oi;let Qr=this.transform.zoom-Math.floor(this.transform.zoom);Ze=Math.pow(2,-Qr),Ze*=this.mapProjection.getPitchedTextCorrection(this.transform,oi,Te),Ar||(Ze*=t.ac(.5+Ot.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}Ar&&(Ge=Ge.add(Sr.mult(Ar.x*Ze)).add(Kr.mult(Ar.y*Ze)));let ot=P.x1*Ze,dt=P.x2*Ze,Ct=(ot+dt)/2,wt=P.y1*Ze,Dt=P.y2*Ze,fr=(wt+Dt)/2,_r=[{offsetX:ot,offsetY:wt},{offsetX:Ct,offsetY:wt},{offsetX:dt,offsetY:wt},{offsetX:dt,offsetY:fr},{offsetX:dt,offsetY:Dt},{offsetX:Ct,offsetY:Dt},{offsetX:ot,offsetY:Dt},{offsetX:ot,offsetY:fr}],kr=[];for(let{offsetX:Qr,offsetY:_i}of _r)kr.push(new t.P(Ge.x+Sr.x*Qr+Kr.x*_i,Ge.y+Sr.y*Qr+Kr.y*_i));let Vr=!1;if(Oe){let Qr=kr.map(_i=>this.projectAndGetPerspectiveRatio(xe,_i.x,_i.y,Te,Qt));Vr=Qr.some(_i=>!_i.isOccluded),kr=Qr.map(_i=>_i.point)}else Vr=!0;return{box:t.ao(kr),allPointsOccluded:!Vr}}}function Vi(Ue,P,ae){return P*(t.X/(Ue.tileSize*Math.pow(2,ae-Ue.tileID.overscaledZ)))}class Ui{constructor(P,ae,xe,Te){this.opacity=P?Math.max(0,Math.min(1,P.opacity+(P.placed?ae:-ae))):Te&&xe?1:0,this.placed=xe}isHidden(){return this.opacity===0&&!this.placed}}class Ki{constructor(P,ae,xe,Te,Oe){this.text=new Ui(P?P.text:null,ae,xe,Oe),this.icon=new Ui(P?P.icon:null,ae,Te,Oe)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ea{constructor(P,ae,xe){this.text=P,this.icon=ae,this.skipFade=xe}}class Bi{constructor(){this.invProjMatrix=t.H(),this.viewportMatrix=t.H(),this.circles=[]}}class _a{constructor(P,ae,xe,Te,Oe){this.bucketInstanceId=P,this.featureIndex=ae,this.sourceLayerIndex=xe,this.bucketIndex=Te,this.tileID=Oe}}class Ca{constructor(P){this.crossSourceCollisions=P,this.maxGroupID=0,this.collisionGroups={}}get(P){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[P]){let ae=++this.maxGroupID;this.collisionGroups[P]={ID:ae,predicate:xe=>xe.collisionGroupID===ae}}return this.collisionGroups[P]}}function Kt(Ue,P,ae,xe,Te){let{horizontalAlign:Oe,verticalAlign:ht}=t.au(Ue);return new t.P(-(Oe-.5)*P+xe[0]*Te,-(ht-.5)*ae+xe[1]*Te)}class zt{constructor(P,ae,xe,Te,Oe,ht){this.transform=P.clone(),this.terrain=xe,this.collisionIndex=new vi(this.transform,ae),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=Te,this.retainedQueryData={},this.collisionGroups=new Ca(Oe),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=ht,ht&&(ht.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(P){let ae=this.terrain;return ae?(xe,Te)=>ae.getElevation(P,xe,Te):null}getBucketParts(P,ae,xe,Te){let Oe=xe.getBucket(ae),ht=xe.latestFeatureIndex;if(!Oe||!ht||ae.id!==Oe.layerIds[0])return;let Tt=xe.collisionBoxArray,Ot=Oe.layers[0].layout,Qt=Oe.layers[0].paint,Ar=Math.pow(2,this.transform.zoom-xe.tileID.overscaledZ),Sr=xe.tileSize/t.X,Kr=xe.tileID.toUnwrapped(),oi=this.transform.calculatePosMatrix(Kr),Ge=Ot.get("text-pitch-alignment")==="map",Ze=Ot.get("text-rotation-alignment")==="map",ot=Vi(xe,1,this.transform.zoom),dt=this.collisionIndex.mapProjection.translatePosition(this.transform,xe,Qt.get("text-translate"),Qt.get("text-translate-anchor")),Ct=this.collisionIndex.mapProjection.translatePosition(this.transform,xe,Qt.get("icon-translate"),Qt.get("icon-translate-anchor")),wt=Mr(oi,Ge,Ze,this.transform,ot),Dt=null;if(Ge){let _r=Dr(oi,Ge,Ze,this.transform,ot);Dt=t.L([],this.transform.labelPlaneMatrix,_r)}this.retainedQueryData[Oe.bucketInstanceId]=new _a(Oe.bucketInstanceId,ht,Oe.sourceLayerIndex,Oe.index,xe.tileID);let fr={bucket:Oe,layout:Ot,translationText:dt,translationIcon:Ct,posMatrix:oi,unwrappedTileID:Kr,textLabelPlaneMatrix:wt,labelToScreenMatrix:Dt,scale:Ar,textPixelRatio:Sr,holdingForFade:xe.holdingForFade(),collisionBoxArray:Tt,partiallyEvaluatedTextSize:t.ag(Oe.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(Oe.sourceID)};if(Te)for(let _r of Oe.sortKeyRanges){let{sortKey:kr,symbolInstanceStart:Vr,symbolInstanceEnd:Qr}=_r;P.push({sortKey:kr,symbolInstanceStart:Vr,symbolInstanceEnd:Qr,parameters:fr})}else P.push({symbolInstanceStart:0,symbolInstanceEnd:Oe.symbolInstances.length,parameters:fr})}attemptAnchorPlacement(P,ae,xe,Te,Oe,ht,Tt,Ot,Qt,Ar,Sr,Kr,oi,Ge,Ze,ot,dt,Ct,wt){let Dt=t.aq[P.textAnchor],fr=[P.textOffset0,P.textOffset1],_r=Kt(Dt,xe,Te,fr,Oe),kr=this.collisionIndex.placeCollisionBox(ae,Kr,Ot,Qt,Ar,Tt,ht,ot,Sr.predicate,wt,_r);if((!Ct||this.collisionIndex.placeCollisionBox(Ct,Kr,Ot,Qt,Ar,Tt,ht,dt,Sr.predicate,wt,_r).placeable)&&kr.placeable){let Vr;if(this.prevPlacement&&this.prevPlacement.variableOffsets[oi.crossTileID]&&this.prevPlacement.placements[oi.crossTileID]&&this.prevPlacement.placements[oi.crossTileID].text&&(Vr=this.prevPlacement.variableOffsets[oi.crossTileID].anchor),oi.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[oi.crossTileID]={textOffset:fr,width:xe,height:Te,anchor:Dt,textBoxScale:Oe,prevAnchor:Vr},this.markUsedJustification(Ge,Dt,oi,Ze),Ge.allowVerticalPlacement&&(this.markUsedOrientation(Ge,Ze,oi),this.placedOrientations[oi.crossTileID]=Ze),{shift:_r,placedGlyphBoxes:kr}}}placeLayerBucketPart(P,ae,xe){let{bucket:Te,layout:Oe,translationText:ht,translationIcon:Tt,posMatrix:Ot,unwrappedTileID:Qt,textLabelPlaneMatrix:Ar,labelToScreenMatrix:Sr,textPixelRatio:Kr,holdingForFade:oi,collisionBoxArray:Ge,partiallyEvaluatedTextSize:Ze,collisionGroup:ot}=P.parameters,dt=Oe.get("text-optional"),Ct=Oe.get("icon-optional"),wt=t.ar(Oe,"text-overlap","text-allow-overlap"),Dt=wt==="always",fr=t.ar(Oe,"icon-overlap","icon-allow-overlap"),_r=fr==="always",kr=Oe.get("text-rotation-alignment")==="map",Vr=Oe.get("text-pitch-alignment")==="map",Qr=Oe.get("icon-text-fit")!=="none",_i=Oe.get("symbol-z-order")==="viewport-y",Pi=Dt&&(_r||!Te.hasIconData()||Ct),qi=_r&&(Dt||!Te.hasTextData()||dt);!Te.collisionArrays&&Ge&&Te.deserializeCollisionBoxes(Ge);let ga=this._getTerrainElevationFunc(this.retainedQueryData[Te.bucketInstanceId].tileID),Qa=($a,yn,qn)=>{var po,to;if(ae[$a.crossTileID])return;if(oi)return void(this.placements[$a.crossTileID]=new ea(!1,!1,!1));let Vo=!1,bs=!1,Ho=!0,ds=null,Is={box:null,placeable:!1,offscreen:null},Tl={box:null,placeable:!1,offscreen:null},dl=null,ms=null,gs=null,ql=0,uu=0,Uu=0;yn.textFeatureIndex?ql=yn.textFeatureIndex:$a.useRuntimeCollisionCircles&&(ql=$a.featureIndex),yn.verticalTextFeatureIndex&&(uu=yn.verticalTextFeatureIndex);let Su=yn.textBox;if(Su){let Ql=Je=>{let vt=t.ah.horizontal;if(Te.allowVerticalPlacement&&!Je&&this.prevPlacement){let _t=this.prevPlacement.placedOrientations[$a.crossTileID];_t&&(this.placedOrientations[$a.crossTileID]=_t,vt=_t,this.markUsedOrientation(Te,vt,$a))}return vt},eu=(Je,vt)=>{if(Te.allowVerticalPlacement&&$a.numVerticalGlyphVertices>0&&yn.verticalTextBox){for(let _t of Te.writingModes)if(_t===t.ah.vertical?(Is=vt(),Tl=Is):Is=Je(),Is&&Is.placeable)break}else Is=Je()},de=$a.textAnchorOffsetStartIndex,Fe=$a.textAnchorOffsetEndIndex;if(Fe===de){let Je=(vt,_t)=>{let At=this.collisionIndex.placeCollisionBox(vt,wt,Kr,Ot,Qt,Vr,kr,ht,ot.predicate,ga);return At&&At.placeable&&(this.markUsedOrientation(Te,_t,$a),this.placedOrientations[$a.crossTileID]=_t),At};eu(()=>Je(Su,t.ah.horizontal),()=>{let vt=yn.verticalTextBox;return Te.allowVerticalPlacement&&$a.numVerticalGlyphVertices>0&&vt?Je(vt,t.ah.vertical):{box:null,offscreen:null}}),Ql(Is&&Is.placeable)}else{let Je=t.aq[(to=(po=this.prevPlacement)===null||po===void 0?void 0:po.variableOffsets[$a.crossTileID])===null||to===void 0?void 0:to.anchor],vt=(At,ar,Ft)=>{let xr=At.x2-At.x1,Gr=At.y2-At.y1,Yr=$a.textBoxScale,Ei=Qr&&fr==="never"?ar:null,xi=null,na=wt==="never"?1:2,ua="never";Je&&na++;for(let Di=0;Di<na;Di++){for(let Hi=de;Hi<Fe;Hi++){let ta=Te.textAnchorOffsets.get(Hi);if(Je&&ta.textAnchor!==Je)continue;let ya=this.attemptAnchorPlacement(ta,At,xr,Gr,Yr,kr,Vr,Kr,Ot,Qt,ot,ua,$a,Te,Ft,ht,Tt,Ei,ga);if(ya&&(xi=ya.placedGlyphBoxes,xi&&xi.placeable))return Vo=!0,ds=ya.shift,xi}Je?Je=null:ua=wt}return xe&&!xi&&(xi={box:this.collisionIndex.placeCollisionBox(Su,"always",Kr,Ot,Qt,Vr,kr,ht,ot.predicate,ga,new t.P(0,0)).box,offscreen:!1,placeable:!1}),xi};eu(()=>vt(Su,yn.iconBox,t.ah.horizontal),()=>{let At=yn.verticalTextBox;return Te.allowVerticalPlacement&&(!Is||!Is.placeable)&&$a.numVerticalGlyphVertices>0&&At?vt(At,yn.verticalIconBox,t.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Is&&(Vo=Is.placeable,Ho=Is.offscreen);let _t=Ql(Is&&Is.placeable);if(!Vo&&this.prevPlacement){let At=this.prevPlacement.variableOffsets[$a.crossTileID];At&&(this.variableOffsets[$a.crossTileID]=At,this.markUsedJustification(Te,At.anchor,$a,_t))}}}if(dl=Is,Vo=dl&&dl.placeable,Ho=dl&&dl.offscreen,$a.useRuntimeCollisionCircles){let Ql=Te.text.placedSymbolArray.get($a.centerJustifiedTextSymbolIndex),eu=t.ai(Te.textSizeData,Ze,Ql),de=Oe.get("text-padding");ms=this.collisionIndex.placeCollisionCircles(wt,Ql,Te.lineVertexArray,Te.glyphOffsetArray,eu,Ot,Qt,Ar,Sr,xe,Vr,ot.predicate,$a.collisionCircleDiameter,de,ht,ga),ms.circles.length&&ms.collisionDetected&&!xe&&t.w("Collisions detected, but collision boxes are not shown"),Vo=Dt||ms.circles.length>0&&!ms.collisionDetected,Ho=Ho&&ms.offscreen}if(yn.iconFeatureIndex&&(Uu=yn.iconFeatureIndex),yn.iconBox){let Ql=eu=>this.collisionIndex.placeCollisionBox(eu,fr,Kr,Ot,Qt,Vr,kr,Tt,ot.predicate,ga,Qr&&ds?ds:void 0);Tl&&Tl.placeable&&yn.verticalIconBox?(gs=Ql(yn.verticalIconBox),bs=gs.placeable):(gs=Ql(yn.iconBox),bs=gs.placeable),Ho=Ho&&gs.offscreen}let Fl=dt||$a.numHorizontalGlyphVertices===0&&$a.numVerticalGlyphVertices===0,yu=Ct||$a.numIconVertices===0;Fl||yu?yu?Fl||(bs=bs&&Vo):Vo=bs&&Vo:bs=Vo=bs&&Vo;let dc=bs&&gs.placeable;if(Vo&&dl.placeable&&this.collisionIndex.insertCollisionBox(dl.box,wt,Oe.get("text-ignore-placement"),Te.bucketInstanceId,Tl&&Tl.placeable&&uu?uu:ql,ot.ID),dc&&this.collisionIndex.insertCollisionBox(gs.box,fr,Oe.get("icon-ignore-placement"),Te.bucketInstanceId,Uu,ot.ID),ms&&Vo&&this.collisionIndex.insertCollisionCircles(ms.circles,wt,Oe.get("text-ignore-placement"),Te.bucketInstanceId,ql,ot.ID),xe&&this.storeCollisionData(Te.bucketInstanceId,qn,yn,dl,gs,ms),$a.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(Te.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[$a.crossTileID]=new ea(Vo||Pi,bs||qi,Ho||Te.justReloaded),ae[$a.crossTileID]=!0};if(_i){if(P.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let $a=Te.getSortedSymbolIndexes(this.transform.angle);for(let yn=$a.length-1;yn>=0;--yn){let qn=$a[yn];Qa(Te.symbolInstances.get(qn),Te.collisionArrays[qn],qn)}}else for(let $a=P.symbolInstanceStart;$a<P.symbolInstanceEnd;$a++)Qa(Te.symbolInstances.get($a),Te.collisionArrays[$a],$a);if(xe&&Te.bucketInstanceId in this.collisionCircleArrays){let $a=this.collisionCircleArrays[Te.bucketInstanceId];t.as($a.invProjMatrix,Ot),$a.viewportMatrix=this.collisionIndex.getViewportMatrix()}Te.justReloaded=!1}storeCollisionData(P,ae,xe,Te,Oe,ht){if(xe.textBox||xe.iconBox){let Tt,Ot;this.collisionBoxArrays.has(P)?Tt=this.collisionBoxArrays.get(P):(Tt=new Map,this.collisionBoxArrays.set(P,Tt)),Tt.has(ae)?Ot=Tt.get(ae):(Ot={text:null,icon:null},Tt.set(ae,Ot)),xe.textBox&&(Ot.text=Te.box),xe.iconBox&&(Ot.icon=Oe.box)}if(ht){let Tt=this.collisionCircleArrays[P];Tt===void 0&&(Tt=this.collisionCircleArrays[P]=new Bi);for(let Ot=0;Ot<ht.circles.length;Ot+=4)Tt.circles.push(ht.circles[Ot+0]),Tt.circles.push(ht.circles[Ot+1]),Tt.circles.push(ht.circles[Ot+2]),Tt.circles.push(ht.collisionDetected?1:0)}}markUsedJustification(P,ae,xe,Te){let Oe;Oe=Te===t.ah.vertical?xe.verticalPlacedTextSymbolIndex:{left:xe.leftJustifiedTextSymbolIndex,center:xe.centerJustifiedTextSymbolIndex,right:xe.rightJustifiedTextSymbolIndex}[t.at(ae)];let ht=[xe.leftJustifiedTextSymbolIndex,xe.centerJustifiedTextSymbolIndex,xe.rightJustifiedTextSymbolIndex,xe.verticalPlacedTextSymbolIndex];for(let Tt of ht)Tt>=0&&(P.text.placedSymbolArray.get(Tt).crossTileID=Oe>=0&&Tt!==Oe?0:xe.crossTileID)}markUsedOrientation(P,ae,xe){let Te=ae===t.ah.horizontal||ae===t.ah.horizontalOnly?ae:0,Oe=ae===t.ah.vertical?ae:0,ht=[xe.leftJustifiedTextSymbolIndex,xe.centerJustifiedTextSymbolIndex,xe.rightJustifiedTextSymbolIndex];for(let Tt of ht)P.text.placedSymbolArray.get(Tt).placedOrientation=Te;xe.verticalPlacedTextSymbolIndex&&(P.text.placedSymbolArray.get(xe.verticalPlacedTextSymbolIndex).placedOrientation=Oe)}commit(P){this.commitTime=P,this.zoomAtLastRecencyCheck=this.transform.zoom;let ae=this.prevPlacement,xe=!1;this.prevZoomAdjustment=ae?ae.zoomAdjustment(this.transform.zoom):0;let Te=ae?ae.symbolFadeChange(P):1,Oe=ae?ae.opacities:{},ht=ae?ae.variableOffsets:{},Tt=ae?ae.placedOrientations:{};for(let Ot in this.placements){let Qt=this.placements[Ot],Ar=Oe[Ot];Ar?(this.opacities[Ot]=new Ki(Ar,Te,Qt.text,Qt.icon),xe=xe||Qt.text!==Ar.text.placed||Qt.icon!==Ar.icon.placed):(this.opacities[Ot]=new Ki(null,Te,Qt.text,Qt.icon,Qt.skipFade),xe=xe||Qt.text||Qt.icon)}for(let Ot in Oe){let Qt=Oe[Ot];if(!this.opacities[Ot]){let Ar=new Ki(Qt,Te,!1,!1);Ar.isHidden()||(this.opacities[Ot]=Ar,xe=xe||Qt.text.placed||Qt.icon.placed)}}for(let Ot in ht)this.variableOffsets[Ot]||!this.opacities[Ot]||this.opacities[Ot].isHidden()||(this.variableOffsets[Ot]=ht[Ot]);for(let Ot in Tt)this.placedOrientations[Ot]||!this.opacities[Ot]||this.opacities[Ot].isHidden()||(this.placedOrientations[Ot]=Tt[Ot]);if(ae&&ae.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");xe?this.lastPlacementChangeTime=P:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=ae?ae.lastPlacementChangeTime:P)}updateLayerOpacities(P,ae){let xe={};for(let Te of ae){let Oe=Te.getBucket(P);Oe&&Te.latestFeatureIndex&&P.id===Oe.layerIds[0]&&this.updateBucketOpacities(Oe,Te.tileID,xe,Te.collisionBoxArray)}}updateBucketOpacities(P,ae,xe,Te){P.hasTextData()&&(P.text.opacityVertexArray.clear(),P.text.hasVisibleVertices=!1),P.hasIconData()&&(P.icon.opacityVertexArray.clear(),P.icon.hasVisibleVertices=!1),P.hasIconCollisionBoxData()&&P.iconCollisionBox.collisionVertexArray.clear(),P.hasTextCollisionBoxData()&&P.textCollisionBox.collisionVertexArray.clear();let Oe=P.layers[0],ht=Oe.layout,Tt=new Ki(null,0,!1,!1,!0),Ot=ht.get("text-allow-overlap"),Qt=ht.get("icon-allow-overlap"),Ar=Oe._unevaluatedLayout.hasValue("text-variable-anchor")||Oe._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Sr=ht.get("text-rotation-alignment")==="map",Kr=ht.get("text-pitch-alignment")==="map",oi=ht.get("icon-text-fit")!=="none",Ge=new Ki(null,0,Ot&&(Qt||!P.hasIconData()||ht.get("icon-optional")),Qt&&(Ot||!P.hasTextData()||ht.get("text-optional")),!0);!P.collisionArrays&&Te&&(P.hasIconCollisionBoxData()||P.hasTextCollisionBoxData())&&P.deserializeCollisionBoxes(Te);let Ze=(dt,Ct,wt)=>{for(let Dt=0;Dt<Ct/4;Dt++)dt.opacityVertexArray.emplaceBack(wt);dt.hasVisibleVertices=dt.hasVisibleVertices||wt!==ca},ot=this.collisionBoxArrays.get(P.bucketInstanceId);for(let dt=0;dt<P.symbolInstances.length;dt++){let Ct=P.symbolInstances.get(dt),{numHorizontalGlyphVertices:wt,numVerticalGlyphVertices:Dt,crossTileID:fr}=Ct,_r=this.opacities[fr];xe[fr]?_r=Tt:_r||(_r=Ge,this.opacities[fr]=_r),xe[fr]=!0;let kr=Ct.numIconVertices>0,Vr=this.placedOrientations[Ct.crossTileID],Qr=Vr===t.ah.vertical,_i=Vr===t.ah.horizontal||Vr===t.ah.horizontalOnly;if(wt>0||Dt>0){let qi=ra(_r.text);Ze(P.text,wt,Qr?ca:qi),Ze(P.text,Dt,_i?ca:qi);let ga=_r.text.isHidden();[Ct.rightJustifiedTextSymbolIndex,Ct.centerJustifiedTextSymbolIndex,Ct.leftJustifiedTextSymbolIndex].forEach(yn=>{yn>=0&&(P.text.placedSymbolArray.get(yn).hidden=ga||Qr?1:0)}),Ct.verticalPlacedTextSymbolIndex>=0&&(P.text.placedSymbolArray.get(Ct.verticalPlacedTextSymbolIndex).hidden=ga||_i?1:0);let Qa=this.variableOffsets[Ct.crossTileID];Qa&&this.markUsedJustification(P,Qa.anchor,Ct,Vr);let $a=this.placedOrientations[Ct.crossTileID];$a&&(this.markUsedJustification(P,"left",Ct,$a),this.markUsedOrientation(P,$a,Ct))}if(kr){let qi=ra(_r.icon),ga=!(oi&&Ct.verticalPlacedIconSymbolIndex&&Qr);Ct.placedIconSymbolIndex>=0&&(Ze(P.icon,Ct.numIconVertices,ga?qi:ca),P.icon.placedSymbolArray.get(Ct.placedIconSymbolIndex).hidden=_r.icon.isHidden()),Ct.verticalPlacedIconSymbolIndex>=0&&(Ze(P.icon,Ct.numVerticalIconVertices,ga?ca:qi),P.icon.placedSymbolArray.get(Ct.verticalPlacedIconSymbolIndex).hidden=_r.icon.isHidden())}let Pi=ot&&ot.has(dt)?ot.get(dt):{text:null,icon:null};if(P.hasIconCollisionBoxData()||P.hasTextCollisionBoxData()){let qi=P.collisionArrays[dt];if(qi){let ga=new t.P(0,0);if(qi.textBox||qi.verticalTextBox){let Qa=!0;if(Ar){let $a=this.variableOffsets[fr];$a?(ga=Kt($a.anchor,$a.width,$a.height,$a.textOffset,$a.textBoxScale),Sr&&ga._rotate(Kr?this.transform.angle:-this.transform.angle)):Qa=!1}if(qi.textBox||qi.verticalTextBox){let $a;qi.textBox&&($a=Qr),qi.verticalTextBox&&($a=_i),Zt(P.textCollisionBox.collisionVertexArray,_r.text.placed,!Qa||$a,Pi.text,ga.x,ga.y)}}if(qi.iconBox||qi.verticalIconBox){let Qa=!!(!_i&&qi.verticalIconBox),$a;qi.iconBox&&($a=Qa),qi.verticalIconBox&&($a=!Qa),Zt(P.iconCollisionBox.collisionVertexArray,_r.icon.placed,$a,Pi.icon,oi?ga.x:0,oi?ga.y:0)}}}}if(P.sortFeatures(this.transform.angle),this.retainedQueryData[P.bucketInstanceId]&&(this.retainedQueryData[P.bucketInstanceId].featureSortOrder=P.featureSortOrder),P.hasTextData()&&P.text.opacityVertexBuffer&&P.text.opacityVertexBuffer.updateData(P.text.opacityVertexArray),P.hasIconData()&&P.icon.opacityVertexBuffer&&P.icon.opacityVertexBuffer.updateData(P.icon.opacityVertexArray),P.hasIconCollisionBoxData()&&P.iconCollisionBox.collisionVertexBuffer&&P.iconCollisionBox.collisionVertexBuffer.updateData(P.iconCollisionBox.collisionVertexArray),P.hasTextCollisionBoxData()&&P.textCollisionBox.collisionVertexBuffer&&P.textCollisionBox.collisionVertexBuffer.updateData(P.textCollisionBox.collisionVertexArray),P.text.opacityVertexArray.length!==P.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${P.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${P.text.layoutVertexArray.length}) / 4`);if(P.icon.opacityVertexArray.length!==P.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${P.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${P.icon.layoutVertexArray.length}) / 4`);if(P.bucketInstanceId in this.collisionCircleArrays){let dt=this.collisionCircleArrays[P.bucketInstanceId];P.placementInvProjMatrix=dt.invProjMatrix,P.placementViewportMatrix=dt.viewportMatrix,P.collisionCircleArray=dt.circles,delete this.collisionCircleArrays[P.bucketInstanceId]}}symbolFadeChange(P){return this.fadeDuration===0?1:(P-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(P){return Math.max(0,(this.transform.zoom-P)/1.5)}hasTransitions(P){return this.stale||P-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(P,ae){let xe=this.zoomAtLastRecencyCheck===ae?1-this.zoomAdjustment(ae):1;return this.zoomAtLastRecencyCheck=ae,this.commitTime+this.fadeDuration*xe>P}setStale(){this.stale=!0}}function Zt(Ue,P,ae,xe,Te,Oe){xe&&xe.length!==0||(xe=[0,0,0,0]);let ht=xe[0]-Ir,Tt=xe[1]-Ir,Ot=xe[2]-Ir,Qt=xe[3]-Ir;Ue.emplaceBack(P?1:0,ae?1:0,Te||0,Oe||0,ht,Tt),Ue.emplaceBack(P?1:0,ae?1:0,Te||0,Oe||0,Ot,Tt),Ue.emplaceBack(P?1:0,ae?1:0,Te||0,Oe||0,Ot,Qt),Ue.emplaceBack(P?1:0,ae?1:0,Te||0,Oe||0,ht,Qt)}let Jt=Math.pow(2,25),Br=Math.pow(2,24),ri=Math.pow(2,17),ii=Math.pow(2,16),di=Math.pow(2,9),Wi=Math.pow(2,8),oa=Math.pow(2,1);function ra(Ue){if(Ue.opacity===0&&!Ue.placed)return 0;if(Ue.opacity===1&&Ue.placed)return 4294967295;let P=Ue.placed?1:0,ae=Math.floor(127*Ue.opacity);return ae*Jt+P*Br+ae*ri+P*ii+ae*di+P*Wi+ae*oa+P}let ca=0;function xa(){return{isOccluded:(Ue,P,ae)=>!1,getPitchedTextCorrection:(Ue,P,ae)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(Ue,P,ae,xe){throw new Error("Not implemented.")},translatePosition:(Ue,P,ae,xe)=>function(Te,Oe,ht,Tt,Ot=!1){if(!ht[0]&&!ht[1])return[0,0];let Qt=Ot?Tt==="map"?Te.angle:0:Tt==="viewport"?-Te.angle:0;if(Qt){let Ar=Math.sin(Qt),Sr=Math.cos(Qt);ht=[ht[0]*Sr-ht[1]*Ar,ht[0]*Ar+ht[1]*Sr]}return[Ot?ht[0]:Vi(Oe,ht[0],Te.zoom),Ot?ht[1]:Vi(Oe,ht[1],Te.zoom)]}(Ue,P,ae,xe),getCircleRadiusCorrection:Ue=>1}}class ji{constructor(P){this._sortAcrossTiles=P.layout.get("symbol-z-order")!=="viewport-y"&&!P.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(P,ae,xe,Te,Oe){let ht=this._bucketParts;for(;this._currentTileIndex<P.length;)if(ae.getBucketParts(ht,Te,P[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,Oe())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,ht.sort((Tt,Ot)=>Tt.sortKey-Ot.sortKey));this._currentPartIndex<ht.length;)if(ae.placeLayerBucketPart(ht[this._currentPartIndex],this._seenCrossTileIDs,xe),this._currentPartIndex++,Oe())return!0;return!1}}class pn{constructor(P,ae,xe,Te,Oe,ht,Tt,Ot){this.placement=new zt(P,xa(),ae,ht,Tt,Ot),this._currentPlacementIndex=xe.length-1,this._forceFullPlacement=Te,this._showCollisionBoxes=Oe,this._done=!1}isDone(){return this._done}continuePlacement(P,ae,xe){let Te=n.now(),Oe=()=>!this._forceFullPlacement&&n.now()-Te>2;for(;this._currentPlacementIndex>=0;){let ht=ae[P[this._currentPlacementIndex]],Tt=this.placement.collisionIndex.transform.zoom;if(ht.type==="symbol"&&(!ht.minzoom||ht.minzoom<=Tt)&&(!ht.maxzoom||ht.maxzoom>Tt)){if(this._inProgressLayer||(this._inProgressLayer=new ji(ht)),this._inProgressLayer.continuePlacement(xe[ht.source],this.placement,this._showCollisionBoxes,ht,Oe))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(P){return this.placement.commit(P),this.placement}}let _n=512/t.X/2;class En{constructor(P,ae,xe){this.tileID=P,this.bucketInstanceId=xe,this._symbolsByKey={};let Te=new Map;for(let Oe=0;Oe<ae.length;Oe++){let ht=ae.get(Oe),Tt=ht.key,Ot=Te.get(Tt);Ot?Ot.push(ht):Te.set(Tt,[ht])}for(let[Oe,ht]of Te){let Tt={positions:ht.map(Ot=>({x:Math.floor(Ot.anchorX*_n),y:Math.floor(Ot.anchorY*_n)})),crossTileIDs:ht.map(Ot=>Ot.crossTileID)};if(Tt.positions.length>128){let Ot=new t.av(Tt.positions.length,16,Uint16Array);for(let{x:Qt,y:Ar}of Tt.positions)Ot.add(Qt,Ar);Ot.finish(),delete Tt.positions,Tt.index=Ot}this._symbolsByKey[Oe]=Tt}}getScaledCoordinates(P,ae){let{x:xe,y:Te,z:Oe}=this.tileID.canonical,{x:ht,y:Tt,z:Ot}=ae.canonical,Qt=_n/Math.pow(2,Ot-Oe),Ar=(Tt*t.X+P.anchorY)*Qt,Sr=Te*t.X*_n;return{x:Math.floor((ht*t.X+P.anchorX)*Qt-xe*t.X*_n),y:Math.floor(Ar-Sr)}}findMatches(P,ae,xe){let Te=this.tileID.canonical.z<ae.canonical.z?1:Math.pow(2,this.tileID.canonical.z-ae.canonical.z);for(let Oe=0;Oe<P.length;Oe++){let ht=P.get(Oe);if(ht.crossTileID)continue;let Tt=this._symbolsByKey[ht.key];if(!Tt)continue;let Ot=this.getScaledCoordinates(ht,ae);if(Tt.index){let Qt=Tt.index.range(Ot.x-Te,Ot.y-Te,Ot.x+Te,Ot.y+Te).sort();for(let Ar of Qt){let Sr=Tt.crossTileIDs[Ar];if(!xe[Sr]){xe[Sr]=!0,ht.crossTileID=Sr;break}}}else if(Tt.positions)for(let Qt=0;Qt<Tt.positions.length;Qt++){let Ar=Tt.positions[Qt],Sr=Tt.crossTileIDs[Qt];if(Math.abs(Ar.x-Ot.x)<=Te&&Math.abs(Ar.y-Ot.y)<=Te&&!xe[Sr]){xe[Sr]=!0,ht.crossTileID=Sr;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:P})=>P)}}class bt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class st{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(P){let ae=Math.round((P-this.lng)/360);if(ae!==0)for(let xe in this.indexes){let Te=this.indexes[xe],Oe={};for(let ht in Te){let Tt=Te[ht];Tt.tileID=Tt.tileID.unwrapTo(Tt.tileID.wrap+ae),Oe[Tt.tileID.key]=Tt}this.indexes[xe]=Oe}this.lng=P}addBucket(P,ae,xe){if(this.indexes[P.overscaledZ]&&this.indexes[P.overscaledZ][P.key]){if(this.indexes[P.overscaledZ][P.key].bucketInstanceId===ae.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(P.overscaledZ,this.indexes[P.overscaledZ][P.key])}for(let Oe=0;Oe<ae.symbolInstances.length;Oe++)ae.symbolInstances.get(Oe).crossTileID=0;this.usedCrossTileIDs[P.overscaledZ]||(this.usedCrossTileIDs[P.overscaledZ]={});let Te=this.usedCrossTileIDs[P.overscaledZ];for(let Oe in this.indexes){let ht=this.indexes[Oe];if(Number(Oe)>P.overscaledZ)for(let Tt in ht){let Ot=ht[Tt];Ot.tileID.isChildOf(P)&&Ot.findMatches(ae.symbolInstances,P,Te)}else{let Tt=ht[P.scaledTo(Number(Oe)).key];Tt&&Tt.findMatches(ae.symbolInstances,P,Te)}}for(let Oe=0;Oe<ae.symbolInstances.length;Oe++){let ht=ae.symbolInstances.get(Oe);ht.crossTileID||(ht.crossTileID=xe.generate(),Te[ht.crossTileID]=!0)}return this.indexes[P.overscaledZ]===void 0&&(this.indexes[P.overscaledZ]={}),this.indexes[P.overscaledZ][P.key]=new En(P,ae.symbolInstances,ae.bucketInstanceId),!0}removeBucketCrossTileIDs(P,ae){for(let xe of ae.getCrossTileIDsLists())for(let Te of xe)delete this.usedCrossTileIDs[P][Te]}removeStaleBuckets(P){let ae=!1;for(let xe in this.indexes){let Te=this.indexes[xe];for(let Oe in Te)P[Te[Oe].bucketInstanceId]||(this.removeBucketCrossTileIDs(xe,Te[Oe]),delete Te[Oe],ae=!0)}return ae}}class Nr{constructor(){this.layerIndexes={},this.crossTileIDs=new bt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(P,ae,xe){let Te=this.layerIndexes[P.id];Te===void 0&&(Te=this.layerIndexes[P.id]=new st);let Oe=!1,ht={};Te.handleWrapJump(xe);for(let Tt of ae){let Ot=Tt.getBucket(P);Ot&&P.id===Ot.layerIds[0]&&(Ot.bucketInstanceId||(Ot.bucketInstanceId=++this.maxBucketInstanceId),Te.addBucket(Tt.tileID,Ot,this.crossTileIDs)&&(Oe=!0),ht[Ot.bucketInstanceId]=!0)}return Te.removeStaleBuckets(ht)&&(Oe=!0),Oe}pruneUnusedLayers(P){let ae={};P.forEach(xe=>{ae[xe]=!0});for(let xe in this.layerIndexes)ae[xe]||delete this.layerIndexes[xe]}}let Lr=(Ue,P)=>t.t(Ue,P&&P.filter(ae=>ae.identifier!=="source.canvas")),br=t.aw();class Rr extends t.E{constructor(P,ae={}){super(),this._rtlPluginLoaded=()=>{for(let xe in this.sourceCaches){let Te=this.sourceCaches[xe].getSource().type;Te!=="vector"&&Te!=="geojson"||this.sourceCaches[xe].reload()}},this.map=P,this.dispatcher=new ee(Z(),P._getMapId()),this.dispatcher.registerMessageHandler("GG",(xe,Te)=>this.getGlyphs(xe,Te)),this.dispatcher.registerMessageHandler("GI",(xe,Te)=>this.getImages(xe,Te)),this.imageManager=new f,this.imageManager.setEventedParent(this),this.glyphManager=new F(P._requestManager,ae.localIdeographFontFamily),this.lineAtlas=new X(256,512),this.crossTileSymbolIndex=new Nr,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",t.ay()),Qe().on(me,this._rtlPluginLoaded),this.on("data",xe=>{if(xe.dataType!=="source"||xe.sourceDataType!=="metadata")return;let Te=this.sourceCaches[xe.sourceId];if(!Te)return;let Oe=Te.getSource();if(Oe&&Oe.vectorLayerIds)for(let ht in this._layers){let Tt=this._layers[ht];Tt.source===Oe.id&&this._validateLayer(Tt)}})}loadURL(P,ae={},xe){this.fire(new t.k("dataloading",{dataType:"style"})),ae.validate=typeof ae.validate!="boolean"||ae.validate;let Te=this.map._requestManager.transformRequest(P,"Style");this._loadStyleRequest=new AbortController;let Oe=this._loadStyleRequest;t.h(Te,this._loadStyleRequest).then(ht=>{this._loadStyleRequest=null,this._load(ht.data,ae,xe)}).catch(ht=>{this._loadStyleRequest=null,ht&&!Oe.signal.aborted&&this.fire(new t.j(ht))})}loadJSON(P,ae={},xe){this.fire(new t.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,n.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,ae.validate=ae.validate!==!1,this._load(P,ae,xe)}).catch(()=>{})}loadEmpty(){this.fire(new t.k("dataloading",{dataType:"style"})),this._load(br,{validate:!1})}_load(P,ae,xe){var Te;let Oe=ae.transformStyle?ae.transformStyle(xe,P):P;if(!ae.validate||!Lr(this,t.u(Oe))){this._loaded=!0,this.stylesheet=Oe;for(let ht in Oe.sources)this.addSource(ht,Oe.sources[ht],{validate:!1});Oe.sprite?this._loadSprite(Oe.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(Oe.glyphs),this._createLayers(),this.light=new I(this.stylesheet.light),this.sky=new O(this.stylesheet.sky),this.map.setTerrain((Te=this.stylesheet.terrain)!==null&&Te!==void 0?Te:null),this.fire(new t.k("data",{dataType:"style"})),this.fire(new t.k("style.load"))}}_createLayers(){let P=t.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",P),this._order=P.map(ae=>ae.id),this._layers={},this._serializedLayers=null;for(let ae of P){let xe=t.aA(ae);xe.setEventedParent(this,{layer:{id:ae.id}}),this._layers[ae.id]=xe}}_loadSprite(P,ae=!1,xe=void 0){let Te;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(Oe,ht,Tt,Ot){return t._(this,void 0,void 0,function*(){let Qt=b(Oe),Ar=Tt>1?"@2x":"",Sr={},Kr={};for(let{id:oi,url:Ge}of Qt){let Ze=ht.transformRequest(v(Ge,Ar,".json"),"SpriteJSON");Sr[oi]=t.h(Ze,Ot);let ot=ht.transformRequest(v(Ge,Ar,".png"),"SpriteImage");Kr[oi]=l.getImage(ot,Ot)}return yield Promise.all([...Object.values(Sr),...Object.values(Kr)]),function(oi,Ge){return t._(this,void 0,void 0,function*(){let Ze={};for(let ot in oi){Ze[ot]={};let dt=n.getImageCanvasContext((yield Ge[ot]).data),Ct=(yield oi[ot]).data;for(let wt in Ct){let{width:Dt,height:fr,x:_r,y:kr,sdf:Vr,pixelRatio:Qr,stretchX:_i,stretchY:Pi,content:qi,textFitWidth:ga,textFitHeight:Qa}=Ct[wt];Ze[ot][wt]={data:null,pixelRatio:Qr,sdf:Vr,stretchX:_i,stretchY:Pi,content:qi,textFitWidth:ga,textFitHeight:Qa,spriteData:{width:Dt,height:fr,x:_r,y:kr,context:dt}}}}return Ze})}(Sr,Kr)})}(P,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(Oe=>{if(this._spriteRequest=null,Oe)for(let ht in Oe){this._spritesImagesIds[ht]=[];let Tt=this._spritesImagesIds[ht]?this._spritesImagesIds[ht].filter(Ot=>!(Ot in Oe)):[];for(let Ot of Tt)this.imageManager.removeImage(Ot),this._changedImages[Ot]=!0;for(let Ot in Oe[ht]){let Qt=ht==="default"?Ot:`${ht}:${Ot}`;this._spritesImagesIds[ht].push(Qt),Qt in this.imageManager.images?this.imageManager.updateImage(Qt,Oe[ht][Ot],!1):this.imageManager.addImage(Qt,Oe[ht][Ot]),ae&&(this._changedImages[Qt]=!0)}}}).catch(Oe=>{this._spriteRequest=null,Te=Oe,this.fire(new t.j(Te))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),ae&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.k("data",{dataType:"style"})),xe&&xe(Te)})}_unloadSprite(){for(let P of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(P),this._changedImages[P]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}_validateLayer(P){let ae=this.sourceCaches[P.source];if(!ae)return;let xe=P.sourceLayer;if(!xe)return;let Te=ae.getSource();(Te.type==="geojson"||Te.vectorLayerIds&&Te.vectorLayerIds.indexOf(xe)===-1)&&this.fire(new t.j(new Error(`Source layer "${xe}" does not exist on source "${Te.id}" as specified by style layer "${P.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let P in this.sourceCaches)if(!this.sourceCaches[P].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(P,ae=!1){let xe=this._serializedAllLayers();if(!P||P.length===0)return Object.values(ae?t.aB(xe):xe);let Te=[];for(let Oe of P)if(xe[Oe]){let ht=ae?t.aB(xe[Oe]):xe[Oe];Te.push(ht)}return Te}_serializedAllLayers(){let P=this._serializedLayers;if(P)return P;P=this._serializedLayers={};let ae=Object.keys(this._layers);for(let xe of ae){let Te=this._layers[xe];Te.type!=="custom"&&(P[xe]=Te.serialize())}return P}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let P in this.sourceCaches)if(this.sourceCaches[P].hasTransition())return!0;for(let P in this._layers)if(this._layers[P].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(P){if(!this._loaded)return;let ae=this._changed;if(ae){let Te=Object.keys(this._updatedLayers),Oe=Object.keys(this._removedLayers);(Te.length||Oe.length)&&this._updateWorkerLayers(Te,Oe);for(let ht in this._updatedSources){let Tt=this._updatedSources[ht];if(Tt==="reload")this._reloadSource(ht);else{if(Tt!=="clear")throw new Error(`Invalid action ${Tt}`);this._clearSource(ht)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let ht in this._updatedPaintProps)this._layers[ht].updateTransitions(P);this.light.updateTransitions(P),this.sky.updateTransitions(P),this._resetUpdates()}let xe={};for(let Te in this.sourceCaches){let Oe=this.sourceCaches[Te];xe[Te]=Oe.used,Oe.used=!1}for(let Te of this._order){let Oe=this._layers[Te];Oe.recalculate(P,this._availableImages),!Oe.isHidden(P.zoom)&&Oe.source&&(this.sourceCaches[Oe.source].used=!0)}for(let Te in xe){let Oe=this.sourceCaches[Te];!!xe[Te]!=!!Oe.used&&Oe.fire(new t.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:Te}))}this.light.recalculate(P),this.sky.recalculate(P),this.z=P.zoom,ae&&this.fire(new t.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let P=Object.keys(this._changedImages);if(P.length){for(let ae in this.sourceCaches)this.sourceCaches[ae].reloadTilesForDependencies(["icons","patterns"],P);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let P in this.sourceCaches)this.sourceCaches[P].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(P,ae){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(P,!1),removedIds:ae})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(P,ae={}){var xe;this._checkLoaded();let Te=this.serialize();if(P=ae.transformStyle?ae.transformStyle(Te,P):P,((xe=ae.validate)===null||xe===void 0||xe)&&Lr(this,t.u(P)))return!1;(P=t.aB(P)).layers=t.az(P.layers);let Oe=t.aC(Te,P),ht=this._getOperationsToPerform(Oe);if(ht.unimplemented.length>0)throw new Error(`Unimplemented: ${ht.unimplemented.join(", ")}.`);if(ht.operations.length===0)return!1;for(let Tt of ht.operations)Tt();return this.stylesheet=P,this._serializedLayers=null,!0}_getOperationsToPerform(P){let ae=[],xe=[];for(let Te of P)switch(Te.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":ae.push(()=>this.addLayer.apply(this,Te.args));break;case"removeLayer":ae.push(()=>this.removeLayer.apply(this,Te.args));break;case"setPaintProperty":ae.push(()=>this.setPaintProperty.apply(this,Te.args));break;case"setLayoutProperty":ae.push(()=>this.setLayoutProperty.apply(this,Te.args));break;case"setFilter":ae.push(()=>this.setFilter.apply(this,Te.args));break;case"addSource":ae.push(()=>this.addSource.apply(this,Te.args));break;case"removeSource":ae.push(()=>this.removeSource.apply(this,Te.args));break;case"setLayerZoomRange":ae.push(()=>this.setLayerZoomRange.apply(this,Te.args));break;case"setLight":ae.push(()=>this.setLight.apply(this,Te.args));break;case"setGeoJSONSourceData":ae.push(()=>this.setGeoJSONSourceData.apply(this,Te.args));break;case"setGlyphs":ae.push(()=>this.setGlyphs.apply(this,Te.args));break;case"setSprite":ae.push(()=>this.setSprite.apply(this,Te.args));break;case"setSky":ae.push(()=>this.setSky.apply(this,Te.args));break;case"setTerrain":ae.push(()=>this.map.setTerrain.apply(this,Te.args));break;case"setTransition":ae.push(()=>{});break;default:xe.push(Te.command)}return{operations:ae,unimplemented:xe}}addImage(P,ae){if(this.getImage(P))return this.fire(new t.j(new Error(`An image named "${P}" already exists.`)));this.imageManager.addImage(P,ae),this._afterImageUpdated(P)}updateImage(P,ae){this.imageManager.updateImage(P,ae)}getImage(P){return this.imageManager.getImage(P)}removeImage(P){if(!this.getImage(P))return this.fire(new t.j(new Error(`An image named "${P}" does not exist.`)));this.imageManager.removeImage(P),this._afterImageUpdated(P)}_afterImageUpdated(P){this._availableImages=this.imageManager.listImages(),this._changedImages[P]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(P,ae,xe={}){if(this._checkLoaded(),this.sourceCaches[P]!==void 0)throw new Error(`Source "${P}" already exists.`);if(!ae.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(ae).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(ae.type)>=0&&this._validate(t.u.source,`sources.${P}`,ae,null,xe))return;this.map&&this.map._collectResourceTiming&&(ae.collectResourceTiming=!0);let Te=this.sourceCaches[P]=new Pt(P,ae,this.dispatcher);Te.style=this,Te.setEventedParent(this,()=>({isSourceLoaded:Te.loaded(),source:Te.serialize(),sourceId:P})),Te.onAdd(this.map),this._changed=!0}removeSource(P){if(this._checkLoaded(),this.sourceCaches[P]===void 0)throw new Error("There is no source with this ID");for(let xe in this._layers)if(this._layers[xe].source===P)return this.fire(new t.j(new Error(`Source "${P}" cannot be removed while layer "${xe}" is using it.`)));let ae=this.sourceCaches[P];delete this.sourceCaches[P],delete this._updatedSources[P],ae.fire(new t.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:P})),ae.setEventedParent(null),ae.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(P,ae){if(this._checkLoaded(),this.sourceCaches[P]===void 0)throw new Error(`There is no source with this ID=${P}`);let xe=this.sourceCaches[P].getSource();if(xe.type!=="geojson")throw new Error(`geojsonSource.type is ${xe.type}, which is !== 'geojson`);xe.setData(ae),this._changed=!0}getSource(P){return this.sourceCaches[P]&&this.sourceCaches[P].getSource()}addLayer(P,ae,xe={}){this._checkLoaded();let Te=P.id;if(this.getLayer(Te))return void this.fire(new t.j(new Error(`Layer "${Te}" already exists on this map.`)));let Oe;if(P.type==="custom"){if(Lr(this,t.aD(P)))return;Oe=t.aA(P)}else{if("source"in P&&typeof P.source=="object"&&(this.addSource(Te,P.source),P=t.aB(P),P=t.e(P,{source:Te})),this._validate(t.u.layer,`layers.${Te}`,P,{arrayIndex:-1},xe))return;Oe=t.aA(P),this._validateLayer(Oe),Oe.setEventedParent(this,{layer:{id:Te}})}let ht=ae?this._order.indexOf(ae):this._order.length;if(ae&&ht===-1)this.fire(new t.j(new Error(`Cannot add layer "${Te}" before non-existing layer "${ae}".`)));else{if(this._order.splice(ht,0,Te),this._layerOrderChanged=!0,this._layers[Te]=Oe,this._removedLayers[Te]&&Oe.source&&Oe.type!=="custom"){let Tt=this._removedLayers[Te];delete this._removedLayers[Te],Tt.type!==Oe.type?this._updatedSources[Oe.source]="clear":(this._updatedSources[Oe.source]="reload",this.sourceCaches[Oe.source].pause())}this._updateLayer(Oe),Oe.onAdd&&Oe.onAdd(this.map)}}moveLayer(P,ae){if(this._checkLoaded(),this._changed=!0,!this._layers[P])return void this.fire(new t.j(new Error(`The layer '${P}' does not exist in the map's style and cannot be moved.`)));if(P===ae)return;let xe=this._order.indexOf(P);this._order.splice(xe,1);let Te=ae?this._order.indexOf(ae):this._order.length;ae&&Te===-1?this.fire(new t.j(new Error(`Cannot move layer "${P}" before non-existing layer "${ae}".`))):(this._order.splice(Te,0,P),this._layerOrderChanged=!0)}removeLayer(P){this._checkLoaded();let ae=this._layers[P];if(!ae)return void this.fire(new t.j(new Error(`Cannot remove non-existing layer "${P}".`)));ae.setEventedParent(null);let xe=this._order.indexOf(P);this._order.splice(xe,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[P]=ae,delete this._layers[P],this._serializedLayers&&delete this._serializedLayers[P],delete this._updatedLayers[P],delete this._updatedPaintProps[P],ae.onRemove&&ae.onRemove(this.map)}getLayer(P){return this._layers[P]}getLayersOrder(){return[...this._order]}hasLayer(P){return P in this._layers}setLayerZoomRange(P,ae,xe){this._checkLoaded();let Te=this.getLayer(P);Te?Te.minzoom===ae&&Te.maxzoom===xe||(ae!=null&&(Te.minzoom=ae),xe!=null&&(Te.maxzoom=xe),this._updateLayer(Te)):this.fire(new t.j(new Error(`Cannot set the zoom range of non-existing layer "${P}".`)))}setFilter(P,ae,xe={}){this._checkLoaded();let Te=this.getLayer(P);if(Te){if(!t.aE(Te.filter,ae))return ae==null?(Te.filter=void 0,void this._updateLayer(Te)):void(this._validate(t.u.filter,`layers.${Te.id}.filter`,ae,null,xe)||(Te.filter=t.aB(ae),this._updateLayer(Te)))}else this.fire(new t.j(new Error(`Cannot filter non-existing layer "${P}".`)))}getFilter(P){return t.aB(this.getLayer(P).filter)}setLayoutProperty(P,ae,xe,Te={}){this._checkLoaded();let Oe=this.getLayer(P);Oe?t.aE(Oe.getLayoutProperty(ae),xe)||(Oe.setLayoutProperty(ae,xe,Te),this._updateLayer(Oe)):this.fire(new t.j(new Error(`Cannot style non-existing layer "${P}".`)))}getLayoutProperty(P,ae){let xe=this.getLayer(P);if(xe)return xe.getLayoutProperty(ae);this.fire(new t.j(new Error(`Cannot get style of non-existing layer "${P}".`)))}setPaintProperty(P,ae,xe,Te={}){this._checkLoaded();let Oe=this.getLayer(P);Oe?t.aE(Oe.getPaintProperty(ae),xe)||(Oe.setPaintProperty(ae,xe,Te)&&this._updateLayer(Oe),this._changed=!0,this._updatedPaintProps[P]=!0,this._serializedLayers=null):this.fire(new t.j(new Error(`Cannot style non-existing layer "${P}".`)))}getPaintProperty(P,ae){return this.getLayer(P).getPaintProperty(ae)}setFeatureState(P,ae){this._checkLoaded();let xe=P.source,Te=P.sourceLayer,Oe=this.sourceCaches[xe];if(Oe===void 0)return void this.fire(new t.j(new Error(`The source '${xe}' does not exist in the map's style.`)));let ht=Oe.getSource().type;ht==="geojson"&&Te?this.fire(new t.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):ht!=="vector"||Te?(P.id===void 0&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),Oe.setFeatureState(Te,P.id,ae)):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(P,ae){this._checkLoaded();let xe=P.source,Te=this.sourceCaches[xe];if(Te===void 0)return void this.fire(new t.j(new Error(`The source '${xe}' does not exist in the map's style.`)));let Oe=Te.getSource().type,ht=Oe==="vector"?P.sourceLayer:void 0;Oe!=="vector"||ht?ae&&typeof P.id!="string"&&typeof P.id!="number"?this.fire(new t.j(new Error("A feature id is required to remove its specific state property."))):Te.removeFeatureState(ht,P.id,ae):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(P){this._checkLoaded();let ae=P.source,xe=P.sourceLayer,Te=this.sourceCaches[ae];if(Te!==void 0)return Te.getSource().type!=="vector"||xe?(P.id===void 0&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),Te.getFeatureState(xe,P.id)):void this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.j(new Error(`The source '${ae}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let P=t.aF(this.sourceCaches,Oe=>Oe.serialize()),ae=this._serializeByIds(this._order,!0),xe=this.map.getTerrain()||void 0,Te=this.stylesheet;return t.aG({version:Te.version,name:Te.name,metadata:Te.metadata,light:Te.light,sky:Te.sky,center:Te.center,zoom:Te.zoom,bearing:Te.bearing,pitch:Te.pitch,sprite:Te.sprite,glyphs:Te.glyphs,transition:Te.transition,sources:P,layers:ae,terrain:xe},Oe=>Oe!==void 0)}_updateLayer(P){this._updatedLayers[P.id]=!0,P.source&&!this._updatedSources[P.source]&&this.sourceCaches[P.source].getSource().type!=="raster"&&(this._updatedSources[P.source]="reload",this.sourceCaches[P.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(P){let ae=ht=>this._layers[ht].type==="fill-extrusion",xe={},Te=[];for(let ht=this._order.length-1;ht>=0;ht--){let Tt=this._order[ht];if(ae(Tt)){xe[Tt]=ht;for(let Ot of P){let Qt=Ot[Tt];if(Qt)for(let Ar of Qt)Te.push(Ar)}}}Te.sort((ht,Tt)=>Tt.intersectionZ-ht.intersectionZ);let Oe=[];for(let ht=this._order.length-1;ht>=0;ht--){let Tt=this._order[ht];if(ae(Tt))for(let Ot=Te.length-1;Ot>=0;Ot--){let Qt=Te[Ot].feature;if(xe[Qt.layer.id]<ht)break;Oe.push(Qt),Te.pop()}else for(let Ot of P){let Qt=Ot[Tt];if(Qt)for(let Ar of Qt)Oe.push(Ar.feature)}}return Oe}queryRenderedFeatures(P,ae,xe){ae&&ae.filter&&this._validate(t.u.filter,"queryRenderedFeatures.filter",ae.filter,null,ae);let Te={};if(ae&&ae.layers){if(!Array.isArray(ae.layers))return this.fire(new t.j(new Error("parameters.layers must be an Array."))),[];for(let Tt of ae.layers){let Ot=this._layers[Tt];if(!Ot)return this.fire(new t.j(new Error(`The layer '${Tt}' does not exist in the map's style and cannot be queried for features.`))),[];Te[Ot.source]=!0}}let Oe=[];ae.availableImages=this._availableImages;let ht=this._serializedAllLayers();for(let Tt in this.sourceCaches)ae.layers&&!Te[Tt]||Oe.push(ie(this.sourceCaches[Tt],this._layers,ht,P,ae,xe));return this.placement&&Oe.push(function(Tt,Ot,Qt,Ar,Sr,Kr,oi){let Ge={},Ze=Kr.queryRenderedSymbols(Ar),ot=[];for(let dt of Object.keys(Ze).map(Number))ot.push(oi[dt]);ot.sort(j);for(let dt of ot){let Ct=dt.featureIndex.lookupSymbolFeatures(Ze[dt.bucketInstanceId],Ot,dt.bucketIndex,dt.sourceLayerIndex,Sr.filter,Sr.layers,Sr.availableImages,Tt);for(let wt in Ct){let Dt=Ge[wt]=Ge[wt]||[],fr=Ct[wt];fr.sort((_r,kr)=>{let Vr=dt.featureSortOrder;if(Vr){let Qr=Vr.indexOf(_r.featureIndex);return Vr.indexOf(kr.featureIndex)-Qr}return kr.featureIndex-_r.featureIndex});for(let _r of fr)Dt.push(_r)}}for(let dt in Ge)Ge[dt].forEach(Ct=>{let wt=Ct.feature,Dt=Qt[Tt[dt].source].getFeatureState(wt.layer["source-layer"],wt.id);wt.source=wt.layer.source,wt.layer["source-layer"]&&(wt.sourceLayer=wt.layer["source-layer"]),wt.state=Dt});return Ge}(this._layers,ht,this.sourceCaches,P,ae,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(Oe)}querySourceFeatures(P,ae){ae&&ae.filter&&this._validate(t.u.filter,"querySourceFeatures.filter",ae.filter,null,ae);let xe=this.sourceCaches[P];return xe?function(Te,Oe){let ht=Te.getRenderableIds().map(Qt=>Te.getTileByID(Qt)),Tt=[],Ot={};for(let Qt=0;Qt<ht.length;Qt++){let Ar=ht[Qt],Sr=Ar.tileID.canonical.key;Ot[Sr]||(Ot[Sr]=!0,Ar.querySourceFeatures(Tt,Oe))}return Tt}(xe,ae):[]}getLight(){return this.light.getLight()}setLight(P,ae={}){this._checkLoaded();let xe=this.light.getLight(),Te=!1;for(let ht in P)if(!t.aE(P[ht],xe[ht])){Te=!0;break}if(!Te)return;let Oe={now:n.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(P,ae),this.light.updateTransitions(Oe)}getSky(){var P;return(P=this.stylesheet)===null||P===void 0?void 0:P.sky}setSky(P,ae={}){let xe=this.getSky(),Te=!1;if(!P&&!xe)return;if(P&&!xe)Te=!0;else if(!P&&xe)Te=!0;else for(let ht in P)if(!t.aE(P[ht],xe[ht])){Te=!0;break}if(!Te)return;let Oe={now:n.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=P,this.sky.setSky(P,ae),this.sky.updateTransitions(Oe)}_validate(P,ae,xe,Te,Oe={}){return(!Oe||Oe.validate!==!1)&&Lr(this,P.call(t.u,t.e({key:ae,style:this.serialize(),value:xe,styleSpec:t.v},Te)))}_remove(P=!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),Qe().off(me,this._rtlPluginLoaded);for(let ae in this._layers)this._layers[ae].setEventedParent(null);for(let ae in this.sourceCaches){let xe=this.sourceCaches[ae];xe.setEventedParent(null),xe.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),P&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(P)}_clearSource(P){this.sourceCaches[P].clearTiles()}_reloadSource(P){this.sourceCaches[P].resume(),this.sourceCaches[P].reload()}_updateSources(P){for(let ae in this.sourceCaches)this.sourceCaches[ae].update(P,this.map.terrain)}_generateCollisionBoxes(){for(let P in this.sourceCaches)this._reloadSource(P)}_updatePlacement(P,ae,xe,Te,Oe=!1){let ht=!1,Tt=!1,Ot={};for(let Qt of this._order){let Ar=this._layers[Qt];if(Ar.type!=="symbol")continue;if(!Ot[Ar.source]){let Kr=this.sourceCaches[Ar.source];Ot[Ar.source]=Kr.getRenderableIds(!0).map(oi=>Kr.getTileByID(oi)).sort((oi,Ge)=>Ge.tileID.overscaledZ-oi.tileID.overscaledZ||(oi.tileID.isLessThan(Ge.tileID)?-1:1))}let Sr=this.crossTileSymbolIndex.addLayer(Ar,Ot[Ar.source],P.center.lng);ht=ht||Sr}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((Oe=Oe||this._layerOrderChanged||xe===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.now(),P.zoom))&&(this.pauseablePlacement=new pn(P,this.map.terrain,this._order,Oe,ae,xe,Te,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,Ot),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.now()),Tt=!0),ht&&this.pauseablePlacement.placement.setStale()),Tt||ht)for(let Qt of this._order){let Ar=this._layers[Qt];Ar.type==="symbol"&&this.placement.updateLayerOpacities(Ar,Ot[Ar.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.now())}_releaseSymbolFadeTiles(){for(let P in this.sourceCaches)this.sourceCaches[P].releaseSymbolFadeTiles()}getImages(P,ae){return t._(this,void 0,void 0,function*(){let xe=yield this.imageManager.getImages(ae.icons);this._updateTilesForChangedImages();let Te=this.sourceCaches[ae.source];return Te&&Te.setDependencies(ae.tileID.key,ae.type,ae.icons),xe})}getGlyphs(P,ae){return t._(this,void 0,void 0,function*(){let xe=yield this.glyphManager.getGlyphs(ae.stacks),Te=this.sourceCaches[ae.source];return Te&&Te.setDependencies(ae.tileID.key,ae.type,[""]),xe})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(P,ae={}){this._checkLoaded(),P&&this._validate(t.u.glyphs,"glyphs",P,null,ae)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=P,this.glyphManager.entries={},this.glyphManager.setURL(P))}addSprite(P,ae,xe={},Te){this._checkLoaded();let Oe=[{id:P,url:ae}],ht=[...b(this.stylesheet.sprite),...Oe];this._validate(t.u.sprite,"sprite",ht,null,xe)||(this.stylesheet.sprite=ht,this._loadSprite(Oe,!0,Te))}removeSprite(P){this._checkLoaded();let ae=b(this.stylesheet.sprite);if(ae.find(xe=>xe.id===P)){if(this._spritesImagesIds[P])for(let xe of this._spritesImagesIds[P])this.imageManager.removeImage(xe),this._changedImages[xe]=!0;ae.splice(ae.findIndex(xe=>xe.id===P),1),this.stylesheet.sprite=ae.length>0?ae:void 0,delete this._spritesImagesIds[P],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.k("data",{dataType:"style"}))}else this.fire(new t.j(new Error(`Sprite "${P}" doesn't exists on this map.`)))}getSprite(){return b(this.stylesheet.sprite)}setSprite(P,ae={},xe){this._checkLoaded(),P&&this._validate(t.u.sprite,"sprite",P,null,ae)||(this.stylesheet.sprite=P,P?this._loadSprite(P,!0,xe):(this._unloadSprite(),xe&&xe(null)))}}var jr=t.Y([{name:"a_pos",type:"Int16",components:2}]);let Wr={prelude:yt(`#ifdef GL_ES
3215precision mediump float;
3216#else
3217#if !defined(lowp)

Callers 1

loadTileMethod · 0.95

Calls 1

lMethod · 0.45

Tested by

no test coverage detected