| 3213 | `)),F.push({type:"Feature",geometry:{type:"Point",coordinates:O.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 v(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 d=1;d<M.length;d++)b.push(g[d-1],M[d])}else b=M;return b}function A(M){var g=M.textfont,b=g.family,d=g.style,u=g.weight,y=b.split(" "),f=y[y.length-1]==="Italic";f&&y.pop(),f=f||d==="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"),a(R)||(R=b);var L=R.split(", ");return L}}}),BV=Xe({"src/traces/scattermap/plot.js"(Z,G){"use strict";var v=sa(),x=OV(),S=b0().traceLayerPrefix,E={cluster:["cluster","clusterCount","circle"],nonCluster:["fill","line","circle","symbol"]};function e(r,o,a,n){this.type="scattermap",this.subplot=r,this.uid=o,this.clusterEnabled=a,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,a){var n={type:"geojson",data:o.geojson};a&&a.enabled&&v.extendFlat(n,{cluster:!0,clusterMaxZoom:a.maxzoom});var i=this.subplot.map.getSource(this.sourceIds[r]);i?i.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,a){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 i=this.layerIds[r],s,h=this.subplot.getMapLayers(),c=0;c<h.length;c++)if(h[c].id===i){s=!0;break}s?(this.subplot.setOptions(i,"setLayoutProperty",n.layout),n.layout.visibility==="visible"&&this.subplot.setOptions(i,"setPaintProperty",n.paint)):this.subplot.addLayer(n,a)},t.update=function(o){var a=o[0].trace,n=this.subplot,i=n.map,s=x(n.gd,o),h=n.belowLookup["trace-"+this.uid],c=!!(a.cluster&&a.cluster.enabled),m=!!this.clusterEnabled,p=this;function T(u){u||p.addSource("circle",s.circle,a.cluster);for(var y=E.cluster,f=0;f<y.length;f++){var R=y[f],L=s[R];p.addLayer(R,L,h)}}function l(u){for(var y=E.cluster,f=y.length-1;f>=0;f--){var R=y[f];i.removeLayer(p.layerIds[R])}u||i.removeSource(p.sourceIds.circle)}function _(u){for(var y=E.nonCluster,f=0;f<y.length;f++){var R=y[f],L=s[R];u||p.addSource(R,L),p.addLayer(R,L,h)}}function w(u){for(var y=E.nonCluster,f=y.length-1;f>=0;f--){var R=y[f];i.removeLayer(p.layerIds[R]),u||i.removeSource(p.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(p.layerIds[f],"setLayoutProperty",R.layout),R.layout.visibility==="visible"&&(f!=="cluster"&&p.setSourceData(f,R),n.setOptions(p.layerIds[f],"setPaintProperty",R.paint)))}}var b=this.isHidden,d=a.visible!==!0;d?b||A():b?d||M():m!==c?(A(),M()):(this.below!==h&&(A(!0),M(!0)),g()),this.clusterEnabled=c,this.isHidden=d,this.below=h,o[0].trace._glTrace=this},t.dispose=function(){for(var o=this.subplot.map,a=this.clusterEnabled?E.cluster:E.nonCluster,n=a.length-1;n>=0;n--){var i=a[n];o.removeLayer(this.layerIds[i]),o.removeSource(this.sourceIds[i])}},G.exports=function(o,a){var n=a[0].trace,i=n.cluster&&n.cluster.enabled,s=n.visible!==!0,h=new e(o,n.uid,i,s),c=x(o.gd,a),m=h.below=o.belowLookup["trace-"+n.uid],p,T,l;if(i)for(h.addSource("circle",c.circle,n.cluster),p=0;p<E.cluster.length;p++)T=E.cluster[p],l=c[T],h.addLayer(T,l,m);else for(p=0;p<E.nonCluster.length;p++)T=E.nonCluster[p],l=c[T],h.addSource(T,l,n.cluster),h.addLayer(T,l,m);return a[0].trace._glTrace=h,h}}}),kT=Xe({"src/traces/scattermap/hover.js"(Z,G){"use strict";var v=rf(),x=sa(),S=l1(),E=x.fillText,e=Hs().BADNUM,t=b0().traceLayerPrefix;function r(a,n,i){var s=a.cd,h=s[0].trace,c=a.xa,m=a.ya,p=a.subplot,T=[],l=t+h.uid+"-circle",_=h.cluster&&h.cluster.enabled;if(_){var w=p.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 O=N.lonlat;if(O[0]===e||_&&T.indexOf(N.i+1)===-1)return 1/0;var P=x.modHalf(O[0],360),U=O[1],B=p.project([P,U]),X=B.x-c.c2p([g,U]),$=B.y-m.c2p([P,i]),se=Math.max(3,N.mrc||0);return Math.max(Math.sqrt(X*X+$*$)-se,1-3/se)}if(v.getClosest(s,b,a),a.index!==!1){var d=s[a.index],u=d.lonlat,y=[x.modHalf(u[0],360)+M,u[1]],f=c.c2p(y),R=m.c2p(y),L=d.mrc||1;a.x0=f-L,a.x1=f+L,a.y0=R-L,a.y1=R+L;var z={};z[h.subplot]={_subplot:p};var F=h._module.formatLabels(d,h,z);return a.lonLabel=F.lonLabel,a.latLabel=F.latLabel,a.color=S(h,d),a.extraText=o(h,d,s[0].t.labels),a.hovertemplate=h.hovertemplate,[a]}}function o(a,n,i){if(a.hovertemplate)return;var s=n.hi||a.hoverinfo,h=s.split("+"),c=h.indexOf("all")!==-1,m=h.indexOf("lon")!==-1,p=h.indexOf("lat")!==-1,T=n.lonlat,l=[];function _(w){return w+"\xB0"}return c||m&&p?l.push("("+_(T[1])+", "+_(T[0])+")"):m?l.push(i.lon+_(T[0])):p&&l.push(i.lat+_(T[1])),(c||h.indexOf("text")!==-1)&&E(n,a,l),l.join("<br>")}G.exports={hoverPoints:r,getExtraText:o}}}),NV=Xe({"src/traces/scattermap/event_data.js"(Z,G){"use strict";G.exports=function(x,S){return x.lon=S.lon,x.lat=S.lat,x}}}),UV=Xe({"src/traces/scattermap/select.js"(Z,G){"use strict";var v=sa(),x=Fu(),S=Hs().BADNUM;G.exports=function(e,t){var r=e.cd,o=e.xaxis,a=e.yaxis,n=[],i=r[0].trace,s;if(!x.hasMarkers(i))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=[v.modHalf(c[0],360),c[1]],p=[o.c2p(m),a.c2p(m)];t.contains(p,null,s,e)?(n.push({pointNumber:s,lon:c[0],lat:c[1]}),h.selected=1):h.selected=0}}return n}}}),jV=Xe({"node_modules/maplibre-gl/dist/maplibre-gl.js"(Z,G){(function(v,x){typeof Z=="object"&&typeof G<"u"?G.exports=x():(v=typeof globalThis<"u"?globalThis:v||self,v.maplibregl=x())})(Z,function(){"use strict";var v={},x={};function S(e,t,r){if(x[e]=r,e==="index"){var o="var sharedModule = {}; ("+x.shared+")(sharedModule); ("+x.worker+")(sharedModule);",a={};return x.shared(a),x.index(v,a),typeof window<"u"&&v.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),v}}S("shared",["exports"],function(e){"use strict";function t(W,D,J,pe){return new(J||(J=Promise))(function(ke,je){function We(Ut){try{Et(pe.next(Ut))}catch(or){je(or)}}function ht(Ut){try{Et(pe.throw(Ut))}catch(or){je(or)}}function Et(Ut){var or;Ut.done?ke(Ut.value):(or=Ut.value,or instanceof J?or:new J(function(Mr){Mr(or)})).then(We,ht)}Et((pe=pe.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=a;function a(W,D){this.x=W,this.y=D}a.prototype={clone:function(){return new a(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,J=W.y-this.y;return D*D+J*J},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),J=Math.sin(W),pe=J*this.x+D*this.y;return this.x=D*this.x-J*this.y,this.y=pe,this},_rotateAround:function(W,D){var J=Math.cos(W),pe=Math.sin(W),ke=D.y+pe*(this.x-D.x)+J*(this.y-D.y);return this.x=D.x+J*(this.x-D.x)-pe*(this.y-D.y),this.y=ke,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(W){return W instanceof a?W:Array.isArray(W)?new a(W[0],W[1]):W};var n=r(o),i=s;function s(W,D,J,pe){this.cx=3*W,this.bx=3*(J-W)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*D,this.by=3*(pe-D)-this.cy,this.ay=1-this.cy-this.by,this.p1x=W,this.p1y=D,this.p2x=J,this.p2y=pe}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 J=W,pe=0;pe<8;pe++){var ke=this.sampleCurveX(J)-W;if(Math.abs(ke)<D)return J;var je=this.sampleCurveDerivativeX(J);if(Math.abs(je)<1e-6)break;J-=ke/je}var We=0,ht=1;for(J=W,pe=0;pe<20&&(ke=this.sampleCurveX(J),!(Math.abs(ke-W)<D));pe++)W>ke?We=J:ht=J,J=.5*(ht-We)+We;return J},solve:function(W,D){return this.sampleCurveY(this.solveCurveX(W,D))}};var h=r(i);let c,m;function p(){return c==null&&(c=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),c}function T(){if(m==null&&(m=!1,p())){let D=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(D){for(let pe=0;pe<5*5;pe++){let ke=4*pe;D.fillStyle=`rgb(${ke},${ke+1},${ke+2})`,D.fillRect(pe%5,Math.floor(pe/5),1,1)}let J=D.getImageData(0,0,5,5).data;for(let pe=0;pe<5*5*4;pe++)if(pe%4!=3&&J[pe]!==pe){m=!0;break}}}return m||!1}function l(W,D,J,pe){let ke=new h(W,D,J,pe);return je=>ke.solve(je)}let _=l(.25,.1,.25,1);function w(W,D,J){return Math.min(J,Math.max(D,W))}function A(W,D,J){let pe=J-D,ke=((W-D)%pe+pe)%pe+D;return ke===D?J:ke}function M(W,...D){for(let J of D)for(let pe in J)W[pe]=J[pe];return W}let g=1;function b(W,D,J){let pe={};for(let ke in W)pe[ke]=D.call(this,W[ke],ke,W);return pe}function d(W,D,J){let pe={};for(let ke in W)D.call(this,W[ke],ke,W)&&(pe[ke]=W[ke]);return pe}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,J){return(J.y-W.y)*(D.x-W.x)>(D.y-W.y)*(J.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 O(W,D,J,pe,ke){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 ht=We.startsWith("BGR"),Et=new Uint8ClampedArray(pe*ke*4);if(yield je.copyTo(Et,function(Ut,or,Mr,zr,Wr){let ia=4*Math.max(-or,0),ha=(Math.max(0,Mr)-Mr)*zr*4+ia,ja=4*zr,Ka=Math.max(0,or),Wi=Math.max(0,Mr);return{rect:{x:Ka,y:Wi,width:Math.min(Ut.width,or+zr)-Ka,height:Math.min(Ut.height,Mr+Wr)-Wi},layout:[{offset:ha,stride:ja}]}}(W,D,J,pe,ke)),ht)for(let Ut=0;Ut<Et.length;Ut+=4){let or=Et[Ut];Et[Ut]=Et[Ut+2],Et[Ut+2]=or}return Et}finally{je.close()}})}let P,U,B="AbortError";function X(){return new Error(B)}let $={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 $.REGISTERED_PROTOCOLS[W.substring(0,W.indexOf("://"))]}let le="global-dispatcher";class fe extends Error{constructor(D,J,pe,ke){super(`AJAXError: ${J} (${D}): ${pe}`),this.status=D,this.statusText=J,this.url=pe,this.body=ke}}let V=()=>L(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Y=function(W,D){if(/:\/\//.test(W.url)&&!/^https?:|^file:/.test(W.url)){let pe=se(W.url);if(pe)return pe(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(J=W.url)||/^file:/.test(V())&&!/^\w+:/.test(J))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(pe,ke){return t(this,void 0,void 0,function*(){let je=new Request(pe.url,{method:pe.method||"GET",body:pe.body,credentials:pe.credentials,headers:pe.headers,cache:pe.cache,referrer:V(),signal:ke.signal});pe.type!=="json"||je.headers.has("Accept")||je.headers.set("Accept","application/json");let We=yield fetch(je);if(!We.ok){let Ut=yield We.blob();throw new fe(We.status,We.statusText,pe.url,Ut)}let ht;ht=pe.type==="arrayBuffer"||pe.type==="image"?We.arrayBuffer():pe.type==="json"?We.json():We.text();let Et=yield ht;if(ke.signal.aborted)throw X();return{data:Et,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 J;return function(pe,ke){return new Promise((je,We)=>{var ht;let Et=new XMLHttpRequest;Et.open(pe.method||"GET",pe.url,!0),pe.type!=="arrayBuffer"&&pe.type!=="image"||(Et.responseType="arraybuffer");for(let Ut in pe.headers)Et.setRequestHeader(Ut,pe.headers[Ut]);pe.type==="json"&&(Et.responseType="text",!((ht=pe.headers)===null||ht===void 0)&&ht.Accept||Et.setRequestHeader("Accept","application/json")),Et.withCredentials=pe.credentials==="include",Et.onerror=()=>{We(new Error(Et.statusText))},Et.onload=()=>{if(!ke.signal.aborted)if((Et.status>=200&&Et.status<300||Et.status===0)&&Et.response!==null){let Ut=Et.response;if(pe.type==="json")try{Ut=JSON.parse(Et.response)}catch(or){return void We(or)}je({data:Ut,cacheControl:Et.getResponseHeader("Cache-Control"),expires:Et.getResponseHeader("Expires")})}else{let Ut=new Blob([Et.response],{type:Et.getResponseHeader("Content-Type")});We(new fe(Et.status,Et.statusText,pe.url,Ut))}},ke.signal.addEventListener("abort",()=>{Et.abort(),We(X())}),Et.send(pe.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),J=window.location;return D.protocol===J.protocol&&D.host===J.host}function q(W,D,J){J[W]&&J[W].indexOf(D)!==-1||(J[W]=J[W]||[],J[W].push(D))}function oe(W,D,J){if(J&&J[W]){let pe=J[W].indexOf(D);pe!==-1&&J[W].splice(pe,1)}}class ae{constructor(D,J={}){M(this,J),this.type=D}}class j extends ae{constructor(D,J={}){super("error",M({error:D},J))}}class Q{on(D,J){return this._listeners=this._listeners||{},q(D,J,this._listeners),this}off(D,J){return oe(D,J,this._listeners),oe(D,J,this._oneTimeListeners),this}once(D,J){return J?(this._oneTimeListeners=this._oneTimeListeners||{},q(D,J,this._oneTimeListeners),this):new Promise(pe=>this.once(D,pe))}fire(D,J){typeof D=="string"&&(D=new ae(D,J||{}));let pe=D.type;if(this.listens(pe)){D.target=this;let ke=this._listeners&&this._listeners[pe]?this._listeners[pe].slice():[];for(let ht of ke)ht.call(this,D);let je=this._oneTimeListeners&&this._oneTimeListeners[pe]?this._oneTimeListeners[pe].slice():[];for(let ht of je)oe(pe,ht,this._oneTimeListeners),ht.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,J){return this._eventedParent=D,this._eventedParentData=J,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 ce=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function be(W,D){let J={};for(let pe in W)pe!=="ref"&&(J[pe]=W[pe]);return ce.forEach(pe=>{pe in D&&(J[pe]=D[pe])}),J}function Ae(W,D){if(Array.isArray(W)){if(!Array.isArray(D)||W.length!==D.length)return!1;for(let J=0;J<W.length;J++)if(!Ae(W[J],D[J]))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 J in W)if(!Ae(W[J],D[J]))return!1;return!0}return W===D}function De(W,D){W.push(D)}function ze(W,D,J){De(J,{command:"addSource",args:[W,D[W]]})}function Ze(W,D,J){De(D,{command:"removeSource",args:[W]}),J[W]=!0}function at(W,D,J,pe){Ze(W,J,pe),ze(W,D,J)}function nt(W,D,J){let pe;for(pe in W[J])if(Object.prototype.hasOwnProperty.call(W[J],pe)&&pe!=="data"&&!Ae(W[J][pe],D[J][pe]))return!1;for(pe in D[J])if(Object.prototype.hasOwnProperty.call(D[J],pe)&&pe!=="data"&&!Ae(W[J][pe],D[J][pe]))return!1;return!0}function rt(W,D,J,pe,ke,je){W=W||{},D=D||{};for(let We in W)Object.prototype.hasOwnProperty.call(W,We)&&(Ae(W[We],D[We])||J.push({command:je,args:[pe,We,D[We],ke]}));for(let We in D)Object.prototype.hasOwnProperty.call(D,We)&&!Object.prototype.hasOwnProperty.call(W,We)&&(Ae(W[We],D[We])||J.push({command:je,args:[pe,We,D[We],ke]}))}function st(W){return W.id}function Me(W,D){return W[D.id]=D,W}class ye{constructor(D,J,pe,ke){this.message=(D?`${D}: `:"")+pe,ke&&(this.identifier=ke),J!=null&&J.__line__&&(this.line=J.__line__)}}function he(W,...D){for(let J of D)for(let pe in J)W[pe]=J[pe];return W}class Oe extends Error{constructor(D,J){super(J),this.message=J,this.key=D}}class tt{constructor(D,J=[]){this.parent=D,this.bindings={};for(let[pe,ke]of J)this.bindings[pe]=ke}concat(D){return new tt(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 ot={kind:"null"},Qe={kind:"number"},Pt={kind:"string"},It={kind:"boolean"},qt={kind:"color"},Wt={kind:"object"},kr={kind:"value"},mr={kind:"collator"},qr={kind:"formatted"},Sr={kind:"padding"},Rr={kind:"resolvedImage"},wt={kind:"variableAnchorOffsetCollection"};function Ne(W,D){return{kind:"array",itemType:W,N:D}}function Ke(W){if(W.kind==="array"){let D=Ke(W.itemType);return typeof W.N=="number"?`array<${D}, ${W.N}>`:W.itemType.kind==="value"?"array":`array<${D}>`}return W.kind}let Te=[ot,Qe,Pt,It,qt,qr,Wt,Ne(kr),Sr,Rr,wt];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 J of Te)if(!Ie(J,D))return null}}return`Expected ${Ke(W)} but found ${Ke(D)} instead.`}function Ve(W,D){return D.some(J=>J.kind===W.kind)}function Ce(W,D){return D.some(J=>J==="null"?W===null:J==="array"?Array.isArray(W):J==="object"?W&&!Array.isArray(W)&&typeof W=="object":J===typeof W)}function Ee(W,D){return W.kind==="array"&&D.kind==="array"?W.itemType.kind===D.itemType.kind&&typeof W.N=="number":W.kind===D.kind}let Pe=.96422,ft=.82521,ct=4/29,_t=6/29,Ct=3*_t*_t,ir=_t*_t*_t,rr=Math.PI/180,er=180/Math.PI;function Lr(W){return(W%=360)<0&&(W+=360),W}function fa([W,D,J,pe]){let ke,je,We=Ia((.2225045*(W=Da(W))+.7168786*(D=Da(D))+.0606169*(J=Da(J)))/1);W===D&&D===J?ke=je=We:(ke=Ia((.4360747*W+.3850649*D+.1430804*J)/Pe),je=Ia((.0139322*W+.0971045*D+.7141733*J)/ft));let ht=116*We-16;return[ht<0?0:ht,500*(ke-We),200*(We-je),pe]}function Da(W){return W<=.04045?W/12.92:Math.pow((W+.055)/1.055,2.4)}function Ia(W){return W>ir?Math.pow(W,1/3):W/Ct+ct}function qa([W,D,J,pe]){let ke=(W+16)/116,je=isNaN(D)?ke:ke+D/500,We=isNaN(J)?ke:ke-J/200;return ke=1*Ca(ke),je=Pe*Ca(je),We=ft*Ca(We),[Wa(3.1338561*je-1.6168667*ke-.4906146*We),Wa(-.9787684*je+1.9161415*ke+.033454*We),Wa(.0719453*je-.2289914*ke+1.4052427*We),pe]}function Wa(W){return(W=W<=.00304?12.92*W:1.055*Math.pow(W,1/2.4)-.055)<0?0:W>1?1:W}function Ca(W){return W>_t?W*W*W:Ct*(W-ct)}function hi(W){return parseInt(W.padEnd(2,W),16)/255}function wi(W,D){return Kt(D?W/100:W,0,1)}function Kt(W,D,J){return Math.min(Math.max(D,W),J)}function Ft(W){return!W.some(Number.isNaN)}let Yt={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,J,pe,ke=1,je=!0){this.r=D,this.g=J,this.b=pe,this.a=ke,je||(this.r*=ke,this.g*=ke,this.b*=ke,ke||this.overwriteGetter("rgb",[D,J,pe,ke]))}static parse(D){if(D instanceof Jt)return D;if(typeof D!="string")return;let J=function(pe){if((pe=pe.toLowerCase().trim())==="transparent")return[0,0,0,0];let ke=Yt[pe];if(ke){let[We,ht,Et]=ke;return[We/255,ht/255,Et/255,1]}if(pe.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(pe)){let We=pe.length<6?1:2,ht=1;return[hi(pe.slice(ht,ht+=We)),hi(pe.slice(ht,ht+=We)),hi(pe.slice(ht,ht+=We)),hi(pe.slice(ht,ht+We)||"ff")]}if(pe.startsWith("rgb")){let We=pe.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(We){let[ht,Et,Ut,or,Mr,zr,Wr,ia,ha,ja,Ka,Wi]=We,gi=[or||" ",Wr||" ",ja].join("");if(gi===" "||gi===" /"||gi===",,"||gi===",,,"){let qi=[Ut,zr,ha].join(""),en=qi==="%%%"?100:qi===""?255:0;if(en){let qn=[Kt(+Et/en,0,1),Kt(+Mr/en,0,1),Kt(+ia/en,0,1),Ka?wi(+Ka,Wi):1];if(Ft(qn))return qn}}return}}let je=pe.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(je){let[We,ht,Et,Ut,or,Mr,zr,Wr,ia]=je,ha=[Et||" ",or||" ",zr].join("");if(ha===" "||ha===" /"||ha===",,"||ha===",,,"){let ja=[+ht,Kt(+Ut,0,100),Kt(+Mr,0,100),Wr?wi(+Wr,ia):1];if(Ft(ja))return function([Ka,Wi,gi,qi]){function en(qn){let Eo=(qn+Ka/30)%12,ys=Wi*Math.min(gi,1-gi);return gi-ys*Math.max(-1,Math.min(Eo-3,9-Eo,1))}return Ka=Lr(Ka),Wi/=100,gi/=100,[en(0),en(8),en(4),qi]}(ja)}}}(D);return J?new Jt(...J,!1):void 0}get rgb(){let{r:D,g:J,b:pe,a:ke}=this,je=ke||1/0;return this.overwriteGetter("rgb",[D/je,J/je,pe/je,ke])}get hcl(){return this.overwriteGetter("hcl",function(D){let[J,pe,ke,je]=fa(D),We=Math.sqrt(pe*pe+ke*ke);return[Math.round(1e4*We)?Lr(Math.atan2(ke,pe)*er):NaN,We,J,je]}(this.rgb))}get lab(){return this.overwriteGetter("lab",fa(this.rgb))}overwriteGetter(D,J){return Object.defineProperty(this,D,{value:J}),J}toString(){let[D,J,pe,ke]=this.rgb;return`rgba(${[D,J,pe].map(je=>Math.round(255*je)).join(",")},${ke})`}}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 Fr{constructor(D,J,pe){this.sensitivity=D?J?"variant":"case":J?"accent":"base",this.locale=pe,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(D,J){return this.collator.compare(D,J)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ta{constructor(D,J,pe,ke,je){this.text=D,this.image=J,this.scale=pe,this.fontStack=ke,this.textColor=je}}class ra{constructor(D){this.sections=D}static fromString(D){return new ra([new ta(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 ra?D:ra.fromString(D)}toString(){return this.sections.length===0?"":this.sections.map(D=>D.text).join("")}}class ca{constructor(D){this.values=D.slice()}static parse(D){if(D instanceof ca)return D;if(typeof D=="number")return new ca([D,D,D,D]);if(Array.isArray(D)&&!(D.length<1||D.length>4)){for(let J of D)if(typeof J!="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 ca(D)}}toString(){return JSON.stringify(this.values)}}let Ba=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class $a{constructor(D){this.values=D.slice()}static parse(D){if(D instanceof $a)return D;if(Array.isArray(D)&&!(D.length<1)&&D.length%2==0){for(let J=0;J<D.length;J+=2){let pe=D[J],ke=D[J+1];if(typeof pe!="string"||!Ba.has(pe)||!Array.isArray(ke)||ke.length!==2||typeof ke[0]!="number"||typeof ke[1]!="number")return}return new $a(D)}}toString(){return JSON.stringify(this.values)}}class Za{constructor(D){this.name=D.name,this.available=D.available}toString(){return this.name}static fromString(D){return D?new Za({name:D,available:!1}):null}}function ri(W,D,J,pe){return typeof W=="number"&&W>=0&&W<=255&&typeof D=="number"&&D>=0&&D<=255&&typeof J=="number"&&J>=0&&J<=255?pe===void 0||typeof pe=="number"&&pe>=0&&pe<=1?null:`Invalid rgba value [${[W,D,J,pe].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof pe=="number"?[W,D,J,pe]:[W,D,J]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function pi(W){if(W===null||typeof W=="string"||typeof W=="boolean"||typeof W=="number"||W instanceof Jt||W instanceof Fr||W instanceof ra||W instanceof ca||W instanceof $a||W instanceof Za)return!0;if(Array.isArray(W)){for(let D of W)if(!pi(D))return!1;return!0}if(typeof W=="object"){for(let D in W)if(!pi(W[D]))return!1;return!0}return!1}function Ra(W){if(W===null)return ot;if(typeof W=="string")return Pt;if(typeof W=="boolean")return It;if(typeof W=="number")return Qe;if(W instanceof Jt)return qt;if(W instanceof Fr)return mr;if(W instanceof ra)return qr;if(W instanceof ca)return Sr;if(W instanceof $a)return wt;if(W instanceof Za)return Rr;if(Array.isArray(W)){let D=W.length,J;for(let pe of W){let ke=Ra(pe);if(J){if(J===ke)continue;J=kr;break}J=ke}return Ne(J||kr,D)}return Wt}function tn(W){let D=typeof W;return W===null?"":D==="string"||D==="number"||D==="boolean"?String(W):W instanceof Jt||W instanceof ra||W instanceof ca||W instanceof $a||W instanceof Za?W.toString():JSON.stringify(W)}class on{constructor(D,J){this.type=D,this.value=J}static parse(D,J){if(D.length!==2)return J.error(`'literal' expression requires exactly one argument, but found ${D.length-1} instead.`);if(!pi(D[1]))return J.error("invalid value");let pe=D[1],ke=Ra(pe),je=J.expectedType;return ke.kind!=="array"||ke.N!==0||!je||je.kind!=="array"||typeof je.N=="number"&&je.N!==0||(ke=je),new on(ke,pe)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class hn{constructor(D){this.name="ExpressionEvaluationError",this.message=D}toJSON(){return this.message}}let Tt={string:Pt,number:Qe,boolean:It,object:Wt};class ut{constructor(D,J){this.type=D,this.args=J}static parse(D,J){if(D.length<2)return J.error("Expected at least one argument.");let pe,ke=1,je=D[0];if(je==="array"){let ht,Et;if(D.length>2){let Ut=D[1];if(typeof Ut!="string"||!(Ut in Tt)||Ut==="object")return J.error('The item type argument of "array" must be one of string, number, boolean',1);ht=Tt[Ut],ke++}else ht=kr;if(D.length>3){if(D[2]!==null&&(typeof D[2]!="number"||D[2]<0||D[2]!==Math.floor(D[2])))return J.error('The length argument to "array" must be a positive integer literal',2);Et=D[2],ke++}pe=Ne(ht,Et)}else{if(!Tt[je])throw new Error(`Types doesn't contain name = ${je}`);pe=Tt[je]}let We=[];for(;ke<D.length;ke++){let ht=J.parse(D[ke],ke,kr);if(!ht)return null;We.push(ht)}return new ut(pe,We)}evaluate(D){for(let J=0;J<this.args.length;J++){let pe=this.args[J].evaluate(D);if(!Ie(this.type,Ra(pe)))return pe;if(J===this.args.length-1)throw new hn(`Expected value to be of type ${Ke(this.type)}, but found ${Ke(Ra(pe))} instead.`)}throw new Error}eachChild(D){this.args.forEach(D)}outputDefined(){return this.args.every(D=>D.outputDefined())}}let Br={"to-boolean":It,"to-color":qt,"to-number":Qe,"to-string":Pt};class Cr{constructor(D,J){this.type=D,this.args=J}static parse(D,J){if(D.length<2)return J.error("Expected at least one argument.");let pe=D[0];if(!Br[pe])throw new Error(`Can't parse ${pe} as it is not part of the known types`);if((pe==="to-boolean"||pe==="to-string")&&D.length!==2)return J.error("Expected one argument.");let ke=Br[pe],je=[];for(let We=1;We<D.length;We++){let ht=J.parse(D[We],We,kr);if(!ht)return null;je.push(ht)}return new Cr(ke,je)}evaluate(D){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(D);case"color":{let J,pe;for(let ke of this.args){if(J=ke.evaluate(D),pe=null,J instanceof Jt)return J;if(typeof J=="string"){let je=D.parseColor(J);if(je)return je}else if(Array.isArray(J)&&(pe=J.length<3||J.length>4?`Invalid rbga value ${JSON.stringify(J)}: expected an array containing either three or four numeric values.`:ri(J[0],J[1],J[2],J[3]),!pe))return new Jt(J[0]/255,J[1]/255,J[2]/255,J[3])}throw new hn(pe||`Could not parse color from value '${typeof J=="string"?J:JSON.stringify(J)}'`)}case"padding":{let J;for(let pe of this.args){J=pe.evaluate(D);let ke=ca.parse(J);if(ke)return ke}throw new hn(`Could not parse padding from value '${typeof J=="string"?J:JSON.stringify(J)}'`)}case"variableAnchorOffsetCollection":{let J;for(let pe of this.args){J=pe.evaluate(D);let ke=$a.parse(J);if(ke)return ke}throw new hn(`Could not parse variableAnchorOffsetCollection from value '${typeof J=="string"?J:JSON.stringify(J)}'`)}case"number":{let J=null;for(let pe of this.args){if(J=pe.evaluate(D),J===null)return 0;let ke=Number(J);if(!isNaN(ke))return ke}throw new hn(`Could not convert ${JSON.stringify(J)} to number.`)}case"formatted":return ra.fromString(tn(this.args[0].evaluate(D)));case"resolvedImage":return Za.fromString(tn(this.args[0].evaluate(D)));default:return tn(this.args[0].evaluate(D))}}eachChild(D){this.args.forEach(D)}outputDefined(){return this.args.every(D=>D.outputDefined())}}let xr=["Unknown","Point","LineString","Polygon"];class Ir{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"?xr[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 J=this._parseColorCache[D];return J||(J=this._parseColorCache[D]=Jt.parse(D)),J}}class Ur{constructor(D,J,pe=[],ke,je=new tt,We=[]){this.registry=D,this.path=pe,this.key=pe.map(ht=>`[${ht}]`).join(""),this.scope=je,this.errors=We,this.expectedType=ke,this._isConstant=J}parse(D,J,pe,ke,je={}){return J?this.concat(J,pe,ke)._parse(D,je):this._parse(D,je)}_parse(D,J){function pe(ke,je,We){return We==="assert"?new ut(je,[ke]):We==="coerce"?new Cr(je,[ke]):ke}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 ke=D[0];if(typeof ke!="string")return this.error(`Expression name must be a string, but found ${typeof ke} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let je=this.registry[ke];if(je){let We=je.parse(D,this);if(!We)return null;if(this.expectedType){let ht=this.expectedType,Et=We.type;if(ht.kind!=="string"&&ht.kind!=="number"&&ht.kind!=="boolean"&&ht.kind!=="object"&&ht.kind!=="array"||Et.kind!=="value")if(ht.kind!=="color"&&ht.kind!=="formatted"&&ht.kind!=="resolvedImage"||Et.kind!=="value"&&Et.kind!=="string")if(ht.kind!=="padding"||Et.kind!=="value"&&Et.kind!=="number"&&Et.kind!=="array")if(ht.kind!=="variableAnchorOffsetCollection"||Et.kind!=="value"&&Et.kind!=="array"){if(this.checkSubtype(ht,Et))return null}else We=pe(We,ht,J.typeAnnotation||"coerce");else We=pe(We,ht,J.typeAnnotation||"coerce");else We=pe(We,ht,J.typeAnnotation||"coerce");else We=pe(We,ht,J.typeAnnotation||"assert")}if(!(We instanceof on)&&We.type.kind!=="resolvedImage"&&this._isConstant(We)){let ht=new Ir;try{We=new on(We.type,We.evaluate(ht))}catch(Et){return this.error(Et.message),null}}return We}return this.error(`Unknown expression "${ke}". 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,J,pe){let ke=typeof D=="number"?this.path.concat(D):this.path,je=pe?this.scope.concat(pe):this.scope;return new Ur(this.registry,this._isConstant,ke,J||null,je,this.errors)}error(D,...J){let pe=`${this.key}${J.map(ke=>`[${ke}]`).join("")}`;this.errors.push(new Oe(pe,D))}checkSubtype(D,J){let pe=Ie(D,J);return pe&&this.error(pe),pe}}class Hr{constructor(D,J){this.type=J.type,this.bindings=[].concat(D),this.result=J}evaluate(D){return this.result.evaluate(D)}eachChild(D){for(let J of this.bindings)D(J[1]);D(this.result)}static parse(D,J){if(D.length<4)return J.error(`Expected at least 3 arguments, but found ${D.length-1} instead.`);let pe=[];for(let je=1;je<D.length-1;je+=2){let We=D[je];if(typeof We!="string")return J.error(`Expected string, but found ${typeof We} instead.`,je);if(/[^a-zA-Z0-9_]/.test(We))return J.error("Variable names must contain only alphanumeric characters or '_'.",je);let ht=J.parse(D[je+1],je+1);if(!ht)return null;pe.push([We,ht])}let ke=J.parse(D[D.length-1],D.length-1,J.expectedType,pe);return ke?new Hr(pe,ke):null}outputDefined(){return this.result.outputDefined()}}class xt{constructor(D,J){this.type=J.type,this.name=D,this.boundExpression=J}static parse(D,J){if(D.length!==2||typeof D[1]!="string")return J.error("'var' expression requires exactly one string literal argument.");let pe=D[1];return J.scope.has(pe)?new xt(pe,J.scope.get(pe)):J.error(`Unknown variable "${pe}". Make sure "${pe}" 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,J,pe){this.type=D,this.index=J,this.input=pe}static parse(D,J){if(D.length!==3)return J.error(`Expected 2 arguments, but found ${D.length-1} instead.`);let pe=J.parse(D[1],1,Qe),ke=J.parse(D[2],2,Ne(J.expectedType||kr));return pe&&ke?new Xt(ke.type.itemType,pe,ke):null}evaluate(D){let J=this.index.evaluate(D),pe=this.input.evaluate(D);if(J<0)throw new hn(`Array index out of bounds: ${J} < 0.`);if(J>=pe.length)throw new hn(`Array index out of bounds: ${J} > ${pe.length-1}.`);if(J!==Math.floor(J))throw new hn(`Array index must be an integer, but found ${J} instead.`);return pe[J]}eachChild(D){D(this.index),D(this.input)}outputDefined(){return!1}}class vr{constructor(D,J){this.type=It,this.needle=D,this.haystack=J}static parse(D,J){if(D.length!==3)return J.error(`Expected 2 arguments, but found ${D.length-1} instead.`);let pe=J.parse(D[1],1,kr),ke=J.parse(D[2],2,kr);return pe&&ke?Ve(pe.type,[It,Pt,Qe,ot,kr])?new vr(pe,ke):J.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(pe.type)} instead`):null}evaluate(D){let J=this.needle.evaluate(D),pe=this.haystack.evaluate(D);if(!pe)return!1;if(!Ce(J,["boolean","string","number","null"]))throw new hn(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(Ra(J))} instead.`);if(!Ce(pe,["string","array"]))throw new hn(`Expected second argument to be of type array or string, but found ${Ke(Ra(pe))} instead.`);return pe.indexOf(J)>=0}eachChild(D){D(this.needle),D(this.haystack)}outputDefined(){return!0}}class Or{constructor(D,J,pe){this.type=Qe,this.needle=D,this.haystack=J,this.fromIndex=pe}static parse(D,J){if(D.length<=2||D.length>=5)return J.error(`Expected 3 or 4 arguments, but found ${D.length-1} instead.`);let pe=J.parse(D[1],1,kr),ke=J.parse(D[2],2,kr);if(!pe||!ke)return null;if(!Ve(pe.type,[It,Pt,Qe,ot,kr]))return J.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(pe.type)} instead`);if(D.length===4){let je=J.parse(D[3],3,Qe);return je?new Or(pe,ke,je):null}return new Or(pe,ke)}evaluate(D){let J=this.needle.evaluate(D),pe=this.haystack.evaluate(D);if(!Ce(J,["boolean","string","number","null"]))throw new hn(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(Ra(J))} instead.`);let ke;if(this.fromIndex&&(ke=this.fromIndex.evaluate(D)),Ce(pe,["string"])){let je=pe.indexOf(J,ke);return je===-1?-1:[...pe.slice(0,je)].length}if(Ce(pe,["array"]))return pe.indexOf(J,ke);throw new hn(`Expected second argument to be of type array or string, but found ${Ke(Ra(pe))} instead.`)}eachChild(D){D(this.needle),D(this.haystack),this.fromIndex&&D(this.fromIndex)}outputDefined(){return!1}}class ba{constructor(D,J,pe,ke,je,We){this.inputType=D,this.type=J,this.input=pe,this.cases=ke,this.outputs=je,this.otherwise=We}static parse(D,J){if(D.length<5)return J.error(`Expected at least 4 arguments, but found only ${D.length-1}.`);if(D.length%2!=1)return J.error("Expected an even number of arguments.");let pe,ke;J.expectedType&&J.expectedType.kind!=="value"&&(ke=J.expectedType);let je={},We=[];for(let Ut=2;Ut<D.length-1;Ut+=2){let or=D[Ut],Mr=D[Ut+1];Array.isArray(or)||(or=[or]);let zr=J.concat(Ut);if(or.length===0)return zr.error("Expected at least one branch label.");for(let ia of or){if(typeof ia!="number"&&typeof ia!="string")return zr.error("Branch labels must be numbers or strings.");if(typeof ia=="number"&&Math.abs(ia)>Number.MAX_SAFE_INTEGER)return zr.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ia=="number"&&Math.floor(ia)!==ia)return zr.error("Numeric branch labels must be integer values.");if(pe){if(zr.checkSubtype(pe,Ra(ia)))return null}else pe=Ra(ia);if(je[String(ia)]!==void 0)return zr.error("Branch labels must be unique.");je[String(ia)]=We.length}let Wr=J.parse(Mr,Ut,ke);if(!Wr)return null;ke=ke||Wr.type,We.push(Wr)}let ht=J.parse(D[1],1,kr);if(!ht)return null;let Et=J.parse(D[D.length-1],D.length-1,ke);return Et?ht.type.kind!=="value"&&J.concat(1).checkSubtype(pe,ht.type)?null:new ba(pe,ke,ht,je,We,Et):null}evaluate(D){let J=this.input.evaluate(D);return(Ra(J)===this.inputType&&this.outputs[this.cases[J]]||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 Pa{constructor(D,J,pe){this.type=D,this.branches=J,this.otherwise=pe}static parse(D,J){if(D.length<4)return J.error(`Expected at least 3 arguments, but found only ${D.length-1}.`);if(D.length%2!=0)return J.error("Expected an odd number of arguments.");let pe;J.expectedType&&J.expectedType.kind!=="value"&&(pe=J.expectedType);let ke=[];for(let We=1;We<D.length-1;We+=2){let ht=J.parse(D[We],We,It);if(!ht)return null;let Et=J.parse(D[We+1],We+1,pe);if(!Et)return null;ke.push([ht,Et]),pe=pe||Et.type}let je=J.parse(D[D.length-1],D.length-1,pe);if(!je)return null;if(!pe)throw new Error("Can't infer output type");return new Pa(pe,ke,je)}evaluate(D){for(let[J,pe]of this.branches)if(J.evaluate(D))return pe.evaluate(D);return this.otherwise.evaluate(D)}eachChild(D){for(let[J,pe]of this.branches)D(J),D(pe);D(this.otherwise)}outputDefined(){return this.branches.every(([D,J])=>J.outputDefined())&&this.otherwise.outputDefined()}}class ya{constructor(D,J,pe,ke){this.type=D,this.input=J,this.beginIndex=pe,this.endIndex=ke}static parse(D,J){if(D.length<=2||D.length>=5)return J.error(`Expected 3 or 4 arguments, but found ${D.length-1} instead.`);let pe=J.parse(D[1],1,kr),ke=J.parse(D[2],2,Qe);if(!pe||!ke)return null;if(!Ve(pe.type,[Ne(kr),Pt,kr]))return J.error(`Expected first argument to be of type array or string, but found ${Ke(pe.type)} instead`);if(D.length===4){let je=J.parse(D[3],3,Qe);return je?new ya(pe.type,pe,ke,je):null}return new ya(pe.type,pe,ke)}evaluate(D){let J=this.input.evaluate(D),pe=this.beginIndex.evaluate(D),ke;if(this.endIndex&&(ke=this.endIndex.evaluate(D)),Ce(J,["string"]))return[...J].slice(pe,ke).join("");if(Ce(J,["array"]))return J.slice(pe,ke);throw new hn(`Expected first argument to be of type array or string, but found ${Ke(Ra(J))} instead.`)}eachChild(D){D(this.input),D(this.beginIndex),this.endIndex&&D(this.endIndex)}outputDefined(){return!1}}function la(W,D){let J=W.length-1,pe,ke,je=0,We=J,ht=0;for(;je<=We;)if(ht=Math.floor((je+We)/2),pe=W[ht],ke=W[ht+1],pe<=D){if(ht===J||D<ke)return ht;je=ht+1}else{if(!(pe>D))throw new hn("Input is not a number.");We=ht-1}return 0}class Ta{constructor(D,J,pe){this.type=D,this.input=J,this.labels=[],this.outputs=[];for(let[ke,je]of pe)this.labels.push(ke),this.outputs.push(je)}static parse(D,J){if(D.length-1<4)return J.error(`Expected at least 4 arguments, but found only ${D.length-1}.`);if((D.length-1)%2!=0)return J.error("Expected an even number of arguments.");let pe=J.parse(D[1],1,Qe);if(!pe)return null;let ke=[],je=null;J.expectedType&&J.expectedType.kind!=="value"&&(je=J.expectedType);for(let We=1;We<D.length;We+=2){let ht=We===1?-1/0:D[We],Et=D[We+1],Ut=We,or=We+1;if(typeof ht!="number")return J.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',Ut);if(ke.length&&ke[ke.length-1][0]>=ht)return J.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',Ut);let Mr=J.parse(Et,or,je);if(!Mr)return null;je=je||Mr.type,ke.push([ht,Mr])}return new Ta(je,pe,ke)}evaluate(D){let J=this.labels,pe=this.outputs;if(J.length===1)return pe[0].evaluate(D);let ke=this.input.evaluate(D);if(ke<=J[0])return pe[0].evaluate(D);let je=J.length;return ke>=J[je-1]?pe[je-1].evaluate(D):pe[la(J,ke)].evaluate(D)}eachChild(D){D(this.input);for(let J of this.outputs)D(J)}outputDefined(){return this.outputs.every(D=>D.outputDefined())}}function Ai(W){return W&&W.__esModule&&Object.prototype.hasOwnProperty.call(W,"default")?W.default:W}var ki=Ki;function Ki(W,D,J,pe){this.cx=3*W,this.bx=3*(J-W)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*D,this.by=3*(pe-D)-this.cy,this.ay=1-this.cy-this.by,this.p1x=W,this.p1y=D,this.p2x=J,this.p2y=pe}Ki.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 J=W,pe=0;pe<8;pe++){var ke=this.sampleCurveX(J)-W;if(Math.abs(ke)<D)return J;var je=this.sampleCurveDerivativeX(J);if(Math.abs(je)<1e-6)break;J-=ke/je}var We=0,ht=1;for(J=W,pe=0;pe<20&&(ke=this.sampleCurveX(J),!(Math.abs(ke-W)<D));pe++)W>ke?We=J:ht=J,J=.5*(ht-We)+We;return J},solve:function(W,D){return this.sampleCurveY(this.solveCurveX(W,D))}};var _n=Ai(ki);function Rn(W,D,J){return W+J*(D-W)}function En(W,D,J){return W.map((pe,ke)=>Rn(pe,D[ke],J))}let On={number:Rn,color:function(W,D,J,pe="rgb"){switch(pe){case"rgb":{let[ke,je,We,ht]=En(W.rgb,D.rgb,J);return new Jt(ke,je,We,ht,!1)}case"hcl":{let[ke,je,We,ht]=W.hcl,[Et,Ut,or,Mr]=D.hcl,zr,Wr;if(isNaN(ke)||isNaN(Et))isNaN(ke)?isNaN(Et)?zr=NaN:(zr=Et,We!==1&&We!==0||(Wr=Ut)):(zr=ke,or!==1&&or!==0||(Wr=je));else{let Wi=Et-ke;Et>ke&&Wi>180?Wi-=360:Et<ke&&ke-Et>180&&(Wi+=360),zr=ke+J*Wi}let[ia,ha,ja,Ka]=function([Wi,gi,qi,en]){return Wi=isNaN(Wi)?0:Wi*rr,qa([qi,Math.cos(Wi)*gi,Math.sin(Wi)*gi,en])}([zr,Wr??Rn(je,Ut,J),Rn(We,or,J),Rn(ht,Mr,J)]);return new Jt(ia,ha,ja,Ka,!1)}case"lab":{let[ke,je,We,ht]=qa(En(W.lab,D.lab,J));return new Jt(ke,je,We,ht,!1)}}},array:En,padding:function(W,D,J){return new ca(En(W.values,D.values,J))},variableAnchorOffsetCollection:function(W,D,J){let pe=W.values,ke=D.values;if(pe.length!==ke.length)throw new hn(`Cannot interpolate values of different length. from: ${W.toString()}, to: ${D.toString()}`);let je=[];for(let We=0;We<pe.length;We+=2){if(pe[We]!==ke[We])throw new hn(`Cannot interpolate values containing mismatched anchors. from[${We}]: ${pe[We]}, to[${We}]: ${ke[We]}`);je.push(pe[We]);let[ht,Et]=pe[We+1],[Ut,or]=ke[We+1];je.push([Rn(ht,Ut,J),Rn(Et,or,J)])}return new $a(je)}};class no{constructor(D,J,pe,ke,je){this.type=D,this.operator=J,this.interpolation=pe,this.input=ke,this.labels=[],this.outputs=[];for(let[We,ht]of je)this.labels.push(We),this.outputs.push(ht)}static interpolationFactor(D,J,pe,ke){let je=0;if(D.name==="exponential")je=cn(J,D.base,pe,ke);else if(D.name==="linear")je=cn(J,1,pe,ke);else if(D.name==="cubic-bezier"){let We=D.controlPoints;je=new _n(We[0],We[1],We[2],We[3]).solve(cn(J,1,pe,ke))}return je}static parse(D,J){let[pe,ke,je,...We]=D;if(!Array.isArray(ke)||ke.length===0)return J.error("Expected an interpolation type expression.",1);if(ke[0]==="linear")ke={name:"linear"};else if(ke[0]==="exponential"){let Ut=ke[1];if(typeof Ut!="number")return J.error("Exponential interpolation requires a numeric base.",1,1);ke={name:"exponential",base:Ut}}else{if(ke[0]!=="cubic-bezier")return J.error(`Unknown interpolation type ${String(ke[0])}`,1,0);{let Ut=ke.slice(1);if(Ut.length!==4||Ut.some(or=>typeof or!="number"||or<0||or>1))return J.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);ke={name:"cubic-bezier",controlPoints:Ut}}}if(D.length-1<4)return J.error(`Expected at least 4 arguments, but found only ${D.length-1}.`);if((D.length-1)%2!=0)return J.error("Expected an even number of arguments.");if(je=J.parse(je,2,Qe),!je)return null;let ht=[],Et=null;pe==="interpolate-hcl"||pe==="interpolate-lab"?Et=qt:J.expectedType&&J.expectedType.kind!=="value"&&(Et=J.expectedType);for(let Ut=0;Ut<We.length;Ut+=2){let or=We[Ut],Mr=We[Ut+1],zr=Ut+3,Wr=Ut+4;if(typeof or!="number")return J.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',zr);if(ht.length&&ht[ht.length-1][0]>=or)return J.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',zr);let ia=J.parse(Mr,Wr,Et);if(!ia)return null;Et=Et||ia.type,ht.push([or,ia])}return Ee(Et,Qe)||Ee(Et,qt)||Ee(Et,Sr)||Ee(Et,wt)||Ee(Et,Ne(Qe))?new no(Et,pe,ke,je,ht):J.error(`Type ${Ke(Et)} is not interpolatable.`)}evaluate(D){let J=this.labels,pe=this.outputs;if(J.length===1)return pe[0].evaluate(D);let ke=this.input.evaluate(D);if(ke<=J[0])return pe[0].evaluate(D);let je=J.length;if(ke>=J[je-1])return pe[je-1].evaluate(D);let We=la(J,ke),ht=no.interpolationFactor(this.interpolation,ke,J[We],J[We+1]),Et=pe[We].evaluate(D),Ut=pe[We+1].evaluate(D);switch(this.operator){case"interpolate":return On[this.type.kind](Et,Ut,ht);case"interpolate-hcl":return On.color(Et,Ut,ht,"hcl");case"interpolate-lab":return On.color(Et,Ut,ht,"lab")}}eachChild(D){D(this.input);for(let J of this.outputs)D(J)}outputDefined(){return this.outputs.every(D=>D.outputDefined())}}function cn(W,D,J,pe){let ke=pe-J,je=W-J;return ke===0?0:D===1?je/ke:(Math.pow(D,je)-1)/(Math.pow(D,ke)-1)}class lo{constructor(D,J){this.type=D,this.args=J}static parse(D,J){if(D.length<2)return J.error("Expectected at least one argument.");let pe=null,ke=J.expectedType;ke&&ke.kind!=="value"&&(pe=ke);let je=[];for(let ht of D.slice(1)){let Et=J.parse(ht,1+je.length,pe,void 0,{typeAnnotation:"omit"});if(!Et)return null;pe=pe||Et.type,je.push(Et)}if(!pe)throw new Error("No output type");let We=ke&&je.some(ht=>Ie(ke,ht.type));return new lo(We?kr:pe,je)}evaluate(D){let J,pe=null,ke=0;for(let je of this.args)if(ke++,pe=je.evaluate(D),pe&&pe instanceof Za&&!pe.available&&(J||(J=pe.name),pe=null,ke===this.args.length&&(pe=J)),pe!==null)break;return pe}eachChild(D){this.args.forEach(D)}outputDefined(){return this.args.every(D=>D.outputDefined())}}function Wo(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 hs(W,D,J,pe){return pe.compare(D,J)===0}function Oo(W,D,J){let pe=W!=="=="&&W!=="!=";return class t7{constructor(je,We,ht){this.type=It,this.lhs=je,this.rhs=We,this.collator=ht,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 ht=je[0],Et=We.parse(je[1],1,kr);if(!Et)return null;if(!Wo(ht,Et.type))return We.concat(1).error(`"${ht}" comparisons are not supported for type '${Ke(Et.type)}'.`);let Ut=We.parse(je[2],2,kr);if(!Ut)return null;if(!Wo(ht,Ut.type))return We.concat(2).error(`"${ht}" comparisons are not supported for type '${Ke(Ut.type)}'.`);if(Et.type.kind!==Ut.type.kind&&Et.type.kind!=="value"&&Ut.type.kind!=="value")return We.error(`Cannot compare types '${Ke(Et.type)}' and '${Ke(Ut.type)}'.`);pe&&(Et.type.kind==="value"&&Ut.type.kind!=="value"?Et=new ut(Ut.type,[Et]):Et.type.kind!=="value"&&Ut.type.kind==="value"&&(Ut=new ut(Et.type,[Ut])));let or=null;if(je.length===4){if(Et.type.kind!=="string"&&Ut.type.kind!=="string"&&Et.type.kind!=="value"&&Ut.type.kind!=="value")return We.error("Cannot use collator to compare non-string types.");if(or=We.parse(je[3],3,mr),!or)return null}return new t7(Et,Ut,or)}evaluate(je){let We=this.lhs.evaluate(je),ht=this.rhs.evaluate(je);if(pe&&this.hasUntypedArgument){let Et=Ra(We),Ut=Ra(ht);if(Et.kind!==Ut.kind||Et.kind!=="string"&&Et.kind!=="number")throw new hn(`Expected arguments for "${W}" to be (string, string) or (number, number), but found (${Et.kind}, ${Ut.kind}) instead.`)}if(this.collator&&!pe&&this.hasUntypedArgument){let Et=Ra(We),Ut=Ra(ht);if(Et.kind!=="string"||Ut.kind!=="string")return D(je,We,ht)}return this.collator?J(je,We,ht,this.collator.evaluate(je)):D(je,We,ht)}eachChild(je){je(this.lhs),je(this.rhs),this.collator&&je(this.collator)}outputDefined(){return!0}}}let Wn=Oo("==",function(W,D,J){return D===J},hs),No=Oo("!=",function(W,D,J){return D!==J},function(W,D,J,pe){return!hs(0,D,J,pe)}),as=Oo("<",function(W,D,J){return D<J},function(W,D,J,pe){return pe.compare(D,J)<0}),Ns=Oo(">",function(W,D,J){return D>J},function(W,D,J,pe){return pe.compare(D,J)>0}),ss=Oo("<=",function(W,D,J){return D<=J},function(W,D,J,pe){return pe.compare(D,J)<=0}),uo=Oo(">=",function(W,D,J){return D>=J},function(W,D,J,pe){return pe.compare(D,J)>=0});class jn{constructor(D,J,pe){this.type=mr,this.locale=pe,this.caseSensitive=D,this.diacriticSensitive=J}static parse(D,J){if(D.length!==2)return J.error("Expected one argument.");let pe=D[1];if(typeof pe!="object"||Array.isArray(pe))return J.error("Collator options argument must be an object.");let ke=J.parse(pe["case-sensitive"]!==void 0&&pe["case-sensitive"],1,It);if(!ke)return null;let je=J.parse(pe["diacritic-sensitive"]!==void 0&&pe["diacritic-sensitive"],1,It);if(!je)return null;let We=null;return pe.locale&&(We=J.parse(pe.locale,1,Pt),!We)?null:new jn(ke,je,We)}evaluate(D){return new Fr(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 Xn{constructor(D,J,pe,ke,je){this.type=Pt,this.number=D,this.locale=J,this.currency=pe,this.minFractionDigits=ke,this.maxFractionDigits=je}static parse(D,J){if(D.length!==3)return J.error("Expected two arguments.");let pe=J.parse(D[1],1,Qe);if(!pe)return null;let ke=D[2];if(typeof ke!="object"||Array.isArray(ke))return J.error("NumberFormat options argument must be an object.");let je=null;if(ke.locale&&(je=J.parse(ke.locale,1,Pt),!je))return null;let We=null;if(ke.currency&&(We=J.parse(ke.currency,1,Pt),!We))return null;let ht=null;if(ke["min-fraction-digits"]&&(ht=J.parse(ke["min-fraction-digits"],1,Qe),!ht))return null;let Et=null;return ke["max-fraction-digits"]&&(Et=J.parse(ke["max-fraction-digits"],1,Qe),!Et)?null:new Xn(pe,je,We,ht,Et)}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 ls{constructor(D){this.type=qr,this.sections=D}static parse(D,J){if(D.length<2)return J.error("Expected at least one argument.");let pe=D[1];if(!Array.isArray(pe)&&typeof pe=="object")return J.error("First argument must be an image or text section.");let ke=[],je=!1;for(let We=1;We<=D.length-1;++We){let ht=D[We];if(je&&typeof ht=="object"&&!Array.isArray(ht)){je=!1;let Et=null;if(ht["font-scale"]&&(Et=J.parse(ht["font-scale"],1,Qe),!Et))return null;let Ut=null;if(ht["text-font"]&&(Ut=J.parse(ht["text-font"],1,Ne(Pt)),!Ut))return null;let or=null;if(ht["text-color"]&&(or=J.parse(ht["text-color"],1,qt),!or))return null;let Mr=ke[ke.length-1];Mr.scale=Et,Mr.font=Ut,Mr.textColor=or}else{let Et=J.parse(D[We],1,kr);if(!Et)return null;let Ut=Et.type.kind;if(Ut!=="string"&&Ut!=="value"&&Ut!=="null"&&Ut!=="resolvedImage")return J.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");je=!0,ke.push({content:Et,scale:null,font:null,textColor:null})}}return new ls(ke)}evaluate(D){return new ra(this.sections.map(J=>{let pe=J.content.evaluate(D);return Ra(pe)===Rr?new ta("",pe,null,null,null):new ta(tn(pe),null,J.scale?J.scale.evaluate(D):null,J.font?J.font.evaluate(D).join(","):null,J.textColor?J.textColor.evaluate(D):null)}))}eachChild(D){for(let J of this.sections)D(J.content),J.scale&&D(J.scale),J.font&&D(J.font),J.textColor&&D(J.textColor)}outputDefined(){return!1}}class Cs{constructor(D){this.type=Rr,this.input=D}static parse(D,J){if(D.length!==2)return J.error("Expected two arguments.");let pe=J.parse(D[1],1,Pt);return pe?new Cs(pe):J.error("No image name provided.")}evaluate(D){let J=this.input.evaluate(D),pe=Za.fromString(J);return pe&&D.availableImages&&(pe.available=D.availableImages.indexOf(J)>-1),pe}eachChild(D){D(this.input)}outputDefined(){return!1}}class Ks{constructor(D){this.type=Qe,this.input=D}static parse(D,J){if(D.length!==2)return J.error(`Expected 1 argument, but found ${D.length-1} instead.`);let pe=J.parse(D[1],1);return pe?pe.type.kind!=="array"&&pe.type.kind!=="string"&&pe.type.kind!=="value"?J.error(`Expected argument of type string or array, but found ${Ke(pe.type)} instead.`):new Ks(pe):null}evaluate(D){let J=this.input.evaluate(D);if(typeof J=="string")return[...J].length;if(Array.isArray(J))return J.length;throw new hn(`Expected value to be of type string or array, but found ${Ke(Ra(J))} instead.`)}eachChild(D){D(this.input)}outputDefined(){return!1}}let Xo=8192;function Gi(W,D){let J=(180+W[0])/360,pe=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+W[1]*Math.PI/360)))/360,ke=Math.pow(2,D.z);return[Math.round(J*ke*Xo),Math.round(pe*ke*Xo)]}function Ln(W,D){let J=Math.pow(2,D.z);return[(ke=(W[0]/Xo+D.x)/J,360*ke-180),(pe=(W[1]/Xo+D.y)/J,360/Math.PI*Math.atan(Math.exp((180-360*pe)*Math.PI/180))-90)];var pe,ke}function Us(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 _s(W,D){return!(W[0]<=D[0]||W[2]>=D[2]||W[1]<=D[1]||W[3]>=D[3])}function Gn(W,D,J){let pe=W[0]-D[0],ke=W[1]-D[1],je=W[0]-J[0],We=W[1]-J[1];return pe*We-je*ke==0&&pe*je<=0&&ke*We<=0}function zs(W,D,J,pe){return(ke=[pe[0]-J[0],pe[1]-J[1]])[0]*(je=[D[0]-W[0],D[1]-W[1]])[1]-ke[1]*je[0]!=0&&!(!bo(W,D,J,pe)||!bo(J,pe,W,D));var ke,je}function vs(W,D,J){for(let pe of J)for(let ke=0;ke<pe.length-1;++ke)if(zs(W,D,pe[ke],pe[ke+1]))return!0;return!1}function Ws(W,D,J=!1){let pe=!1;for(let ht of D)for(let Et=0;Et<ht.length-1;Et++){if(Gn(W,ht[Et],ht[Et+1]))return J;(je=ht[Et])[1]>(ke=W)[1]!=(We=ht[Et+1])[1]>ke[1]&&ke[0]<(We[0]-je[0])*(ke[1]-je[1])/(We[1]-je[1])+je[0]&&(pe=!pe)}var ke,je,We;return pe}function il(W,D){for(let J of D)if(Ws(W,J))return!0;return!1}function xn(W,D){for(let J of W)if(!Ws(J,D))return!1;for(let J=0;J<W.length-1;++J)if(vs(W[J],W[J+1],D))return!1;return!0}function ko(W,D){for(let J of D)if(xn(W,J))return!0;return!1}function bo(W,D,J,pe){let ke=pe[0]-J[0],je=pe[1]-J[1],We=(W[0]-J[0])*je-ke*(W[1]-J[1]),ht=(D[0]-J[0])*je-ke*(D[1]-J[1]);return We>0&&ht<0||We<0&&ht>0}function Is(W,D,J){let pe=[];for(let ke=0;ke<W.length;ke++){let je=[];for(let We=0;We<W[ke].length;We++){let ht=Gi(W[ke][We],J);Us(D,ht),je.push(ht)}pe.push(je)}return pe}function pu(W,D,J){let pe=[];for(let ke=0;ke<W.length;ke++){let je=Is(W[ke],D,J);pe.push(je)}return pe}function co(W,D,J,pe){if(W[0]<J[0]||W[0]>J[2]){let ke=.5*pe,je=W[0]-J[0]>ke?-pe:J[0]-W[0]>ke?pe:0;je===0&&(je=W[0]-J[2]>ke?-pe:J[2]-W[0]>ke?pe:0),W[0]+=je}Us(D,W)}function Vs(W,D,J,pe){let ke=Math.pow(2,pe.z)*Xo,je=[pe.x*Xo,pe.y*Xo],We=[];for(let ht of W)for(let Et of ht){let Ut=[Et.x+je[0],Et.y+je[1]];co(Ut,D,J,ke),We.push(Ut)}return We}function vl(W,D,J,pe){let ke=Math.pow(2,pe.z)*Xo,je=[pe.x*Xo,pe.y*Xo],We=[];for(let Et of W){let Ut=[];for(let or of Et){let Mr=[or.x+je[0],or.y+je[1]];Us(D,Mr),Ut.push(Mr)}We.push(Ut)}if(D[2]-D[0]<=ke/2){(ht=D)[0]=ht[1]=1/0,ht[2]=ht[3]=-1/0;for(let Et of We)for(let Ut of Et)co(Ut,D,J,ke)}var ht;return We}class Ts{constructor(D,J){this.type=It,this.geojson=D,this.geometries=J}static parse(D,J){if(D.length!==2)return J.error(`'within' expression requires exactly one argument, but found ${D.length-1} instead.`);if(pi(D[1])){let pe=D[1];if(pe.type==="FeatureCollection"){let ke=[];for(let je of pe.features){let{type:We,coordinates:ht}=je.geometry;We==="Polygon"&&ke.push(ht),We==="MultiPolygon"&&ke.push(...ht)}if(ke.length)return new Ts(pe,{type:"MultiPolygon",coordinates:ke})}else if(pe.type==="Feature"){let ke=pe.geometry.type;if(ke==="Polygon"||ke==="MultiPolygon")return new Ts(pe,pe.geometry)}else if(pe.type==="Polygon"||pe.type==="MultiPolygon")return new Ts(pe,pe)}return J.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(J,pe){let ke=[1/0,1/0,-1/0,-1/0],je=[1/0,1/0,-1/0,-1/0],We=J.canonicalID();if(pe.type==="Polygon"){let ht=Is(pe.coordinates,je,We),Et=Vs(J.geometry(),ke,je,We);if(!_s(ke,je))return!1;for(let Ut of Et)if(!Ws(Ut,ht))return!1}if(pe.type==="MultiPolygon"){let ht=pu(pe.coordinates,je,We),Et=Vs(J.geometry(),ke,je,We);if(!_s(ke,je))return!1;for(let Ut of Et)if(!il(Ut,ht))return!1}return!0}(D,this.geometries);if(D.geometryType()==="LineString")return function(J,pe){let ke=[1/0,1/0,-1/0,-1/0],je=[1/0,1/0,-1/0,-1/0],We=J.canonicalID();if(pe.type==="Polygon"){let ht=Is(pe.coordinates,je,We),Et=vl(J.geometry(),ke,je,We);if(!_s(ke,je))return!1;for(let Ut of Et)if(!xn(Ut,ht))return!1}if(pe.type==="MultiPolygon"){let ht=pu(pe.coordinates,je,We),Et=vl(J.geometry(),ke,je,We);if(!_s(ke,je))return!1;for(let Ut of Et)if(!ko(Ut,ht))return!1}return!0}(D,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let js=class{constructor(W=[],D=(J,pe)=>J<pe?-1:J>pe?1:0){if(this.data=W,this.length=this.data.length,this.compare=D,this.length>0)for(let J=(this.length>>1)-1;J>=0;J--)this._down(J)}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:J}=this,pe=D[W];for(;W>0;){let ke=W-1>>1,je=D[ke];if(J(pe,je)>=0)break;D[W]=je,W=ke}D[W]=pe}_down(W){let{data:D,compare:J}=this,pe=this.length>>1,ke=D[W];for(;W<pe;){let je=1+(W<<1),We=je+1;if(We<this.length&&J(D[We],D[je])<0&&(je=We),J(D[je],ke)>=0)break;D[W]=D[je],W=je}D[W]=ke}};function us(W,D,J,pe,ke){As(W,D,J,pe||W.length-1,ke||su)}function As(W,D,J,pe,ke){for(;pe>J;){if(pe-J>600){var je=pe-J+1,We=D-J+1,ht=Math.log(je),Et=.5*Math.exp(2*ht/3),Ut=.5*Math.sqrt(ht*Et*(je-Et)/je)*(We-je/2<0?-1:1);As(W,D,Math.max(J,Math.floor(D-We*Et/je+Ut)),Math.min(pe,Math.floor(D+(je-We)*Et/je+Ut)),ke)}var or=W[D],Mr=J,zr=pe;for(Nl(W,J,D),ke(W[pe],or)>0&&Nl(W,J,pe);Mr<zr;){for(Nl(W,Mr,zr),Mr++,zr--;ke(W[Mr],or)<0;)Mr++;for(;ke(W[zr],or)>0;)zr--}ke(W[J],or)===0?Nl(W,J,zr):Nl(W,++zr,pe),zr<=D&&(J=zr+1),D<=zr&&(pe=zr-1)}}function Nl(W,D,J){var pe=W[D];W[D]=W[J],W[J]=pe}function su(W,D){return W<D?-1:W>D?1:0}function Tc(W,D){if(W.length<=1)return[W];let J=[],pe,ke;for(let je of W){let We=Sf(je);We!==0&&(je.area=Math.abs(We),ke===void 0&&(ke=We<0),ke===We<0?(pe&&J.push(pe),pe=[je]):pe.push(je))}if(pe&&J.push(pe),D>1)for(let je=0;je<J.length;je++)J[je].length<=D||(us(J[je],D,1,J[je].length-1,du),J[je]=J[je].slice(0,D));return J}function du(W,D){return D.area-W.area}function Sf(W){let D=0;for(let J,pe,ke=0,je=W.length,We=je-1;ke<je;We=ke++)J=W[ke],pe=W[We],D+=(pe.x-J.x)*(J.y+pe.y);return D}let Uc=1/298.257223563,Fs=Uc*(2-Uc),dc=Math.PI/180;class Hc{constructor(D){let J=6378.137*dc*1e3,pe=Math.cos(D*dc),ke=1/(1-Fs*(1-pe*pe)),je=Math.sqrt(ke);this.kx=J*je*pe,this.ky=J*je*ke*(1-Fs)}distance(D,J){let pe=this.wrap(D[0]-J[0])*this.kx,ke=(D[1]-J[1])*this.ky;return Math.sqrt(pe*pe+ke*ke)}pointOnLine(D,J){let pe,ke,je,We,ht=1/0;for(let Et=0;Et<D.length-1;Et++){let Ut=D[Et][0],or=D[Et][1],Mr=this.wrap(D[Et+1][0]-Ut)*this.kx,zr=(D[Et+1][1]-or)*this.ky,Wr=0;Mr===0&&zr===0||(Wr=(this.wrap(J[0]-Ut)*this.kx*Mr+(J[1]-or)*this.ky*zr)/(Mr*Mr+zr*zr),Wr>1?(Ut=D[Et+1][0],or=D[Et+1][1]):Wr>0&&(Ut+=Mr/this.kx*Wr,or+=zr/this.ky*Wr)),Mr=this.wrap(J[0]-Ut)*this.kx,zr=(J[1]-or)*this.ky;let ia=Mr*Mr+zr*zr;ia<ht&&(ht=ia,pe=Ut,ke=or,je=Et,We=Wr)}return{point:[pe,ke],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 lu(W,D){return D[0]-W[0]}function Pl(W){return W[1]-W[0]+1}function ic(W,D){return W[1]>=W[0]&&W[1]<D}function Ou(W,D){if(W[0]>W[1])return[null,null];let J=Pl(W);if(D){if(J===2)return[W,null];let ke=Math.floor(J/2);return[[W[0],W[0]+ke],[W[0]+ke,W[1]]]}if(J===1)return[W,null];let pe=Math.floor(J/2)-1;return[[W[0],W[0]+pe],[W[0]+pe+1,W[1]]]}function nl(W,D){if(!ic(D,W.length))return[1/0,1/0,-1/0,-1/0];let J=[1/0,1/0,-1/0,-1/0];for(let pe=D[0];pe<=D[1];++pe)Us(J,W[pe]);return J}function ml(W){let D=[1/0,1/0,-1/0,-1/0];for(let J of W)for(let pe of J)Us(D,pe);return D}function xs(W){return W[0]!==-1/0&&W[1]!==-1/0&&W[2]!==1/0&&W[3]!==1/0}function Xs(W,D,J){if(!xs(W)||!xs(D))return NaN;let pe=0,ke=0;return W[2]<D[0]&&(pe=D[0]-W[2]),W[0]>D[2]&&(pe=W[0]-D[2]),W[1]>D[3]&&(ke=W[1]-D[3]),W[3]<D[1]&&(ke=D[1]-W[3]),J.distance([0,0],[pe,ke])}function nc(W,D,J){let pe=J.pointOnLine(D,W);return J.distance(W,pe.point)}function Ul(W,D,J,pe,ke){let je=Math.min(nc(W,[J,pe],ke),nc(D,[J,pe],ke)),We=Math.min(nc(J,[W,D],ke),nc(pe,[W,D],ke));return Math.min(je,We)}function qu(W,D,J,pe,ke){if(!ic(D,W.length)||!ic(pe,J.length))return 1/0;let je=1/0;for(let We=D[0];We<D[1];++We){let ht=W[We],Et=W[We+1];for(let Ut=pe[0];Ut<pe[1];++Ut){let or=J[Ut],Mr=J[Ut+1];if(zs(ht,Et,or,Mr))return 0;je=Math.min(je,Ul(ht,Et,or,Mr,ke))}}return je}function fl(W,D,J,pe,ke){if(!ic(D,W.length)||!ic(pe,J.length))return NaN;let je=1/0;for(let We=D[0];We<=D[1];++We)for(let ht=pe[0];ht<=pe[1];++ht)if(je=Math.min(je,ke.distance(W[We],J[ht])),je===0)return je;return je}function xh(W,D,J){if(Ws(W,D,!0))return 0;let pe=1/0;for(let ke of D){let je=ke[0],We=ke[ke.length-1];if(je!==We&&(pe=Math.min(pe,nc(W,[We,je],J)),pe===0))return pe;let ht=J.pointOnLine(ke,W);if(pe=Math.min(pe,J.distance(W,ht.point)),pe===0)return pe}return pe}function ns(W,D,J,pe){if(!ic(D,W.length))return NaN;for(let je=D[0];je<=D[1];++je)if(Ws(W[je],J,!0))return 0;let ke=1/0;for(let je=D[0];je<D[1];++je){let We=W[je],ht=W[je+1];for(let Et of J)for(let Ut=0,or=Et.length,Mr=or-1;Ut<or;Mr=Ut++){let zr=Et[Mr],Wr=Et[Ut];if(zs(We,ht,zr,Wr))return 0;ke=Math.min(ke,Ul(We,ht,zr,Wr,pe))}}return ke}function bh(W,D){for(let J of W)for(let pe of J)if(Ws(pe,D,!0))return!0;return!1}function Es(W,D,J,pe=1/0){let ke=ml(W),je=ml(D);if(pe!==1/0&&Xs(ke,je,J)>=pe)return pe;if(_s(ke,je)){if(bh(W,D))return 0}else if(bh(D,W))return 0;let We=1/0;for(let ht of W)for(let Et=0,Ut=ht.length,or=Ut-1;Et<Ut;or=Et++){let Mr=ht[or],zr=ht[Et];for(let Wr of D)for(let ia=0,ha=Wr.length,ja=ha-1;ia<ha;ja=ia++){let Ka=Wr[ja],Wi=Wr[ia];if(zs(Mr,zr,Ka,Wi))return 0;We=Math.min(We,Ul(Mr,zr,Ka,Wi,J))}}return We}function to(W,D,J,pe,ke,je){if(!je)return;let We=Xs(nl(pe,je),ke,J);We<D&&W.push([We,je,[0,0]])}function Wc(W,D,J,pe,ke,je,We){if(!je||!We)return;let ht=Xs(nl(pe,je),nl(ke,We),J);ht<D&&W.push([ht,je,We])}function Vu(W,D,J,pe,ke=1/0){let je=Math.min(pe.distance(W[0],J[0][0]),ke);if(je===0)return je;let We=new js([[0,[0,W.length-1],[0,0]]],lu),ht=ml(J);for(;We.length>0;){let Et=We.pop();if(Et[0]>=je)continue;let Ut=Et[1],or=D?50:100;if(Pl(Ut)<=or){if(!ic(Ut,W.length))return NaN;if(D){let Mr=ns(W,Ut,J,pe);if(isNaN(Mr)||Mr===0)return Mr;je=Math.min(je,Mr)}else for(let Mr=Ut[0];Mr<=Ut[1];++Mr){let zr=xh(W[Mr],J,pe);if(je=Math.min(je,zr),je===0)return 0}}else{let Mr=Ou(Ut,D);to(We,je,pe,W,ht,Mr[0]),to(We,je,pe,W,ht,Mr[1])}}return je}function jl(W,D,J,pe,ke,je=1/0){let We=Math.min(je,ke.distance(W[0],J[0]));if(We===0)return We;let ht=new js([[0,[0,W.length-1],[0,J.length-1]]],lu);for(;ht.length>0;){let Et=ht.pop();if(Et[0]>=We)continue;let Ut=Et[1],or=Et[2],Mr=D?50:100,zr=pe?50:100;if(Pl(Ut)<=Mr&&Pl(or)<=zr){if(!ic(Ut,W.length)&&ic(or,J.length))return NaN;let Wr;if(D&&pe)Wr=qu(W,Ut,J,or,ke),We=Math.min(We,Wr);else if(D&&!pe){let ia=W.slice(Ut[0],Ut[1]+1);for(let ha=or[0];ha<=or[1];++ha)if(Wr=nc(J[ha],ia,ke),We=Math.min(We,Wr),We===0)return We}else if(!D&&pe){let ia=J.slice(or[0],or[1]+1);for(let ha=Ut[0];ha<=Ut[1];++ha)if(Wr=nc(W[ha],ia,ke),We=Math.min(We,Wr),We===0)return We}else Wr=fl(W,Ut,J,or,ke),We=Math.min(We,Wr)}else{let Wr=Ou(Ut,D),ia=Ou(or,pe);Wc(ht,We,ke,W,J,Wr[0],ia[0]),Wc(ht,We,ke,W,J,Wr[0],ia[1]),Wc(ht,We,ke,W,J,Wr[1],ia[0]),Wc(ht,We,ke,W,J,Wr[1],ia[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 Ac{constructor(D,J){this.type=Qe,this.geojson=D,this.geometries=J}static parse(D,J){if(D.length!==2)return J.error(`'distance' expression requires exactly one argument, but found ${D.length-1} instead.`);if(pi(D[1])){let pe=D[1];if(pe.type==="FeatureCollection")return new Ac(pe,pe.features.map(ke=>Mf(ke.geometry)).flat());if(pe.type==="Feature")return new Ac(pe,Mf(pe.geometry));if("type"in pe&&"coordinates"in pe)return new Ac(pe,Mf(pe))}return J.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(J,pe){let ke=J.geometry(),je=ke.flat().map(Et=>Ln([Et.x,Et.y],J.canonical));if(ke.length===0)return NaN;let We=new Hc(je[0][1]),ht=1/0;for(let Et of pe){switch(Et.type){case"Point":ht=Math.min(ht,jl(je,!1,[Et.coordinates],!1,We,ht));break;case"LineString":ht=Math.min(ht,jl(je,!1,Et.coordinates,!0,We,ht));break;case"Polygon":ht=Math.min(ht,Vu(je,!1,Et.coordinates,We,ht))}if(ht===0)return ht}return ht}(D,this.geometries);if(D.geometryType()==="LineString")return function(J,pe){let ke=J.geometry(),je=ke.flat().map(Et=>Ln([Et.x,Et.y],J.canonical));if(ke.length===0)return NaN;let We=new Hc(je[0][1]),ht=1/0;for(let Et of pe){switch(Et.type){case"Point":ht=Math.min(ht,jl(je,!0,[Et.coordinates],!1,We,ht));break;case"LineString":ht=Math.min(ht,jl(je,!0,Et.coordinates,!0,We,ht));break;case"Polygon":ht=Math.min(ht,Vu(je,!0,Et.coordinates,We,ht))}if(ht===0)return ht}return ht}(D,this.geometries);if(D.geometryType()==="Polygon")return function(J,pe){let ke=J.geometry();if(ke.length===0||ke[0].length===0)return NaN;let je=Tc(ke,0).map(Et=>Et.map(Ut=>Ut.map(or=>Ln([or.x,or.y],J.canonical)))),We=new Hc(je[0][0][0][1]),ht=1/0;for(let Et of pe)for(let Ut of je){switch(Et.type){case"Point":ht=Math.min(ht,Vu([Et.coordinates],!1,Ut,We,ht));break;case"LineString":ht=Math.min(ht,Vu(Et.coordinates,!0,Ut,We,ht));break;case"Polygon":ht=Math.min(ht,Es(Ut,Et.coordinates,We,ht))}if(ht===0)return ht}return ht}(D,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}let nf={"==":Wn,"!=":No,">":Ns,"<":as,">=":uo,"<=":ss,array:ut,at:Xt,boolean:ut,case:Pa,coalesce:lo,collator:jn,format:ls,image:Cs,in:vr,"index-of":Or,interpolate:no,"interpolate-hcl":no,"interpolate-lab":no,length:Ks,let:Hr,literal:on,match:ba,number:ut,"number-format":Xn,object:ut,slice:ya,step:Ta,string:ut,"to-boolean":Cr,"to-color":Cr,"to-number":Cr,"to-string":Cr,var:xt,within:Ts,distance:Ac};class $l{constructor(D,J,pe,ke){this.name=D,this.type=J,this._evaluate=pe,this.args=ke}evaluate(D){return this._evaluate(D,this.args)}eachChild(D){this.args.forEach(D)}outputDefined(){return!1}static parse(D,J){let pe=D[0],ke=$l.definitions[pe];if(!ke)return J.error(`Unknown expression "${pe}". If you wanted a literal array, use ["literal", [...]].`,0);let je=Array.isArray(ke)?ke[0]:ke.type,We=Array.isArray(ke)?[[ke[1],ke[2]]]:ke.overloads,ht=We.filter(([Ut])=>!Array.isArray(Ut)||Ut.length===D.length-1),Et=null;for(let[Ut,or]of ht){Et=new Ur(J.registry,Bf,J.path,null,J.scope);let Mr=[],zr=!1;for(let Wr=1;Wr<D.length;Wr++){let ia=D[Wr],ha=Array.isArray(Ut)?Ut[Wr-1]:Ut.type,ja=Et.parse(ia,1+Mr.length,ha);if(!ja){zr=!0;break}Mr.push(ja)}if(!zr)if(Array.isArray(Ut)&&Ut.length!==Mr.length)Et.error(`Expected ${Ut.length} arguments, but found ${Mr.length} instead.`);else{for(let Wr=0;Wr<Mr.length;Wr++){let ia=Array.isArray(Ut)?Ut[Wr]:Ut.type,ha=Mr[Wr];Et.concat(Wr+1).checkSubtype(ia,ha.type)}if(Et.errors.length===0)return new $l(pe,je,or,Mr)}}if(ht.length===1)J.errors.push(...Et.errors);else{let Ut=(ht.length?ht:We).map(([Mr])=>{return zr=Mr,Array.isArray(zr)?`(${zr.map(Ke).join(", ")})`:`(${Ke(zr.type)}...)`;var zr}).join(" | "),or=[];for(let Mr=1;Mr<D.length;Mr++){let zr=J.parse(D[Mr],1+or.length);if(!zr)return null;or.push(Ke(zr.type))}J.error(`Expected arguments of type ${Ut}, but found (${or.join(", ")}) instead.`)}return null}static register(D,J){$l.definitions=J;for(let pe in J)D[pe]=$l}}function Jf(W,[D,J,pe,ke]){D=D.evaluate(W),J=J.evaluate(W),pe=pe.evaluate(W);let je=ke?ke.evaluate(W):1,We=ri(D,J,pe,je);if(We)throw new hn(We);return new Jt(D/255,J/255,pe/255,je,!1)}function Of(W,D){return W in D}function of(W,D){let J=D[W];return J===void 0?null:J}function jc(W){return{type:W}}function Bf(W){if(W instanceof xt)return Bf(W.boundExpression);if(W instanceof $l&&W.name==="error"||W instanceof jn||W instanceof Ts||W instanceof Ac)return!1;let D=W instanceof Cr||W instanceof ut,J=!0;return W.eachChild(pe=>{J=D?J&&Bf(pe):J&&pe instanceof on}),!!J&&Nf(W)&&Ef(W,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Nf(W){if(W instanceof $l&&(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 Ts||W instanceof Ac)return!1;let D=!0;return W.eachChild(J=>{D&&!Nf(J)&&(D=!1)}),D}function Gu(W){if(W instanceof $l&&W.name==="feature-state")return!1;let D=!0;return W.eachChild(J=>{D&&!Gu(J)&&(D=!1)}),D}function Ef(W,D){if(W instanceof $l&&D.indexOf(W.name)>=0)return!1;let J=!0;return W.eachChild(pe=>{J&&!Ef(pe,D)&&(J=!1)}),J}function oc(W){return{result:"success",value:W}}function Xc(W){return{result:"error",value:W}}function Ql(W){return W["property-type"]==="data-driven"||W["property-type"]==="cross-faded-data-driven"}function qc(W){return!!W.expression&&W.expression.parameters.indexOf("zoom")>-1}function Sc(W){return!!W.expression&&W.expression.interpolated}function Zs(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 fh(W){return W}function Uf(W,D){let J=D.type==="color",pe=W.stops&&typeof W.stops[0][0]=="object",ke=pe||!(pe||W.property!==void 0),je=W.type||(Sc(D)?"exponential":"interval");if(J||D.type==="padding"){let or=J?Jt.parse:ca.parse;(W=he({},W)).stops&&(W.stops=W.stops.map(Mr=>[Mr[0],or(Mr[1])])),W.default=or(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 ht,Et,Ut;if(je==="exponential")ht=jf;else if(je==="interval")ht=Cu;else if(je==="categorical"){ht=$f,Et=Object.create(null);for(let or of W.stops)Et[or[0]]=or[1];Ut=typeof W.stops[0][0]}else{if(je!=="identity")throw new Error(`Unknown function type "${je}"`);ht=yl}if(pe){let or={},Mr=[];for(let ia=0;ia<W.stops.length;ia++){let ha=W.stops[ia],ja=ha[0].zoom;or[ja]===void 0&&(or[ja]={zoom:ja,type:W.type,property:W.property,default:W.default,stops:[]},Mr.push(ja)),or[ja].stops.push([ha[0].value,ha[1]])}let zr=[];for(let ia of Mr)zr.push([or[ia].zoom,Uf(or[ia],D)]);let Wr={name:"linear"};return{kind:"composite",interpolationType:Wr,interpolationFactor:no.interpolationFactor.bind(void 0,Wr),zoomStops:zr.map(ia=>ia[0]),evaluate:({zoom:ia},ha)=>jf({stops:zr,base:W.base},D,ia).evaluate(ia,ha)}}if(ke){let or=je==="exponential"?{name:"exponential",base:W.base!==void 0?W.base:1}:null;return{kind:"camera",interpolationType:or,interpolationFactor:no.interpolationFactor.bind(void 0,or),zoomStops:W.stops.map(Mr=>Mr[0]),evaluate:({zoom:Mr})=>ht(W,D,Mr,Et,Ut)}}return{kind:"source",evaluate(or,Mr){let zr=Mr&&Mr.properties?Mr.properties[W.property]:void 0;return zr===void 0?Zc(W.default,D.default):ht(W,D,zr,Et,Ut)}}}function Zc(W,D,J){return W!==void 0?W:D!==void 0?D:J!==void 0?J:void 0}function $f(W,D,J,pe,ke){return Zc(typeof J===ke?pe[J]:void 0,W.default,D.default)}function Cu(W,D,J){if(Zs(J)!=="number")return Zc(W.default,D.default);let pe=W.stops.length;if(pe===1||J<=W.stops[0][0])return W.stops[0][1];if(J>=W.stops[pe-1][0])return W.stops[pe-1][1];let ke=la(W.stops.map(je=>je[0]),J);return W.stops[ke][1]}function jf(W,D,J){let pe=W.base!==void 0?W.base:1;if(Zs(J)!=="number")return Zc(W.default,D.default);let ke=W.stops.length;if(ke===1||J<=W.stops[0][0])return W.stops[0][1];if(J>=W.stops[ke-1][0])return W.stops[ke-1][1];let je=la(W.stops.map(or=>or[0]),J),We=function(or,Mr,zr,Wr){let ia=Wr-zr,ha=or-zr;return ia===0?0:Mr===1?ha/ia:(Math.pow(Mr,ha)-1)/(Math.pow(Mr,ia)-1)}(J,pe,W.stops[je][0],W.stops[je+1][0]),ht=W.stops[je][1],Et=W.stops[je+1][1],Ut=On[D.type]||fh;return typeof ht.evaluate=="function"?{evaluate(...or){let Mr=ht.evaluate.apply(void 0,or),zr=Et.evaluate.apply(void 0,or);if(Mr!==void 0&&zr!==void 0)return Ut(Mr,zr,We,W.colorSpace)}}:Ut(ht,Et,We,W.colorSpace)}function yl(W,D,J){switch(D.type){case"color":J=Jt.parse(J);break;case"formatted":J=ra.fromString(J.toString());break;case"resolvedImage":J=Za.fromString(J.toString());break;case"padding":J=ca.parse(J);break;default:Zs(J)===D.type||D.type==="enum"&&D.values[J]||(J=void 0)}return Zc(J,W.default,D.default)}$l.register(nf,{error:[{kind:"error"},[Pt],(W,[D])=>{throw new hn(D.evaluate(W))}],typeof:[Pt,[kr],(W,[D])=>Ke(Ra(D.evaluate(W)))],"to-rgba":[Ne(Qe,4),[qt],(W,[D])=>{let[J,pe,ke,je]=D.evaluate(W).rgb;return[255*J,255*pe,255*ke,je]}],rgb:[qt,[Qe,Qe,Qe],Jf],rgba:[qt,[Qe,Qe,Qe,Qe],Jf],has:{type:It,overloads:[[[Pt],(W,[D])=>Of(D.evaluate(W),W.properties())],[[Pt,Wt],(W,[D,J])=>Of(D.evaluate(W),J.evaluate(W))]]},get:{type:kr,overloads:[[[Pt],(W,[D])=>of(D.evaluate(W),W.properties())],[[Pt,Wt],(W,[D,J])=>of(D.evaluate(W),J.evaluate(W))]]},"feature-state":[kr,[Pt],(W,[D])=>of(D.evaluate(W),W.featureState||{})],properties:[Wt,[],W=>W.properties()],"geometry-type":[Pt,[],W=>W.geometryType()],id:[kr,[],W=>W.id()],zoom:[Qe,[],W=>W.globals.zoom],"heatmap-density":[Qe,[],W=>W.globals.heatmapDensity||0],"line-progress":[Qe,[],W=>W.globals.lineProgress||0],accumulated:[kr,[],W=>W.globals.accumulated===void 0?null:W.globals.accumulated],"+":[Qe,jc(Qe),(W,D)=>{let J=0;for(let pe of D)J+=pe.evaluate(W);return J}],"*":[Qe,jc(Qe),(W,D)=>{let J=1;for(let pe of D)J*=pe.evaluate(W);return J}],"-":{type:Qe,overloads:[[[Qe,Qe],(W,[D,J])=>D.evaluate(W)-J.evaluate(W)],[[Qe],(W,[D])=>-D.evaluate(W)]]},"/":[Qe,[Qe,Qe],(W,[D,J])=>D.evaluate(W)/J.evaluate(W)],"%":[Qe,[Qe,Qe],(W,[D,J])=>D.evaluate(W)%J.evaluate(W)],ln2:[Qe,[],()=>Math.LN2],pi:[Qe,[],()=>Math.PI],e:[Qe,[],()=>Math.E],"^":[Qe,[Qe,Qe],(W,[D,J])=>Math.pow(D.evaluate(W),J.evaluate(W))],sqrt:[Qe,[Qe],(W,[D])=>Math.sqrt(D.evaluate(W))],log10:[Qe,[Qe],(W,[D])=>Math.log(D.evaluate(W))/Math.LN10],ln:[Qe,[Qe],(W,[D])=>Math.log(D.evaluate(W))],log2:[Qe,[Qe],(W,[D])=>Math.log(D.evaluate(W))/Math.LN2],sin:[Qe,[Qe],(W,[D])=>Math.sin(D.evaluate(W))],cos:[Qe,[Qe],(W,[D])=>Math.cos(D.evaluate(W))],tan:[Qe,[Qe],(W,[D])=>Math.tan(D.evaluate(W))],asin:[Qe,[Qe],(W,[D])=>Math.asin(D.evaluate(W))],acos:[Qe,[Qe],(W,[D])=>Math.acos(D.evaluate(W))],atan:[Qe,[Qe],(W,[D])=>Math.atan(D.evaluate(W))],min:[Qe,jc(Qe),(W,D)=>Math.min(...D.map(J=>J.evaluate(W)))],max:[Qe,jc(Qe),(W,D)=>Math.max(...D.map(J=>J.evaluate(W)))],abs:[Qe,[Qe],(W,[D])=>Math.abs(D.evaluate(W))],round:[Qe,[Qe],(W,[D])=>{let J=D.evaluate(W);return J<0?-Math.round(-J):Math.round(J)}],floor:[Qe,[Qe],(W,[D])=>Math.floor(D.evaluate(W))],ceil:[Qe,[Qe],(W,[D])=>Math.ceil(D.evaluate(W))],"filter-==":[It,[Pt,kr],(W,[D,J])=>W.properties()[D.value]===J.value],"filter-id-==":[It,[kr],(W,[D])=>W.id()===D.value],"filter-type-==":[It,[Pt],(W,[D])=>W.geometryType()===D.value],"filter-<":[It,[Pt,kr],(W,[D,J])=>{let pe=W.properties()[D.value],ke=J.value;return typeof pe==typeof ke&&pe<ke}],"filter-id-<":[It,[kr],(W,[D])=>{let J=W.id(),pe=D.value;return typeof J==typeof pe&&J<pe}],"filter->":[It,[Pt,kr],(W,[D,J])=>{let pe=W.properties()[D.value],ke=J.value;return typeof pe==typeof ke&&pe>ke}],"filter-id->":[It,[kr],(W,[D])=>{let J=W.id(),pe=D.value;return typeof J==typeof pe&&J>pe}],"filter-<=":[It,[Pt,kr],(W,[D,J])=>{let pe=W.properties()[D.value],ke=J.value;return typeof pe==typeof ke&&pe<=ke}],"filter-id-<=":[It,[kr],(W,[D])=>{let J=W.id(),pe=D.value;return typeof J==typeof pe&&J<=pe}],"filter->=":[It,[Pt,kr],(W,[D,J])=>{let pe=W.properties()[D.value],ke=J.value;return typeof pe==typeof ke&&pe>=ke}],"filter-id->=":[It,[kr],(W,[D])=>{let J=W.id(),pe=D.value;return typeof J==typeof pe&&J>=pe}],"filter-has":[It,[kr],(W,[D])=>D.value in W.properties()],"filter-has-id":[It,[],W=>W.id()!==null&&W.id()!==void 0],"filter-type-in":[It,[Ne(Pt)],(W,[D])=>D.value.indexOf(W.geometryType())>=0],"filter-id-in":[It,[Ne(kr)],(W,[D])=>D.value.indexOf(W.id())>=0],"filter-in-small":[It,[Pt,Ne(kr)],(W,[D,J])=>J.value.indexOf(W.properties()[D.value])>=0],"filter-in-large":[It,[Pt,Ne(kr)],(W,[D,J])=>function(pe,ke,je,We){for(;je<=We;){let ht=je+We>>1;if(ke[ht]===pe)return!0;ke[ht]>pe?We=ht-1:je=ht+1}return!1}(W.properties()[D.value],J.value,0,J.value.length-1)],all:{type:It,overloads:[[[It,It],(W,[D,J])=>D.evaluate(W)&&J.evaluate(W)],[jc(It),(W,D)=>{for(let J of D)if(!J.evaluate(W))return!1;return!0}]]},any:{type:It,overloads:[[[It,It],(W,[D,J])=>D.evaluate(W)||J.evaluate(W)],[jc(It),(W,D)=>{for(let J of D)if(J.evaluate(W))return!0;return!1}]]},"!":[It,[It],(W,[D])=>!D.evaluate(W)],"is-supported-script":[It,[Pt],(W,[D])=>{let J=W.globals&&W.globals.isSupportedScript;return!J||J(D.evaluate(W))}],upcase:[Pt,[Pt],(W,[D])=>D.evaluate(W).toUpperCase()],downcase:[Pt,[Pt],(W,[D])=>D.evaluate(W).toLowerCase()],concat:[Pt,jc(kr),(W,D)=>D.map(J=>tn(J.evaluate(W))).join("")],"resolved-locale":[Pt,[mr],(W,[D])=>D.evaluate(W).resolvedLocale()]});class Lu{constructor(D,J){var pe;this.expression=D,this._warningHistory={},this._evaluator=new Ir,this._defaultValue=J?(pe=J).type==="color"&&kf(pe.default)?new Jt(0,0,0,0):pe.type==="color"?Jt.parse(pe.default)||null:pe.type==="padding"?ca.parse(pe.default)||null:pe.type==="variableAnchorOffsetCollection"?$a.parse(pe.default)||null:pe.default===void 0?null:pe.default:null,this._enumValues=J&&J.type==="enum"?J.values:null}evaluateWithoutErrorHandling(D,J,pe,ke,je,We){return this._evaluator.globals=D,this._evaluator.feature=J,this._evaluator.featureState=pe,this._evaluator.canonical=ke,this._evaluator.availableImages=je||null,this._evaluator.formattedSection=We,this.expression.evaluate(this._evaluator)}evaluate(D,J,pe,ke,je,We){this._evaluator.globals=D,this._evaluator.feature=J||null,this._evaluator.featureState=pe||null,this._evaluator.canonical=ke,this._evaluator.availableImages=je||null,this._evaluator.formattedSection=We||null;try{let ht=this.expression.evaluate(this._evaluator);if(ht==null||typeof ht=="number"&&ht!=ht)return this._defaultValue;if(this._enumValues&&!(ht in this._enumValues))throw new hn(`Expected value to be one of ${Object.keys(this._enumValues).map(Et=>JSON.stringify(Et)).join(", ")}, but found ${JSON.stringify(ht)} instead.`);return ht}catch(ht){return this._warningHistory[ht.message]||(this._warningHistory[ht.message]=!0,typeof console<"u"&&console.warn(ht.message)),this._defaultValue}}}function Mc(W){return Array.isArray(W)&&W.length>0&&typeof W[0]=="string"&&W[0]in nf}function ol(W,D){let J=new Ur(nf,Bf,[],D?function(ke){let je={color:qt,string:Pt,number:Qe,enum:Pt,boolean:It,formatted:qr,padding:Sr,resolvedImage:Rr,variableAnchorOffsetCollection:wt};return ke.type==="array"?Ne(je[ke.value]||kr,ke.length):je[ke.type]}(D):void 0),pe=J.parse(W,void 0,void 0,void 0,D&&D.type==="string"?{typeAnnotation:"coerce"}:void 0);return pe?oc(new Lu(pe,D)):Xc(J.errors)}class vc{constructor(D,J){this.kind=D,this._styleExpression=J,this.isStateDependent=D!=="constant"&&!Gu(J.expression)}evaluateWithoutErrorHandling(D,J,pe,ke,je,We){return this._styleExpression.evaluateWithoutErrorHandling(D,J,pe,ke,je,We)}evaluate(D,J,pe,ke,je,We){return this._styleExpression.evaluate(D,J,pe,ke,je,We)}}class yu{constructor(D,J,pe,ke){this.kind=D,this.zoomStops=pe,this._styleExpression=J,this.isStateDependent=D!=="camera"&&!Gu(J.expression),this.interpolationType=ke}evaluateWithoutErrorHandling(D,J,pe,ke,je,We){return this._styleExpression.evaluateWithoutErrorHandling(D,J,pe,ke,je,We)}evaluate(D,J,pe,ke,je,We){return this._styleExpression.evaluate(D,J,pe,ke,je,We)}interpolationFactor(D,J,pe){return this.interpolationType?no.interpolationFactor(this.interpolationType,D,J,pe):0}}function Tu(W,D){let J=ol(W,D);if(J.result==="error")return J;let pe=J.value.expression,ke=Nf(pe);if(!ke&&!Ql(D))return Xc([new Oe("","data expressions not supported")]);let je=Ef(pe,["zoom"]);if(!je&&!qc(D))return Xc([new Oe("","zoom expressions not supported")]);let We=qf(pe);return We||je?We instanceof Oe?Xc([We]):We instanceof no&&!Sc(D)?Xc([new Oe("",'"interpolate" expressions cannot be used with this property')]):oc(We?new yu(ke?"camera":"composite",J.value,We.labels,We instanceof no?We.interpolation:void 0):new vc(ke?"constant":"source",J.value)):Xc([new Oe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class El{constructor(D,J){this._parameters=D,this._specification=J,he(this,Uf(this._parameters,this._specification))}static deserialize(D){return new El(D._parameters,D._specification)}static serialize(D){return{_parameters:D._parameters,_specification:D._specification}}}function qf(W){let D=null;if(W instanceof Hr)D=qf(W.result);else if(W instanceof lo){for(let J of W.args)if(D=qf(J),D)break}else(W instanceof Ta||W instanceof no)&&W.input instanceof $l&&W.input.name==="zoom"&&(D=W);return D instanceof Oe||W.eachChild(J=>{let pe=qf(J);pe instanceof Oe?D=pe:!D&&pe?D=new Oe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):D&&pe&&D!==pe&&(D=new Oe("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),D}function Qf(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(!Qf(D)&&typeof D!="boolean")return!1;return!0;default:return!0}}let Bu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ec(W){if(W==null)return{filter:()=>!0,needGeometry:!1};Qf(W)||(W=sf(W));let D=ol(W,Bu);if(D.result==="error")throw new Error(D.value.map(J=>`${J.key}: ${J.message}`).join(", "));return{filter:(J,pe,ke)=>D.value.evaluate(J,pe,{},ke),needGeometry:Lh(W)}}function mc(W,D){return W<D?-1:W>D?1:0}function Lh(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(Lh(W[D]))return!0;return!1}function sf(W){if(!W)return!0;let D=W[0];return W.length<=1?D!=="any":D==="=="?vf(W[1],W[2],"=="):D==="!="?au(vf(W[1],W[2],"==")):D==="<"||D===">"||D==="<="||D===">="?vf(W[1],W[2],D):D==="any"?(J=W.slice(1),["any"].concat(J.map(sf))):D==="all"?["all"].concat(W.slice(1).map(sf)):D==="none"?["all"].concat(W.slice(1).map(sf).map(au)):D==="in"?Nu(W[1],W.slice(2)):D==="!in"?au(Nu(W[1],W.slice(2))):D==="has"?lf(W[1]):D!=="!has"||au(lf(W[1]));var J}function vf(W,D,J){switch(W){case"$type":return[`filter-type-${J}`,D];case"$id":return[`filter-id-${J}`,D];default:return[`filter-${J}`,W,D]}}function Nu(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(J=>typeof J!=typeof D[0])?["filter-in-large",W,["literal",D.sort(mc)]]:["filter-in-small",W,["literal",D]]}}function lf(W){switch(W){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",W]}}function au(W){return["!",W]}function Yc(W){let D=typeof W;if(D==="number"||D==="boolean"||D==="string"||W==null)return JSON.stringify(W);if(Array.isArray(W)){let ke="[";for(let je of W)ke+=`${Yc(je)},`;return`${ke}]`}let J=Object.keys(W).sort(),pe="{";for(let ke=0;ke<J.length;ke++)pe+=`${JSON.stringify(J[ke])}:${Yc(W[J[ke]])},`;return`${pe}}`}function hh(W){let D="";for(let J of ce)D+=`/${Yc(W[J])}`;return D}function mf(W){let D=W.value;return D?[new ye(W.key,D,"constants have been deprecated as of v8")]:[]}function sl(W){return W instanceof Number||W instanceof String||W instanceof Boolean?W.valueOf():W}function _u(W){if(Array.isArray(W))return W.map(_u);if(W instanceof Object&&!(W instanceof Number||W instanceof String||W instanceof Boolean)){let D={};for(let J in W)D[J]=_u(W[J]);return D}return sl(W)}function Pu(W){let D=W.key,J=W.value,pe=W.valueSpec||{},ke=W.objectElementValidators||{},je=W.style,We=W.styleSpec,ht=W.validateSpec,Et=[],Ut=Zs(J);if(Ut!=="object")return[new ye(D,J,`object expected, ${Ut} found`)];for(let or in J){let Mr=or.split(".")[0],zr=pe[Mr]||pe["*"],Wr;if(ke[Mr])Wr=ke[Mr];else if(pe[Mr])Wr=ht;else if(ke["*"])Wr=ke["*"];else{if(!pe["*"]){Et.push(new ye(D,J[or],`unknown property "${or}"`));continue}Wr=ht}Et=Et.concat(Wr({key:(D&&`${D}.`)+or,value:J[or],valueSpec:zr,style:je,styleSpec:We,object:J,objectKey:or,validateSpec:ht},J))}for(let or in pe)ke[or]||pe[or].required&&pe[or].default===void 0&&J[or]===void 0&&Et.push(new ye(D,J,`missing required property "${or}"`));return Et}function Cf(W){let D=W.value,J=W.valueSpec,pe=W.style,ke=W.styleSpec,je=W.key,We=W.arrayElementValidator||W.validateSpec;if(Zs(D)!=="array")return[new ye(je,D,`array expected, ${Zs(D)} found`)];if(J.length&&D.length!==J.length)return[new ye(je,D,`array length ${J.length} expected, length ${D.length} found`)];if(J["min-length"]&&D.length<J["min-length"])return[new ye(je,D,`array length at least ${J["min-length"]} expected, length ${D.length} found`)];let ht={type:J.value,values:J.values};ke.$version<7&&(ht.function=J.function),Zs(J.value)==="object"&&(ht=J.value);let Et=[];for(let Ut=0;Ut<D.length;Ut++)Et=Et.concat(We({array:D,arrayIndex:Ut,value:D[Ut],valueSpec:ht,validateSpec:W.validateSpec,style:pe,styleSpec:ke,key:`${je}[${Ut}]`}));return Et}function hl(W){let D=W.key,J=W.value,pe=W.valueSpec,ke=Zs(J);return ke==="number"&&J!=J&&(ke="NaN"),ke!=="number"?[new ye(D,J,`number expected, ${ke} found`)]:"minimum"in pe&&J<pe.minimum?[new ye(D,J,`${J} is less than the minimum value ${pe.minimum}`)]:"maximum"in pe&&J>pe.maximum?[new ye(D,J,`${J} is greater than the maximum value ${pe.maximum}`)]:[]}function uf(W){let D=W.valueSpec,J=sl(W.value.type),pe,ke,je,We={},ht=J!=="categorical"&&W.value.property===void 0,Et=!ht,Ut=Zs(W.value.stops)==="array"&&Zs(W.value.stops[0])==="array"&&Zs(W.value.stops[0][0])==="object",or=Pu({key:W.key,value:W.value,valueSpec:W.styleSpec.function,validateSpec:W.validateSpec,style:W.style,styleSpec:W.styleSpec,objectElementValidators:{stops:function(Wr){if(J==="identity")return[new ye(Wr.key,Wr.value,'identity function may not have a "stops" property')];let ia=[],ha=Wr.value;return ia=ia.concat(Cf({key:Wr.key,value:ha,valueSpec:Wr.valueSpec,validateSpec:Wr.validateSpec,style:Wr.style,styleSpec:Wr.styleSpec,arrayElementValidator:Mr})),Zs(ha)==="array"&&ha.length===0&&ia.push(new ye(Wr.key,ha,"array must have at least one stop")),ia},default:function(Wr){return Wr.validateSpec({key:Wr.key,value:Wr.value,valueSpec:D,validateSpec:Wr.validateSpec,style:Wr.style,styleSpec:Wr.styleSpec})}}});return J==="identity"&&ht&&or.push(new ye(W.key,W.value,'missing required property "property"')),J==="identity"||W.value.stops||or.push(new ye(W.key,W.value,'missing required property "stops"')),J==="exponential"&&W.valueSpec.expression&&!Sc(W.valueSpec)&&or.push(new ye(W.key,W.value,"exponential functions not supported")),W.styleSpec.$version>=8&&(Et&&!Ql(W.valueSpec)?or.push(new ye(W.key,W.value,"property functions not supported")):ht&&!qc(W.valueSpec)&&or.push(new ye(W.key,W.value,"zoom functions not supported"))),J!=="categorical"&&!Ut||W.value.property!==void 0||or.push(new ye(W.key,W.value,'"property" property is required')),or;function Mr(Wr){let ia=[],ha=Wr.value,ja=Wr.key;if(Zs(ha)!=="array")return[new ye(ja,ha,`array expected, ${Zs(ha)} found`)];if(ha.length!==2)return[new ye(ja,ha,`array length 2 expected, length ${ha.length} found`)];if(Ut){if(Zs(ha[0])!=="object")return[new ye(ja,ha,`object expected, ${Zs(ha[0])} found`)];if(ha[0].zoom===void 0)return[new ye(ja,ha,"object stop key must have zoom")];if(ha[0].value===void 0)return[new ye(ja,ha,"object stop key must have value")];if(je&&je>sl(ha[0].zoom))return[new ye(ja,ha[0].zoom,"stop zoom values must appear in ascending order")];sl(ha[0].zoom)!==je&&(je=sl(ha[0].zoom),ke=void 0,We={}),ia=ia.concat(Pu({key:`${ja}[0]`,value:ha[0],valueSpec:{zoom:{}},validateSpec:Wr.validateSpec,style:Wr.style,styleSpec:Wr.styleSpec,objectElementValidators:{zoom:hl,value:zr}}))}else ia=ia.concat(zr({key:`${ja}[0]`,value:ha[0],valueSpec:{},validateSpec:Wr.validateSpec,style:Wr.style,styleSpec:Wr.styleSpec},ha));return Mc(_u(ha[1]))?ia.concat([new ye(`${ja}[1]`,ha[1],"expressions are not allowed in function stops.")]):ia.concat(Wr.validateSpec({key:`${ja}[1]`,value:ha[1],valueSpec:D,validateSpec:Wr.validateSpec,style:Wr.style,styleSpec:Wr.styleSpec}))}function zr(Wr,ia){let ha=Zs(Wr.value),ja=sl(Wr.value),Ka=Wr.value!==null?Wr.value:ia;if(pe){if(ha!==pe)return[new ye(Wr.key,Ka,`${ha} stop domain type must match previous stop domain type ${pe}`)]}else pe=ha;if(ha!=="number"&&ha!=="string"&&ha!=="boolean")return[new ye(Wr.key,Ka,"stop domain value must be a number, string, or boolean")];if(ha!=="number"&&J!=="categorical"){let Wi=`number expected, ${ha} found`;return Ql(D)&&J===void 0&&(Wi+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ye(Wr.key,Ka,Wi)]}return J!=="categorical"||ha!=="number"||isFinite(ja)&&Math.floor(ja)===ja?J!=="categorical"&&ha==="number"&&ke!==void 0&&ja<ke?[new ye(Wr.key,Ka,"stop domain values must appear in ascending order")]:(ke=ja,J==="categorical"&&ja in We?[new ye(Wr.key,Ka,"stop domain values must be unique")]:(We[ja]=!0,[])):[new ye(Wr.key,Ka,`integer expected, found ${ja}`)]}}function kc(W){let D=(W.expressionContext==="property"?Tu:ol)(_u(W.value),W.valueSpec);if(D.result==="error")return D.value.map(pe=>new ye(`${W.key}${pe.key}`,W.value,pe.message));let J=D.value.expression||D.value._styleExpression.expression;if(W.expressionContext==="property"&&W.propertyKey==="text-font"&&!J.outputDefined())return[new ye(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"&&!Gu(J))return[new ye(W.key,W.value,'"feature-state" data expressions are not supported with layout properties.')];if(W.expressionContext==="filter"&&!Gu(J))return[new ye(W.key,W.value,'"feature-state" data expressions are not supported with filters.')];if(W.expressionContext&&W.expressionContext.indexOf("cluster")===0){if(!Ef(J,["zoom","feature-state"]))return[new ye(W.key,W.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(W.expressionContext==="cluster-initial"&&!Nf(J))return[new ye(W.key,W.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Hu(W){let D=W.key,J=W.value,pe=W.valueSpec,ke=[];return Array.isArray(pe.values)?pe.values.indexOf(sl(J))===-1&&ke.push(new ye(D,J,`expected one of [${pe.values.join(", ")}], ${JSON.stringify(J)} found`)):Object.keys(pe.values).indexOf(sl(J))===-1&&ke.push(new ye(D,J,`expected one of [${Object.keys(pe.values).join(", ")}], ${JSON.stringify(J)} found`)),ke}function gf(W){return Qf(_u(W.value))?kc(he({},W,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Wu(W)}function Wu(W){let D=W.value,J=W.key;if(Zs(D)!=="array")return[new ye(J,D,`array expected, ${Zs(D)} found`)];let pe=W.styleSpec,ke,je=[];if(D.length<1)return[new ye(J,D,"filter array must have at least 1 element")];switch(je=je.concat(Hu({key:`${J}[0]`,value:D[0],valueSpec:pe.filter_operator,style:W.style,styleSpec:W.styleSpec})),sl(D[0])){case"<":case"<=":case">":case">=":D.length>=2&&sl(D[1])==="$type"&&je.push(new ye(J,D,`"$type" cannot be use with operator "${D[0]}"`));case"==":case"!=":D.length!==3&&je.push(new ye(J,D,`filter array for operator "${D[0]}" must have 3 elements`));case"in":case"!in":D.length>=2&&(ke=Zs(D[1]),ke!=="string"&&je.push(new ye(`${J}[1]`,D[1],`string expected, ${ke} found`)));for(let We=2;We<D.length;We++)ke=Zs(D[We]),sl(D[1])==="$type"?je=je.concat(Hu({key:`${J}[${We}]`,value:D[We],valueSpec:pe.geometry_type,style:W.style,styleSpec:W.styleSpec})):ke!=="string"&&ke!=="number"&&ke!=="boolean"&&je.push(new ye(`${J}[${We}]`,D[We],`string, number, or boolean expected, ${ke} found`));break;case"any":case"all":case"none":for(let We=1;We<D.length;We++)je=je.concat(Wu({key:`${J}[${We}]`,value:D[We],style:W.style,styleSpec:W.styleSpec}));break;case"has":case"!has":ke=Zs(D[1]),D.length!==2?je.push(new ye(J,D,`filter array for "${D[0]}" operator must have 2 elements`)):ke!=="string"&&je.push(new ye(`${J}[1]`,D[1],`string expected, ${ke} found`))}return je}function Kc(W,D){let J=W.key,pe=W.validateSpec,ke=W.style,je=W.styleSpec,We=W.value,ht=W.objectKey,Et=je[`${D}_${W.layerType}`];if(!Et)return[];let Ut=ht.match(/^(.*)-transition$/);if(D==="paint"&&Ut&&Et[Ut[1]]&&Et[Ut[1]].transition)return pe({key:J,value:We,valueSpec:je.transition,style:ke,styleSpec:je});let or=W.valueSpec||Et[ht];if(!or)return[new ye(J,We,`unknown property "${ht}"`)];let Mr;if(Zs(We)==="string"&&Ql(or)&&!or.tokens&&(Mr=/^{([^}]+)}$/.exec(We)))return[new ye(J,We,`"${ht}" does not support interpolation syntax |
| 3214 | Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(Mr[1])} }\`.`)];let zr=[];return W.layerType==="symbol"&&(ht==="text-field"&&ke&&!ke.glyphs&&zr.push(new ye(J,We,'use of "text-field" requires a style "glyphs" property')),ht==="text-font"&&kf(_u(We))&&sl(We.type)==="identity"&&zr.push(new ye(J,We,'"text-font" does not support identity functions'))),zr.concat(pe({key:W.key,value:We,valueSpec:or,style:ke,styleSpec:je,expressionContext:"property",propertyType:D,propertyKey:ht}))}function Lf(W){return Kc(W,"paint")}function iu(W){return Kc(W,"layout")}function Vf(W){let D=[],J=W.value,pe=W.key,ke=W.style,je=W.styleSpec;J.type||J.ref||D.push(new ye(pe,J,'either "type" or "ref" is required'));let We=sl(J.type),ht=sl(J.ref);if(J.id){let Et=sl(J.id);for(let Ut=0;Ut<W.arrayIndex;Ut++){let or=ke.layers[Ut];sl(or.id)===Et&&D.push(new ye(pe,J.id,`duplicate layer id "${J.id}", previously used at line ${or.id.__line__}`))}}if("ref"in J){let Et;["type","source","source-layer","filter","layout"].forEach(Ut=>{Ut in J&&D.push(new ye(pe,J[Ut],`"${Ut}" is prohibited for ref layers`))}),ke.layers.forEach(Ut=>{sl(Ut.id)===ht&&(Et=Ut)}),Et?Et.ref?D.push(new ye(pe,J.ref,"ref cannot reference another ref layer")):We=sl(Et.type):D.push(new ye(pe,J.ref,`ref layer "${ht}" not found`))}else if(We!=="background")if(J.source){let Et=ke.sources&&ke.sources[J.source],Ut=Et&&sl(Et.type);Et?Ut==="vector"&&We==="raster"?D.push(new ye(pe,J.source,`layer "${J.id}" requires a raster source`)):Ut!=="raster-dem"&&We==="hillshade"?D.push(new ye(pe,J.source,`layer "${J.id}" requires a raster-dem source`)):Ut==="raster"&&We!=="raster"?D.push(new ye(pe,J.source,`layer "${J.id}" requires a vector source`)):Ut!=="vector"||J["source-layer"]?Ut==="raster-dem"&&We!=="hillshade"?D.push(new ye(pe,J.source,"raster-dem source can only be used with layer type 'hillshade'.")):We!=="line"||!J.paint||!J.paint["line-gradient"]||Ut==="geojson"&&Et.lineMetrics||D.push(new ye(pe,J,`layer "${J.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):D.push(new ye(pe,J,`layer "${J.id}" must specify a "source-layer"`)):D.push(new ye(pe,J.source,`source "${J.source}" not found`))}else D.push(new ye(pe,J,'missing required property "source"'));return D=D.concat(Pu({key:pe,value:J,valueSpec:je.layer,style:W.style,styleSpec:W.styleSpec,validateSpec:W.validateSpec,objectElementValidators:{"*":()=>[],type:()=>W.validateSpec({key:`${pe}.type`,value:J.type,valueSpec:je.layer.type,style:W.style,styleSpec:W.styleSpec,validateSpec:W.validateSpec,object:J,objectKey:"type"}),filter:gf,layout:Et=>Pu({layer:J,key:Et.key,value:Et.value,style:Et.style,styleSpec:Et.styleSpec,validateSpec:Et.validateSpec,objectElementValidators:{"*":Ut=>iu(he({layerType:We},Ut))}}),paint:Et=>Pu({layer:J,key:Et.key,value:Et.value,style:Et.style,styleSpec:Et.styleSpec,validateSpec:Et.validateSpec,objectElementValidators:{"*":Ut=>Lf(he({layerType:We},Ut))}})}})),D}function Xu(W){let D=W.value,J=W.key,pe=Zs(D);return pe!=="string"?[new ye(J,D,`string expected, ${pe} found`)]:[]}let Cc={promoteId:function({key:W,value:D}){if(Zs(D)==="string")return Xu({key:W,value:D});{let J=[];for(let pe in D)J.push(...Xu({key:`${W}.${pe}`,value:D[pe]}));return J}}};function gc(W){let D=W.value,J=W.key,pe=W.styleSpec,ke=W.style,je=W.validateSpec;if(!D.type)return[new ye(J,D,'"type" is required')];let We=sl(D.type),ht;switch(We){case"vector":case"raster":return ht=Pu({key:J,value:D,valueSpec:pe[`source_${We.replace("-","_")}`],style:W.style,styleSpec:pe,objectElementValidators:Cc,validateSpec:je}),ht;case"raster-dem":return ht=function(Et){var Ut;let or=(Ut=Et.sourceName)!==null&&Ut!==void 0?Ut:"",Mr=Et.value,zr=Et.styleSpec,Wr=zr.source_raster_dem,ia=Et.style,ha=[],ja=Zs(Mr);if(Mr===void 0)return ha;if(ja!=="object")return ha.push(new ye("source_raster_dem",Mr,`object expected, ${ja} found`)),ha;let Ka=sl(Mr.encoding)==="custom",Wi=["redFactor","greenFactor","blueFactor","baseShift"],gi=Et.value.encoding?`"${Et.value.encoding}"`:"Default";for(let qi in Mr)!Ka&&Wi.includes(qi)?ha.push(new ye(qi,Mr[qi],`In "${or}": "${qi}" is only valid when "encoding" is set to "custom". ${gi} encoding found`)):Wr[qi]?ha=ha.concat(Et.validateSpec({key:qi,value:Mr[qi],valueSpec:Wr[qi],validateSpec:Et.validateSpec,style:ia,styleSpec:zr})):ha.push(new ye(qi,Mr[qi],`unknown property "${qi}"`));return ha}({sourceName:J,value:D,style:W.style,styleSpec:pe,validateSpec:je}),ht;case"geojson":if(ht=Pu({key:J,value:D,valueSpec:pe.source_geojson,style:ke,styleSpec:pe,validateSpec:je,objectElementValidators:Cc}),D.cluster)for(let Et in D.clusterProperties){let[Ut,or]=D.clusterProperties[Et],Mr=typeof Ut=="string"?[Ut,["accumulated"],["get",Et]]:Ut;ht.push(...kc({key:`${J}.${Et}.map`,value:or,validateSpec:je,expressionContext:"cluster-map"})),ht.push(...kc({key:`${J}.${Et}.reduce`,value:Mr,validateSpec:je,expressionContext:"cluster-reduce"}))}return ht;case"video":return Pu({key:J,value:D,valueSpec:pe.source_video,style:ke,validateSpec:je,styleSpec:pe});case"image":return Pu({key:J,value:D,valueSpec:pe.source_image,style:ke,validateSpec:je,styleSpec:pe});case"canvas":return[new ye(J,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Hu({key:`${J}.type`,value:D.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:ke,validateSpec:je,styleSpec:pe})}}function ql(W){let D=W.value,J=W.styleSpec,pe=J.light,ke=W.style,je=[],We=Zs(D);if(D===void 0)return je;if(We!=="object")return je=je.concat([new ye("light",D,`object expected, ${We} found`)]),je;for(let ht in D){let Et=ht.match(/^(.*)-transition$/);je=je.concat(Et&&pe[Et[1]]&&pe[Et[1]].transition?W.validateSpec({key:ht,value:D[ht],valueSpec:J.transition,validateSpec:W.validateSpec,style:ke,styleSpec:J}):pe[ht]?W.validateSpec({key:ht,value:D[ht],valueSpec:pe[ht],validateSpec:W.validateSpec,style:ke,styleSpec:J}):[new ye(ht,D[ht],`unknown property "${ht}"`)])}return je}function xu(W){let D=W.value,J=W.styleSpec,pe=J.sky,ke=W.style,je=Zs(D);if(D===void 0)return[];if(je!=="object")return[new ye("sky",D,`object expected, ${je} found`)];let We=[];for(let ht in D)We=We.concat(pe[ht]?W.validateSpec({key:ht,value:D[ht],valueSpec:pe[ht],style:ke,styleSpec:J}):[new ye(ht,D[ht],`unknown property "${ht}"`)]);return We}function Lc(W){let D=W.value,J=W.styleSpec,pe=J.terrain,ke=W.style,je=[],We=Zs(D);if(D===void 0)return je;if(We!=="object")return je=je.concat([new ye("terrain",D,`object expected, ${We} found`)]),je;for(let ht in D)je=je.concat(pe[ht]?W.validateSpec({key:ht,value:D[ht],valueSpec:pe[ht],validateSpec:W.validateSpec,style:ke,styleSpec:J}):[new ye(ht,D[ht],`unknown property "${ht}"`)]);return je}function Jc(W){let D=[],J=W.value,pe=W.key;if(Array.isArray(J)){let ke=[],je=[];for(let We in J)J[We].id&&ke.includes(J[We].id)&&D.push(new ye(pe,J,`all the sprites' ids must be unique, but ${J[We].id} is duplicated`)),ke.push(J[We].id),J[We].url&&je.includes(J[We].url)&&D.push(new ye(pe,J,`all the sprites' URLs must be unique, but ${J[We].url} is duplicated`)),je.push(J[We].url),D=D.concat(Pu({key:`${pe}[${We}]`,value:J[We],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:W.validateSpec}));return D}return Xu({key:pe,value:J})}let sc={"*":()=>[],array:Cf,boolean:function(W){let D=W.value,J=W.key,pe=Zs(D);return pe!=="boolean"?[new ye(J,D,`boolean expected, ${pe} found`)]:[]},number:hl,color:function(W){let D=W.key,J=W.value,pe=Zs(J);return pe!=="string"?[new ye(D,J,`color expected, ${pe} found`)]:Jt.parse(String(J))?[]:[new ye(D,J,`color expected, "${J}" found`)]},constants:mf,enum:Hu,filter:gf,function:uf,layer:Vf,object:Pu,source:gc,light:ql,sky:xu,terrain:Lc,projection:function(W){let D=W.value,J=W.styleSpec,pe=J.projection,ke=W.style,je=Zs(D);if(D===void 0)return[];if(je!=="object")return[new ye("projection",D,`object expected, ${je} found`)];let We=[];for(let ht in D)We=We.concat(pe[ht]?W.validateSpec({key:ht,value:D[ht],valueSpec:pe[ht],style:ke,styleSpec:J}):[new ye(ht,D[ht],`unknown property "${ht}"`)]);return We},string:Xu,formatted:function(W){return Xu(W).length===0?[]:kc(W)},resolvedImage:function(W){return Xu(W).length===0?[]:kc(W)},padding:function(W){let D=W.key,J=W.value;if(Zs(J)==="array"){if(J.length<1||J.length>4)return[new ye(D,J,`padding requires 1 to 4 values; ${J.length} values found`)];let pe={type:"number"},ke=[];for(let je=0;je<J.length;je++)ke=ke.concat(W.validateSpec({key:`${D}[${je}]`,value:J[je],validateSpec:W.validateSpec,valueSpec:pe}));return ke}return hl({key:D,value:J,valueSpec:{}})},variableAnchorOffsetCollection:function(W){let D=W.key,J=W.value,pe=Zs(J),ke=W.styleSpec;if(pe!=="array"||J.length<1||J.length%2!=0)return[new ye(D,J,"variableAnchorOffsetCollection requires a non-empty array of even length")];let je=[];for(let We=0;We<J.length;We+=2)je=je.concat(Hu({key:`${D}[${We}]`,value:J[We],valueSpec:ke.layout_symbol["text-anchor"]})),je=je.concat(Cf({key:`${D}[${We+1}]`,value:J[We+1],valueSpec:{length:2,value:"number"},validateSpec:W.validateSpec,style:W.style,styleSpec:ke}));return je},sprite:Jc};function Pc(W){let D=W.value,J=W.valueSpec,pe=W.styleSpec;return W.validateSpec=Pc,J.expression&&kf(sl(D))?uf(W):J.expression&&Mc(_u(D))?kc(W):J.type&&sc[J.type]?sc[J.type](W):Pu(he({},W,{valueSpec:J.type?pe[J.type]:J}))}function Qt(W){let D=W.value,J=W.key,pe=Xu(W);return pe.length||(D.indexOf("{fontstack}")===-1&&pe.push(new ye(J,D,'"glyphs" url must include a "{fontstack}" token')),D.indexOf("{range}")===-1&&pe.push(new ye(J,D,'"glyphs" url must include a "{range}" token'))),pe}function br(W,D=re){let J=[];return J=J.concat(Pc({key:"",value:W,valueSpec:D.$root,styleSpec:D,style:W,validateSpec:Pc,objectElementValidators:{glyphs:Qt,"*":()=>[]}})),W.constants&&(J=J.concat(mf({key:"constants",value:W.constants,style:W,styleSpec:D,validateSpec:Pc}))),$r(J)}function aa(W){return function(D){return W(ds(To({},D),{validateSpec:Pc}))}}function $r(W){return[].concat(W).sort((D,J)=>D.line-J.line)}function ka(W){return function(...D){return $r(W.apply(this,D))}}br.source=ka(aa(gc)),br.sprite=ka(aa(Jc)),br.glyphs=ka(aa(Qt)),br.light=ka(aa(ql)),br.sky=ka(aa(xu)),br.terrain=ka(aa(Lc)),br.layer=ka(aa(Vf)),br.filter=ka(aa(gf)),br.paintProperty=ka(aa(Lf)),br.layoutProperty=ka(aa(iu));let li=br,Ci=li.light,Hi=li.sky,Qi=li.paintProperty,dn=li.layoutProperty;function Pi(W,D){let J=!1;if(D&&D.length)for(let pe of D)W.fire(new j(new Error(pe.message))),J=!0;return J}class Di{constructor(D,J,pe){let ke=this.cells=[];if(D instanceof ArrayBuffer){this.arrayBuffer=D;let We=new Int32Array(this.arrayBuffer);D=We[0],this.d=(J=We[1])+2*(pe=We[2]);for(let Et=0;Et<this.d*this.d;Et++){let Ut=We[3+Et],or=We[3+Et+1];ke.push(Ut===or?null:We.subarray(Ut,or))}let ht=We[3+ke.length+1];this.keys=We.subarray(We[3+ke.length],ht),this.bboxes=We.subarray(ht),this.insert=this._insertReadonly}else{this.d=J+2*pe;for(let We=0;We<this.d*this.d;We++)ke.push([]);this.keys=[],this.bboxes=[]}this.n=J,this.extent=D,this.padding=pe,this.scale=J/D,this.uid=0;let je=pe/J*D;this.min=-je,this.max=D+je}insert(D,J,pe,ke,je){this._forEachCell(J,pe,ke,je,this._insertCell,this.uid++,void 0,void 0),this.keys.push(D),this.bboxes.push(J),this.bboxes.push(pe),this.bboxes.push(ke),this.bboxes.push(je)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(D,J,pe,ke,je,We){this.cells[je].push(We)}query(D,J,pe,ke,je){let We=this.min,ht=this.max;if(D<=We&&J<=We&&ht<=pe&&ht<=ke&&!je)return Array.prototype.slice.call(this.keys);{let Et=[];return this._forEachCell(D,J,pe,ke,this._queryCell,Et,{},je),Et}}_queryCell(D,J,pe,ke,je,We,ht,Et){let Ut=this.cells[je];if(Ut!==null){let or=this.keys,Mr=this.bboxes;for(let zr=0;zr<Ut.length;zr++){let Wr=Ut[zr];if(ht[Wr]===void 0){let ia=4*Wr;(Et?Et(Mr[ia+0],Mr[ia+1],Mr[ia+2],Mr[ia+3]):D<=Mr[ia+2]&&J<=Mr[ia+3]&&pe>=Mr[ia+0]&&ke>=Mr[ia+1])?(ht[Wr]=!0,We.push(or[Wr])):ht[Wr]=!1}}}}_forEachCell(D,J,pe,ke,je,We,ht,Et){let Ut=this._convertToCellCoord(D),or=this._convertToCellCoord(J),Mr=this._convertToCellCoord(pe),zr=this._convertToCellCoord(ke);for(let Wr=Ut;Wr<=Mr;Wr++)for(let ia=or;ia<=zr;ia++){let ha=this.d*ia+Wr;if((!Et||Et(this._convertFromCellCoord(Wr),this._convertFromCellCoord(ia),this._convertFromCellCoord(Wr+1),this._convertFromCellCoord(ia+1)))&&je.call(this,D,J,pe,ke,ha,We,ht,Et))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,J=3+this.cells.length+1+1,pe=0;for(let We=0;We<this.cells.length;We++)pe+=this.cells[We].length;let ke=new Int32Array(J+pe+this.keys.length+this.bboxes.length);ke[0]=this.extent,ke[1]=this.n,ke[2]=this.padding;let je=J;for(let We=0;We<D.length;We++){let ht=D[We];ke[3+We]=je,ke.set(ht,je),je+=ht.length}return ke[3+D.length]=je,ke.set(this.keys,je),je+=this.keys.length,ke[3+D.length+1]=je,ke.set(this.bboxes,je),je+=this.bboxes.length,ke.buffer}static serialize(D,J){let pe=D.toArrayBuffer();return J&&J.push(pe),{buffer:pe}}static deserialize(D){return new Di(D.buffer)}}let Ni={};function mi(W,D,J={}){if(Ni[W])throw new Error(`${W} is already registered.`);Object.defineProperty(D,"_classRegistryKey",{value:W,writeable:!1}),Ni[W]={klass:D,omit:J.omit||[],shallow:J.shallow||[]}}mi("Object",Object),mi("TransferableGridIndex",Di),mi("Color",Jt),mi("Error",Error),mi("AJAXError",fe),mi("ResolvedImage",Za),mi("StylePropertyFunction",El),mi("StyleExpression",Lu,{omit:["_evaluator"]}),mi("ZoomDependentExpression",yu),mi("ZoomConstantExpression",vc),mi("CompoundExpression",$l,{omit:["_evaluate"]});for(let W in nf)nf[W]._classRegistryKey||mi(`Expression_${W}`,nf[W]);function Mn(W){return W&&typeof ArrayBuffer<"u"&&(W instanceof ArrayBuffer||W.constructor&&W.constructor.name==="ArrayBuffer")}function Qn(W){return W.$name||W.constructor._classRegistryKey}function ao(W){return!function(D){if(D===null||typeof D!="object")return!1;let J=Qn(D);return!(!J||J==="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||Mn(W)||F(W)||ArrayBuffer.isView(W)||W instanceof ImageData)}function eo(W,D){if(ao(W))return(Mn(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(eo(We,D));return je}if(typeof W!="object")throw new Error("can't serialize object of type "+typeof W);let J=Qn(W);if(!J)throw new Error(`can't serialize object of unregistered class ${W.constructor.name}`);if(!Ni[J])throw new Error(`${J} is not registered.`);let{klass:pe}=Ni[J],ke=pe.serialize?pe.serialize(W,D):{};if(pe.serialize){if(D&&ke===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)||Ni[J].omit.indexOf(je)>=0)continue;let We=W[je];ke[je]=Ni[J].shallow.indexOf(je)>=0?We:eo(We,D)}W instanceof Error&&(ke.message=W.message)}if(ke.$name)throw new Error("$name property is reserved for worker serialization logic.");return J!=="Object"&&(ke.$name=J),ke}function fo(W){if(ao(W))return W;if(Array.isArray(W))return W.map(fo);if(typeof W!="object")throw new Error("can't deserialize object of type "+typeof W);let D=Qn(W)||"Object";if(!Ni[D])throw new Error(`can't deserialize unregistered class ${D}`);let{klass:J}=Ni[D];if(!J)throw new Error(`can't deserialize unregistered class ${D}`);if(J.deserialize)return J.deserialize(W);let pe=Object.create(J.prototype);for(let ke of Object.keys(W)){if(ke==="$name")continue;let je=W[ke];pe[ke]=Ni[D].shallow.indexOf(ke)>=0?je:fo(je)}return pe}class An{constructor(){this.first=!0}update(D,J){let pe=Math.floor(D);return this.first?(this.first=!1,this.lastIntegerZoom=pe,this.lastIntegerZoomTime=0,this.lastZoom=D,this.lastFloorZoom=pe,!0):(this.lastFloorZoom>pe?(this.lastIntegerZoom=pe+1,this.lastIntegerZoomTime=J):this.lastFloorZoom<pe&&(this.lastIntegerZoom=pe,this.lastIntegerZoomTime=J),D!==this.lastZoom&&(this.lastZoom=D,this.lastFloorZoom=pe,!0))}}let un={"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 yo(W){for(let D of W)if(bs(D.charCodeAt(0)))return!0;return!1}function Ko(W){for(let D of W)if(!Os(D.charCodeAt(0)))return!1;return!0}function Ss(W){let D=W.map(J=>{try{return new RegExp(`\\p{sc=${J}}`,"u").source}catch{return null}}).filter(J=>J);return new RegExp(D.join("|"),"u")}let rl=Ss(["Arab","Dupl","Mong","Ougr","Syrc"]);function Os(W){return!rl.test(String.fromCodePoint(W))}let el=Ss(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function bs(W){return!(W!==746&&W!==747&&(W<4352||!(un["CJK Compatibility Forms"](W)&&!(W>=65097&&W<=65103)||un["CJK Compatibility"](W)||un["CJK Strokes"](W)||!(!un["CJK Symbols and Punctuation"](W)||W>=12296&&W<=12305||W>=12308&&W<=12319||W===12336)||un["Enclosed CJK Letters and Months"](W)||un["Ideographic Description Characters"](W)||un.Kanbun(W)||un.Katakana(W)&&W!==12540||!(!un["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)||!(!un["Small Form Variants"](W)||W>=65112&&W<=65118||W>=65123&&W<=65126)||un["Vertical Forms"](W)||un["Yijing Hexagram Symbols"](W)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(W))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(W))||el.test(String.fromCodePoint(W)))))}function Fl(W){return!(bs(W)||function(D){return!!(un["Latin-1 Supplement"](D)&&(D===167||D===169||D===174||D===177||D===188||D===189||D===190||D===215||D===247)||un["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)||un["Letterlike Symbols"](D)||un["Number Forms"](D)||un["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)||un["Control Pictures"](D)&&D!==9251||un["Optical Character Recognition"](D)||un["Enclosed Alphanumerics"](D)||un["Geometric Shapes"](D)||un["Miscellaneous Symbols"](D)&&!(D>=9754&&D<=9759)||un["Miscellaneous Symbols and Arrows"](D)&&(D>=11026&&D<=11055||D>=11088&&D<=11097||D>=11192&&D<=11243)||un["CJK Symbols and Punctuation"](D)||un.Katakana(D)||un["Private Use Area"](D)||un["CJK Compatibility Forms"](D)||un["Small Form Variants"](D)||un["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 _l=Ss(["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 ll(W){return _l.test(String.fromCodePoint(W))}function Un(W,D){return!(!D&&ll(W)||W>=2304&&W<=3583||W>=3840&&W<=4255||un.Khmer(W))}function Lo(W){for(let D of W)if(ll(D.charCodeAt(0)))return!0;return!1}let Js=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 Rs{constructor(D,J){this.zoom=D,J?(this.now=J.now,this.fadeDuration=J.fadeDuration,this.zoomHistory=J.zoomHistory,this.transition=J.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new An,this.transition={})}isSupportedScript(D){return function(J,pe){for(let ke of J)if(!Un(ke.charCodeAt(0),pe))return!1;return!0}(D,Js.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let D=this.zoom,J=D-Math.floor(D),pe=this.crossFadingFactor();return D>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:J+(1-J)*pe}:{fromScale:.5,toScale:1,t:1-(1-pe)*J}}}class uu{constructor(D,J){this.property=D,this.value=J,this.expression=function(pe,ke){if(kf(pe))return new El(pe,ke);if(Mc(pe)){let je=Tu(pe,ke);if(je.result==="error")throw new Error(je.value.map(We=>`${We.key}: ${We.message}`).join(", "));return je.value}{let je=pe;return ke.type==="color"&&typeof pe=="string"?je=Jt.parse(pe):ke.type!=="padding"||typeof pe!="number"&&!Array.isArray(pe)?ke.type==="variableAnchorOffsetCollection"&&Array.isArray(pe)&&(je=$a.parse(pe)):je=ca.parse(pe),{kind:"constant",evaluate:()=>je}}}(J===void 0?D.specification.default:J,D.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(D,J,pe){return this.property.possiblyEvaluate(this,D,J,pe)}}class Iu{constructor(D){this.property=D,this.value=new uu(D,void 0)}transitioned(D,J){return new Ic(this.property,this.value,J,M({},D.transition,this.transition),D.now)}untransitioned(){return new Ic(this.property,this.value,null,{},0)}}class Zu{constructor(D){this._properties=D,this._values=Object.create(D.defaultTransitionablePropertyValues)}getValue(D){return u(this._values[D].value.value)}setValue(D,J){Object.prototype.hasOwnProperty.call(this._values,D)||(this._values[D]=new Iu(this._values[D].property)),this._values[D].value=new uu(this._values[D].property,J===null?void 0:u(J))}getTransition(D){return u(this._values[D].transition)}setTransition(D,J){Object.prototype.hasOwnProperty.call(this._values,D)||(this._values[D]=new Iu(this._values[D].property)),this._values[D].transition=u(J)||void 0}serialize(){let D={};for(let J of Object.keys(this._values)){let pe=this.getValue(J);pe!==void 0&&(D[J]=pe);let ke=this.getTransition(J);ke!==void 0&&(D[`${J}-transition`]=ke)}return D}transitioned(D,J){let pe=new bu(this._properties);for(let ke of Object.keys(this._values))pe._values[ke]=this._values[ke].transitioned(D,J._values[ke]);return pe}untransitioned(){let D=new bu(this._properties);for(let J of Object.keys(this._values))D._values[J]=this._values[J].untransitioned();return D}}class Ic{constructor(D,J,pe,ke,je){this.property=D,this.value=J,this.begin=je+ke.delay||0,this.end=this.begin+ke.duration||0,D.specification.transition&&(ke.delay||ke.duration)&&(this.prior=pe)}possiblyEvaluate(D,J,pe){let ke=D.now||0,je=this.value.possiblyEvaluate(D,J,pe),We=this.prior;if(We){if(ke>this.end)return this.prior=null,je;if(this.value.isDataDriven())return this.prior=null,je;if(ke<this.begin)return We.possiblyEvaluate(D,J,pe);{let ht=(ke-this.begin)/(this.end-this.begin);return this.property.interpolate(We.possiblyEvaluate(D,J,pe),je,function(Et){if(Et<=0)return 0;if(Et>=1)return 1;let Ut=Et*Et,or=Ut*Et;return 4*(Et<.5?or:3*(Et-Ut)+or-.75)}(ht))}}return je}}class bu{constructor(D){this._properties=D,this._values=Object.create(D.defaultTransitioningPropertyValues)}possiblyEvaluate(D,J,pe){let ke=new yc(this._properties);for(let je of Object.keys(this._values))ke._values[je]=this._values[je].possiblyEvaluate(D,J,pe);return ke}hasTransition(){for(let D of Object.keys(this._values))if(this._values[D].prior)return!0;return!1}}class Rc{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,J){this._values[D]=new uu(this._values[D].property,J===null?void 0:u(J))}serialize(){let D={};for(let J of Object.keys(this._values)){let pe=this.getValue(J);pe!==void 0&&(D[J]=pe)}return D}possiblyEvaluate(D,J,pe){let ke=new yc(this._properties);for(let je of Object.keys(this._values))ke._values[je]=this._values[je].possiblyEvaluate(D,J,pe);return ke}}class Au{constructor(D,J,pe){this.property=D,this.value=J,this.parameters=pe}isConstant(){return this.value.kind==="constant"}constantOr(D){return this.value.kind==="constant"?this.value.value:D}evaluate(D,J,pe,ke){return this.property.evaluate(this.value,this.parameters,D,J,pe,ke)}}class yc{constructor(D){this._properties=D,this._values=Object.create(D.defaultPossiblyEvaluatedValues)}get(D){return this._values[D]}}class ho{constructor(D){this.specification=D}possiblyEvaluate(D,J){if(D.isDataDriven())throw new Error("Value should not be data driven");return D.expression.evaluate(J)}interpolate(D,J,pe){let ke=On[this.specification.type];return ke?ke(D,J,pe):D}}class Ro{constructor(D,J){this.specification=D,this.overrides=J}possiblyEvaluate(D,J,pe,ke){return new Au(this,D.expression.kind==="constant"||D.expression.kind==="camera"?{kind:"constant",value:D.expression.evaluate(J,null,{},pe,ke)}:D.expression,J)}interpolate(D,J,pe){if(D.value.kind!=="constant"||J.value.kind!=="constant")return D;if(D.value.value===void 0||J.value.value===void 0)return new Au(this,{kind:"constant",value:void 0},D.parameters);let ke=On[this.specification.type];if(ke){let je=ke(D.value.value,J.value.value,pe);return new Au(this,{kind:"constant",value:je},D.parameters)}return D}evaluate(D,J,pe,ke,je,We){return D.kind==="constant"?D.value:D.evaluate(J,pe,ke,je,We)}}class Dc extends Ro{possiblyEvaluate(D,J,pe,ke){if(D.value===void 0)return new Au(this,{kind:"constant",value:void 0},J);if(D.expression.kind==="constant"){let je=D.expression.evaluate(J,null,{},pe,ke),We=D.property.specification.type==="resolvedImage"&&typeof je!="string"?je.name:je,ht=this._calculate(We,We,We,J);return new Au(this,{kind:"constant",value:ht},J)}if(D.expression.kind==="camera"){let je=this._calculate(D.expression.evaluate({zoom:J.zoom-1}),D.expression.evaluate({zoom:J.zoom}),D.expression.evaluate({zoom:J.zoom+1}),J);return new Au(this,{kind:"constant",value:je},J)}return new Au(this,D.expression,J)}evaluate(D,J,pe,ke,je,We){if(D.kind==="source"){let ht=D.evaluate(J,pe,ke,je,We);return this._calculate(ht,ht,ht,J)}return D.kind==="composite"?this._calculate(D.evaluate({zoom:Math.floor(J.zoom)-1},pe,ke),D.evaluate({zoom:Math.floor(J.zoom)},pe,ke),D.evaluate({zoom:Math.floor(J.zoom)+1},pe,ke),J):D.value}_calculate(D,J,pe,ke){return ke.zoom>ke.zoomHistory.lastIntegerZoom?{from:D,to:J}:{from:pe,to:J}}interpolate(D){return D}}class lc{constructor(D){this.specification=D}possiblyEvaluate(D,J,pe,ke){if(D.value!==void 0){if(D.expression.kind==="constant"){let je=D.expression.evaluate(J,null,{},pe,ke);return this._calculate(je,je,je,J)}return this._calculate(D.expression.evaluate(new Rs(Math.floor(J.zoom-1),J)),D.expression.evaluate(new Rs(Math.floor(J.zoom),J)),D.expression.evaluate(new Rs(Math.floor(J.zoom+1),J)),J)}}_calculate(D,J,pe,ke){return ke.zoom>ke.zoomHistory.lastIntegerZoom?{from:D,to:J}:{from:pe,to:J}}interpolate(D){return D}}class Yu{constructor(D){this.specification=D}possiblyEvaluate(D,J,pe,ke){return!!D.expression.evaluate(J,null,{},pe,ke)}interpolate(){return!1}}class Ue{constructor(D){this.properties=D,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let J in D){let pe=D[J];pe.specification.overridable&&this.overridableProperties.push(J);let ke=this.defaultPropertyValues[J]=new uu(pe,void 0),je=this.defaultTransitionablePropertyValues[J]=new Iu(pe);this.defaultTransitioningPropertyValues[J]=je.untransitioned(),this.defaultPossiblyEvaluatedValues[J]=ke.possiblyEvaluate({})}}}mi("DataDrivenProperty",Ro),mi("DataConstantProperty",ho),mi("CrossFadedDataDrivenProperty",Dc),mi("CrossFadedProperty",lc),mi("ColorRampProperty",Yu);let I="-transition";class ie extends Q{constructor(D,J){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),J.layout&&(this._unevaluatedLayout=new Rc(J.layout)),J.paint)){this._transitionablePaint=new Zu(J.paint);for(let pe in D.paint)this.setPaintProperty(pe,D.paint[pe],{validate:!1});for(let pe in D.layout)this.setLayoutProperty(pe,D.layout[pe],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new yc(J.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(D){return D==="visibility"?this.visibility:this._unevaluatedLayout.getValue(D)}setLayoutProperty(D,J,pe={}){J!=null&&this._validate(dn,`layers.${this.id}.layout.${D}`,D,J,pe)||(D!=="visibility"?this._unevaluatedLayout.setValue(D,J):this.visibility=J)}getPaintProperty(D){return D.endsWith(I)?this._transitionablePaint.getTransition(D.slice(0,-11)):this._transitionablePaint.getValue(D)}setPaintProperty(D,J,pe={}){if(J!=null&&this._validate(Qi,`layers.${this.id}.paint.${D}`,D,J,pe))return!1;if(D.endsWith(I))return this._transitionablePaint.setTransition(D.slice(0,-11),J||void 0),!1;{let ke=this._transitionablePaint._values[D],je=ke.property.specification["property-type"]==="cross-faded-data-driven",We=ke.value.isDataDriven(),ht=ke.value;this._transitionablePaint.setValue(D,J),this._handleSpecialPaintPropertyUpdate(D);let Et=this._transitionablePaint._values[D].value;return Et.isDataDriven()||We||je||this._handleOverridablePaintPropertyUpdate(D,ht,Et)}}_handleSpecialPaintPropertyUpdate(D){}_handleOverridablePaintPropertyUpdate(D,J,pe){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,J){D.getCrossfadeParameters&&(this._crossfadeParameters=D.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(D,void 0,J)),this.paint=this._transitioningPaint.possiblyEvaluate(D,void 0,J)}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),d(D,(J,pe)=>!(J===void 0||pe==="layout"&&!Object.keys(J).length||pe==="paint"&&!Object.keys(J).length))}_validate(D,J,pe,ke,je={}){return(!je||je.validate!==!1)&&Pi(this,D.call(li,{key:J,layerType:this.type,objectKey:pe,value:ke,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 J=this.paint.get(D);if(J instanceof Au&&Ql(J.property.specification)&&(J.value.kind==="source"||J.value.kind==="composite")&&J.value.isStateDependent)return!0}return!1}}let we={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Se{constructor(D,J){this._structArray=D,this._pos1=J*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Be{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(D,J){return D._trim(),J&&(D.isTransferred=!0,J.push(D.arrayBuffer)),{length:D.length,arrayBuffer:D.arrayBuffer}}static deserialize(D){let J=Object.create(this.prototype);return J.arrayBuffer=D.arrayBuffer,J.length=D.length,J.capacity=D.arrayBuffer.byteLength/J.bytesPerElement,J._refreshViews(),J}_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 J=this.uint8;this._refreshViews(),J&&this.uint8.set(J)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function dt(W,D=1){let J=0,pe=0;return{members:W.map(ke=>{let je=we[ke.type].BYTES_PER_ELEMENT,We=J=St(J,Math.max(D,je)),ht=ke.components||1;return pe=Math.max(pe,je),J+=je*ht,{name:ke.name,type:ke.type,components:ht,offset:We}}),size:St(J,Math.max(pe,D)),alignment:D}}function St(W,D){return Math.ceil(W/D)*D}class Nt extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J){let pe=this.length;return this.resize(pe+1),this.emplace(pe,D,J)}emplace(D,J,pe){let ke=2*D;return this.int16[ke+0]=J,this.int16[ke+1]=pe,D}}Nt.prototype.bytesPerElement=4,mi("StructArrayLayout2i4",Nt);class $t extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J,pe){let ke=this.length;return this.resize(ke+1),this.emplace(ke,D,J,pe)}emplace(D,J,pe,ke){let je=3*D;return this.int16[je+0]=J,this.int16[je+1]=pe,this.int16[je+2]=ke,D}}$t.prototype.bytesPerElement=6,mi("StructArrayLayout3i6",$t);class Tr extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke){let je=this.length;return this.resize(je+1),this.emplace(je,D,J,pe,ke)}emplace(D,J,pe,ke,je){let We=4*D;return this.int16[We+0]=J,this.int16[We+1]=pe,this.int16[We+2]=ke,this.int16[We+3]=je,D}}Tr.prototype.bytesPerElement=8,mi("StructArrayLayout4i8",Tr);class Ar extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke,je,We){let ht=this.length;return this.resize(ht+1),this.emplace(ht,D,J,pe,ke,je,We)}emplace(D,J,pe,ke,je,We,ht){let Et=6*D;return this.int16[Et+0]=J,this.int16[Et+1]=pe,this.int16[Et+2]=ke,this.int16[Et+3]=je,this.int16[Et+4]=We,this.int16[Et+5]=ht,D}}Ar.prototype.bytesPerElement=12,mi("StructArrayLayout2i4i12",Ar);class Kr extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke,je,We){let ht=this.length;return this.resize(ht+1),this.emplace(ht,D,J,pe,ke,je,We)}emplace(D,J,pe,ke,je,We,ht){let Et=4*D,Ut=8*D;return this.int16[Et+0]=J,this.int16[Et+1]=pe,this.uint8[Ut+4]=ke,this.uint8[Ut+5]=je,this.uint8[Ut+6]=We,this.uint8[Ut+7]=ht,D}}Kr.prototype.bytesPerElement=8,mi("StructArrayLayout2i4ub8",Kr);class na extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,J){let pe=this.length;return this.resize(pe+1),this.emplace(pe,D,J)}emplace(D,J,pe){let ke=2*D;return this.float32[ke+0]=J,this.float32[ke+1]=pe,D}}na.prototype.bytesPerElement=8,mi("StructArrayLayout2f8",na);class He extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke,je,We,ht,Et,Ut,or){let Mr=this.length;return this.resize(Mr+1),this.emplace(Mr,D,J,pe,ke,je,We,ht,Et,Ut,or)}emplace(D,J,pe,ke,je,We,ht,Et,Ut,or,Mr){let zr=10*D;return this.uint16[zr+0]=J,this.uint16[zr+1]=pe,this.uint16[zr+2]=ke,this.uint16[zr+3]=je,this.uint16[zr+4]=We,this.uint16[zr+5]=ht,this.uint16[zr+6]=Et,this.uint16[zr+7]=Ut,this.uint16[zr+8]=or,this.uint16[zr+9]=Mr,D}}He.prototype.bytesPerElement=20,mi("StructArrayLayout10ui20",He);class Je extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr){let Wr=this.length;return this.resize(Wr+1),this.emplace(Wr,D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr)}emplace(D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr){let ia=12*D;return this.int16[ia+0]=J,this.int16[ia+1]=pe,this.int16[ia+2]=ke,this.int16[ia+3]=je,this.uint16[ia+4]=We,this.uint16[ia+5]=ht,this.uint16[ia+6]=Et,this.uint16[ia+7]=Ut,this.int16[ia+8]=or,this.int16[ia+9]=Mr,this.int16[ia+10]=zr,this.int16[ia+11]=Wr,D}}Je.prototype.bytesPerElement=24,mi("StructArrayLayout4i4ui4i24",Je);class lt extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,J,pe){let ke=this.length;return this.resize(ke+1),this.emplace(ke,D,J,pe)}emplace(D,J,pe,ke){let je=3*D;return this.float32[je+0]=J,this.float32[je+1]=pe,this.float32[je+2]=ke,D}}lt.prototype.bytesPerElement=12,mi("StructArrayLayout3f12",lt);class vt extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(D){let J=this.length;return this.resize(J+1),this.emplace(J,D)}emplace(D,J){return this.uint32[1*D+0]=J,D}}vt.prototype.bytesPerElement=4,mi("StructArrayLayout1ul4",vt);class Lt extends Be{_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,J,pe,ke,je,We,ht,Et,Ut){let or=this.length;return this.resize(or+1),this.emplace(or,D,J,pe,ke,je,We,ht,Et,Ut)}emplace(D,J,pe,ke,je,We,ht,Et,Ut,or){let Mr=10*D,zr=5*D;return this.int16[Mr+0]=J,this.int16[Mr+1]=pe,this.int16[Mr+2]=ke,this.int16[Mr+3]=je,this.int16[Mr+4]=We,this.int16[Mr+5]=ht,this.uint32[zr+3]=Et,this.uint16[Mr+8]=Ut,this.uint16[Mr+9]=or,D}}Lt.prototype.bytesPerElement=20,mi("StructArrayLayout6i1ul2ui20",Lt);class At extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke,je,We){let ht=this.length;return this.resize(ht+1),this.emplace(ht,D,J,pe,ke,je,We)}emplace(D,J,pe,ke,je,We,ht){let Et=6*D;return this.int16[Et+0]=J,this.int16[Et+1]=pe,this.int16[Et+2]=ke,this.int16[Et+3]=je,this.int16[Et+4]=We,this.int16[Et+5]=ht,D}}At.prototype.bytesPerElement=12,mi("StructArrayLayout2i2i2i12",At);class zt extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke,je){let We=this.length;return this.resize(We+1),this.emplace(We,D,J,pe,ke,je)}emplace(D,J,pe,ke,je,We){let ht=4*D,Et=8*D;return this.float32[ht+0]=J,this.float32[ht+1]=pe,this.float32[ht+2]=ke,this.int16[Et+6]=je,this.int16[Et+7]=We,D}}zt.prototype.bytesPerElement=16,mi("StructArrayLayout2f1f2i16",zt);class cr extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke,je,We){let ht=this.length;return this.resize(ht+1),this.emplace(ht,D,J,pe,ke,je,We)}emplace(D,J,pe,ke,je,We,ht){let Et=16*D,Ut=4*D,or=8*D;return this.uint8[Et+0]=J,this.uint8[Et+1]=pe,this.float32[Ut+1]=ke,this.float32[Ut+2]=je,this.int16[or+6]=We,this.int16[or+7]=ht,D}}cr.prototype.bytesPerElement=16,mi("StructArrayLayout2ub2f2i16",cr);class yr extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,J,pe){let ke=this.length;return this.resize(ke+1),this.emplace(ke,D,J,pe)}emplace(D,J,pe,ke){let je=3*D;return this.uint16[je+0]=J,this.uint16[je+1]=pe,this.uint16[je+2]=ke,D}}yr.prototype.bytesPerElement=6,mi("StructArrayLayout3ui6",yr);class Er extends Be{_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,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia,ha,ja,Ka){let Wi=this.length;return this.resize(Wi+1),this.emplace(Wi,D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia,ha,ja,Ka)}emplace(D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia,ha,ja,Ka,Wi){let gi=24*D,qi=12*D,en=48*D;return this.int16[gi+0]=J,this.int16[gi+1]=pe,this.uint16[gi+2]=ke,this.uint16[gi+3]=je,this.uint32[qi+2]=We,this.uint32[qi+3]=ht,this.uint32[qi+4]=Et,this.uint16[gi+10]=Ut,this.uint16[gi+11]=or,this.uint16[gi+12]=Mr,this.float32[qi+7]=zr,this.float32[qi+8]=Wr,this.uint8[en+36]=ia,this.uint8[en+37]=ha,this.uint8[en+38]=ja,this.uint32[qi+10]=Ka,this.int16[gi+22]=Wi,D}}Er.prototype.bytesPerElement=48,mi("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Er);class jr extends Be{_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,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia,ha,ja,Ka,Wi,gi,qi,en,qn,Eo,ys,mo,zn,ts,Uo){let zo=this.length;return this.resize(zo+1),this.emplace(zo,D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia,ha,ja,Ka,Wi,gi,qi,en,qn,Eo,ys,mo,zn,ts,Uo)}emplace(D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia,ha,ja,Ka,Wi,gi,qi,en,qn,Eo,ys,mo,zn,ts,Uo,zo){let wn=32*D,os=16*D;return this.int16[wn+0]=J,this.int16[wn+1]=pe,this.int16[wn+2]=ke,this.int16[wn+3]=je,this.int16[wn+4]=We,this.int16[wn+5]=ht,this.int16[wn+6]=Et,this.int16[wn+7]=Ut,this.uint16[wn+8]=or,this.uint16[wn+9]=Mr,this.uint16[wn+10]=zr,this.uint16[wn+11]=Wr,this.uint16[wn+12]=ia,this.uint16[wn+13]=ha,this.uint16[wn+14]=ja,this.uint16[wn+15]=Ka,this.uint16[wn+16]=Wi,this.uint16[wn+17]=gi,this.uint16[wn+18]=qi,this.uint16[wn+19]=en,this.uint16[wn+20]=qn,this.uint16[wn+21]=Eo,this.uint16[wn+22]=ys,this.uint32[os+12]=mo,this.float32[os+13]=zn,this.float32[os+14]=ts,this.uint16[wn+30]=Uo,this.uint16[wn+31]=zo,D}}jr.prototype.bytesPerElement=64,mi("StructArrayLayout8i15ui1ul2f2ui64",jr);class Qr extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D){let J=this.length;return this.resize(J+1),this.emplace(J,D)}emplace(D,J){return this.float32[1*D+0]=J,D}}Qr.prototype.bytesPerElement=4,mi("StructArrayLayout1f4",Qr);class pa extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,J,pe){let ke=this.length;return this.resize(ke+1),this.emplace(ke,D,J,pe)}emplace(D,J,pe,ke){let je=3*D;return this.uint16[6*D+0]=J,this.float32[je+1]=pe,this.float32[je+2]=ke,D}}pa.prototype.bytesPerElement=12,mi("StructArrayLayout1ui2f12",pa);class Aa extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,J,pe){let ke=this.length;return this.resize(ke+1),this.emplace(ke,D,J,pe)}emplace(D,J,pe,ke){let je=4*D;return this.uint32[2*D+0]=J,this.uint16[je+2]=pe,this.uint16[je+3]=ke,D}}Aa.prototype.bytesPerElement=8,mi("StructArrayLayout1ul2ui8",Aa);class za extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D,J){let pe=this.length;return this.resize(pe+1),this.emplace(pe,D,J)}emplace(D,J,pe){let ke=2*D;return this.uint16[ke+0]=J,this.uint16[ke+1]=pe,D}}za.prototype.bytesPerElement=4,mi("StructArrayLayout2ui4",za);class ci extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(D){let J=this.length;return this.resize(J+1),this.emplace(J,D)}emplace(D,J){return this.uint16[1*D+0]=J,D}}ci.prototype.bytesPerElement=2,mi("StructArrayLayout1ui2",ci);class Vi extends Be{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(D,J,pe,ke){let je=this.length;return this.resize(je+1),this.emplace(je,D,J,pe,ke)}emplace(D,J,pe,ke,je){let We=4*D;return this.float32[We+0]=J,this.float32[We+1]=pe,this.float32[We+2]=ke,this.float32[We+3]=je,D}}Vi.prototype.bytesPerElement=16,mi("StructArrayLayout4f16",Vi);class ji extends Se{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)}}ji.prototype.size=20;class nn extends Lt{get(D){return new ji(this,D)}}mi("CollisionBoxArray",nn);class Sn extends Se{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]}}Sn.prototype.size=48;class Kn extends Er{get(D){return new Sn(this,D)}}mi("PlacedSymbolArray",Kn);class Bn extends Se{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]}}Bn.prototype.size=64;class wo extends jr{get(D){return new Bn(this,D)}}mi("SymbolInstanceArray",wo);class is extends Qr{getoffsetX(D){return this.float32[1*D+0]}}mi("GlyphOffsetArray",is);class Ao extends $t{getx(D){return this.int16[3*D+0]}gety(D){return this.int16[3*D+1]}gettileUnitDistanceFromAnchor(D){return this.int16[3*D+2]}}mi("SymbolLineVertexArray",Ao);class Zo extends Se{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]}}Zo.prototype.size=12;class ps extends pa{get(D){return new Zo(this,D)}}mi("TextAnchorOffsetArray",ps);class ul extends Se{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]}}ul.prototype.size=8;class tl extends Aa{get(D){return new ul(this,D)}}mi("FeatureIndexArray",tl);class Jo extends Nt{}class $o extends Nt{}class Il extends Nt{}class eu extends Ar{}class Ru extends Kr{}class vu extends na{}class Tl extends He{}class cu extends Je{}class uc extends lt{}class Vl extends vt{}class Gl extends At{}class de extends cr{}class Fe extends yr{}class et extends za{}let mt=dt([{name:"a_pos",components:2,type:"Int16"}],4),{members:bt}=mt;class Mt{constructor(D=[]){this.segments=D}prepareSegment(D,J,pe,ke){let je=this.segments[this.segments.length-1];return D>Mt.MAX_VERTEX_ARRAY_LENGTH&&f(`Max vertices per segment is ${Mt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${D}`),(!je||je.vertexLength+D>Mt.MAX_VERTEX_ARRAY_LENGTH||je.sortKey!==ke)&&(je={vertexOffset:J.length,primitiveOffset:pe.length,vertexLength:0,primitiveLength:0},ke!==void 0&&(je.sortKey=ke),this.segments.push(je)),je}get(){return this.segments}destroy(){for(let D of this.segments)for(let J in D.vaos)D.vaos[J].destroy()}static simpleSegment(D,J,pe,ke){return new Mt([{vertexOffset:D,primitiveOffset:J,vertexLength:pe,primitiveLength:ke,vaos:{},sortKey:0}])}}function ar(W,D){return 256*(W=w(Math.floor(W),0,255))+w(Math.floor(D),0,255)}Mt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,mi("SegmentVector",Mt);let Ot=dt([{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 _r={exports:{}},Gr={exports:{}};Gr.exports=function(W,D){var J,pe,ke,je,We,ht,Et,Ut;for(pe=W.length-(J=3&W.length),ke=D,We=3432918353,ht=461845907,Ut=0;Ut<pe;)Et=255&W.charCodeAt(Ut)|(255&W.charCodeAt(++Ut))<<8|(255&W.charCodeAt(++Ut))<<16|(255&W.charCodeAt(++Ut))<<24,++Ut,ke=27492+(65535&(je=5*(65535&(ke=(ke^=Et=(65535&(Et=(Et=(65535&Et)*We+(((Et>>>16)*We&65535)<<16)&4294967295)<<15|Et>>>17))*ht+(((Et>>>16)*ht&65535)<<16)&4294967295)<<13|ke>>>19))+((5*(ke>>>16)&65535)<<16)&4294967295))+((58964+(je>>>16)&65535)<<16);switch(Et=0,J){case 3:Et^=(255&W.charCodeAt(Ut+2))<<16;case 2:Et^=(255&W.charCodeAt(Ut+1))<<8;case 1:ke^=Et=(65535&(Et=(Et=(65535&(Et^=255&W.charCodeAt(Ut)))*We+(((Et>>>16)*We&65535)<<16)&4294967295)<<15|Et>>>17))*ht+(((Et>>>16)*ht&65535)<<16)&4294967295}return ke^=W.length,ke=2246822507*(65535&(ke^=ke>>>16))+((2246822507*(ke>>>16)&65535)<<16)&4294967295,ke=3266489909*(65535&(ke^=ke>>>13))+((3266489909*(ke>>>16)&65535)<<16)&4294967295,(ke^=ke>>>16)>>>0};var Xr=Gr.exports,xa={exports:{}};xa.exports=function(W,D){for(var J,pe=W.length,ke=D^pe,je=0;pe>=4;)J=1540483477*(65535&(J=255&W.charCodeAt(je)|(255&W.charCodeAt(++je))<<8|(255&W.charCodeAt(++je))<<16|(255&W.charCodeAt(++je))<<24))+((1540483477*(J>>>16)&65535)<<16),ke=1540483477*(65535&ke)+((1540483477*(ke>>>16)&65535)<<16)^(J=1540483477*(65535&(J^=J>>>24))+((1540483477*(J>>>16)&65535)<<16)),pe-=4,++je;switch(pe){case 3:ke^=(255&W.charCodeAt(je+2))<<16;case 2:ke^=(255&W.charCodeAt(je+1))<<8;case 1:ke=1540483477*(65535&(ke^=255&W.charCodeAt(je)))+((1540483477*(ke>>>16)&65535)<<16)}return ke=1540483477*(65535&(ke^=ke>>>13))+((1540483477*(ke>>>16)&65535)<<16),(ke^=ke>>>15)>>>0};var da=Xr,Ja=xa.exports;_r.exports=da,_r.exports.murmur3=da,_r.exports.murmur2=Ja;var ti=r(_r.exports);class Sa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(D,J,pe,ke){this.ids.push(Fa(D)),this.positions.push(J,pe,ke)}getPositions(D){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let J=Fa(D),pe=0,ke=this.ids.length-1;for(;pe<ke;){let We=pe+ke>>1;this.ids[We]>=J?ke=We:pe=We+1}let je=[];for(;this.ids[pe]===J;)je.push({index:this.positions[3*pe],start:this.positions[3*pe+1],end:this.positions[3*pe+2]}),pe++;return je}static serialize(D,J){let pe=new Float64Array(D.ids),ke=new Uint32Array(D.positions);return Xa(pe,ke,0,pe.length-1),J&&J.push(pe.buffer,ke.buffer),{ids:pe,positions:ke}}static deserialize(D){let J=new Sa;return J.ids=D.ids,J.positions=D.positions,J.indexed=!0,J}}function Fa(W){let D=+W;return!isNaN(D)&&D<=Number.MAX_SAFE_INTEGER?D:ti(String(W))}function Xa(W,D,J,pe){for(;J<pe;){let ke=W[J+pe>>1],je=J-1,We=pe+1;for(;;){do je++;while(W[je]<ke);do We--;while(W[We]>ke);if(je>=We)break;fi(W,je,We),fi(D,3*je,3*We),fi(D,3*je+1,3*We+1),fi(D,3*je+2,3*We+2)}We-J<pe-We?(Xa(W,D,J,We),J=We+1):(Xa(W,D,We+1,pe),pe=We)}}function fi(W,D,J){let pe=W[D];W[D]=W[J],W[J]=pe}mi("FeaturePositionMap",Sa);class ni{constructor(D,J){this.gl=D.gl,this.location=J}}class La extends ni{constructor(D,J){super(D,J),this.current=0}set(D){this.current!==D&&(this.current=D,this.gl.uniform1f(this.location,D))}}class sn extends ni{constructor(D,J){super(D,J),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 rn extends ni{constructor(D,J){super(D,J),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 vn=new Float32Array(16);function Pn(W){return[ar(255*W.r,255*W.g),ar(255*W.b,255*W.a)]}class Jn{constructor(D,J,pe){this.value=D,this.uniformNames=J.map(ke=>`u_${ke}`),this.type=pe}setUniform(D,J,pe){D.set(pe.constantOr(this.value))}getBinding(D,J,pe){return this.type==="color"?new rn(D,J):new La(D,J)}}class ro{constructor(D,J){this.uniformNames=J.map(pe=>`u_${pe}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(D,J){this.pixelRatioFrom=J.pixelRatio,this.pixelRatioTo=D.pixelRatio,this.patternFrom=J.tlbr,this.patternTo=D.tlbr}setUniform(D,J,pe,ke){let je=ke==="u_pattern_to"?this.patternTo:ke==="u_pattern_from"?this.patternFrom:ke==="u_pixel_ratio_to"?this.pixelRatioTo:ke==="u_pixel_ratio_from"?this.pixelRatioFrom:null;je&&D.set(je)}getBinding(D,J,pe){return pe.substr(0,9)==="u_pattern"?new sn(D,J):new La(D,J)}}class Yo{constructor(D,J,pe,ke){this.expression=D,this.type=pe,this.maxValue=0,this.paintVertexAttributes=J.map(je=>({name:`a_${je}`,type:"Float32",components:pe==="color"?2:1,offset:0})),this.paintVertexArray=new ke}populatePaintArray(D,J,pe,ke,je){let We=this.paintVertexArray.length,ht=this.expression.evaluate(new Rs(0),J,{},ke,[],je);this.paintVertexArray.resize(D),this._setPaintValue(We,D,ht)}updatePaintArray(D,J,pe,ke){let je=this.expression.evaluate({zoom:0},pe,ke);this._setPaintValue(D,J,je)}_setPaintValue(D,J,pe){if(this.type==="color"){let ke=Pn(pe);for(let je=D;je<J;je++)this.paintVertexArray.emplace(je,ke[0],ke[1])}else{for(let ke=D;ke<J;ke++)this.paintVertexArray.emplace(ke,pe);this.maxValue=Math.max(this.maxValue,Math.abs(pe))}}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 io{constructor(D,J,pe,ke,je,We){this.expression=D,this.uniformNames=J.map(ht=>`u_${ht}_t`),this.type=pe,this.useIntegerZoom=ke,this.zoom=je,this.maxValue=0,this.paintVertexAttributes=J.map(ht=>({name:`a_${ht}`,type:"Float32",components:pe==="color"?4:2,offset:0})),this.paintVertexArray=new We}populatePaintArray(D,J,pe,ke,je){let We=this.expression.evaluate(new Rs(this.zoom),J,{},ke,[],je),ht=this.expression.evaluate(new Rs(this.zoom+1),J,{},ke,[],je),Et=this.paintVertexArray.length;this.paintVertexArray.resize(D),this._setPaintValue(Et,D,We,ht)}updatePaintArray(D,J,pe,ke){let je=this.expression.evaluate({zoom:this.zoom},pe,ke),We=this.expression.evaluate({zoom:this.zoom+1},pe,ke);this._setPaintValue(D,J,je,We)}_setPaintValue(D,J,pe,ke){if(this.type==="color"){let je=Pn(pe),We=Pn(ke);for(let ht=D;ht<J;ht++)this.paintVertexArray.emplace(ht,je[0],je[1],We[0],We[1])}else{for(let je=D;je<J;je++)this.paintVertexArray.emplace(je,pe,ke);this.maxValue=Math.max(this.maxValue,Math.abs(pe),Math.abs(ke))}}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,J){let pe=this.useIntegerZoom?Math.floor(J.zoom):J.zoom,ke=w(this.expression.interpolationFactor(pe,this.zoom,this.zoom+1),0,1);D.set(ke)}getBinding(D,J,pe){return new La(D,J)}}class Ho{constructor(D,J,pe,ke,je,We){this.expression=D,this.type=J,this.useIntegerZoom=pe,this.zoom=ke,this.layerId=We,this.zoomInPaintVertexArray=new je,this.zoomOutPaintVertexArray=new je}populatePaintArray(D,J,pe){let ke=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(D),this.zoomOutPaintVertexArray.resize(D),this._setPaintValues(ke,D,J.patterns&&J.patterns[this.layerId],pe)}updatePaintArray(D,J,pe,ke,je){this._setPaintValues(D,J,pe.patterns&&pe.patterns[this.layerId],je)}_setPaintValues(D,J,pe,ke){if(!ke||!pe)return;let{min:je,mid:We,max:ht}=pe,Et=ke[je],Ut=ke[We],or=ke[ht];if(Et&&Ut&&or)for(let Mr=D;Mr<J;Mr++)this.zoomInPaintVertexArray.emplace(Mr,Ut.tl[0],Ut.tl[1],Ut.br[0],Ut.br[1],Et.tl[0],Et.tl[1],Et.br[0],Et.br[1],Ut.pixelRatio,Et.pixelRatio),this.zoomOutPaintVertexArray.emplace(Mr,Ut.tl[0],Ut.tl[1],Ut.br[0],Ut.br[1],or.tl[0],or.tl[1],or.br[0],or.br[1],Ut.pixelRatio,or.pixelRatio)}upload(D){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=D.createVertexBuffer(this.zoomInPaintVertexArray,Ot.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=D.createVertexBuffer(this.zoomOutPaintVertexArray,Ot.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class cl{constructor(D,J,pe){this.binders={},this._buffers=[];let ke=[];for(let je in D.paint._values){if(!pe(je))continue;let We=D.paint.get(je);if(!(We instanceof Au&&Ql(We.property.specification)))continue;let ht=xl(je,D.type),Et=We.value,Ut=We.property.specification.type,or=We.property.useIntegerZoom,Mr=We.property.specification["property-type"],zr=Mr==="cross-faded"||Mr==="cross-faded-data-driven";if(Et.kind==="constant")this.binders[je]=zr?new ro(Et.value,ht):new Jn(Et.value,ht,Ut),ke.push(`/u_${je}`);else if(Et.kind==="source"||zr){let Wr=gn(je,Ut,"source");this.binders[je]=zr?new Ho(Et,Ut,or,J,Wr,D.id):new Yo(Et,ht,Ut,Wr),ke.push(`/a_${je}`)}else{let Wr=gn(je,Ut,"composite");this.binders[je]=new io(Et,ht,Ut,or,J,Wr),ke.push(`/z_${je}`)}}this.cacheKey=ke.sort().join("")}getMaxValue(D){let J=this.binders[D];return J instanceof Yo||J instanceof io?J.maxValue:0}populatePaintArrays(D,J,pe,ke,je){for(let We in this.binders){let ht=this.binders[We];(ht instanceof Yo||ht instanceof io||ht instanceof Ho)&&ht.populatePaintArray(D,J,pe,ke,je)}}setConstantPatternPositions(D,J){for(let pe in this.binders){let ke=this.binders[pe];ke instanceof ro&&ke.setConstantPatternPositions(D,J)}}updatePaintArrays(D,J,pe,ke,je){let We=!1;for(let ht in D){let Et=J.getPositions(ht);for(let Ut of Et){let or=pe.feature(Ut.index);for(let Mr in this.binders){let zr=this.binders[Mr];if((zr instanceof Yo||zr instanceof io||zr instanceof Ho)&&zr.expression.isStateDependent===!0){let Wr=ke.paint.get(Mr);zr.expression=Wr.value,zr.updatePaintArray(Ut.start,Ut.end,or,D[ht],je),We=!0}}}}return We}defines(){let D=[];for(let J in this.binders){let pe=this.binders[J];(pe instanceof Jn||pe instanceof ro)&&D.push(...pe.uniformNames.map(ke=>`#define HAS_UNIFORM_${ke}`))}return D}getBinderAttributes(){let D=[];for(let J in this.binders){let pe=this.binders[J];if(pe instanceof Yo||pe instanceof io)for(let ke=0;ke<pe.paintVertexAttributes.length;ke++)D.push(pe.paintVertexAttributes[ke].name);else if(pe instanceof Ho)for(let ke=0;ke<Ot.members.length;ke++)D.push(Ot.members[ke].name)}return D}getBinderUniforms(){let D=[];for(let J in this.binders){let pe=this.binders[J];if(pe instanceof Jn||pe instanceof ro||pe instanceof io)for(let ke of pe.uniformNames)D.push(ke)}return D}getPaintVertexBuffers(){return this._buffers}getUniforms(D,J){let pe=[];for(let ke in this.binders){let je=this.binders[ke];if(je instanceof Jn||je instanceof ro||je instanceof io){for(let We of je.uniformNames)if(J[We]){let ht=je.getBinding(D,J[We],We);pe.push({name:We,property:ke,binding:ht})}}}return pe}setUniforms(D,J,pe,ke){for(let{name:je,property:We,binding:ht}of J)this.binders[We].setUniform(ht,ke,pe.get(We),je)}updatePaintBuffers(D){this._buffers=[];for(let J in this.binders){let pe=this.binders[J];if(D&&pe instanceof Ho){let ke=D.fromScale===2?pe.zoomInPaintVertexBuffer:pe.zoomOutPaintVertexBuffer;ke&&this._buffers.push(ke)}else(pe instanceof Yo||pe instanceof io)&&pe.paintVertexBuffer&&this._buffers.push(pe.paintVertexBuffer)}}upload(D){for(let J in this.binders){let pe=this.binders[J];(pe instanceof Yo||pe instanceof io||pe instanceof Ho)&&pe.upload(D)}this.updatePaintBuffers()}destroy(){for(let D in this.binders){let J=this.binders[D];(J instanceof Yo||J instanceof io||J instanceof Ho)&&J.destroy()}}}class al{constructor(D,J,pe=()=>!0){this.programConfigurations={};for(let ke of D)this.programConfigurations[ke.id]=new cl(ke,J,pe);this.needsUpload=!1,this._featureMap=new Sa,this._bufferOffset=0}populatePaintArrays(D,J,pe,ke,je,We){for(let ht in this.programConfigurations)this.programConfigurations[ht].populatePaintArrays(D,J,ke,je,We);J.id!==void 0&&this._featureMap.add(J.id,pe,this._bufferOffset,D),this._bufferOffset=D,this.needsUpload=!0}updatePaintArrays(D,J,pe,ke){for(let je of pe)this.needsUpload=this.programConfigurations[je.id].updatePaintArrays(D,this._featureMap,J,je,ke)||this.needsUpload}get(D){return this.programConfigurations[D]}upload(D){if(this.needsUpload){for(let J in this.programConfigurations)this.programConfigurations[J].upload(D);this.needsUpload=!1}}destroy(){for(let D in this.programConfigurations)this.programConfigurations[D].destroy()}}function xl(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 gn(W,D,J){let pe={color:{source:na,composite:Vi},number:{source:Qr,composite:na}},ke=function(je){return{"line-pattern":{source:Tl,composite:Tl},"fill-pattern":{source:Tl,composite:Tl},"fill-extrusion-pattern":{source:Tl,composite:Tl}}[je]}(W);return ke&&ke[J]||pe[D][J]}mi("ConstantBinder",Jn),mi("CrossFadedConstantBinder",ro),mi("SourceExpressionBinder",Yo),mi("CrossFadedCompositeBinder",Ho),mi("CompositeExpressionBinder",io),mi("ProgramConfiguration",cl,{omit:["_buffers"]}),mi("ProgramConfigurationSet",al);let vo=8192,cs=Math.pow(2,14)-1,ms=-cs-1;function Al(W){let D=vo/W.extent,J=W.loadGeometry();for(let pe=0;pe<J.length;pe++){let ke=J[pe];for(let je=0;je<ke.length;je++){let We=ke[je],ht=Math.round(We.x*D),Et=Math.round(We.y*D);We.x=w(ht,ms,cs),We.y=w(Et,ms,cs),(ht<We.x||ht>We.x+1||Et<We.y||Et>We.y+1)&&f("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return J}function Hl(W,D){return{type:W.type,id:W.id,properties:W.properties,geometry:D?Al(W):[]}}function Su(W,D,J,pe,ke){W.emplaceBack(2*D+(pe+1)/2,2*J+(ke+1)/2)}class Rl{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map(J=>J.id),this.index=D.index,this.hasPattern=!1,this.layoutVertexArray=new $o,this.indexArray=new Fe,this.segments=new Mt,this.programConfigurations=new al(D.layers,D.zoom),this.stateDependentLayerIds=this.layers.filter(J=>J.isStateDependent()).map(J=>J.id)}populate(D,J,pe){let ke=this.layers[0],je=[],We=null,ht=!1;ke.type==="circle"&&(We=ke.layout.get("circle-sort-key"),ht=!We.isConstant());for(let{feature:Et,id:Ut,index:or,sourceLayerIndex:Mr}of D){let zr=this.layers[0]._featureFilter.needGeometry,Wr=Hl(Et,zr);if(!this.layers[0]._featureFilter.filter(new Rs(this.zoom),Wr,pe))continue;let ia=ht?We.evaluate(Wr,{},pe):void 0,ha={id:Ut,properties:Et.properties,type:Et.type,sourceLayerIndex:Mr,index:or,geometry:zr?Wr.geometry:Al(Et),patterns:{},sortKey:ia};je.push(ha)}ht&&je.sort((Et,Ut)=>Et.sortKey-Ut.sortKey);for(let Et of je){let{geometry:Ut,index:or,sourceLayerIndex:Mr}=Et,zr=D[or].feature;this.addFeature(Et,Ut,or,pe),J.featureIndex.insert(zr,Ut,or,Mr,this.index)}}update(D,J,pe){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,J,this.stateDependentLayers,pe)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(D){this.uploaded||(this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,bt),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,J,pe,ke){for(let je of J)for(let We of je){let ht=We.x,Et=We.y;if(ht<0||ht>=vo||Et<0||Et>=vo)continue;let Ut=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,D.sortKey),or=Ut.vertexLength;Su(this.layoutVertexArray,ht,Et,-1,-1),Su(this.layoutVertexArray,ht,Et,1,-1),Su(this.layoutVertexArray,ht,Et,1,1),Su(this.layoutVertexArray,ht,Et,-1,1),this.indexArray.emplaceBack(or,or+1,or+2),this.indexArray.emplaceBack(or,or+3,or+2),Ut.vertexLength+=4,Ut.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,pe,{},ke)}}function _c(W,D){for(let J=0;J<W.length;J++)if(bi(D,W[J]))return!0;for(let J=0;J<D.length;J++)if(bi(W,D[J]))return!0;return!!oa(W,D)}function it(W,D,J){return!!bi(W,D)||!!ma(D,W,J)}function Zt(W,D){if(W.length===1)return Ya(D,W[0]);for(let J=0;J<D.length;J++){let pe=D[J];for(let ke=0;ke<pe.length;ke++)if(bi(W,pe[ke]))return!0}for(let J=0;J<W.length;J++)if(Ya(D,W[J]))return!0;for(let J=0;J<D.length;J++)if(oa(W,D[J]))return!0;return!1}function fr(W,D,J){if(W.length>1){if(oa(W,D))return!0;for(let pe=0;pe<D.length;pe++)if(ma(D[pe],W,J))return!0}for(let pe=0;pe<W.length;pe++)if(ma(W[pe],D,J))return!0;return!1}function oa(W,D){if(W.length===0||D.length===0)return!1;for(let J=0;J<W.length-1;J++){let pe=W[J],ke=W[J+1];for(let je=0;je<D.length-1;je++)if(wa(pe,ke,D[je],D[je+1]))return!0}return!1}function wa(W,D,J,pe){return R(W,J,pe)!==R(D,J,pe)&&R(W,D,J)!==R(W,D,pe)}function ma(W,D,J){let pe=J*J;if(D.length===1)return W.distSqr(D[0])<pe;for(let ke=1;ke<D.length;ke++)if(_a(W,D[ke-1],D[ke])<pe)return!0;return!1}function _a(W,D,J){let pe=D.distSqr(J);if(pe===0)return W.distSqr(D);let ke=((W.x-D.x)*(J.x-D.x)+(W.y-D.y)*(J.y-D.y))/pe;return W.distSqr(ke<0?D:ke>1?J:J.sub(D)._mult(ke)._add(D))}function Ya(W,D){let J,pe,ke,je=!1;for(let We=0;We<W.length;We++){J=W[We];for(let ht=0,Et=J.length-1;ht<J.length;Et=ht++)pe=J[ht],ke=J[Et],pe.y>D.y!=ke.y>D.y&&D.x<(ke.x-pe.x)*(D.y-pe.y)/(ke.y-pe.y)+pe.x&&(je=!je)}return je}function bi(W,D){let J=!1;for(let pe=0,ke=W.length-1;pe<W.length;ke=pe++){let je=W[pe],We=W[ke];je.y>D.y!=We.y>D.y&&D.x<(We.x-je.x)*(D.y-je.y)/(We.y-je.y)+je.x&&(J=!J)}return J}function yi(W,D,J){let pe=J[0],ke=J[2];if(W.x<pe.x&&D.x<pe.x||W.x>ke.x&&D.x>ke.x||W.y<pe.y&&D.y<pe.y||W.y>ke.y&&D.y>ke.y)return!1;let je=R(W,D,J[0]);return je!==R(W,D,J[1])||je!==R(W,D,J[2])||je!==R(W,D,J[3])}function si(W,D,J){let pe=D.paint.get(W).value;return pe.kind==="constant"?pe.value:J.programConfigurations.get(D.id).getMaxValue(W)}function yn(W){return Math.sqrt(W[0]*W[0]+W[1]*W[1])}function zi(W,D,J,pe,ke){if(!D[0]&&!D[1])return W;let je=n.convert(D)._mult(ke);J==="viewport"&&je._rotate(-pe);let We=[];for(let ht=0;ht<W.length;ht++)We.push(W[ht].sub(je));return We}let Ei,Na;mi("CircleBucket",Rl,{omit:["layers"]});var ea={get paint(){return Na=Na||new Ue({"circle-radius":new Ro(re.paint_circle["circle-radius"]),"circle-color":new Ro(re.paint_circle["circle-color"]),"circle-blur":new Ro(re.paint_circle["circle-blur"]),"circle-opacity":new Ro(re.paint_circle["circle-opacity"]),"circle-translate":new ho(re.paint_circle["circle-translate"]),"circle-translate-anchor":new ho(re.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ho(re.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ho(re.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ro(re.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ro(re.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ro(re.paint_circle["circle-stroke-opacity"])})},get layout(){return Ei=Ei||new Ue({"circle-sort-key":new Ro(re.layout_circle["circle-sort-key"])})}},Ma=1e-6,Qa=typeof Float32Array<"u"?Float32Array:Array;function di(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 Va(W,D,J){var pe=D[0],ke=D[1],je=D[2],We=D[3],ht=D[4],Et=D[5],Ut=D[6],or=D[7],Mr=D[8],zr=D[9],Wr=D[10],ia=D[11],ha=D[12],ja=D[13],Ka=D[14],Wi=D[15],gi=J[0],qi=J[1],en=J[2],qn=J[3];return W[0]=gi*pe+qi*ht+en*Mr+qn*ha,W[1]=gi*ke+qi*Et+en*zr+qn*ja,W[2]=gi*je+qi*Ut+en*Wr+qn*Ka,W[3]=gi*We+qi*or+en*ia+qn*Wi,W[4]=(gi=J[4])*pe+(qi=J[5])*ht+(en=J[6])*Mr+(qn=J[7])*ha,W[5]=gi*ke+qi*Et+en*zr+qn*ja,W[6]=gi*je+qi*Ut+en*Wr+qn*Ka,W[7]=gi*We+qi*or+en*ia+qn*Wi,W[8]=(gi=J[8])*pe+(qi=J[9])*ht+(en=J[10])*Mr+(qn=J[11])*ha,W[9]=gi*ke+qi*Et+en*zr+qn*ja,W[10]=gi*je+qi*Ut+en*Wr+qn*Ka,W[11]=gi*We+qi*or+en*ia+qn*Wi,W[12]=(gi=J[12])*pe+(qi=J[13])*ht+(en=J[14])*Mr+(qn=J[15])*ha,W[13]=gi*ke+qi*Et+en*zr+qn*ja,W[14]=gi*je+qi*Ut+en*Wr+qn*Ka,W[15]=gi*We+qi*or+en*ia+qn*Wi,W}Math.hypot||(Math.hypot=function(){for(var W=0,D=arguments.length;D--;)W+=arguments[D]*arguments[D];return Math.sqrt(W)});var Bi,Li=Va;function pn(W,D,J){var pe=D[0],ke=D[1],je=D[2],We=D[3];return W[0]=J[0]*pe+J[4]*ke+J[8]*je+J[12]*We,W[1]=J[1]*pe+J[5]*ke+J[9]*je+J[13]*We,W[2]=J[2]*pe+J[6]*ke+J[10]*je+J[14]*We,W[3]=J[3]*pe+J[7]*ke+J[11]*je+J[15]*We,W}Bi=new Qa(4),Qa!=Float32Array&&(Bi[0]=0,Bi[1]=0,Bi[2]=0,Bi[3]=0);class Ha extends ie{constructor(D){super(D,ea)}createBucket(D){return new Rl(D)}queryRadius(D){let J=D;return si("circle-radius",this,J)+si("circle-stroke-width",this,J)+yn(this.paint.get("circle-translate"))}queryIntersectsFeature(D,J,pe,ke,je,We,ht,Et){let Ut=zi(D,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),We.angle,ht),or=this.paint.get("circle-radius").evaluate(J,pe)+this.paint.get("circle-stroke-width").evaluate(J,pe),Mr=this.paint.get("circle-pitch-alignment")==="map",zr=Mr?Ut:function(ia,ha){return ia.map(ja=>Ua(ja,ha))}(Ut,Et),Wr=Mr?or*ht:or;for(let ia of ke)for(let ha of ia){let ja=Mr?ha:Ua(ha,Et),Ka=Wr,Wi=pn([],[ha.x,ha.y,0,1],Et);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Ka*=Wi[3]/We.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Ka*=We.cameraToCenterDistance/Wi[3]),it(zr,ja,Ka))return!0}return!1}}function Ua(W,D){let J=pn([],[W.x,W.y,0,1],D);return new n(J[0]/J[3],J[1]/J[3])}class Yi extends Rl{}let Ri;mi("HeatmapBucket",Yi,{omit:["layers"]});var Ti={get paint(){return Ri=Ri||new Ue({"heatmap-radius":new Ro(re.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ro(re.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ho(re.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yu(re.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ho(re.paint_heatmap["heatmap-opacity"])})}};function xi(W,{width:D,height:J},pe,ke){if(ke){if(ke instanceof Uint8ClampedArray)ke=new Uint8Array(ke.buffer);else if(ke.length!==D*J*pe)throw new RangeError(`mismatched image size. expected: ${ke.length} but got: ${D*J*pe}`)}else ke=new Uint8Array(D*J*pe);return W.width=D,W.height=J,W.data=ke,W}function Xi(W,{width:D,height:J},pe){if(D===W.width&&J===W.height)return;let ke=xi({},{width:D,height:J},pe);mn(W,ke,{x:0,y:0},{x:0,y:0},{width:Math.min(W.width,D),height:Math.min(W.height,J)},pe),W.width=D,W.height=J,W.data=ke.data}function mn(W,D,J,pe,ke,je){if(ke.width===0||ke.height===0)return D;if(ke.width>W.width||ke.height>W.height||J.x>W.width-ke.width||J.y>W.height-ke.height)throw new RangeError("out of range source coordinates for image copy");if(ke.width>D.width||ke.height>D.height||pe.x>D.width-ke.width||pe.y>D.height-ke.height)throw new RangeError("out of range destination coordinates for image copy");let We=W.data,ht=D.data;if(We===ht)throw new Error("srcData equals dstData, so image is already copied");for(let Et=0;Et<ke.height;Et++){let Ut=((J.y+Et)*W.width+J.x)*je,or=((pe.y+Et)*D.width+pe.x)*je;for(let Mr=0;Mr<ke.width*je;Mr++)ht[or+Mr]=We[Ut+Mr]}return D}class In{constructor(D,J){xi(this,D,1,J)}resize(D){Xi(this,D,1)}clone(){return new In({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(D,J,pe,ke,je){mn(D,J,pe,ke,je,1)}}class Ii{constructor(D,J){xi(this,D,4,J)}resize(D){Xi(this,D,4)}replace(D,J){J?this.data.set(D):this.data=D instanceof Uint8ClampedArray?new Uint8Array(D.buffer):D}clone(){return new Ii({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(D,J,pe,ke,je){mn(D,J,pe,ke,je,4)}}function an(W){let D={},J=W.resolution||256,pe=W.clips?W.clips.length:1,ke=W.image||new Ii({width:J,height:pe});if(Math.log(J)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${J}`);let je=(We,ht,Et)=>{D[W.evaluationKey]=Et;let Ut=W.expression.evaluate(D);ke.data[We+ht+0]=Math.floor(255*Ut.r/Ut.a),ke.data[We+ht+1]=Math.floor(255*Ut.g/Ut.a),ke.data[We+ht+2]=Math.floor(255*Ut.b/Ut.a),ke.data[We+ht+3]=Math.floor(255*Ut.a)};if(W.clips)for(let We=0,ht=0;We<pe;++We,ht+=4*J)for(let Et=0,Ut=0;Et<J;Et++,Ut+=4){let or=Et/(J-1),{start:Mr,end:zr}=W.clips[We];je(ht,Ut,Mr*(1-or)+zr*or)}else for(let We=0,ht=0;We<J;We++,ht+=4)je(0,ht,We/(J-1));return ke}mi("AlphaImage",In),mi("RGBAImage",Ii);let kn="big-fb";class Dn extends ie{createBucket(D){return new Yi(D)}constructor(D){super(D,Ti),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(D){D==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=an({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(kn)&&this.heatmapFbos.delete(kn)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Zn;var Ds={get paint(){return Zn=Zn||new Ue({"hillshade-illumination-direction":new ho(re.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ho(re.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ho(re.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ho(re.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ho(re.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ho(re.paint_hillshade["hillshade-accent-color"])})}};class bl extends ie{constructor(D){super(D,Ds)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let po=dt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Wl}=po;function fs(W,D,J=2){let pe=D&&D.length,ke=pe?D[0]*J:W.length,je=Sl(W,0,ke,J,!0),We=[];if(!je||je.next===je.prev)return We;let ht,Et,Ut;if(pe&&(je=function(or,Mr,zr,Wr){let ia=[];for(let ha=0,ja=Mr.length;ha<ja;ha++){let Ka=Sl(or,Mr[ha]*Wr,ha<ja-1?Mr[ha+1]*Wr:or.length,Wr,!1);Ka===Ka.next&&(Ka.steiner=!0),ia.push(_e(Ka))}ia.sort(Cl);for(let ha=0;ha<ia.length;ha++)zr=Co(ia[ha],zr);return zr}(W,D,je,J)),W.length>80*J){ht=1/0,Et=1/0;let or=-1/0,Mr=-1/0;for(let zr=J;zr<ke;zr+=J){let Wr=W[zr],ia=W[zr+1];Wr<ht&&(ht=Wr),ia<Et&&(Et=ia),Wr>or&&(or=Wr),ia>Mr&&(Mr=ia)}Ut=Math.max(or-ht,Mr-Et),Ut=Ut!==0?32767/Ut:0}return tu(je,We,J,ht,Et,Ut,0),We}function Sl(W,D,J,pe,ke){let je;if(ke===function(We,ht,Et,Ut){let or=0;for(let Mr=ht,zr=Et-Ut;Mr<Et;Mr+=Ut)or+=(We[zr]-We[Mr])*(We[Mr+1]+We[zr+1]),zr=Mr;return or}(W,D,J,pe)>0)for(let We=D;We<J;We+=pe)je=pr(We/pe|0,W[We],W[We+1],je);else for(let We=J-pe;We>=D;We-=pe)je=pr(We/pe|0,W[We],W[We+1],je);return je&&Le(je,je.next)&&(yt(je),je=je.next),je}function kl(W,D){if(!W)return W;D||(D=W);let J,pe=W;do if(J=!1,pe.steiner||!Le(pe,pe.next)&&Ge(pe.prev,pe,pe.next)!==0)pe=pe.next;else{if(yt(pe),pe=D=pe.prev,pe===pe.next)break;J=!0}while(J||pe!==D);return D}function tu(W,D,J,pe,ke,je,We){if(!W)return;!We&&je&&function(Et,Ut,or,Mr){let zr=Et;do zr.z===0&&(zr.z=K(zr.x,zr.y,Ut,or,Mr)),zr.prevZ=zr.prev,zr.nextZ=zr.next,zr=zr.next;while(zr!==Et);zr.prevZ.nextZ=null,zr.prevZ=null,function(Wr){let ia,ha=1;do{let ja,Ka=Wr;Wr=null;let Wi=null;for(ia=0;Ka;){ia++;let gi=Ka,qi=0;for(let qn=0;qn<ha&&(qi++,gi=gi.nextZ,gi);qn++);let en=ha;for(;qi>0||en>0&&gi;)qi!==0&&(en===0||!gi||Ka.z<=gi.z)?(ja=Ka,Ka=Ka.nextZ,qi--):(ja=gi,gi=gi.nextZ,en--),Wi?Wi.nextZ=ja:Wr=ja,ja.prevZ=Wi,Wi=ja;Ka=gi}Wi.nextZ=null,ha*=2}while(ia>1)}(zr)}(W,pe,ke,je);let ht=W;for(;W.prev!==W.next;){let Et=W.prev,Ut=W.next;if(je?pl(W,pe,ke,je):qs(W))D.push(Et.i,W.i,Ut.i),yt(W),W=Ut.next,ht=Ut.next;else if((W=Ut)===ht){We?We===1?tu(W=wl(kl(W),D),D,J,pe,ke,je,2):We===2&&Yn(W,D,J,pe,ke,je):tu(kl(W),D,J,pe,ke,je,1);break}}}function qs(W){let D=W.prev,J=W,pe=W.next;if(Ge(D,J,pe)>=0)return!1;let ke=D.x,je=J.x,We=pe.x,ht=D.y,Et=J.y,Ut=pe.y,or=ke<je?ke<We?ke:We:je<We?je:We,Mr=ht<Et?ht<Ut?ht:Ut:Et<Ut?Et:Ut,zr=ke>je?ke>We?ke:We:je>We?je:We,Wr=ht>Et?ht>Ut?ht:Ut:Et>Ut?Et:Ut,ia=pe.next;for(;ia!==D;){if(ia.x>=or&&ia.x<=zr&&ia.y>=Mr&&ia.y<=Wr&&te(ke,ht,je,Et,We,Ut,ia.x,ia.y)&&Ge(ia.prev,ia,ia.next)>=0)return!1;ia=ia.next}return!0}function pl(W,D,J,pe){let ke=W.prev,je=W,We=W.next;if(Ge(ke,je,We)>=0)return!1;let ht=ke.x,Et=je.x,Ut=We.x,or=ke.y,Mr=je.y,zr=We.y,Wr=ht<Et?ht<Ut?ht:Ut:Et<Ut?Et:Ut,ia=or<Mr?or<zr?or:zr:Mr<zr?Mr:zr,ha=ht>Et?ht>Ut?ht:Ut:Et>Ut?Et:Ut,ja=or>Mr?or>zr?or:zr:Mr>zr?Mr:zr,Ka=K(Wr,ia,D,J,pe),Wi=K(ha,ja,D,J,pe),gi=W.prevZ,qi=W.nextZ;for(;gi&&gi.z>=Ka&&qi&&qi.z<=Wi;){if(gi.x>=Wr&&gi.x<=ha&&gi.y>=ia&&gi.y<=ja&&gi!==ke&&gi!==We&&te(ht,or,Et,Mr,Ut,zr,gi.x,gi.y)&&Ge(gi.prev,gi,gi.next)>=0||(gi=gi.prevZ,qi.x>=Wr&&qi.x<=ha&&qi.y>=ia&&qi.y<=ja&&qi!==ke&&qi!==We&&te(ht,or,Et,Mr,Ut,zr,qi.x,qi.y)&&Ge(qi.prev,qi,qi.next)>=0))return!1;qi=qi.nextZ}for(;gi&&gi.z>=Ka;){if(gi.x>=Wr&&gi.x<=ha&&gi.y>=ia&&gi.y<=ja&&gi!==ke&&gi!==We&&te(ht,or,Et,Mr,Ut,zr,gi.x,gi.y)&&Ge(gi.prev,gi,gi.next)>=0)return!1;gi=gi.prevZ}for(;qi&&qi.z<=Wi;){if(qi.x>=Wr&&qi.x<=ha&&qi.y>=ia&&qi.y<=ja&&qi!==ke&&qi!==We&&te(ht,or,Et,Mr,Ut,zr,qi.x,qi.y)&&Ge(qi.prev,qi,qi.next)>=0)return!1;qi=qi.nextZ}return!0}function wl(W,D){let J=W;do{let pe=J.prev,ke=J.next.next;!Le(pe,ke)&&$e(pe,J,J.next,ke)&&wr(pe,ke)&&wr(ke,pe)&&(D.push(pe.i,J.i,ke.i),yt(J),yt(J.next),J=W=ke),J=J.next}while(J!==W);return kl(J)}function Yn(W,D,J,pe,ke,je){let We=W;do{let ht=We.next.next;for(;ht!==We.prev;){if(We.i!==ht.i&&me(We,ht)){let Et=Nr(We,ht);return We=kl(We,We.next),Et=kl(Et,Et.next),tu(We,D,J,pe,ke,je,0),void tu(Et,D,J,pe,ke,je,0)}ht=ht.next}We=We.next}while(We!==W)}function Cl(W,D){return W.x-D.x}function Co(W,D){let J=function(ke,je){let We=je,ht=ke.x,Et=ke.y,Ut,or=-1/0;do{if(Et<=We.y&&Et>=We.next.y&&We.next.y!==We.y){let ha=We.x+(Et-We.y)*(We.next.x-We.x)/(We.next.y-We.y);if(ha<=ht&&ha>or&&(or=ha,Ut=We.x<We.next.x?We:We.next,ha===ht))return Ut}We=We.next}while(We!==je);if(!Ut)return null;let Mr=Ut,zr=Ut.x,Wr=Ut.y,ia=1/0;We=Ut;do{if(ht>=We.x&&We.x>=zr&&ht!==We.x&&te(Et<Wr?ht:or,Et,zr,Wr,Et<Wr?or:ht,Et,We.x,We.y)){let ha=Math.abs(Et-We.y)/(ht-We.x);wr(We,ke)&&(ha<ia||ha===ia&&(We.x>Ut.x||We.x===Ut.x&&ve(Ut,We)))&&(Ut=We,ia=ha)}We=We.next}while(We!==Mr);return Ut}(W,D);if(!J)return D;let pe=Nr(J,W);return kl(pe,pe.next),kl(J,J.next)}function ve(W,D){return Ge(W.prev,W,D.prev)<0&&Ge(D.next,W,W.next)<0}function K(W,D,J,pe,ke){return(W=1431655765&((W=858993459&((W=252645135&((W=16711935&((W=(W-J)*ke|0)|W<<8))|W<<4))|W<<2))|W<<1))|(D=1431655765&((D=858993459&((D=252645135&((D=16711935&((D=(D-pe)*ke|0)|D<<8))|D<<4))|D<<2))|D<<1))<<1}function _e(W){let D=W,J=W;do(D.x<J.x||D.x===J.x&&D.y<J.y)&&(J=D),D=D.next;while(D!==W);return J}function te(W,D,J,pe,ke,je,We,ht){return(ke-We)*(D-ht)>=(W-We)*(je-ht)&&(W-We)*(pe-ht)>=(J-We)*(D-ht)&&(J-We)*(je-ht)>=(ke-We)*(pe-ht)}function me(W,D){return W.next.i!==D.i&&W.prev.i!==D.i&&!function(J,pe){let ke=J;do{if(ke.i!==J.i&&ke.next.i!==J.i&&ke.i!==pe.i&&ke.next.i!==pe.i&&$e(ke,ke.next,J,pe))return!0;ke=ke.next}while(ke!==J);return!1}(W,D)&&(wr(W,D)&&wr(D,W)&&function(J,pe){let ke=J,je=!1,We=(J.x+pe.x)/2,ht=(J.y+pe.y)/2;do ke.y>ht!=ke.next.y>ht&&ke.next.y!==ke.y&&We<(ke.next.x-ke.x)*(ht-ke.y)/(ke.next.y-ke.y)+ke.x&&(je=!je),ke=ke.next;while(ke!==J);return je}(W,D)&&(Ge(W.prev,W,D.prev)||Ge(W,D.prev,D))||Le(W,D)&&Ge(W.prev,W,W.next)>0&&Ge(D.prev,D,D.next)>0)}function Ge(W,D,J){return(D.y-W.y)*(J.x-D.x)-(D.x-W.x)*(J.y-D.y)}function Le(W,D){return W.x===D.x&&W.y===D.y}function $e(W,D,J,pe){let ke=jt(Ge(W,D,J)),je=jt(Ge(W,D,pe)),We=jt(Ge(J,pe,W)),ht=jt(Ge(J,pe,D));return ke!==je&&We!==ht||!(ke!==0||!gt(W,J,D))||!(je!==0||!gt(W,pe,D))||!(We!==0||!gt(J,W,pe))||!(ht!==0||!gt(J,D,pe))}function gt(W,D,J){return D.x<=Math.max(W.x,J.x)&&D.x>=Math.min(W.x,J.x)&&D.y<=Math.max(W.y,J.y)&&D.y>=Math.min(W.y,J.y)}function jt(W){return W>0?1:W<0?-1:0}function wr(W,D){return Ge(W.prev,W,W.next)<0?Ge(W,D,W.next)>=0&&Ge(W,W.prev,D)>=0:Ge(W,D,W.prev)<0||Ge(W,W.next,D)<0}function Nr(W,D){let J=kt(W.i,W.x,W.y),pe=kt(D.i,D.x,D.y),ke=W.next,je=D.prev;return W.next=D,D.prev=W,J.next=ke,ke.prev=J,pe.next=J,J.prev=pe,je.next=pe,pe.prev=je,pe}function pr(W,D,J,pe){let ke=kt(W,D,J);return pe?(ke.next=pe.next,ke.prev=pe,pe.next.prev=ke,pe.next=ke):(ke.prev=ke,ke.next=ke),ke}function yt(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 kt(W,D,J){return{i:W,x:D,y:J,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Bt(W,D,J){let pe=J.patternDependencies,ke=!1;for(let je of D){let We=je.paint.get(`${W}-pattern`);We.isConstant()||(ke=!0);let ht=We.constantOr(null);ht&&(ke=!0,pe[ht.to]=!0,pe[ht.from]=!0)}return ke}function nr(W,D,J,pe,ke){let je=ke.patternDependencies;for(let We of D){let ht=We.paint.get(`${W}-pattern`).value;if(ht.kind!=="constant"){let Et=ht.evaluate({zoom:pe-1},J,{},ke.availableImages),Ut=ht.evaluate({zoom:pe},J,{},ke.availableImages),or=ht.evaluate({zoom:pe+1},J,{},ke.availableImages);Et=Et&&Et.name?Et.name:Et,Ut=Ut&&Ut.name?Ut.name:Ut,or=or&&or.name?or.name:or,je[Et]=!0,je[Ut]=!0,je[or]=!0,J.patterns[We.id]={min:Et,mid:Ut,max:or}}}return J}class hr{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map(J=>J.id),this.index=D.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Il,this.indexArray=new Fe,this.indexArray2=new et,this.programConfigurations=new al(D.layers,D.zoom),this.segments=new Mt,this.segments2=new Mt,this.stateDependentLayerIds=this.layers.filter(J=>J.isStateDependent()).map(J=>J.id)}populate(D,J,pe){this.hasPattern=Bt("fill",this.layers,J);let ke=this.layers[0].layout.get("fill-sort-key"),je=!ke.isConstant(),We=[];for(let{feature:ht,id:Et,index:Ut,sourceLayerIndex:or}of D){let Mr=this.layers[0]._featureFilter.needGeometry,zr=Hl(ht,Mr);if(!this.layers[0]._featureFilter.filter(new Rs(this.zoom),zr,pe))continue;let Wr=je?ke.evaluate(zr,{},pe,J.availableImages):void 0,ia={id:Et,properties:ht.properties,type:ht.type,sourceLayerIndex:or,index:Ut,geometry:Mr?zr.geometry:Al(ht),patterns:{},sortKey:Wr};We.push(ia)}je&&We.sort((ht,Et)=>ht.sortKey-Et.sortKey);for(let ht of We){let{geometry:Et,index:Ut,sourceLayerIndex:or}=ht;if(this.hasPattern){let Mr=nr("fill",this.layers,ht,this.zoom,J);this.patternFeatures.push(Mr)}else this.addFeature(ht,Et,Ut,pe,{});J.featureIndex.insert(D[Ut].feature,Et,Ut,or,this.index)}}update(D,J,pe){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,J,this.stateDependentLayers,pe)}addFeatures(D,J,pe){for(let ke of this.patternFeatures)this.addFeature(ke,ke.geometry,ke.index,J,pe)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(D){this.uploaded||(this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,Wl),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,J,pe,ke,je){for(let We of Tc(J,500)){let ht=0;for(let Wr of We)ht+=Wr.length;let Et=this.segments.prepareSegment(ht,this.layoutVertexArray,this.indexArray),Ut=Et.vertexLength,or=[],Mr=[];for(let Wr of We){if(Wr.length===0)continue;Wr!==We[0]&&Mr.push(or.length/2);let ia=this.segments2.prepareSegment(Wr.length,this.layoutVertexArray,this.indexArray2),ha=ia.vertexLength;this.layoutVertexArray.emplaceBack(Wr[0].x,Wr[0].y),this.indexArray2.emplaceBack(ha+Wr.length-1,ha),or.push(Wr[0].x),or.push(Wr[0].y);for(let ja=1;ja<Wr.length;ja++)this.layoutVertexArray.emplaceBack(Wr[ja].x,Wr[ja].y),this.indexArray2.emplaceBack(ha+ja-1,ha+ja),or.push(Wr[ja].x),or.push(Wr[ja].y);ia.vertexLength+=Wr.length,ia.primitiveLength+=Wr.length}let zr=fs(or,Mr);for(let Wr=0;Wr<zr.length;Wr+=3)this.indexArray.emplaceBack(Ut+zr[Wr],Ut+zr[Wr+1],Ut+zr[Wr+2]);Et.vertexLength+=ht,Et.primitiveLength+=zr.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,pe,je,ke)}}let lr,dr;mi("FillBucket",hr,{omit:["layers","patternFeatures"]});var ur={get paint(){return dr=dr||new Ue({"fill-antialias":new ho(re.paint_fill["fill-antialias"]),"fill-opacity":new Ro(re.paint_fill["fill-opacity"]),"fill-color":new Ro(re.paint_fill["fill-color"]),"fill-outline-color":new Ro(re.paint_fill["fill-outline-color"]),"fill-translate":new ho(re.paint_fill["fill-translate"]),"fill-translate-anchor":new ho(re.paint_fill["fill-translate-anchor"]),"fill-pattern":new Dc(re.paint_fill["fill-pattern"])})},get layout(){return lr=lr||new Ue({"fill-sort-key":new Ro(re.layout_fill["fill-sort-key"])})}};class Ht extends ie{constructor(D){super(D,ur)}recalculate(D,J){super.recalculate(D,J);let pe=this.paint._values["fill-outline-color"];pe.value.kind==="constant"&&pe.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(D){return new hr(D)}queryRadius(){return yn(this.paint.get("fill-translate"))}queryIntersectsFeature(D,J,pe,ke,je,We,ht){return Zt(zi(D,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),We.angle,ht),ke)}isTileClipped(){return!0}}let sr=dt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Vt=dt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Dr}=sr;var Jr={},ga=o,vi=Ga;function Ga(W,D,J,pe,ke){this.properties={},this.extent=J,this.type=0,this._pbf=W,this._geometry=-1,this._keys=pe,this._values=ke,W.readFields(ai,this,D)}function ai(W,D,J){W==1?D.id=J.readVarint():W==2?function(pe,ke){for(var je=pe.readVarint()+pe.pos;pe.pos<je;){var We=ke._keys[pe.readVarint()],ht=ke._values[pe.readVarint()];ke.properties[We]=ht}}(J,D):W==3?D.type=J.readVarint():W==4&&(D._geometry=J.pos)}function Zi(W){for(var D,J,pe=0,ke=0,je=W.length,We=je-1;ke<je;We=ke++)pe+=((J=W[We]).x-(D=W[ke]).x)*(D.y+J.y);return pe}Ga.types=["Unknown","Point","LineString","Polygon"],Ga.prototype.loadGeometry=function(){var W=this._pbf;W.pos=this._geometry;for(var D,J=W.readVarint()+W.pos,pe=1,ke=0,je=0,We=0,ht=[];W.pos<J;){if(ke<=0){var Et=W.readVarint();pe=7&Et,ke=Et>>3}if(ke--,pe===1||pe===2)je+=W.readSVarint(),We+=W.readSVarint(),pe===1&&(D&&ht.push(D),D=[]),D.push(new ga(je,We));else{if(pe!==7)throw new Error("unknown command "+pe);D&&D.push(D[0].clone())}}return D&&ht.push(D),ht},Ga.prototype.bbox=function(){var W=this._pbf;W.pos=this._geometry;for(var D=W.readVarint()+W.pos,J=1,pe=0,ke=0,je=0,We=1/0,ht=-1/0,Et=1/0,Ut=-1/0;W.pos<D;){if(pe<=0){var or=W.readVarint();J=7&or,pe=or>>3}if(pe--,J===1||J===2)(ke+=W.readSVarint())<We&&(We=ke),ke>ht&&(ht=ke),(je+=W.readSVarint())<Et&&(Et=je),je>Ut&&(Ut=je);else if(J!==7)throw new Error("unknown command "+J)}return[We,Et,ht,Ut]},Ga.prototype.toGeoJSON=function(W,D,J){var pe,ke,je=this.extent*Math.pow(2,J),We=this.extent*W,ht=this.extent*D,Et=this.loadGeometry(),Ut=Ga.types[this.type];function or(Wr){for(var ia=0;ia<Wr.length;ia++){var ha=Wr[ia];Wr[ia]=[360*(ha.x+We)/je-180,360/Math.PI*Math.atan(Math.exp((180-360*(ha.y+ht)/je)*Math.PI/180))-90]}}switch(this.type){case 1:var Mr=[];for(pe=0;pe<Et.length;pe++)Mr[pe]=Et[pe][0];or(Et=Mr);break;case 2:for(pe=0;pe<Et.length;pe++)or(Et[pe]);break;case 3:for(Et=function(Wr){var ia=Wr.length;if(ia<=1)return[Wr];for(var ha,ja,Ka=[],Wi=0;Wi<ia;Wi++){var gi=Zi(Wr[Wi]);gi!==0&&(ja===void 0&&(ja=gi<0),ja===gi<0?(ha&&Ka.push(ha),ha=[Wr[Wi]]):ha.push(Wr[Wi]))}return ha&&Ka.push(ha),Ka}(Et),pe=0;pe<Et.length;pe++)for(ke=0;ke<Et[pe].length;ke++)or(Et[pe][ke])}Et.length===1?Et=Et[0]:Ut="Multi"+Ut;var zr={type:"Feature",geometry:{type:Ut,coordinates:Et},properties:this.properties};return"id"in this&&(zr.id=this.id),zr};var Fi=vi,ui=_i;function _i(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(Si,this,D),this.length=this._features.length}function Si(W,D,J){W===15?D.version=J.readVarint():W===1?D.name=J.readString():W===5?D.extent=J.readVarint():W===2?D._features.push(J.pos):W===3?D._keys.push(J.readString()):W===4&&D._values.push(function(pe){for(var ke=null,je=pe.readVarint()+pe.pos;pe.pos<je;){var We=pe.readVarint()>>3;ke=We===1?pe.readString():We===2?pe.readFloat():We===3?pe.readDouble():We===4?pe.readVarint64():We===5?pe.readVarint():We===6?pe.readSVarint():We===7?pe.readBoolean():null}return ke}(J))}_i.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 Fi(this._pbf,D,this.extent,this._keys,this._values)};var Ui=ui;function fn(W,D,J){if(W===3){var pe=new Ui(J,J.readVarint()+J.pos);pe.length&&(D[pe.name]=pe)}}Jr.VectorTile=function(W,D){this.layers=W.readFields(fn,{},D)},Jr.VectorTileFeature=vi,Jr.VectorTileLayer=ui;let _o=Jr.VectorTileFeature.types,Bo=Math.pow(2,13);function Ps(W,D,J,pe,ke,je,We,ht){W.emplaceBack(D,J,2*Math.floor(pe*Bo)+We,ke*Bo*2,je*Bo*2,Math.round(ht))}class Do{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map(J=>J.id),this.index=D.index,this.hasPattern=!1,this.layoutVertexArray=new eu,this.centroidVertexArray=new Jo,this.indexArray=new Fe,this.programConfigurations=new al(D.layers,D.zoom),this.segments=new Mt,this.stateDependentLayerIds=this.layers.filter(J=>J.isStateDependent()).map(J=>J.id)}populate(D,J,pe){this.features=[],this.hasPattern=Bt("fill-extrusion",this.layers,J);for(let{feature:ke,id:je,index:We,sourceLayerIndex:ht}of D){let Et=this.layers[0]._featureFilter.needGeometry,Ut=Hl(ke,Et);if(!this.layers[0]._featureFilter.filter(new Rs(this.zoom),Ut,pe))continue;let or={id:je,sourceLayerIndex:ht,index:We,geometry:Et?Ut.geometry:Al(ke),properties:ke.properties,type:ke.type,patterns:{}};this.hasPattern?this.features.push(nr("fill-extrusion",this.layers,or,this.zoom,J)):this.addFeature(or,or.geometry,We,pe,{}),J.featureIndex.insert(ke,or.geometry,We,ht,this.index,!0)}}addFeatures(D,J,pe){for(let ke of this.features){let{geometry:je}=ke;this.addFeature(ke,je,ke.index,J,pe)}}update(D,J,pe){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,J,this.stateDependentLayers,pe)}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,Dr),this.centroidVertexBuffer=D.createVertexBuffer(this.centroidVertexArray,Vt.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,J,pe,ke,je){for(let We of Tc(J,500)){let ht={x:0,y:0,vertexCount:0},Et=0;for(let ia of We)Et+=ia.length;let Ut=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let ia of We){if(ia.length===0||Ys(ia))continue;let ha=0;for(let ja=0;ja<ia.length;ja++){let Ka=ia[ja];if(ja>=1){let Wi=ia[ja-1];if(!Ms(Ka,Wi)){Ut.vertexLength+4>Mt.MAX_VERTEX_ARRAY_LENGTH&&(Ut=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let gi=Ka.sub(Wi)._perp()._unit(),qi=Wi.dist(Ka);ha+qi>32768&&(ha=0),Ps(this.layoutVertexArray,Ka.x,Ka.y,gi.x,gi.y,0,0,ha),Ps(this.layoutVertexArray,Ka.x,Ka.y,gi.x,gi.y,0,1,ha),ht.x+=2*Ka.x,ht.y+=2*Ka.y,ht.vertexCount+=2,ha+=qi,Ps(this.layoutVertexArray,Wi.x,Wi.y,gi.x,gi.y,0,0,ha),Ps(this.layoutVertexArray,Wi.x,Wi.y,gi.x,gi.y,0,1,ha),ht.x+=2*Wi.x,ht.y+=2*Wi.y,ht.vertexCount+=2;let en=Ut.vertexLength;this.indexArray.emplaceBack(en,en+2,en+1),this.indexArray.emplaceBack(en+1,en+2,en+3),Ut.vertexLength+=4,Ut.primitiveLength+=2}}}}if(Ut.vertexLength+Et>Mt.MAX_VERTEX_ARRAY_LENGTH&&(Ut=this.segments.prepareSegment(Et,this.layoutVertexArray,this.indexArray)),_o[D.type]!=="Polygon")continue;let or=[],Mr=[],zr=Ut.vertexLength;for(let ia of We)if(ia.length!==0){ia!==We[0]&&Mr.push(or.length/2);for(let ha=0;ha<ia.length;ha++){let ja=ia[ha];Ps(this.layoutVertexArray,ja.x,ja.y,0,0,1,1,0),ht.x+=ja.x,ht.y+=ja.y,ht.vertexCount+=1,or.push(ja.x),or.push(ja.y)}}let Wr=fs(or,Mr);for(let ia=0;ia<Wr.length;ia+=3)this.indexArray.emplaceBack(zr+Wr[ia],zr+Wr[ia+2],zr+Wr[ia+1]);Ut.primitiveLength+=Wr.length/3,Ut.vertexLength+=Et;for(let ia=0;ia<ht.vertexCount;ia++){let ha=Math.floor(ht.x/ht.vertexCount),ja=Math.floor(ht.y/ht.vertexCount);this.centroidVertexArray.emplaceBack(ha,ja)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,pe,je,ke)}}function Ms(W,D){return W.x===D.x&&(W.x<0||W.x>vo)||W.y===D.y&&(W.y<0||W.y>vo)}function Ys(W){return W.every(D=>D.x<0)||W.every(D=>D.x>vo)||W.every(D=>D.y<0)||W.every(D=>D.y>vo)}let mu;mi("FillExtrusionBucket",Do,{omit:["layers","features"]});var Ep={get paint(){return mu=mu||new Ue({"fill-extrusion-opacity":new ho(re["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ro(re["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ho(re["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ho(re["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Dc(re["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ro(re["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ro(re["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ho(re["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class kp extends ie{constructor(D){super(D,Ep)}createBucket(D){return new Do(D)}queryRadius(){return yn(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(D,J,pe,ke,je,We,ht,Et){let Ut=zi(D,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),We.angle,ht),or=this.paint.get("fill-extrusion-height").evaluate(J,pe),Mr=this.paint.get("fill-extrusion-base").evaluate(J,pe),zr=function(ia,ha,ja,Ka){let Wi=[];for(let gi of ia){let qi=[gi.x,gi.y,0,1];pn(qi,qi,ha),Wi.push(new n(qi[0]/qi[3],qi[1]/qi[3]))}return Wi}(Ut,Et),Wr=function(ia,ha,ja,Ka){let Wi=[],gi=[],qi=Ka[8]*ha,en=Ka[9]*ha,qn=Ka[10]*ha,Eo=Ka[11]*ha,ys=Ka[8]*ja,mo=Ka[9]*ja,zn=Ka[10]*ja,ts=Ka[11]*ja;for(let Uo of ia){let zo=[],wn=[];for(let os of Uo){let Fo=os.x,Ls=os.y,Ku=Ka[0]*Fo+Ka[4]*Ls+Ka[12],Uu=Ka[1]*Fo+Ka[5]*Ls+Ka[13],th=Ka[2]*Fo+Ka[6]*Ls+Ka[14],Hp=Ka[3]*Fo+Ka[7]*Ls+Ka[15],Th=th+qn,rh=Hp+Eo,Jh=Ku+ys,$h=Uu+mo,Qh=th+zn,ff=Hp+ts,ah=new n((Ku+qi)/rh,(Uu+en)/rh);ah.z=Th/rh,zo.push(ah);let Fh=new n(Jh/ff,$h/ff);Fh.z=Qh/ff,wn.push(Fh)}Wi.push(zo),gi.push(wn)}return[Wi,gi]}(ke,Mr,or,Et);return function(ia,ha,ja){let Ka=1/0;Zt(ja,ha)&&(Ka=qp(ja,ha[0]));for(let Wi=0;Wi<ha.length;Wi++){let gi=ha[Wi],qi=ia[Wi];for(let en=0;en<gi.length-1;en++){let qn=gi[en],Eo=[qn,gi[en+1],qi[en+1],qi[en],qn];_c(ja,Eo)&&(Ka=Math.min(Ka,qp(ja,Eo)))}}return Ka!==1/0&&Ka}(Wr[0],Wr[1],zr)}}function Ph(W,D){return W.x*D.x+W.y*D.y}function qp(W,D){if(W.length===1){let J=0,pe=D[J++],ke;for(;!ke||pe.equals(ke);)if(ke=D[J++],!ke)return 1/0;for(;J<D.length;J++){let je=D[J],We=W[0],ht=ke.sub(pe),Et=je.sub(pe),Ut=We.sub(pe),or=Ph(ht,ht),Mr=Ph(ht,Et),zr=Ph(Et,Et),Wr=Ph(Ut,ht),ia=Ph(Ut,Et),ha=or*zr-Mr*Mr,ja=(zr*Wr-Mr*ia)/ha,Ka=(or*ia-Mr*Wr)/ha,Wi=pe.z*(1-ja-Ka)+ke.z*ja+je.z*Ka;if(isFinite(Wi))return Wi}return 1/0}{let J=1/0;for(let pe of D)J=Math.min(J,pe.z);return J}}let qd=dt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ed}=qd,Ih=dt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:td}=Ih,Kh=Jr.VectorTileFeature.types,Rh=Math.cos(Math.PI/180*37.5),Cp=Math.pow(2,14)/.5;class Vp{constructor(D){this.zoom=D.zoom,this.overscaling=D.overscaling,this.layers=D.layers,this.layerIds=this.layers.map(J=>J.id),this.index=D.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(J=>{this.gradients[J.id]={}}),this.layoutVertexArray=new Ru,this.layoutVertexArray2=new vu,this.indexArray=new Fe,this.programConfigurations=new al(D.layers,D.zoom),this.segments=new Mt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(J=>J.isStateDependent()).map(J=>J.id)}populate(D,J,pe){this.hasPattern=Bt("line",this.layers,J);let ke=this.layers[0].layout.get("line-sort-key"),je=!ke.isConstant(),We=[];for(let{feature:ht,id:Et,index:Ut,sourceLayerIndex:or}of D){let Mr=this.layers[0]._featureFilter.needGeometry,zr=Hl(ht,Mr);if(!this.layers[0]._featureFilter.filter(new Rs(this.zoom),zr,pe))continue;let Wr=je?ke.evaluate(zr,{},pe):void 0,ia={id:Et,properties:ht.properties,type:ht.type,sourceLayerIndex:or,index:Ut,geometry:Mr?zr.geometry:Al(ht),patterns:{},sortKey:Wr};We.push(ia)}je&&We.sort((ht,Et)=>ht.sortKey-Et.sortKey);for(let ht of We){let{geometry:Et,index:Ut,sourceLayerIndex:or}=ht;if(this.hasPattern){let Mr=nr("line",this.layers,ht,this.zoom,J);this.patternFeatures.push(Mr)}else this.addFeature(ht,Et,Ut,pe,{});J.featureIndex.insert(D[Ut].feature,Et,Ut,or,this.index)}}update(D,J,pe){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(D,J,this.stateDependentLayers,pe)}addFeatures(D,J,pe){for(let ke of this.patternFeatures)this.addFeature(ke,ke.geometry,ke.index,J,pe)}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,td)),this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,ed),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,J,pe,ke,je){let We=this.layers[0].layout,ht=We.get("line-join").evaluate(D,{}),Et=We.get("line-cap"),Ut=We.get("line-miter-limit"),or=We.get("line-round-limit");this.lineClips=this.lineFeatureClips(D);for(let Mr of J)this.addLine(Mr,D,ht,Et,Ut,or);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,D,pe,je,ke)}addLine(D,J,pe,ke,je,We){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Ka=0;Ka<D.length-1;Ka++)this.totalDistance+=D[Ka].dist(D[Ka+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let ht=Kh[J.type]==="Polygon",Et=D.length;for(;Et>=2&&D[Et-1].equals(D[Et-2]);)Et--;let Ut=0;for(;Ut<Et-1&&D[Ut].equals(D[Ut+1]);)Ut++;if(Et<(ht?3:2))return;pe==="bevel"&&(je=1.05);let or=this.overscaling<=16?15*vo/(512*this.overscaling):0,Mr=this.segments.prepareSegment(10*Et,this.layoutVertexArray,this.indexArray),zr,Wr,ia,ha,ja;this.e1=this.e2=-1,ht&&(zr=D[Et-2],ja=D[Ut].sub(zr)._unit()._perp());for(let Ka=Ut;Ka<Et;Ka++){if(ia=Ka===Et-1?ht?D[Ut+1]:void 0:D[Ka+1],ia&&D[Ka].equals(ia))continue;ja&&(ha=ja),zr&&(Wr=zr),zr=D[Ka],ja=ia?ia.sub(zr)._unit()._perp():ha,ha=ha||ja;let Wi=ha.add(ja);Wi.x===0&&Wi.y===0||Wi._unit();let gi=ha.x*ja.x+ha.y*ja.y,qi=Wi.x*ja.x+Wi.y*ja.y,en=qi!==0?1/qi:1/0,qn=2*Math.sqrt(2-2*qi),Eo=qi<Rh&&Wr&&ia,ys=ha.x*ja.y-ha.y*ja.x>0;if(Eo&&Ka>Ut){let ts=zr.dist(Wr);if(ts>2*or){let Uo=zr.sub(zr.sub(Wr)._mult(or/ts)._round());this.updateDistance(Wr,Uo),this.addCurrentVertex(Uo,ha,0,0,Mr),Wr=Uo}}let mo=Wr&&ia,zn=mo?pe:ht?"butt":ke;if(mo&&zn==="round"&&(en<We?zn="miter":en<=2&&(zn="fakeround")),zn==="miter"&&en>je&&(zn="bevel"),zn==="bevel"&&(en>2&&(zn="flipbevel"),en<je&&(zn="miter")),Wr&&this.updateDistance(Wr,zr),zn==="miter")Wi._mult(en),this.addCurrentVertex(zr,Wi,0,0,Mr);else if(zn==="flipbevel"){if(en>100)Wi=ja.mult(-1);else{let ts=en*ha.add(ja).mag()/ha.sub(ja).mag();Wi._perp()._mult(ts*(ys?-1:1))}this.addCurrentVertex(zr,Wi,0,0,Mr),this.addCurrentVertex(zr,Wi.mult(-1),0,0,Mr)}else if(zn==="bevel"||zn==="fakeround"){let ts=-Math.sqrt(en*en-1),Uo=ys?ts:0,zo=ys?0:ts;if(Wr&&this.addCurrentVertex(zr,ha,Uo,zo,Mr),zn==="fakeround"){let wn=Math.round(180*qn/Math.PI/20);for(let os=1;os<wn;os++){let Fo=os/wn;if(Fo!==.5){let Ku=Fo-.5;Fo+=Fo*Ku*(Fo-1)*((1.0904+gi*(gi*(3.55645-1.43519*gi)-3.2452))*Ku*Ku+(.848013+gi*(.215638*gi-1.06021)))}let Ls=ja.sub(ha)._mult(Fo)._add(ha)._unit()._mult(ys?-1:1);this.addHalfVertex(zr,Ls.x,Ls.y,!1,ys,0,Mr)}}ia&&this.addCurrentVertex(zr,ja,-Uo,-zo,Mr)}else if(zn==="butt")this.addCurrentVertex(zr,Wi,0,0,Mr);else if(zn==="square"){let ts=Wr?1:-1;this.addCurrentVertex(zr,Wi,ts,ts,Mr)}else zn==="round"&&(Wr&&(this.addCurrentVertex(zr,ha,0,0,Mr),this.addCurrentVertex(zr,ha,1,1,Mr,!0)),ia&&(this.addCurrentVertex(zr,ja,-1,-1,Mr,!0),this.addCurrentVertex(zr,ja,0,0,Mr)));if(Eo&&Ka<Et-1){let ts=zr.dist(ia);if(ts>2*or){let Uo=zr.add(ia.sub(zr)._mult(or/ts)._round());this.updateDistance(zr,Uo),this.addCurrentVertex(Uo,ja,0,0,Mr),zr=Uo}}}}addCurrentVertex(D,J,pe,ke,je,We=!1){let ht=J.y*ke-J.x,Et=-J.y-J.x*ke;this.addHalfVertex(D,J.x+J.y*pe,J.y-J.x*pe,We,!1,pe,je),this.addHalfVertex(D,ht,Et,We,!0,-ke,je),this.distance>Cp/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(D,J,pe,ke,je,We))}addHalfVertex({x:D,y:J},pe,ke,je,We,ht,Et){let Ut=.5*(this.lineClips?this.scaledDistance*(Cp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((D<<1)+(je?1:0),(J<<1)+(We?1:0),Math.round(63*pe)+128,Math.round(63*ke)+128,1+(ht===0?0:ht<0?-1:1)|(63&Ut)<<2,Ut>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let or=Et.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,or),Et.primitiveLength++),We?this.e2=or:this.e1=or}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(D,J){this.distance+=D.dist(J),this.updateScaledDistance()}}let Lp,Cv;mi("LineBucket",Vp,{omit:["layers","patternFeatures"]});var Vd={get paint(){return Cv=Cv||new Ue({"line-opacity":new Ro(re.paint_line["line-opacity"]),"line-color":new Ro(re.paint_line["line-color"]),"line-translate":new ho(re.paint_line["line-translate"]),"line-translate-anchor":new ho(re.paint_line["line-translate-anchor"]),"line-width":new Ro(re.paint_line["line-width"]),"line-gap-width":new Ro(re.paint_line["line-gap-width"]),"line-offset":new Ro(re.paint_line["line-offset"]),"line-blur":new Ro(re.paint_line["line-blur"]),"line-dasharray":new lc(re.paint_line["line-dasharray"]),"line-pattern":new Dc(re.paint_line["line-pattern"]),"line-gradient":new Yu(re.paint_line["line-gradient"])})},get layout(){return Lp=Lp||new Ue({"line-cap":new ho(re.layout_line["line-cap"]),"line-join":new Ro(re.layout_line["line-join"]),"line-miter-limit":new ho(re.layout_line["line-miter-limit"]),"line-round-limit":new ho(re.layout_line["line-round-limit"]),"line-sort-key":new Ro(re.layout_line["line-sort-key"])})}};class Gf extends Ro{possiblyEvaluate(D,J){return J=new Rs(Math.floor(J.zoom),{now:J.now,fadeDuration:J.fadeDuration,zoomHistory:J.zoomHistory,transition:J.transition}),super.possiblyEvaluate(D,J)}evaluate(D,J,pe,ke){return J=M({},J,{zoom:Math.floor(J.zoom)}),super.evaluate(D,J,pe,ke)}}let Gd;class Lv extends ie{constructor(D){super(D,Vd),this.gradientVersion=0,Gd||(Gd=new Gf(Vd.paint.properties["line-width"].specification),Gd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(D){if(D==="line-gradient"){let J=this.gradientExpression();this.stepInterpolant=!!function(pe){return pe._styleExpression!==void 0}(J)&&J._styleExpression.expression instanceof Ta,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(D,J){super.recalculate(D,J),this.paint._values["line-floorwidth"]=Gd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,D)}createBucket(D){return new Vp(D)}queryRadius(D){let J=D,pe=ph(si("line-width",this,J),si("line-gap-width",this,J)),ke=si("line-offset",this,J);return pe/2+Math.abs(ke)+yn(this.paint.get("line-translate"))}queryIntersectsFeature(D,J,pe,ke,je,We,ht){let Et=zi(D,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),We.angle,ht),Ut=ht/2*ph(this.paint.get("line-width").evaluate(J,pe),this.paint.get("line-gap-width").evaluate(J,pe)),or=this.paint.get("line-offset").evaluate(J,pe);return or&&(ke=function(Mr,zr){let Wr=[];for(let ia=0;ia<Mr.length;ia++){let ha=Mr[ia],ja=[];for(let Ka=0;Ka<ha.length;Ka++){let Wi=ha[Ka-1],gi=ha[Ka],qi=ha[Ka+1],en=Ka===0?new n(0,0):gi.sub(Wi)._unit()._perp(),qn=Ka===ha.length-1?new n(0,0):qi.sub(gi)._unit()._perp(),Eo=en._add(qn)._unit(),ys=Eo.x*qn.x+Eo.y*qn.y;ys!==0&&Eo._mult(1/ys),ja.push(Eo._mult(zr)._add(gi))}Wr.push(ja)}return Wr}(ke,or*ht)),function(Mr,zr,Wr){for(let ia=0;ia<zr.length;ia++){let ha=zr[ia];if(Mr.length>=3){for(let ja=0;ja<ha.length;ja++)if(bi(Mr,ha[ja]))return!0}if(fr(Mr,ha,Wr))return!0}return!1}(Et,ke,Ut)}isTileClipped(){return!0}}function ph(W,D){return D>0?D+2*W:W}let iv=dt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),nm=dt([{name:"a_projected_pos",components:3,type:"Float32"}],4);dt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let om=dt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);dt([{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 Pv=dt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),nv=dt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ov(W,D,J){return W.sections.forEach(pe=>{pe.text=function(ke,je,We){let ht=je.layout.get("text-transform").evaluate(We,{});return ht==="uppercase"?ke=ke.toLocaleUpperCase():ht==="lowercase"&&(ke=ke.toLocaleLowerCase()),Js.applyArabicShaping&&(ke=Js.applyArabicShaping(ke)),ke}(pe.text,D,J)}),W}dt([{name:"triangle",components:3,type:"Uint16"}]),dt([{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"}]),dt([{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"}]),dt([{type:"Float32",name:"offsetX"}]),dt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),dt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let cc={"!":"\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 fu=24,Dh=Mu,Iv=function(W,D,J,pe,ke){var je,We,ht=8*ke-pe-1,Et=(1<<ht)-1,Ut=Et>>1,or=-7,Mr=J?ke-1:0,zr=J?-1:1,Wr=W[D+Mr];for(Mr+=zr,je=Wr&(1<<-or)-1,Wr>>=-or,or+=ht;or>0;je=256*je+W[D+Mr],Mr+=zr,or-=8);for(We=je&(1<<-or)-1,je>>=-or,or+=pe;or>0;We=256*We+W[D+Mr],Mr+=zr,or-=8);if(je===0)je=1-Ut;else{if(je===Et)return We?NaN:1/0*(Wr?-1:1);We+=Math.pow(2,pe),je-=Ut}return(Wr?-1:1)*We*Math.pow(2,je-pe)},sm=function(W,D,J,pe,ke,je){var We,ht,Et,Ut=8*je-ke-1,or=(1<<Ut)-1,Mr=or>>1,zr=ke===23?Math.pow(2,-24)-Math.pow(2,-77):0,Wr=pe?0:je-1,ia=pe?1:-1,ha=D<0||D===0&&1/D<0?1:0;for(D=Math.abs(D),isNaN(D)||D===1/0?(ht=isNaN(D)?1:0,We=or):(We=Math.floor(Math.log(D)/Math.LN2),D*(Et=Math.pow(2,-We))<1&&(We--,Et*=2),(D+=We+Mr>=1?zr/Et:zr*Math.pow(2,1-Mr))*Et>=2&&(We++,Et/=2),We+Mr>=or?(ht=0,We=or):We+Mr>=1?(ht=(D*Et-1)*Math.pow(2,ke),We+=Mr):(ht=D*Math.pow(2,Mr-1)*Math.pow(2,ke),We=0));ke>=8;W[J+Wr]=255&ht,Wr+=ia,ht/=256,ke-=8);for(We=We<<ke|ht,Ut+=ke;Ut>0;W[J+Wr]=255&We,Wr+=ia,We/=256,Ut-=8);W[J+Wr-ia]|=128*ha};function Mu(W){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(W)?W:new Uint8Array(W||0),this.pos=0,this.type=0,this.length=this.buf.length}Mu.Varint=0,Mu.Fixed64=1,Mu.Bytes=2,Mu.Fixed32=5;var w0=4294967296,sv=1/w0,xg=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Pp(W){return W.type===Mu.Bytes?W.readVarint()+W.pos:W.pos+1}function lv(W,D,J){return J?4294967296*D+(W>>>0):4294967296*(D>>>0)+(W>>>0)}function bg(W,D,J){var pe=D<=16383?1:D<=2097151?2:D<=268435455?3:Math.floor(Math.log(D)/(7*Math.LN2));J.realloc(pe);for(var ke=J.pos-1;ke>=W;ke--)J.buf[ke+pe]=J.buf[ke]}function T0(W,D){for(var J=0;J<W.length;J++)D.writeVarint(W[J])}function UT(W,D){for(var J=0;J<W.length;J++)D.writeSVarint(W[J])}function jT(W,D){for(var J=0;J<W.length;J++)D.writeFloat(W[J])}function qT(W,D){for(var J=0;J<W.length;J++)D.writeDouble(W[J])}function VT(W,D){for(var J=0;J<W.length;J++)D.writeBoolean(W[J])}function vk(W,D){for(var J=0;J<W.length;J++)D.writeFixed32(W[J])}function GT(W,D){for(var J=0;J<W.length;J++)D.writeSFixed32(W[J])}function HT(W,D){for(var J=0;J<W.length;J++)D.writeFixed64(W[J])}function WT(W,D){for(var J=0;J<W.length;J++)D.writeSFixed64(W[J])}function Rv(W,D){return(W[D]|W[D+1]<<8|W[D+2]<<16)+16777216*W[D+3]}function A0(W,D,J){W[J]=D,W[J+1]=D>>>8,W[J+2]=D>>>16,W[J+3]=D>>>24}function Lx(W,D){return(W[D]|W[D+1]<<8|W[D+2]<<16)+(W[D+3]<<24)}Mu.prototype={destroy:function(){this.buf=null},readFields:function(W,D,J){for(J=J||this.length;this.pos<J;){var pe=this.readVarint(),ke=pe>>3,je=this.pos;this.type=7&pe,W(ke,D,this),this.pos===je&&this.skip(pe)}return D},readMessage:function(W,D){return this.readFields(W,D,this.readVarint()+this.pos)},readFixed32:function(){var W=Rv(this.buf,this.pos);return this.pos+=4,W},readSFixed32:function(){var W=Lx(this.buf,this.pos);return this.pos+=4,W},readFixed64:function(){var W=Rv(this.buf,this.pos)+Rv(this.buf,this.pos+4)*w0;return this.pos+=8,W},readSFixed64:function(){var W=Rv(this.buf,this.pos)+Lx(this.buf,this.pos+4)*w0;return this.pos+=8,W},readFloat:function(){var W=Iv(this.buf,this.pos,!0,23,4);return this.pos+=4,W},readDouble:function(){var W=Iv(this.buf,this.pos,!0,52,8);return this.pos+=8,W},readVarint:function(W){var D,J,pe=this.buf;return D=127&(J=pe[this.pos++]),J<128?D:(D|=(127&(J=pe[this.pos++]))<<7,J<128?D:(D|=(127&(J=pe[this.pos++]))<<14,J<128?D:(D|=(127&(J=pe[this.pos++]))<<21,J<128?D:function(ke,je,We){var ht,Et,Ut=We.buf;if(ht=(112&(Et=Ut[We.pos++]))>>4,Et<128||(ht|=(127&(Et=Ut[We.pos++]))<<3,Et<128)||(ht|=(127&(Et=Ut[We.pos++]))<<10,Et<128)||(ht|=(127&(Et=Ut[We.pos++]))<<17,Et<128)||(ht|=(127&(Et=Ut[We.pos++]))<<24,Et<128)||(ht|=(1&(Et=Ut[We.pos++]))<<31,Et<128))return lv(ke,ht,je);throw new Error("Expected varint not more than 10 bytes")}(D|=(15&(J=pe[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&&xg?function(J,pe,ke){return xg.decode(J.subarray(pe,ke))}(this.buf,D,W):function(J,pe,ke){for(var je="",We=pe;We<ke;){var ht,Et,Ut,or=J[We],Mr=null,zr=or>239?4:or>223?3:or>191?2:1;if(We+zr>ke)break;zr===1?or<128&&(Mr=or):zr===2?(192&(ht=J[We+1]))==128&&(Mr=(31&or)<<6|63&ht)<=127&&(Mr=null):zr===3?(Et=J[We+2],(192&(ht=J[We+1]))==128&&(192&Et)==128&&((Mr=(15&or)<<12|(63&ht)<<6|63&Et)<=2047||Mr>=55296&&Mr<=57343)&&(Mr=null)):zr===4&&(Et=J[We+2],Ut=J[We+3],(192&(ht=J[We+1]))==128&&(192&Et)==128&&(192&Ut)==128&&((Mr=(15&or)<<18|(63&ht)<<12|(63&Et)<<6|63&Ut)<=65535||Mr>=1114112)&&(Mr=null)),Mr===null?(Mr=65533,zr=1):Mr>65535&&(Mr-=65536,je+=String.fromCharCode(Mr>>>10&1023|55296),Mr=56320|1023&Mr),je+=String.fromCharCode(Mr),We+=zr}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!==Mu.Bytes)return W.push(this.readVarint(D));var J=Pp(this);for(W=W||[];this.pos<J;)W.push(this.readVarint(D));return W},readPackedSVarint:function(W){if(this.type!==Mu.Bytes)return W.push(this.readSVarint());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readSVarint());return W},readPackedBoolean:function(W){if(this.type!==Mu.Bytes)return W.push(this.readBoolean());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readBoolean());return W},readPackedFloat:function(W){if(this.type!==Mu.Bytes)return W.push(this.readFloat());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readFloat());return W},readPackedDouble:function(W){if(this.type!==Mu.Bytes)return W.push(this.readDouble());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readDouble());return W},readPackedFixed32:function(W){if(this.type!==Mu.Bytes)return W.push(this.readFixed32());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readFixed32());return W},readPackedSFixed32:function(W){if(this.type!==Mu.Bytes)return W.push(this.readSFixed32());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readSFixed32());return W},readPackedFixed64:function(W){if(this.type!==Mu.Bytes)return W.push(this.readFixed64());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readFixed64());return W},readPackedSFixed64:function(W){if(this.type!==Mu.Bytes)return W.push(this.readSFixed64());var D=Pp(this);for(W=W||[];this.pos<D;)W.push(this.readSFixed64());return W},skip:function(W){var D=7&W;if(D===Mu.Varint)for(;this.buf[this.pos++]>127;);else if(D===Mu.Bytes)this.pos=this.readVarint()+this.pos;else if(D===Mu.Fixed32)this.pos+=4;else{if(D!==Mu.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 J=new Uint8Array(D);J.set(this.buf),this.buf=J,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),A0(this.buf,W,this.pos),this.pos+=4},writeSFixed32:function(W){this.realloc(4),A0(this.buf,W,this.pos),this.pos+=4},writeFixed64:function(W){this.realloc(8),A0(this.buf,-1&W,this.pos),A0(this.buf,Math.floor(W*sv),this.pos+4),this.pos+=8},writeSFixed64:function(W){this.realloc(8),A0(this.buf,-1&W,this.pos),A0(this.buf,Math.floor(W*sv),this.pos+4),this.pos+=8},writeVarint:function(W){(W=+W||0)>268435455||W<0?function(D,J){var pe,ke;if(D>=0?(pe=D%4294967296|0,ke=D/4294967296|0):(ke=~(-D/4294967296),4294967295^(pe=~(-D%4294967296))?pe=pe+1|0:(pe=0,ke=ke+1|0)),D>=18446744073709552e3||D<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");J.realloc(10),function(je,We,ht){ht.buf[ht.pos++]=127&je|128,je>>>=7,ht.buf[ht.pos++]=127&je|128,je>>>=7,ht.buf[ht.pos++]=127&je|128,je>>>=7,ht.buf[ht.pos++]=127&je|128,ht.buf[ht.pos]=127&(je>>>=7)}(pe,0,J),function(je,We){var ht=(7&je)<<4;We.buf[We.pos++]|=ht|((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)))))}(ke,J)}(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(pe,ke,je){for(var We,ht,Et=0;Et<ke.length;Et++){if((We=ke.charCodeAt(Et))>55295&&We<57344){if(!ht){We>56319||Et+1===ke.length?(pe[je++]=239,pe[je++]=191,pe[je++]=189):ht=We;continue}if(We<56320){pe[je++]=239,pe[je++]=191,pe[je++]=189,ht=We;continue}We=ht-55296<<10|We-56320|65536,ht=null}else ht&&(pe[je++]=239,pe[je++]=191,pe[je++]=189,ht=null);We<128?pe[je++]=We:(We<2048?pe[je++]=We>>6|192:(We<65536?pe[je++]=We>>12|224:(pe[je++]=We>>18|240,pe[je++]=We>>12&63|128),pe[je++]=We>>6&63|128),pe[je++]=63&We|128)}return je}(this.buf,W,this.pos);var J=this.pos-D;J>=128&&bg(D,J,this),this.pos=D-1,this.writeVarint(J),this.pos+=J},writeFloat:function(W){this.realloc(4),sm(this.buf,W,this.pos,!0,23,4),this.pos+=4},writeDouble:function(W){this.realloc(8),sm(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 J=0;J<D;J++)this.buf[this.pos++]=W[J]},writeRawMessage:function(W,D){this.pos++;var J=this.pos;W(D,this);var pe=this.pos-J;pe>=128&&bg(J,pe,this),this.pos=J-1,this.writeVarint(pe),this.pos+=pe},writeMessage:function(W,D,J){this.writeTag(W,Mu.Bytes),this.writeRawMessage(D,J)},writePackedVarint:function(W,D){D.length&&this.writeMessage(W,T0,D)},writePackedSVarint:function(W,D){D.length&&this.writeMessage(W,UT,D)},writePackedBoolean:function(W,D){D.length&&this.writeMessage(W,VT,D)},writePackedFloat:function(W,D){D.length&&this.writeMessage(W,jT,D)},writePackedDouble:function(W,D){D.length&&this.writeMessage(W,qT,D)},writePackedFixed32:function(W,D){D.length&&this.writeMessage(W,vk,D)},writePackedSFixed32:function(W,D){D.length&&this.writeMessage(W,GT,D)},writePackedFixed64:function(W,D){D.length&&this.writeMessage(W,HT,D)},writePackedSFixed64:function(W,D){D.length&&this.writeMessage(W,WT,D)},writeBytesField:function(W,D){this.writeTag(W,Mu.Bytes),this.writeBytes(D)},writeFixed32Field:function(W,D){this.writeTag(W,Mu.Fixed32),this.writeFixed32(D)},writeSFixed32Field:function(W,D){this.writeTag(W,Mu.Fixed32),this.writeSFixed32(D)},writeFixed64Field:function(W,D){this.writeTag(W,Mu.Fixed64),this.writeFixed64(D)},writeSFixed64Field:function(W,D){this.writeTag(W,Mu.Fixed64),this.writeSFixed64(D)},writeVarintField:function(W,D){this.writeTag(W,Mu.Varint),this.writeVarint(D)},writeSVarintField:function(W,D){this.writeTag(W,Mu.Varint),this.writeSVarint(D)},writeStringField:function(W,D){this.writeTag(W,Mu.Bytes),this.writeString(D)},writeFloatField:function(W,D){this.writeTag(W,Mu.Fixed32),this.writeFloat(D)},writeDoubleField:function(W,D){this.writeTag(W,Mu.Fixed64),this.writeDouble(D)},writeBooleanField:function(W,D){this.writeVarintField(W,!!D)}};var P1=r(Dh);let I1=3;function mk(W,D,J){W===1&&J.readMessage(XT,D)}function XT(W,D,J){if(W===3){let{id:pe,bitmap:ke,width:je,height:We,left:ht,top:Et,advance:Ut}=J.readMessage(Px,{});D.push({id:pe,bitmap:new In({width:je+2*I1,height:We+2*I1},ke),metrics:{width:je,height:We,left:ht,top:Et,advance:Ut}})}}function Px(W,D,J){W===1?D.id=J.readVarint():W===2?D.bitmap=J.readBytes():W===3?D.width=J.readVarint():W===4?D.height=J.readVarint():W===5?D.left=J.readSVarint():W===6?D.top=J.readSVarint():W===7&&(D.advance=J.readVarint())}let Ix=I1;function R1(W){let D=0,J=0;for(let We of W)D+=We.w*We.h,J=Math.max(J,We.w);W.sort((We,ht)=>ht.h-We.h);let pe=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(D/.95)),J),h:1/0}],ke=0,je=0;for(let We of W)for(let ht=pe.length-1;ht>=0;ht--){let Et=pe[ht];if(!(We.w>Et.w||We.h>Et.h)){if(We.x=Et.x,We.y=Et.y,je=Math.max(je,We.y+We.h),ke=Math.max(ke,We.x+We.w),We.w===Et.w&&We.h===Et.h){let Ut=pe.pop();ht<pe.length&&(pe[ht]=Ut)}else We.h===Et.h?(Et.x+=We.w,Et.w-=We.w):We.w===Et.w?(Et.y+=We.h,Et.h-=We.h):(pe.push({x:Et.x+We.w,y:Et.y,w:Et.w-We.w,h:We.h}),Et.y+=We.h,Et.h-=We.h);break}}return{w:ke,h:je,fill:D/(ke*je)||0}}let zh=1;class wg{constructor(D,{pixelRatio:J,version:pe,stretchX:ke,stretchY:je,content:We,textFitWidth:ht,textFitHeight:Et}){this.paddedRect=D,this.pixelRatio=J,this.stretchX=ke,this.stretchY=je,this.content=We,this.version=pe,this.textFitWidth=ht,this.textFitHeight=Et}get tl(){return[this.paddedRect.x+zh,this.paddedRect.y+zh]}get br(){return[this.paddedRect.x+this.paddedRect.w-zh,this.paddedRect.y+this.paddedRect.h-zh]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*zh)/this.pixelRatio,(this.paddedRect.h-2*zh)/this.pixelRatio]}}class Tg{constructor(D,J){let pe={},ke={};this.haveRenderCallbacks=[];let je=[];this.addImages(D,pe,je),this.addImages(J,ke,je);let{w:We,h:ht}=R1(je),Et=new Ii({width:We||1,height:ht||1});for(let Ut in D){let or=D[Ut],Mr=pe[Ut].paddedRect;Ii.copy(or.data,Et,{x:0,y:0},{x:Mr.x+zh,y:Mr.y+zh},or.data)}for(let Ut in J){let or=J[Ut],Mr=ke[Ut].paddedRect,zr=Mr.x+zh,Wr=Mr.y+zh,ia=or.data.width,ha=or.data.height;Ii.copy(or.data,Et,{x:0,y:0},{x:zr,y:Wr},or.data),Ii.copy(or.data,Et,{x:0,y:ha-1},{x:zr,y:Wr-1},{width:ia,height:1}),Ii.copy(or.data,Et,{x:0,y:0},{x:zr,y:Wr+ha},{width:ia,height:1}),Ii.copy(or.data,Et,{x:ia-1,y:0},{x:zr-1,y:Wr},{width:1,height:ha}),Ii.copy(or.data,Et,{x:0,y:0},{x:zr+ia,y:Wr},{width:1,height:ha})}this.image=Et,this.iconPositions=pe,this.patternPositions=ke}addImages(D,J,pe){for(let ke in D){let je=D[ke],We={x:0,y:0,w:je.data.width+2*zh,h:je.data.height+2*zh};pe.push(We),J[ke]=new wg(We,je),je.hasRenderCallback&&this.haveRenderCallbacks.push(ke)}}patchUpdatedImages(D,J){D.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let pe in D.updatedImages)this.patchUpdatedImage(this.iconPositions[pe],D.getImage(pe),J),this.patchUpdatedImage(this.patternPositions[pe],D.getImage(pe),J)}patchUpdatedImage(D,J,pe){if(!D||!J||D.version===J.version)return;D.version=J.version;let[ke,je]=D.tl;pe.update(J.data,void 0,{x:ke,y:je})}}var Ip;mi("ImagePosition",wg),mi("ImageAtlas",Tg),e.ah=void 0,(Ip=e.ah||(e.ah={}))[Ip.none=0]="none",Ip[Ip.horizontal=1]="horizontal",Ip[Ip.vertical=2]="vertical",Ip[Ip.horizontalOnly=3]="horizontalOnly";let eh=-17;class S0{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(D,J){let pe=new S0;return pe.scale=D||1,pe.fontStack=J,pe}static forImage(D){let J=new S0;return J.imageName=D,J}}class lm{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(D,J){let pe=new lm;for(let ke=0;ke<D.sections.length;ke++){let je=D.sections[ke];je.image?pe.addImageSection(je):pe.addTextSection(je,J)}return pe}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 J="";for(let pe=0;pe<D.length;pe++){let ke=D.charCodeAt(pe+1)||null,je=D.charCodeAt(pe-1)||null;J+=ke&&Fl(ke)&&!cc[D[pe+1]]||je&&Fl(je)&&!cc[D[pe-1]]||!cc[D[pe]]?D[pe]:cc[D[pe]]}return J}(this.text)}trim(){let D=0;for(let pe=0;pe<this.text.length&&Ag[this.text.charCodeAt(pe)];pe++)D++;let J=this.text.length;for(let pe=this.text.length-1;pe>=0&&pe>=D&&Ag[this.text.charCodeAt(pe)];pe--)J--;this.text=this.text.substring(D,J),this.sectionIndex=this.sectionIndex.slice(D,J)}substring(D,J){let pe=new lm;return pe.text=this.text.substring(D,J),pe.sectionIndex=this.sectionIndex.slice(D,J),pe.sections=this.sections,pe}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((D,J)=>Math.max(D,this.sections[J].scale),0)}addTextSection(D,J){this.text+=D.text,this.sections.push(S0.forText(D.scale,D.fontStack||J));let pe=this.sections.length-1;for(let ke=0;ke<D.text.length;++ke)this.sectionIndex.push(pe)}addImageSection(D){let J=D.image?D.image.name:"";if(J.length===0)return void f("Can't add FormattedSection with an empty image.");let pe=this.getNextImageSectionCharCode();pe?(this.text+=String.fromCharCode(pe),this.sections.push(S0.forImage(J)),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,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia){let ha=lm.fromFeature(W,ke),ja;Mr===e.ah.vertical&&ha.verticalizePunctuation();let{processBidirectionalText:Ka,processStyledBidirectionalText:Wi}=Js;if(Ka&&ha.sections.length===1){ja=[];let en=Ka(ha.toString(),um(ha,Ut,je,D,pe,Wr));for(let qn of en){let Eo=new lm;Eo.text=qn,Eo.sections=ha.sections;for(let ys=0;ys<qn.length;ys++)Eo.sectionIndex.push(0);ja.push(Eo)}}else if(Wi){ja=[];let en=Wi(ha.text,ha.sectionIndex,um(ha,Ut,je,D,pe,Wr));for(let qn of en){let Eo=new lm;Eo.text=qn[0],Eo.sectionIndex=qn[1],Eo.sections=ha.sections,ja.push(Eo)}}else ja=function(en,qn){let Eo=[],ys=en.text,mo=0;for(let zn of qn)Eo.push(en.substring(mo,zn)),mo=zn;return mo<ys.length&&Eo.push(en.substring(mo,ys.length)),Eo}(ha,um(ha,Ut,je,D,pe,Wr));let gi=[],qi={positionedLines:gi,text:ha.toString(),top:or[1],bottom:or[1],left:or[0],right:or[0],writingMode:Mr,iconsInText:!1,verticalizable:!1};return function(en,qn,Eo,ys,mo,zn,ts,Uo,zo,wn,os,Fo){let Ls=0,Ku=eh,Uu=0,th=0,Hp=Uo==="right"?1:Uo==="left"?0:.5,Th=0;for(let ff of mo){ff.trim();let ah=ff.getMaxScale(),Fh=(ah-1)*fu,Ah={positionedGlyphs:[],lineOffset:0};en.positionedLines[Th]=Ah;let dh=Ah.positionedGlyphs,yf=0;if(!ff.length()){Ku+=zn,++Th;continue}for(let dp=0;dp<ff.length();dp++){let hu=ff.getSection(dp),fc=ff.getSectionIndex(dp),Ju=ff.getCharCode(dp),Dp=0,$c=null,vm=null,_d=null,fd=fu,Wp=!(zo===e.ah.horizontal||!os&&!bs(Ju)||os&&(Ag[Ju]||(rh=Ju,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(rh)))));if(hu.imageName){let zc=ys[hu.imageName];if(!zc)continue;_d=hu.imageName,en.iconsInText=en.iconsInText||!0,vm=zc.paddedRect;let Pf=zc.displaySize;hu.scale=hu.scale*fu/Fo,$c={width:Pf[0],height:Pf[1],left:zh,top:-Ix,advance:Wp?Pf[1]:Pf[0]},Dp=Fh+(fu-Pf[1]*hu.scale),fd=$c.advance;let Xp=Wp?Pf[0]*hu.scale-fu*ah:Pf[1]*hu.scale-fu*ah;Xp>0&&Xp>yf&&(yf=Xp)}else{let zc=Eo[hu.fontStack],Pf=zc&&zc[Ju];if(Pf&&Pf.rect)vm=Pf.rect,$c=Pf.metrics;else{let Xp=qn[hu.fontStack],Zd=Xp&&Xp[Ju];if(!Zd)continue;$c=Zd.metrics}Dp=(ah-hu.scale)*fu}Wp?(en.verticalizable=!0,dh.push({glyph:Ju,imageName:_d,x:Ls,y:Ku+Dp,vertical:Wp,scale:hu.scale,fontStack:hu.fontStack,sectionIndex:fc,metrics:$c,rect:vm}),Ls+=fd*hu.scale+wn):(dh.push({glyph:Ju,imageName:_d,x:Ls,y:Ku+Dp,vertical:Wp,scale:hu.scale,fontStack:hu.fontStack,sectionIndex:fc,metrics:$c,rect:vm}),Ls+=$c.advance*hu.scale+wn)}dh.length!==0&&(Uu=Math.max(Ls-wn,Uu),uv(dh,0,dh.length-1,Hp,yf)),Ls=0;let Rp=zn*ah+yf;Ah.lineOffset=Math.max(yf,Fh),Ku+=Rp,th=Math.max(Rp,th),++Th}var rh;let Jh=Ku-eh,{horizontalAlign:$h,verticalAlign:Qh}=Mg(ts);(function(ff,ah,Fh,Ah,dh,yf,Rp,dp,hu){let fc=(ah-Fh)*dh,Ju=0;Ju=yf!==Rp?-dp*Ah-eh:(-Ah*hu+.5)*Rp;for(let Dp of ff)for(let $c of Dp.positionedGlyphs)$c.x+=fc,$c.y+=Ju})(en.positionedLines,Hp,$h,Qh,Uu,th,zn,Jh,mo.length),en.top+=-Qh*Jh,en.bottom=en.top+Jh,en.left+=-$h*Uu,en.right=en.left+Uu}(qi,D,J,pe,ja,We,ht,Et,Mr,Ut,zr,ia),!function(en){for(let qn of en)if(qn.positionedGlyphs.length!==0)return!1;return!0}(gi)&&qi}let Ag={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ZT={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},YT={40:!0};function Rx(W,D,J,pe,ke,je){if(D.imageName){let We=pe[D.imageName];return We?We.displaySize[0]*D.scale*fu/je+ke:0}{let We=J[D.fontStack],ht=We&&We[W];return ht?ht.metrics.advance*D.scale+ke:0}}function Dx(W,D,J,pe){let ke=Math.pow(W-D,2);return pe?W<D?ke/2:2*ke:ke+Math.abs(J)*J}function KT(W,D,J){let pe=0;return W===10&&(pe-=1e4),J&&(pe+=150),W!==40&&W!==65288||(pe+=50),D!==41&&D!==65289||(pe+=50),pe}function Sg(W,D,J,pe,ke,je){let We=null,ht=Dx(D,J,ke,je);for(let Et of pe){let Ut=Dx(D-Et.x,J,ke,je)+Et.badness;Ut<=ht&&(We=Et,ht=Ut)}return{index:W,x:D,priorBreak:We,badness:ht}}function zx(W){return W?zx(W.priorBreak).concat(W.index):[]}function um(W,D,J,pe,ke,je){if(!W)return[];let We=[],ht=function(Mr,zr,Wr,ia,ha,ja){let Ka=0;for(let Wi=0;Wi<Mr.length();Wi++){let gi=Mr.getSection(Wi);Ka+=Rx(Mr.getCharCode(Wi),gi,ia,ha,zr,ja)}return Ka/Math.max(1,Math.ceil(Ka/Wr))}(W,D,J,pe,ke,je),Et=W.text.indexOf("\u200B")>=0,Ut=0;for(let Mr=0;Mr<W.length();Mr++){let zr=W.getSection(Mr),Wr=W.getCharCode(Mr);if(Ag[Wr]||(Ut+=Rx(Wr,zr,pe,ke,D,je)),Mr<W.length()-1){let ia=!((or=Wr)<11904)&&(!!un["CJK Compatibility Forms"](or)||!!un["CJK Compatibility"](or)||!!un["CJK Strokes"](or)||!!un["CJK Symbols and Punctuation"](or)||!!un["Enclosed CJK Letters and Months"](or)||!!un["Halfwidth and Fullwidth Forms"](or)||!!un["Ideographic Description Characters"](or)||!!un["Vertical Forms"](or)||el.test(String.fromCodePoint(or)));(ZT[Wr]||ia||zr.imageName||Mr!==W.length()-2&&YT[W.getCharCode(Mr+1)])&&We.push(Sg(Mr+1,Ut,ht,We,KT(Wr,W.getCharCode(Mr+1),ia&&Et),!1))}}var or;return zx(Sg(W.length(),Ut,ht,We,0,!0))}function Mg(W){let D=.5,J=.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":J=1;break;case"top":case"top-right":case"top-left":J=0}return{horizontalAlign:D,verticalAlign:J}}function uv(W,D,J,pe,ke){if(!pe&&!ke)return;let je=W[J],We=(W[J].x+je.metrics.advance*je.scale)*pe;for(let ht=D;ht<=J;ht++)W[ht].x-=We,W[ht].y+=ke}function E0(W,D,J){let{horizontalAlign:pe,verticalAlign:ke}=Mg(J),je=D[0]-W.displaySize[0]*pe,We=D[1]-W.displaySize[1]*ke;return{image:W,top:We,bottom:We+W.displaySize[1],left:je,right:je+W.displaySize[0]}}function Fx(W){var D,J;let pe=W.left,ke=W.top,je=W.right-pe,We=W.bottom-ke,ht=(D=W.image.textFitWidth)!==null&&D!==void 0?D:"stretchOrShrink",Et=(J=W.image.textFitHeight)!==null&&J!==void 0?J:"stretchOrShrink",Ut=(W.image.content[2]-W.image.content[0])/(W.image.content[3]-W.image.content[1]);if(Et==="proportional"){if(ht==="stretchOnly"&&je/We<Ut||ht==="proportional"){let or=Math.ceil(We*Ut);pe*=or/je,je=or}}else if(ht==="proportional"&&Et==="stretchOnly"&&Ut!==0&&je/We>Ut){let or=Math.ceil(je/Ut);ke*=or/We,We=or}return{x1:pe,y1:ke,x2:pe+je,y2:ke+We}}function Ox(W,D,J,pe,ke,je){let We=W.image,ht;if(We.content){let ja=We.content,Ka=We.pixelRatio||1;ht=[ja[0]/Ka,ja[1]/Ka,We.displaySize[0]-ja[2]/Ka,We.displaySize[1]-ja[3]/Ka]}let Et=D.left*je,Ut=D.right*je,or,Mr,zr,Wr;J==="width"||J==="both"?(Wr=ke[0]+Et-pe[3],Mr=ke[0]+Ut+pe[1]):(Wr=ke[0]+(Et+Ut-We.displaySize[0])/2,Mr=Wr+We.displaySize[0]);let ia=D.top*je,ha=D.bottom*je;return J==="height"||J==="both"?(or=ke[1]+ia-pe[0],zr=ke[1]+ha+pe[2]):(or=ke[1]+(ia+ha-We.displaySize[1])/2,zr=or+We.displaySize[1]),{image:We,top:or,right:Mr,bottom:zr,left:Wr,collisionPadding:ht}}let k0=255,yd=128,cv=k0*yd;function Bx(W,D){let{expression:J}=D;if(J.kind==="constant")return{kind:"constant",layoutSize:J.evaluate(new Rs(W+1))};if(J.kind==="source")return{kind:"source"};{let{zoomStops:pe,interpolationType:ke}=J,je=0;for(;je<pe.length&&pe[je]<=W;)je++;je=Math.max(0,je-1);let We=je;for(;We<pe.length&&pe[We]<W+1;)We++;We=Math.min(pe.length-1,We);let ht=pe[je],Et=pe[We];return J.kind==="composite"?{kind:"composite",minZoom:ht,maxZoom:Et,interpolationType:ke}:{kind:"camera",minZoom:ht,maxZoom:Et,minSize:J.evaluate(new Rs(ht)),maxSize:J.evaluate(new Rs(Et)),interpolationType:ke}}}function D1(W,D,J){let pe="never",ke=W.get(D);return ke?pe=ke:W.get(J)&&(pe="always"),pe}let JT=Jr.VectorTileFeature.types,$T=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Eg(W,D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr){let Wr=ht?Math.min(cv,Math.round(ht[0])):0,ia=ht?Math.min(cv,Math.round(ht[1])):0;W.emplaceBack(D,J,Math.round(32*pe),Math.round(32*ke),je,We,(Wr<<1)+(Et?1:0),ia,16*Ut,16*or,256*Mr,256*zr)}function z1(W,D,J){W.emplaceBack(D.x,D.y,J),W.emplaceBack(D.x,D.y,J),W.emplaceBack(D.x,D.y,J),W.emplaceBack(D.x,D.y,J)}function F1(W){for(let D of W.sections)if(Lo(D.text))return!0;return!1}class O1{constructor(D){this.layoutVertexArray=new cu,this.indexArray=new Fe,this.programConfigurations=D,this.segments=new Mt,this.dynamicLayoutVertexArray=new uc,this.opacityVertexArray=new Vl,this.hasVisibleVertices=!1,this.placedSymbolArray=new Kn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(D,J,pe,ke){this.isEmpty()||(pe&&(this.layoutVertexBuffer=D.createVertexBuffer(this.layoutVertexArray,iv.members),this.indexBuffer=D.createIndexBuffer(this.indexArray,J),this.dynamicLayoutVertexBuffer=D.createVertexBuffer(this.dynamicLayoutVertexArray,nm.members,!0),this.opacityVertexBuffer=D.createVertexBuffer(this.opacityVertexArray,$T,!0),this.opacityVertexBuffer.itemSize=1),(pe||ke)&&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())}}mi("SymbolBuffers",O1);class fv{constructor(D,J,pe){this.layoutVertexArray=new D,this.layoutAttributes=J,this.indexArray=new pe,this.segments=new Mt,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,om.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}mi("CollisionBuffers",fv);class cm{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=di([]),this.placementViewportMatrix=di([]);let J=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Bx(this.zoom,J["text-size"]),this.iconSizeData=Bx(this.zoom,J["icon-size"]);let pe=this.layers[0].layout,ke=pe.get("symbol-sort-key"),je=pe.get("symbol-z-order");this.canOverlap=D1(pe,"text-overlap","text-allow-overlap")!=="never"||D1(pe,"icon-overlap","icon-allow-overlap")!=="never"||pe.get("text-ignore-placement")||pe.get("icon-ignore-placement"),this.sortFeaturesByKey=je!=="viewport-y"&&!ke.isConstant(),this.sortFeaturesByY=(je==="viewport-y"||je==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,pe.get("symbol-placement")==="point"&&(this.writingModes=pe.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 O1(new al(this.layers,this.zoom,D=>/^text/.test(D))),this.icon=new O1(new al(this.layers,this.zoom,D=>/^icon/.test(D))),this.glyphOffsetArray=new is,this.lineVertexArray=new Ao,this.symbolInstances=new wo,this.textAnchorOffsets=new ps}calculateGlyphDependencies(D,J,pe,ke,je){for(let We=0;We<D.length;We++)if(J[D.charCodeAt(We)]=!0,(pe||ke)&&je){let ht=cc[D.charAt(We)];ht&&(J[ht.charCodeAt(0)]=!0)}}populate(D,J,pe){let ke=this.layers[0],je=ke.layout,We=je.get("text-font"),ht=je.get("text-field"),Et=je.get("icon-image"),Ut=(ht.value.kind!=="constant"||ht.value.value instanceof ra&&!ht.value.value.isEmpty()||ht.value.value.toString().length>0)&&(We.value.kind!=="constant"||We.value.value.length>0),or=Et.value.kind!=="constant"||!!Et.value.value||Object.keys(Et.parameters).length>0,Mr=je.get("symbol-sort-key");if(this.features=[],!Ut&&!or)return;let zr=J.iconDependencies,Wr=J.glyphDependencies,ia=J.availableImages,ha=new Rs(this.zoom);for(let{feature:ja,id:Ka,index:Wi,sourceLayerIndex:gi}of D){let qi=ke._featureFilter.needGeometry,en=Hl(ja,qi);if(!ke._featureFilter.filter(ha,en,pe))continue;let qn,Eo;if(qi||(en.geometry=Al(ja)),Ut){let mo=ke.getValueAndResolveTokens("text-field",en,pe,ia),zn=ra.factory(mo),ts=this.hasRTLText=this.hasRTLText||F1(zn);(!ts||Js.getRTLTextPluginStatus()==="unavailable"||ts&&Js.isParsed())&&(qn=ov(zn,ke,en))}if(or){let mo=ke.getValueAndResolveTokens("icon-image",en,pe,ia);Eo=mo instanceof Za?mo:Za.fromString(mo)}if(!qn&&!Eo)continue;let ys=this.sortFeaturesByKey?Mr.evaluate(en,{},pe):void 0;if(this.features.push({id:Ka,text:qn,icon:Eo,index:Wi,sourceLayerIndex:gi,geometry:en.geometry,properties:ja.properties,type:JT[ja.type],sortKey:ys}),Eo&&(zr[Eo.name]=!0),qn){let mo=We.evaluate(en,{},pe).join(","),zn=je.get("text-rotation-alignment")!=="viewport"&&je.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.ah.vertical)>=0;for(let ts of qn.sections)if(ts.image)zr[ts.image.name]=!0;else{let Uo=yo(qn.toString()),zo=ts.fontStack||mo,wn=Wr[zo]=Wr[zo]||{};this.calculateGlyphDependencies(ts.text,wn,zn,this.allowVerticalPlacement,Uo)}}}je.get("symbol-placement")==="line"&&(this.features=function(ja){let Ka={},Wi={},gi=[],qi=0;function en(mo){gi.push(ja[mo]),qi++}function qn(mo,zn,ts){let Uo=Wi[mo];return delete Wi[mo],Wi[zn]=Uo,gi[Uo].geometry[0].pop(),gi[Uo].geometry[0]=gi[Uo].geometry[0].concat(ts[0]),Uo}function Eo(mo,zn,ts){let Uo=Ka[zn];return delete Ka[zn],Ka[mo]=Uo,gi[Uo].geometry[0].shift(),gi[Uo].geometry[0]=ts[0].concat(gi[Uo].geometry[0]),Uo}function ys(mo,zn,ts){let Uo=ts?zn[0][zn[0].length-1]:zn[0][0];return`${mo}:${Uo.x}:${Uo.y}`}for(let mo=0;mo<ja.length;mo++){let zn=ja[mo],ts=zn.geometry,Uo=zn.text?zn.text.toString():null;if(!Uo){en(mo);continue}let zo=ys(Uo,ts),wn=ys(Uo,ts,!0);if(zo in Wi&&wn in Ka&&Wi[zo]!==Ka[wn]){let os=Eo(zo,wn,ts),Fo=qn(zo,wn,gi[os].geometry);delete Ka[zo],delete Wi[wn],Wi[ys(Uo,gi[Fo].geometry,!0)]=Fo,gi[os].geometry=null}else zo in Wi?qn(zo,wn,ts):wn in Ka?Eo(zo,wn,ts):(en(mo),Ka[zo]=qi-1,Wi[wn]=qi-1)}return gi.filter(mo=>mo.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ja,Ka)=>ja.sortKey-Ka.sortKey)}update(D,J,pe){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(D,J,this.layers,pe),this.icon.programConfigurations.updatePaintArrays(D,J,this.layers,pe))}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,J){let pe=this.lineVertexArray.length;if(D.segment!==void 0){let ke=D.dist(J[D.segment+1]),je=D.dist(J[D.segment]),We={};for(let ht=D.segment+1;ht<J.length;ht++)We[ht]={x:J[ht].x,y:J[ht].y,tileUnitDistanceFromAnchor:ke},ht<J.length-1&&(ke+=J[ht+1].dist(J[ht]));for(let ht=D.segment||0;ht>=0;ht--)We[ht]={x:J[ht].x,y:J[ht].y,tileUnitDistanceFromAnchor:je},ht>0&&(je+=J[ht-1].dist(J[ht]));for(let ht=0;ht<J.length;ht++){let Et=We[ht];this.lineVertexArray.emplaceBack(Et.x,Et.y,Et.tileUnitDistanceFromAnchor)}}return{lineStartIndex:pe,lineLength:this.lineVertexArray.length-pe}}addSymbols(D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr){let Wr=D.indexArray,ia=D.layoutVertexArray,ha=D.segments.prepareSegment(4*J.length,ia,Wr,this.canOverlap?We.sortKey:void 0),ja=this.glyphOffsetArray.length,Ka=ha.vertexLength,Wi=this.allowVerticalPlacement&&ht===e.ah.vertical?Math.PI/2:0,gi=We.text&&We.text.sections;for(let qi=0;qi<J.length;qi++){let{tl:en,tr:qn,bl:Eo,br:ys,tex:mo,pixelOffsetTL:zn,pixelOffsetBR:ts,minFontScaleX:Uo,minFontScaleY:zo,glyphOffset:wn,isSDF:os,sectionIndex:Fo}=J[qi],Ls=ha.vertexLength,Ku=wn[1];Eg(ia,Et.x,Et.y,en.x,Ku+en.y,mo.x,mo.y,pe,os,zn.x,zn.y,Uo,zo),Eg(ia,Et.x,Et.y,qn.x,Ku+qn.y,mo.x+mo.w,mo.y,pe,os,ts.x,zn.y,Uo,zo),Eg(ia,Et.x,Et.y,Eo.x,Ku+Eo.y,mo.x,mo.y+mo.h,pe,os,zn.x,ts.y,Uo,zo),Eg(ia,Et.x,Et.y,ys.x,Ku+ys.y,mo.x+mo.w,mo.y+mo.h,pe,os,ts.x,ts.y,Uo,zo),z1(D.dynamicLayoutVertexArray,Et,Wi),Wr.emplaceBack(Ls,Ls+1,Ls+2),Wr.emplaceBack(Ls+1,Ls+2,Ls+3),ha.vertexLength+=4,ha.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(wn[0]),qi!==J.length-1&&Fo===J[qi+1].sectionIndex||D.programConfigurations.populatePaintArrays(ia.length,We,We.index,{},zr,gi&&gi[Fo])}D.placedSymbolArray.emplaceBack(Et.x,Et.y,ja,this.glyphOffsetArray.length-ja,Ka,Ut,or,Et.segment,pe?pe[0]:0,pe?pe[1]:0,ke[0],ke[1],ht,0,!1,0,Mr)}_addCollisionDebugVertex(D,J,pe,ke,je,We){return J.emplaceBack(0,0),D.emplaceBack(pe.x,pe.y,ke,je,Math.round(We.x),Math.round(We.y))}addCollisionDebugVertices(D,J,pe,ke,je,We,ht){let Et=je.segments.prepareSegment(4,je.layoutVertexArray,je.indexArray),Ut=Et.vertexLength,or=je.layoutVertexArray,Mr=je.collisionVertexArray,zr=ht.anchorX,Wr=ht.anchorY;this._addCollisionDebugVertex(or,Mr,We,zr,Wr,new n(D,J)),this._addCollisionDebugVertex(or,Mr,We,zr,Wr,new n(pe,J)),this._addCollisionDebugVertex(or,Mr,We,zr,Wr,new n(pe,ke)),this._addCollisionDebugVertex(or,Mr,We,zr,Wr,new n(D,ke)),Et.vertexLength+=4;let ia=je.indexArray;ia.emplaceBack(Ut,Ut+1),ia.emplaceBack(Ut+1,Ut+2),ia.emplaceBack(Ut+2,Ut+3),ia.emplaceBack(Ut+3,Ut),Et.primitiveLength+=4}addDebugCollisionBoxes(D,J,pe,ke){for(let je=D;je<J;je++){let We=this.collisionBoxArray.get(je);this.addCollisionDebugVertices(We.x1,We.y1,We.x2,We.y2,ke?this.textCollisionBox:this.iconCollisionBox,We.anchorPoint,pe)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new fv(Gl,Pv.members,et),this.iconCollisionBox=new fv(Gl,Pv.members,et);for(let D=0;D<this.symbolInstances.length;D++){let J=this.symbolInstances.get(D);this.addDebugCollisionBoxes(J.textBoxStartIndex,J.textBoxEndIndex,J,!0),this.addDebugCollisionBoxes(J.verticalTextBoxStartIndex,J.verticalTextBoxEndIndex,J,!0),this.addDebugCollisionBoxes(J.iconBoxStartIndex,J.iconBoxEndIndex,J,!1),this.addDebugCollisionBoxes(J.verticalIconBoxStartIndex,J.verticalIconBoxEndIndex,J,!1)}}_deserializeCollisionBoxesForSymbol(D,J,pe,ke,je,We,ht,Et,Ut){let or={};for(let Mr=J;Mr<pe;Mr++){let zr=D.get(Mr);or.textBox={x1:zr.x1,y1:zr.y1,x2:zr.x2,y2:zr.y2,anchorPointX:zr.anchorPointX,anchorPointY:zr.anchorPointY},or.textFeatureIndex=zr.featureIndex;break}for(let Mr=ke;Mr<je;Mr++){let zr=D.get(Mr);or.verticalTextBox={x1:zr.x1,y1:zr.y1,x2:zr.x2,y2:zr.y2,anchorPointX:zr.anchorPointX,anchorPointY:zr.anchorPointY},or.verticalTextFeatureIndex=zr.featureIndex;break}for(let Mr=We;Mr<ht;Mr++){let zr=D.get(Mr);or.iconBox={x1:zr.x1,y1:zr.y1,x2:zr.x2,y2:zr.y2,anchorPointX:zr.anchorPointX,anchorPointY:zr.anchorPointY},or.iconFeatureIndex=zr.featureIndex;break}for(let Mr=Et;Mr<Ut;Mr++){let zr=D.get(Mr);or.verticalIconBox={x1:zr.x1,y1:zr.y1,x2:zr.x2,y2:zr.y2,anchorPointX:zr.anchorPointX,anchorPointY:zr.anchorPointY},or.verticalIconFeatureIndex=zr.featureIndex;break}return or}deserializeCollisionBoxes(D){this.collisionArrays=[];for(let J=0;J<this.symbolInstances.length;J++){let pe=this.symbolInstances.get(J);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(D,pe.textBoxStartIndex,pe.textBoxEndIndex,pe.verticalTextBoxStartIndex,pe.verticalTextBoxEndIndex,pe.iconBoxStartIndex,pe.iconBoxEndIndex,pe.verticalIconBoxStartIndex,pe.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,J){let pe=D.placedSymbolArray.get(J),ke=pe.vertexStartIndex+4*pe.numGlyphs;for(let je=pe.vertexStartIndex;je<ke;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 J=Math.sin(D),pe=Math.cos(D),ke=[],je=[],We=[];for(let ht=0;ht<this.symbolInstances.length;++ht){We.push(ht);let Et=this.symbolInstances.get(ht);ke.push(0|Math.round(J*Et.anchorX+pe*Et.anchorY)),je.push(Et.featureIndex)}return We.sort((ht,Et)=>ke[ht]-ke[Et]||je[Et]-je[ht]),We}addToSortKeyRanges(D,J){let pe=this.sortKeyRanges[this.sortKeyRanges.length-1];pe&&pe.sortKey===J?pe.symbolInstanceEnd=D+1:this.sortKeyRanges.push({sortKey:J,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 J of this.symbolInstanceIndexes){let pe=this.symbolInstances.get(J);this.featureSortOrder.push(pe.featureIndex),[pe.rightJustifiedTextSymbolIndex,pe.centerJustifiedTextSymbolIndex,pe.leftJustifiedTextSymbolIndex].forEach((ke,je,We)=>{ke>=0&&We.indexOf(ke)===je&&this.addIndicesForPlacedSymbol(this.text,ke)}),pe.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,pe.verticalPlacedTextSymbolIndex),pe.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,pe.placedIconSymbolIndex),pe.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,pe.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let cf,C0;mi("SymbolBucket",cm,{omit:["layers","collisionBoxArray","features","compareText"]}),cm.MAX_GLYPHS=65535,cm.addDynamicAttributes=z1;var kg={get paint(){return C0=C0||new Ue({"icon-opacity":new Ro(re.paint_symbol["icon-opacity"]),"icon-color":new Ro(re.paint_symbol["icon-color"]),"icon-halo-color":new Ro(re.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ro(re.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ro(re.paint_symbol["icon-halo-blur"]),"icon-translate":new ho(re.paint_symbol["icon-translate"]),"icon-translate-anchor":new ho(re.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ro(re.paint_symbol["text-opacity"]),"text-color":new Ro(re.paint_symbol["text-color"],{runtimeType:qt,getOverride:W=>W.textColor,hasOverride:W=>!!W.textColor}),"text-halo-color":new Ro(re.paint_symbol["text-halo-color"]),"text-halo-width":new Ro(re.paint_symbol["text-halo-width"]),"text-halo-blur":new Ro(re.paint_symbol["text-halo-blur"]),"text-translate":new ho(re.paint_symbol["text-translate"]),"text-translate-anchor":new ho(re.paint_symbol["text-translate-anchor"])})},get layout(){return cf=cf||new Ue({"symbol-placement":new ho(re.layout_symbol["symbol-placement"]),"symbol-spacing":new ho(re.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ho(re.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ro(re.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ho(re.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ho(re.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ho(re.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ho(re.layout_symbol["icon-ignore-placement"]),"icon-optional":new ho(re.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ho(re.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ro(re.layout_symbol["icon-size"]),"icon-text-fit":new ho(re.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ho(re.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ro(re.layout_symbol["icon-image"]),"icon-rotate":new Ro(re.layout_symbol["icon-rotate"]),"icon-padding":new Ro(re.layout_symbol["icon-padding"]),"icon-keep-upright":new ho(re.layout_symbol["icon-keep-upright"]),"icon-offset":new Ro(re.layout_symbol["icon-offset"]),"icon-anchor":new Ro(re.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ho(re.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ho(re.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ho(re.layout_symbol["text-rotation-alignment"]),"text-field":new Ro(re.layout_symbol["text-field"]),"text-font":new Ro(re.layout_symbol["text-font"]),"text-size":new Ro(re.layout_symbol["text-size"]),"text-max-width":new Ro(re.layout_symbol["text-max-width"]),"text-line-height":new ho(re.layout_symbol["text-line-height"]),"text-letter-spacing":new Ro(re.layout_symbol["text-letter-spacing"]),"text-justify":new Ro(re.layout_symbol["text-justify"]),"text-radial-offset":new Ro(re.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ho(re.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ro(re.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ro(re.layout_symbol["text-anchor"]),"text-max-angle":new ho(re.layout_symbol["text-max-angle"]),"text-writing-mode":new ho(re.layout_symbol["text-writing-mode"]),"text-rotate":new Ro(re.layout_symbol["text-rotate"]),"text-padding":new ho(re.layout_symbol["text-padding"]),"text-keep-upright":new ho(re.layout_symbol["text-keep-upright"]),"text-transform":new Ro(re.layout_symbol["text-transform"]),"text-offset":new Ro(re.layout_symbol["text-offset"]),"text-allow-overlap":new ho(re.layout_symbol["text-allow-overlap"]),"text-overlap":new ho(re.layout_symbol["text-overlap"]),"text-ignore-placement":new ho(re.layout_symbol["text-ignore-placement"]),"text-optional":new ho(re.layout_symbol["text-optional"])})}};class L0{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:ot,this.defaultValue=D}evaluate(D){if(D.formattedSection){let J=this.defaultValue.property.overrides;if(J&&J.hasOverride(D.formattedSection))return J.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}}mi("FormatSectionOverride",L0,{omit:["defaultValue"]});class Dv extends ie{constructor(D){super(D,kg)}recalculate(D,J){if(super.recalculate(D,J),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 pe=this.layout.get("text-writing-mode");if(pe){let ke=[];for(let je of pe)ke.indexOf(je)<0&&ke.push(je);this.layout._values["text-writing-mode"]=ke}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(D,J,pe,ke){let je=this.layout.get(D).evaluate(J,{},pe,ke),We=this._unevaluatedLayout._values[D];return We.isDataDriven()||Mc(We.value)||!je?je:function(ht,Et){return Et.replace(/{([^{}]+)}/g,(Ut,or)=>ht&&or in ht?String(ht[or]):"")}(J.properties,je)}createBucket(D){return new cm(D)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let D of kg.paint.overridableProperties){if(!Dv.hasPaintOverride(this.layout,D))continue;let J=this.paint.get(D),pe=new L0(J),ke=new Lu(pe,J.property.specification),je=null;je=J.value.kind==="constant"||J.value.kind==="source"?new vc("source",ke):new yu("composite",ke,J.value.zoomStops),this.paint._values[D]=new Au(J.property,je,J.parameters)}}_handleOverridablePaintPropertyUpdate(D,J,pe){return!(!this.layout||J.isDataDriven()||pe.isDataDriven())&&Dv.hasPaintOverride(this.layout,D)}static hasPaintOverride(D,J){let pe=D.get("text-field"),ke=kg.paint.properties[J],je=!1,We=ht=>{for(let Et of ht)if(ke.overrides&&ke.overrides.hasOverride(Et))return void(je=!0)};if(pe.value.kind==="constant"&&pe.value.value instanceof ra)We(pe.value.value.sections);else if(pe.value.kind==="source"){let ht=Ut=>{je||(Ut instanceof on&&Ra(Ut.value)===qr?We(Ut.value.sections):Ut instanceof ls?We(Ut.sections):Ut.eachChild(ht))},Et=pe.value;Et._styleExpression&&ht(Et._styleExpression.expression)}return je}}let Nx;var P0={get paint(){return Nx=Nx||new Ue({"background-color":new ho(re.paint_background["background-color"]),"background-pattern":new lc(re.paint_background["background-pattern"]),"background-opacity":new ho(re.paint_background["background-opacity"])})}};class QT extends ie{constructor(D){super(D,P0)}}let B1;var Ux={get paint(){return B1=B1||new Ue({"raster-opacity":new ho(re.paint_raster["raster-opacity"]),"raster-hue-rotate":new ho(re.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ho(re.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ho(re.paint_raster["raster-brightness-max"]),"raster-saturation":new ho(re.paint_raster["raster-saturation"]),"raster-contrast":new ho(re.paint_raster["raster-contrast"]),"raster-resampling":new ho(re.paint_raster["raster-resampling"]),"raster-fade-duration":new ho(re.paint_raster["raster-fade-duration"])})}};class I0 extends ie{constructor(D){super(D,Ux)}}class N1 extends ie{constructor(D){super(D,{}),this.onAdd=J=>{this.implementation.onAdd&&this.implementation.onAdd(J,J.painter.context.gl)},this.onRemove=J=>{this.implementation.onRemove&&this.implementation.onRemove(J,J.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 U1{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 j1=63710088e-1;class Hd{constructor(D,J){if(isNaN(D)||isNaN(J))throw new Error(`Invalid LngLat object: (${D}, ${J})`);if(this.lng=+D,this.lat=+J,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Hd(A(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(D){let J=Math.PI/180,pe=this.lat*J,ke=D.lat*J,je=Math.sin(pe)*Math.sin(ke)+Math.cos(pe)*Math.cos(ke)*Math.cos((D.lng-this.lng)*J);return j1*Math.acos(Math.min(je,1))}static convert(D){if(D instanceof Hd)return D;if(Array.isArray(D)&&(D.length===2||D.length===3))return new Hd(Number(D[0]),Number(D[1]));if(!Array.isArray(D)&&typeof D=="object"&&D!==null)return new Hd(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 fm=2*Math.PI*j1;function jx(W){return fm*Math.cos(W*Math.PI/180)}function Cg(W){return(180+W)/360}function qx(W){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+W*Math.PI/360)))/360}function Lg(W,D){return W/jx(D)}function R0(W){return 360/Math.PI*Math.atan(Math.exp((180-360*W)*Math.PI/180))-90}class D0{constructor(D,J,pe=0){this.x=+D,this.y=+J,this.z=+pe}static fromLngLat(D,J=0){let pe=Hd.convert(D);return new D0(Cg(pe.lng),qx(pe.lat),Lg(J,pe.lat))}toLngLat(){return new Hd(360*this.x-180,R0(this.y))}toAltitude(){return this.z*jx(R0(this.y))}meterInMercatorCoordinateUnits(){return 1/fm*(D=R0(this.y),1/Math.cos(D*Math.PI/180));var D}}function rd(W,D,J){var pe=2*Math.PI*6378137/256/Math.pow(2,J);return[W*pe-2*Math.PI*6378137/2,D*pe-2*Math.PI*6378137/2]}class q1{constructor(D,J,pe){if(!function(ke,je,We){return!(ke<0||ke>25||We<0||We>=Math.pow(2,ke)||je<0||je>=Math.pow(2,ke))}(D,J,pe))throw new Error(`x=${J}, y=${pe}, 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=J,this.y=pe,this.key=z0(0,D,D,J,pe)}equals(D){return this.z===D.z&&this.x===D.x&&this.y===D.y}url(D,J,pe){let ke=(We=this.y,ht=this.z,Et=rd(256*(je=this.x),256*(We=Math.pow(2,ht)-We-1),ht),Ut=rd(256*(je+1),256*(We+1),ht),Et[0]+","+Et[1]+","+Ut[0]+","+Ut[1]);var je,We,ht,Et,Ut;let or=function(Mr,zr,Wr){let ia,ha="";for(let ja=Mr;ja>0;ja--)ia=1<<ja-1,ha+=(zr&ia?1:0)+(Wr&ia?2:0);return ha}(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(pe==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,J>1?"@2x":"").replace(/{quadkey}/g,or).replace(/{bbox-epsg-3857}/g,ke)}isChildOf(D){let J=this.z-D.z;return J>0&&D.x===this.x>>J&&D.y===this.y>>J}getTilePoint(D){let J=Math.pow(2,this.z);return new n((D.x*J-this.x)*vo,(D.y*J-this.y)*vo)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Vx{constructor(D,J){this.wrap=D,this.canonical=J,this.key=z0(D,J.z,J.z,J.x,J.y)}}class Gp{constructor(D,J,pe,ke,je){if(D<pe)throw new Error(`overscaledZ should be >= z; overscaledZ = ${D}; z = ${pe}`);this.overscaledZ=D,this.wrap=J,this.canonical=new q1(pe,+ke,+je),this.key=z0(J,D,pe,ke,je)}clone(){return new Gp(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 J=this.canonical.z-D;return D>this.canonical.z?new Gp(D,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gp(D,this.wrap,D,this.canonical.x>>J,this.canonical.y>>J)}calculateScaledKey(D,J){if(D>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${D}; overscaledZ = ${this.overscaledZ}`);let pe=this.canonical.z-D;return D>this.canonical.z?z0(this.wrap*+J,D,this.canonical.z,this.canonical.x,this.canonical.y):z0(this.wrap*+J,D,D,this.canonical.x>>pe,this.canonical.y>>pe)}isChildOf(D){if(D.wrap!==this.wrap)return!1;let J=this.canonical.z-D.canonical.z;return D.overscaledZ===0||D.overscaledZ<this.overscaledZ&&D.canonical.x===this.canonical.x>>J&&D.canonical.y===this.canonical.y>>J}children(D){if(this.overscaledZ>=D)return[new Gp(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let J=this.canonical.z+1,pe=2*this.canonical.x,ke=2*this.canonical.y;return[new Gp(J,this.wrap,J,pe,ke),new Gp(J,this.wrap,J,pe+1,ke),new Gp(J,this.wrap,J,pe,ke+1),new Gp(J,this.wrap,J,pe+1,ke+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 Gp(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(D){return new Gp(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 Vx(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(D){return this.canonical.getTilePoint(new D0(D.x-this.wrap,D.y))}}function z0(W,D,J,pe,ke){(W*=2)<0&&(W=-1*W-1);let je=1<<J;return(je*je*W+je*ke+pe).toString(36)+J.toString(36)+D.toString(36)}mi("CanonicalTileID",q1),mi("OverscaledTileID",Gp,{omit:["posMatrix"]});class Gx{constructor(D,J,pe,ke=1,je=1,We=1,ht=0){if(this.uid=D,J.height!==J.width)throw new RangeError("DEM tiles must be square");if(pe&&!["mapbox","terrarium","custom"].includes(pe))return void f(`"${pe}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=J.height;let Et=this.dim=J.height-2;switch(this.data=new Uint32Array(J.data.buffer),pe){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=ke,this.greenFactor=je,this.blueFactor=We,this.baseShift=ht;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let Ut=0;Ut<Et;Ut++)this.data[this._idx(-1,Ut)]=this.data[this._idx(0,Ut)],this.data[this._idx(Et,Ut)]=this.data[this._idx(Et-1,Ut)],this.data[this._idx(Ut,-1)]=this.data[this._idx(Ut,0)],this.data[this._idx(Ut,Et)]=this.data[this._idx(Ut,Et-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(Et,-1)]=this.data[this._idx(Et-1,0)],this.data[this._idx(-1,Et)]=this.data[this._idx(0,Et-1)],this.data[this._idx(Et,Et)]=this.data[this._idx(Et-1,Et-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let Ut=0;Ut<Et;Ut++)for(let or=0;or<Et;or++){let Mr=this.get(Ut,or);Mr>this.max&&(this.max=Mr),Mr<this.min&&(this.min=Mr)}}get(D,J){let pe=new Uint8Array(this.data.buffer),ke=4*this._idx(D,J);return this.unpack(pe[ke],pe[ke+1],pe[ke+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(D,J){if(D<-1||D>=this.dim+1||J<-1||J>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(J+1)*this.stride+(D+1)}unpack(D,J,pe){return D*this.redFactor+J*this.greenFactor+pe*this.blueFactor-this.baseShift}getPixels(){return new Ii({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(D,J,pe){if(this.dim!==D.dim)throw new Error("dem dimension mismatch");let ke=J*this.dim,je=J*this.dim+this.dim,We=pe*this.dim,ht=pe*this.dim+this.dim;switch(J){case-1:ke=je-1;break;case 1:je=ke+1}switch(pe){case-1:We=ht-1;break;case 1:ht=We+1}let Et=-J*this.dim,Ut=-pe*this.dim;for(let or=We;or<ht;or++)for(let Mr=ke;Mr<je;Mr++)this.data[this._idx(Mr,or)]=D.data[this._idx(Mr+Et,or+Ut)]}}mi("DEMData",Gx);class Hx{constructor(D){this._stringToNumber={},this._numberToString=[];for(let J=0;J<D.length;J++){let pe=D[J];this._stringToNumber[pe]=J,this._numberToString[J]=pe}}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 V1{constructor(D,J,pe,ke,je){this.type="Feature",this._vectorTileFeature=D,D._z=J,D._x=pe,D._y=ke,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 J in this)J!=="_geometry"&&J!=="_vectorTileFeature"&&(D[J]=this[J]);return D}}class zv{constructor(D,J){this.tileID=D,this.x=D.canonical.x,this.y=D.canonical.y,this.z=D.canonical.z,this.grid=new Di(vo,16,0),this.grid3D=new Di(vo,16,0),this.featureIndexArray=new tl,this.promoteId=J}insert(D,J,pe,ke,je,We){let ht=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(pe,ke,je);let Et=We?this.grid3D:this.grid;for(let Ut=0;Ut<J.length;Ut++){let or=J[Ut],Mr=[1/0,1/0,-1/0,-1/0];for(let zr=0;zr<or.length;zr++){let Wr=or[zr];Mr[0]=Math.min(Mr[0],Wr.x),Mr[1]=Math.min(Mr[1],Wr.y),Mr[2]=Math.max(Mr[2],Wr.x),Mr[3]=Math.max(Mr[3],Wr.y)}Mr[0]<vo&&Mr[1]<vo&&Mr[2]>=0&&Mr[3]>=0&&Et.insert(ht,Mr[0],Mr[1],Mr[2],Mr[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Jr.VectorTile(new P1(this.rawTileData)).layers,this.sourceLayerCoder=new Hx(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(D,J,pe,ke){this.loadVTLayers();let je=D.params||{},We=vo/D.tileSize/D.scale,ht=Ec(je.filter),Et=D.queryGeometry,Ut=D.queryPadding*We,or=Xx(Et),Mr=this.grid.query(or.minX-Ut,or.minY-Ut,or.maxX+Ut,or.maxY+Ut),zr=Xx(D.cameraQueryGeometry),Wr=this.grid3D.query(zr.minX-Ut,zr.minY-Ut,zr.maxX+Ut,zr.maxY+Ut,(ja,Ka,Wi,gi)=>function(qi,en,qn,Eo,ys){for(let zn of qi)if(en<=zn.x&&qn<=zn.y&&Eo>=zn.x&&ys>=zn.y)return!0;let mo=[new n(en,qn),new n(en,ys),new n(Eo,ys),new n(Eo,qn)];if(qi.length>2){for(let zn of mo)if(bi(qi,zn))return!0}for(let zn=0;zn<qi.length-1;zn++)if(yi(qi[zn],qi[zn+1],mo))return!0;return!1}(D.cameraQueryGeometry,ja-Ut,Ka-Ut,Wi+Ut,gi+Ut));for(let ja of Wr)Mr.push(ja);Mr.sort(eA);let ia={},ha;for(let ja=0;ja<Mr.length;ja++){let Ka=Mr[ja];if(Ka===ha)continue;ha=Ka;let Wi=this.featureIndexArray.get(Ka),gi=null;this.loadMatchingFeature(ia,Wi.bucketIndex,Wi.sourceLayerIndex,Wi.featureIndex,ht,je.layers,je.availableImages,J,pe,ke,(qi,en,qn)=>(gi||(gi=Al(qi)),en.queryIntersectsFeature(Et,qi,qn,gi,this.z,D.transform,We,D.pixelPosMatrix)))}return ia}loadMatchingFeature(D,J,pe,ke,je,We,ht,Et,Ut,or,Mr){let zr=this.bucketLayerIDs[J];if(We&&!function(ja,Ka){for(let Wi=0;Wi<ja.length;Wi++)if(Ka.indexOf(ja[Wi])>=0)return!0;return!1}(We,zr))return;let Wr=this.sourceLayerCoder.decode(pe),ia=this.vtLayers[Wr].feature(ke);if(je.needGeometry){let ja=Hl(ia,!0);if(!je.filter(new Rs(this.tileID.overscaledZ),ja,this.tileID.canonical))return}else if(!je.filter(new Rs(this.tileID.overscaledZ),ia))return;let ha=this.getId(ia,Wr);for(let ja=0;ja<zr.length;ja++){let Ka=zr[ja];if(We&&We.indexOf(Ka)<0)continue;let Wi=Et[Ka];if(!Wi)continue;let gi={};ha&&or&&(gi=or.getState(Wi.sourceLayer||"_geojsonTileLayer",ha));let qi=M({},Ut[Ka]);qi.paint=Wx(qi.paint,Wi.paint,ia,gi,ht),qi.layout=Wx(qi.layout,Wi.layout,ia,gi,ht);let en=!Mr||Mr(ia,Wi,gi);if(!en)continue;let qn=new V1(ia,this.z,this.x,this.y,ha);qn.layer=qi;let Eo=D[Ka];Eo===void 0&&(Eo=D[Ka]=[]),Eo.push({featureIndex:ke,feature:qn,intersectionZ:en})}}lookupSymbolFeatures(D,J,pe,ke,je,We,ht,Et){let Ut={};this.loadVTLayers();let or=Ec(je);for(let Mr of D)this.loadMatchingFeature(Ut,pe,ke,Mr,or,We,ht,Et,J);return Ut}hasLayer(D){for(let J of this.bucketLayerIDs)for(let pe of J)if(D===pe)return!0;return!1}getId(D,J){let pe=D.id;return this.promoteId&&(pe=D.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[J]],typeof pe=="boolean"&&(pe=Number(pe))),pe}}function Wx(W,D,J,pe,ke){return b(W,(je,We)=>{let ht=D instanceof yc?D.get(We):null;return ht&&ht.evaluate?ht.evaluate(J,pe,ke):ht})}function Xx(W){let D=1/0,J=1/0,pe=-1/0,ke=-1/0;for(let je of W)D=Math.min(D,je.x),J=Math.min(J,je.y),pe=Math.max(pe,je.x),ke=Math.max(ke,je.y);return{minX:D,minY:J,maxX:pe,maxY:ke}}function eA(W,D){return D-W}function Zx(W,D,J,pe,ke){let je=[];for(let We=0;We<W.length;We++){let ht=W[We],Et;for(let Ut=0;Ut<ht.length-1;Ut++){let or=ht[Ut],Mr=ht[Ut+1];or.x<D&&Mr.x<D||(or.x<D?or=new n(D,or.y+(D-or.x)/(Mr.x-or.x)*(Mr.y-or.y))._round():Mr.x<D&&(Mr=new n(D,or.y+(D-or.x)/(Mr.x-or.x)*(Mr.y-or.y))._round()),or.y<J&&Mr.y<J||(or.y<J?or=new n(or.x+(J-or.y)/(Mr.y-or.y)*(Mr.x-or.x),J)._round():Mr.y<J&&(Mr=new n(or.x+(J-or.y)/(Mr.y-or.y)*(Mr.x-or.x),J)._round()),or.x>=pe&&Mr.x>=pe||(or.x>=pe?or=new n(pe,or.y+(pe-or.x)/(Mr.x-or.x)*(Mr.y-or.y))._round():Mr.x>=pe&&(Mr=new n(pe,or.y+(pe-or.x)/(Mr.x-or.x)*(Mr.y-or.y))._round()),or.y>=ke&&Mr.y>=ke||(or.y>=ke?or=new n(or.x+(ke-or.y)/(Mr.y-or.y)*(Mr.x-or.x),ke)._round():Mr.y>=ke&&(Mr=new n(or.x+(ke-or.y)/(Mr.y-or.y)*(Mr.x-or.x),ke)._round()),Et&&or.equals(Et[Et.length-1])||(Et=[or],je.push(Et)),Et.push(Mr)))))}}return je}mi("FeatureIndex",zv,{omit:["rawTileData","sourceLayerCoder"]});class Wd extends n{constructor(D,J,pe,ke){super(D,J),this.angle=pe,ke!==void 0&&(this.segment=ke)}clone(){return new Wd(this.x,this.y,this.angle,this.segment)}}function G1(W,D,J,pe,ke){if(D.segment===void 0||J===0)return!0;let je=D,We=D.segment+1,ht=0;for(;ht>-J/2;){if(We--,We<0)return!1;ht-=W[We].dist(je),je=W[We]}ht+=W[We].dist(W[We+1]),We++;let Et=[],Ut=0;for(;ht<J/2;){let or=W[We],Mr=W[We+1];if(!Mr)return!1;let zr=W[We-1].angleTo(or)-or.angleTo(Mr);for(zr=Math.abs((zr+3*Math.PI)%(2*Math.PI)-Math.PI),Et.push({distance:ht,angleDelta:zr}),Ut+=zr;ht-Et[0].distance>pe;)Ut-=Et.shift().angleDelta;if(Ut>ke)return!1;We++,ht+=or.dist(Mr)}return!0}function Yx(W){let D=0;for(let J=0;J<W.length-1;J++)D+=W[J].dist(W[J+1]);return D}function Kx(W,D,J){return W?.6*D*J:0}function Jx(W,D){return Math.max(W?W.right-W.left:0,D?D.right-D.left:0)}function tA(W,D,J,pe,ke,je){let We=Kx(J,ke,je),ht=Jx(J,pe)*je,Et=0,Ut=Yx(W)/2;for(let or=0;or<W.length-1;or++){let Mr=W[or],zr=W[or+1],Wr=Mr.dist(zr);if(Et+Wr>Ut){let ia=(Ut-Et)/Wr,ha=On.number(Mr.x,zr.x,ia),ja=On.number(Mr.y,zr.y,ia),Ka=new Wd(ha,ja,zr.angleTo(Mr),or);return Ka._round(),!We||G1(W,Ka,ht,We,D)?Ka:void 0}Et+=Wr}}function rA(W,D,J,pe,ke,je,We,ht,Et){let Ut=Kx(pe,je,We),or=Jx(pe,ke),Mr=or*We,zr=W[0].x===0||W[0].x===Et||W[0].y===0||W[0].y===Et;return D-Mr<D/4&&(D=Mr+D/4),$x(W,zr?D/2*ht%D:(or/2+2*je)*We*ht%D,D,Ut,J,Mr,zr,!1,Et)}function $x(W,D,J,pe,ke,je,We,ht,Et){let Ut=je/2,or=Yx(W),Mr=0,zr=D-J,Wr=[];for(let ia=0;ia<W.length-1;ia++){let ha=W[ia],ja=W[ia+1],Ka=ha.dist(ja),Wi=ja.angleTo(ha);for(;zr+J<Mr+Ka;){zr+=J;let gi=(zr-Mr)/Ka,qi=On.number(ha.x,ja.x,gi),en=On.number(ha.y,ja.y,gi);if(qi>=0&&qi<Et&&en>=0&&en<Et&&zr-Ut>=0&&zr+Ut<=or){let qn=new Wd(qi,en,Wi,ia);qn._round(),pe&&!G1(W,qn,je,pe,ke)||Wr.push(qn)}}Mr+=Ka}return ht||Wr.length||We||(Wr=$x(W,Mr/2,J,pe,ke,je,We,!0,Et)),Wr}mi("Anchor",Wd);let hm=zh;function Qx(W,D,J,pe){let ke=[],je=W.image,We=je.pixelRatio,ht=je.paddedRect.w-2*hm,Et=je.paddedRect.h-2*hm,Ut={x1:W.left,y1:W.top,x2:W.right,y2:W.bottom},or=je.stretchX||[[0,ht]],Mr=je.stretchY||[[0,Et]],zr=(wn,os)=>wn+os[1]-os[0],Wr=or.reduce(zr,0),ia=Mr.reduce(zr,0),ha=ht-Wr,ja=Et-ia,Ka=0,Wi=Wr,gi=0,qi=ia,en=0,qn=ha,Eo=0,ys=ja;if(je.content&&pe){let wn=je.content,os=wn[2]-wn[0],Fo=wn[3]-wn[1];(je.textFitWidth||je.textFitHeight)&&(Ut=Fx(W)),Ka=Xd(or,0,wn[0]),gi=Xd(Mr,0,wn[1]),Wi=Xd(or,wn[0],wn[2]),qi=Xd(Mr,wn[1],wn[3]),en=wn[0]-Ka,Eo=wn[1]-gi,qn=os-Wi,ys=Fo-qi}let mo=Ut.x1,zn=Ut.y1,ts=Ut.x2-mo,Uo=Ut.y2-zn,zo=(wn,os,Fo,Ls)=>{let Ku=Pg(wn.stretch-Ka,Wi,ts,mo),Uu=pm(wn.fixed-en,qn,wn.stretch,Wr),th=Pg(os.stretch-gi,qi,Uo,zn),Hp=pm(os.fixed-Eo,ys,os.stretch,ia),Th=Pg(Fo.stretch-Ka,Wi,ts,mo),rh=pm(Fo.fixed-en,qn,Fo.stretch,Wr),Jh=Pg(Ls.stretch-gi,qi,Uo,zn),$h=pm(Ls.fixed-Eo,ys,Ls.stretch,ia),Qh=new n(Ku,th),ff=new n(Th,th),ah=new n(Th,Jh),Fh=new n(Ku,Jh),Ah=new n(Uu/We,Hp/We),dh=new n(rh/We,$h/We),yf=D*Math.PI/180;if(yf){let hu=Math.sin(yf),fc=Math.cos(yf),Ju=[fc,-hu,hu,fc];Qh._matMult(Ju),ff._matMult(Ju),Fh._matMult(Ju),ah._matMult(Ju)}let Rp=wn.stretch+wn.fixed,dp=os.stretch+os.fixed;return{tl:Qh,tr:ff,bl:Fh,br:ah,tex:{x:je.paddedRect.x+hm+Rp,y:je.paddedRect.y+hm+dp,w:Fo.stretch+Fo.fixed-Rp,h:Ls.stretch+Ls.fixed-dp},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ah,pixelOffsetBR:dh,minFontScaleX:qn/We/ts,minFontScaleY:ys/We/Uo,isSDF:J}};if(pe&&(je.stretchX||je.stretchY)){let wn=eb(or,ha,Wr),os=eb(Mr,ja,ia);for(let Fo=0;Fo<wn.length-1;Fo++){let Ls=wn[Fo],Ku=wn[Fo+1];for(let Uu=0;Uu<os.length-1;Uu++)ke.push(zo(Ls,os[Uu],Ku,os[Uu+1]))}}else ke.push(zo({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:ht+1},{fixed:0,stretch:Et+1}));return ke}function Xd(W,D,J){let pe=0;for(let ke of W)pe+=Math.max(D,Math.min(J,ke[1]))-Math.max(D,Math.min(J,ke[0]));return pe}function eb(W,D,J){let pe=[{fixed:-hm,stretch:0}];for(let[ke,je]of W){let We=pe[pe.length-1];pe.push({fixed:ke-We.stretch,stretch:We.stretch}),pe.push({fixed:ke-We.stretch,stretch:We.stretch+(je-ke)})}return pe.push({fixed:D+hm,stretch:J}),pe}function Pg(W,D,J,pe){return W/D*J+pe}function pm(W,D,J,pe){return W-D*J/pe}class hv{constructor(D,J,pe,ke,je,We,ht,Et,Ut,or){var Mr;if(this.boxStartIndex=D.length,Ut){let zr=We.top,Wr=We.bottom,ia=We.collisionPadding;ia&&(zr-=ia[1],Wr+=ia[3]);let ha=Wr-zr;ha>0&&(ha=Math.max(10,ha),this.circleDiameter=ha)}else{let zr=!((Mr=We.image)===null||Mr===void 0)&&Mr.content&&(We.image.textFitWidth||We.image.textFitHeight)?Fx(We):{x1:We.left,y1:We.top,x2:We.right,y2:We.bottom};zr.y1=zr.y1*ht-Et[0],zr.y2=zr.y2*ht+Et[2],zr.x1=zr.x1*ht-Et[3],zr.x2=zr.x2*ht+Et[1];let Wr=We.collisionPadding;if(Wr&&(zr.x1-=Wr[0]*ht,zr.y1-=Wr[1]*ht,zr.x2+=Wr[2]*ht,zr.y2+=Wr[3]*ht),or){let ia=new n(zr.x1,zr.y1),ha=new n(zr.x2,zr.y1),ja=new n(zr.x1,zr.y2),Ka=new n(zr.x2,zr.y2),Wi=or*Math.PI/180;ia._rotate(Wi),ha._rotate(Wi),ja._rotate(Wi),Ka._rotate(Wi),zr.x1=Math.min(ia.x,ha.x,ja.x,Ka.x),zr.x2=Math.max(ia.x,ha.x,ja.x,Ka.x),zr.y1=Math.min(ia.y,ha.y,ja.y,Ka.y),zr.y2=Math.max(ia.y,ha.y,ja.y,Ka.y)}D.emplaceBack(J.x,J.y,zr.x1,zr.y1,zr.x2,zr.y2,pe,ke,je)}this.boxEndIndex=D.length}}class cd{constructor(D=[],J=(pe,ke)=>pe<ke?-1:pe>ke?1:0){if(this.data=D,this.length=this.data.length,this.compare=J,this.length>0)for(let pe=(this.length>>1)-1;pe>=0;pe--)this._down(pe)}push(D){this.data.push(D),this._up(this.length++)}pop(){if(this.length===0)return;let D=this.data[0],J=this.data.pop();return--this.length>0&&(this.data[0]=J,this._down(0)),D}peek(){return this.data[0]}_up(D){let{data:J,compare:pe}=this,ke=J[D];for(;D>0;){let je=D-1>>1,We=J[je];if(pe(ke,We)>=0)break;J[D]=We,D=je}J[D]=ke}_down(D){let{data:J,compare:pe}=this,ke=this.length>>1,je=J[D];for(;D<ke;){let We=1+(D<<1),ht=We+1;if(ht<this.length&&pe(J[ht],J[We])<0&&(We=ht),pe(J[We],je)>=0)break;J[D]=J[We],D=We}J[D]=je}}function aA(W,D=1,J=!1){let pe=1/0,ke=1/0,je=-1/0,We=-1/0,ht=W[0];for(let Wr=0;Wr<ht.length;Wr++){let ia=ht[Wr];(!Wr||ia.x<pe)&&(pe=ia.x),(!Wr||ia.y<ke)&&(ke=ia.y),(!Wr||ia.x>je)&&(je=ia.x),(!Wr||ia.y>We)&&(We=ia.y)}let Et=Math.min(je-pe,We-ke),Ut=Et/2,or=new cd([],iA);if(Et===0)return new n(pe,ke);for(let Wr=pe;Wr<je;Wr+=Et)for(let ia=ke;ia<We;ia+=Et)or.push(new dm(Wr+Ut,ia+Ut,Ut,W));let Mr=function(Wr){let ia=0,ha=0,ja=0,Ka=Wr[0];for(let Wi=0,gi=Ka.length,qi=gi-1;Wi<gi;qi=Wi++){let en=Ka[Wi],qn=Ka[qi],Eo=en.x*qn.y-qn.x*en.y;ha+=(en.x+qn.x)*Eo,ja+=(en.y+qn.y)*Eo,ia+=3*Eo}return new dm(ha/ia,ja/ia,0,Wr)}(W),zr=or.length;for(;or.length;){let Wr=or.pop();(Wr.d>Mr.d||!Mr.d)&&(Mr=Wr,J&&console.log("found best %d after %d probes",Math.round(1e4*Wr.d)/1e4,zr)),Wr.max-Mr.d<=D||(Ut=Wr.h/2,or.push(new dm(Wr.p.x-Ut,Wr.p.y-Ut,Ut,W)),or.push(new dm(Wr.p.x+Ut,Wr.p.y-Ut,Ut,W)),or.push(new dm(Wr.p.x-Ut,Wr.p.y+Ut,Ut,W)),or.push(new dm(Wr.p.x+Ut,Wr.p.y+Ut,Ut,W)),zr+=4)}return J&&(console.log(`num probes: ${zr}`),console.log(`best distance: ${Mr.d}`)),Mr.p}function iA(W,D){return D.max-W.max}function dm(W,D,J,pe){this.p=new n(W,D),this.h=J,this.d=function(ke,je){let We=!1,ht=1/0;for(let Et=0;Et<je.length;Et++){let Ut=je[Et];for(let or=0,Mr=Ut.length,zr=Mr-1;or<Mr;zr=or++){let Wr=Ut[or],ia=Ut[zr];Wr.y>ke.y!=ia.y>ke.y&&ke.x<(ia.x-Wr.x)*(ke.y-Wr.y)/(ia.y-Wr.y)+Wr.x&&(We=!We),ht=Math.min(ht,_a(ke,Wr,ia))}}return(We?1:-1)*Math.sqrt(ht)}(this.p,pe),this.max=this.d+this.h*Math.SQRT2}var wh;e.aq=void 0,(wh=e.aq||(e.aq={}))[wh.center=1]="center",wh[wh.left=2]="left",wh[wh.right=3]="right",wh[wh.top=4]="top",wh[wh.bottom=5]="bottom",wh[wh["top-left"]=6]="top-left",wh[wh["top-right"]=7]="top-right",wh[wh["bottom-left"]=8]="bottom-left",wh[wh["bottom-right"]=9]="bottom-right";let pv=7,Fv=Number.POSITIVE_INFINITY;function H1(W,D){return D[1]!==Fv?function(J,pe,ke){let je=0,We=0;switch(pe=Math.abs(pe),ke=Math.abs(ke),J){case"top-right":case"top-left":case"top":We=ke-pv;break;case"bottom-right":case"bottom-left":case"bottom":We=-ke+pv}switch(J){case"top-right":case"bottom-right":case"right":je=-pe;break;case"top-left":case"bottom-left":case"left":je=pe}return[je,We]}(W,D[0],D[1]):function(J,pe){let ke=0,je=0;pe<0&&(pe=0);let We=pe/Math.SQRT2;switch(J){case"top-right":case"top-left":je=We-pv;break;case"bottom-right":case"bottom-left":je=-We+pv;break;case"bottom":je=-pe+pv;break;case"top":je=pe-pv}switch(J){case"top-right":case"bottom-right":ke=-We;break;case"top-left":case"bottom-left":ke=We;break;case"left":ke=pe;break;case"right":ke=-pe}return[ke,je]}(W,D[0])}function tb(W,D,J){var pe;let ke=W.layout,je=(pe=ke.get("text-variable-anchor-offset"))===null||pe===void 0?void 0:pe.evaluate(D,{},J);if(je){let ht=je.values,Et=[];for(let Ut=0;Ut<ht.length;Ut+=2){let or=Et[Ut]=ht[Ut],Mr=ht[Ut+1].map(zr=>zr*fu);or.startsWith("top")?Mr[1]-=pv:or.startsWith("bottom")&&(Mr[1]+=pv),Et[Ut+1]=Mr}return new $a(Et)}let We=ke.get("text-variable-anchor");if(We){let ht;ht=W._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[ke.get("text-radial-offset").evaluate(D,{},J)*fu,Fv]:ke.get("text-offset").evaluate(D,{},J).map(Ut=>Ut*fu);let Et=[];for(let Ut of We)Et.push(Ut,H1(Ut,ht));return new $a(Et)}return null}function W1(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 nA(W,D,J,pe,ke,je,We,ht,Et,Ut,or){let Mr=je.textMaxSize.evaluate(D,{});Mr===void 0&&(Mr=We);let zr=W.layers[0].layout,Wr=zr.get("icon-offset").evaluate(D,{},or),ia=ab(J.horizontal),ha=We/24,ja=W.tilePixelRatio*ha,Ka=W.tilePixelRatio*Mr/24,Wi=W.tilePixelRatio*ht,gi=W.tilePixelRatio*zr.get("symbol-spacing"),qi=zr.get("text-padding")*W.tilePixelRatio,en=function(wn,os,Fo,Ls=1){let Ku=wn.get("icon-padding").evaluate(os,{},Fo),Uu=Ku&&Ku.values;return[Uu[0]*Ls,Uu[1]*Ls,Uu[2]*Ls,Uu[3]*Ls]}(zr,D,or,W.tilePixelRatio),qn=zr.get("text-max-angle")/180*Math.PI,Eo=zr.get("text-rotation-alignment")!=="viewport"&&zr.get("symbol-placement")!=="point",ys=zr.get("icon-rotation-alignment")==="map"&&zr.get("symbol-placement")!=="point",mo=zr.get("symbol-placement"),zn=gi/2,ts=zr.get("icon-text-fit"),Uo;pe&&ts!=="none"&&(W.allowVerticalPlacement&&J.vertical&&(Uo=Ox(pe,J.vertical,ts,zr.get("icon-text-fit-padding"),Wr,ha)),ia&&(pe=Ox(pe,ia,ts,zr.get("icon-text-fit-padding"),Wr,ha)));let zo=(wn,os)=>{os.x<0||os.x>=vo||os.y<0||os.y>=vo||function(Fo,Ls,Ku,Uu,th,Hp,Th,rh,Jh,$h,Qh,ff,ah,Fh,Ah,dh,yf,Rp,dp,hu,fc,Ju,Dp,$c,vm){let _d=Fo.addToLineVertexArray(Ls,Ku),fd,Wp,zc,Pf,Xp=0,Zd=0,vp=0,mm=0,J1=-1,zg=-1,xd={},Ov=ti("");if(Fo.allowVerticalPlacement&&Uu.vertical){let Oh=rh.layout.get("text-rotate").evaluate(fc,{},$c)+90;zc=new hv(Jh,Ls,$h,Qh,ff,Uu.vertical,ah,Fh,Ah,Oh),Th&&(Pf=new hv(Jh,Ls,$h,Qh,ff,Th,yf,Rp,Ah,Oh))}if(th){let Oh=rh.layout.get("icon-rotate").evaluate(fc,{}),Zp=rh.layout.get("icon-text-fit")!=="none",dv=Qx(th,Oh,Dp,Zp),ep=Th?Qx(Th,Oh,Dp,Zp):void 0;Wp=new hv(Jh,Ls,$h,Qh,ff,th,yf,Rp,!1,Oh),Xp=4*dv.length;let Bh=Fo.iconSizeData,id=null;Bh.kind==="source"?(id=[yd*rh.layout.get("icon-size").evaluate(fc,{})],id[0]>cv&&f(`${Fo.layerIds[0]}: Value for "icon-size" is >= ${k0}. Reduce your "icon-size".`)):Bh.kind==="composite"&&(id=[yd*Ju.compositeIconSizes[0].evaluate(fc,{},$c),yd*Ju.compositeIconSizes[1].evaluate(fc,{},$c)],(id[0]>cv||id[1]>cv)&&f(`${Fo.layerIds[0]}: Value for "icon-size" is >= ${k0}. Reduce your "icon-size".`)),Fo.addSymbols(Fo.icon,dv,id,hu,dp,fc,e.ah.none,Ls,_d.lineStartIndex,_d.lineLength,-1,$c),J1=Fo.icon.placedSymbolArray.length-1,ep&&(Zd=4*ep.length,Fo.addSymbols(Fo.icon,ep,id,hu,dp,fc,e.ah.vertical,Ls,_d.lineStartIndex,_d.lineLength,-1,$c),zg=Fo.icon.placedSymbolArray.length-1)}let vh=Object.keys(Uu.horizontal);for(let Oh of vh){let Zp=Uu.horizontal[Oh];if(!fd){Ov=ti(Zp.text);let ep=rh.layout.get("text-rotate").evaluate(fc,{},$c);fd=new hv(Jh,Ls,$h,Qh,ff,Zp,ah,Fh,Ah,ep)}let dv=Zp.positionedLines.length===1;if(vp+=rb(Fo,Ls,Zp,Hp,rh,Ah,fc,dh,_d,Uu.vertical?e.ah.horizontal:e.ah.horizontalOnly,dv?vh:[Oh],xd,J1,Ju,$c),dv)break}Uu.vertical&&(mm+=rb(Fo,Ls,Uu.vertical,Hp,rh,Ah,fc,dh,_d,e.ah.vertical,["vertical"],xd,zg,Ju,$c));let lA=fd?fd.boxStartIndex:Fo.collisionBoxArray.length,Fg=fd?fd.boxEndIndex:Fo.collisionBoxArray.length,bd=zc?zc.boxStartIndex:Fo.collisionBoxArray.length,mp=zc?zc.boxEndIndex:Fo.collisionBoxArray.length,sb=Wp?Wp.boxStartIndex:Fo.collisionBoxArray.length,uA=Wp?Wp.boxEndIndex:Fo.collisionBoxArray.length,lb=Pf?Pf.boxStartIndex:Fo.collisionBoxArray.length,cA=Pf?Pf.boxEndIndex:Fo.collisionBoxArray.length,ad=-1,B0=(Oh,Zp)=>Oh&&Oh.circleDiameter?Math.max(Oh.circleDiameter,Zp):Zp;ad=B0(fd,ad),ad=B0(zc,ad),ad=B0(Wp,ad),ad=B0(Pf,ad);let Og=ad>-1?1:0;Og&&(ad*=vm/fu),Fo.glyphOffsetArray.length>=cm.MAX_GLYPHS&&f("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),fc.sortKey!==void 0&&Fo.addToSortKeyRanges(Fo.symbolInstances.length,fc.sortKey);let $1=tb(rh,fc,$c),[fA,hA]=function(Oh,Zp){let dv=Oh.length,ep=Zp?.values;if(ep?.length>0)for(let Bh=0;Bh<ep.length;Bh+=2){let id=ep[Bh+1];Oh.emplaceBack(e.aq[ep[Bh]],id[0],id[1])}return[dv,Oh.length]}(Fo.textAnchorOffsets,$1);Fo.symbolInstances.emplaceBack(Ls.x,Ls.y,xd.right>=0?xd.right:-1,xd.center>=0?xd.center:-1,xd.left>=0?xd.left:-1,xd.vertical||-1,J1,zg,Ov,lA,Fg,bd,mp,sb,uA,lb,cA,$h,vp,mm,Xp,Zd,Og,0,ah,ad,fA,hA)}(W,os,wn,J,pe,ke,Uo,W.layers[0],W.collisionBoxArray,D.index,D.sourceLayerIndex,W.index,ja,[qi,qi,qi,qi],Eo,Et,Wi,en,ys,Wr,D,je,Ut,or,We)};if(mo==="line")for(let wn of Zx(D.geometry,0,0,vo,vo)){let os=rA(wn,gi,qn,J.vertical||ia,pe,24,Ka,W.overscaling,vo);for(let Fo of os)ia&&oA(W,ia.text,zn,Fo)||zo(wn,Fo)}else if(mo==="line-center"){for(let wn of D.geometry)if(wn.length>1){let os=tA(wn,qn,J.vertical||ia,pe,24,Ka);os&&zo(wn,os)}}else if(D.type==="Polygon")for(let wn of Tc(D.geometry,0)){let os=aA(wn,16);zo(wn[0],new Wd(os.x,os.y,0))}else if(D.type==="LineString")for(let wn of D.geometry)zo(wn,new Wd(wn[0].x,wn[0].y,0));else if(D.type==="Point")for(let wn of D.geometry)for(let os of wn)zo([os],new Wd(os.x,os.y,0))}function rb(W,D,J,pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia){let ha=function(Wi,gi,qi,en,qn,Eo,ys,mo){let zn=en.layout.get("text-rotate").evaluate(Eo,{})*Math.PI/180,ts=[];for(let Uo of gi.positionedLines)for(let zo of Uo.positionedGlyphs){if(!zo.rect)continue;let wn=zo.rect||{},os=Ix+1,Fo=!0,Ls=1,Ku=0,Uu=(qn||mo)&&zo.vertical,th=zo.metrics.advance*zo.scale/2;if(mo&&gi.verticalizable&&(Ku=Uo.lineOffset/2-(zo.imageName?-(fu-zo.metrics.width*zo.scale)/2:(zo.scale-1)*fu)),zo.imageName){let hu=ys[zo.imageName];Fo=hu.sdf,Ls=hu.pixelRatio,os=zh/Ls}let Hp=qn?[zo.x+th,zo.y]:[0,0],Th=qn?[0,0]:[zo.x+th+qi[0],zo.y+qi[1]-Ku],rh=[0,0];Uu&&(rh=Th,Th=[0,0]);let Jh=zo.metrics.isDoubleResolution?2:1,$h=(zo.metrics.left-os)*zo.scale-th+Th[0],Qh=(-zo.metrics.top-os)*zo.scale+Th[1],ff=$h+wn.w/Jh*zo.scale/Ls,ah=Qh+wn.h/Jh*zo.scale/Ls,Fh=new n($h,Qh),Ah=new n(ff,Qh),dh=new n($h,ah),yf=new n(ff,ah);if(Uu){let hu=new n(-th,th-eh),fc=-Math.PI/2,Ju=fu/2-th,Dp=new n(5-eh-Ju,-(zo.imageName?Ju:0)),$c=new n(...rh);Fh._rotateAround(fc,hu)._add(Dp)._add($c),Ah._rotateAround(fc,hu)._add(Dp)._add($c),dh._rotateAround(fc,hu)._add(Dp)._add($c),yf._rotateAround(fc,hu)._add(Dp)._add($c)}if(zn){let hu=Math.sin(zn),fc=Math.cos(zn),Ju=[fc,-hu,hu,fc];Fh._matMult(Ju),Ah._matMult(Ju),dh._matMult(Ju),yf._matMult(Ju)}let Rp=new n(0,0),dp=new n(0,0);ts.push({tl:Fh,tr:Ah,bl:dh,br:yf,tex:wn,writingMode:gi.writingMode,glyphOffset:Hp,sectionIndex:zo.sectionIndex,isSDF:Fo,pixelOffsetTL:Rp,pixelOffsetBR:dp,minFontScaleX:0,minFontScaleY:0})}return ts}(0,J,ht,ke,je,We,pe,W.allowVerticalPlacement),ja=W.textSizeData,Ka=null;ja.kind==="source"?(Ka=[yd*ke.layout.get("text-size").evaluate(We,{})],Ka[0]>cv&&f(`${W.layerIds[0]}: Value for "text-size" is >= ${k0}. Reduce your "text-size".`)):ja.kind==="composite"&&(Ka=[yd*Wr.compositeTextSizes[0].evaluate(We,{},ia),yd*Wr.compositeTextSizes[1].evaluate(We,{},ia)],(Ka[0]>cv||Ka[1]>cv)&&f(`${W.layerIds[0]}: Value for "text-size" is >= ${k0}. Reduce your "text-size".`)),W.addSymbols(W.text,ha,Ka,ht,je,We,Ut,D,Et.lineStartIndex,Et.lineLength,zr,ia);for(let Wi of or)Mr[Wi]=W.text.placedSymbolArray.length-1;return 4*ha.length}function ab(W){for(let D in W)return W[D];return null}function oA(W,D,J,pe){let ke=W.compareText;if(D in ke){let je=ke[D];for(let We=je.length-1;We>=0;We--)if(pe.dist(je[We])<J)return!0}else ke[D]=[];return ke[D].push(pe),!1}let ib=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class X1{static from(D){if(!(D instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[J,pe]=new Uint8Array(D,0,2);if(J!==219)throw new Error("Data does not appear to be in a KDBush format.");let ke=pe>>4;if(ke!==1)throw new Error(`Got v${ke} data when expected v1.`);let je=ib[15&pe];if(!je)throw new Error("Unrecognized array type.");let[We]=new Uint16Array(D,2,1),[ht]=new Uint32Array(D,4,1);return new X1(ht,We,je,D)}constructor(D,J=64,pe=Float64Array,ke){if(isNaN(D)||D<0)throw new Error(`Unpexpected numItems value: ${D}.`);this.numItems=+D,this.nodeSize=Math.min(Math.max(+J,2),65535),this.ArrayType=pe,this.IndexArrayType=D<65536?Uint16Array:Uint32Array;let je=ib.indexOf(this.ArrayType),We=2*D*this.ArrayType.BYTES_PER_ELEMENT,ht=D*this.IndexArrayType.BYTES_PER_ELEMENT,Et=(8-ht%8)%8;if(je<0)throw new Error(`Unexpected typed array class: ${pe}.`);ke&&ke instanceof ArrayBuffer?(this.data=ke,this.ids=new this.IndexArrayType(this.data,8,D),this.coords=new this.ArrayType(this.data,8+ht+Et,2*D),this._pos=2*D,this._finished=!0):(this.data=new ArrayBuffer(8+We+ht+Et),this.ids=new this.IndexArrayType(this.data,8,D),this.coords=new this.ArrayType(this.data,8+ht+Et,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]=J,new Uint32Array(this.data,4,1)[0]=D)}add(D,J){let pe=this._pos>>1;return this.ids[pe]=pe,this.coords[this._pos++]=D,this.coords[this._pos++]=J,pe}finish(){let D=this._pos>>1;if(D!==this.numItems)throw new Error(`Added ${D} items when expected ${this.numItems}.`);return Ig(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(D,J,pe,ke){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:je,coords:We,nodeSize:ht}=this,Et=[0,je.length-1,0],Ut=[];for(;Et.length;){let or=Et.pop()||0,Mr=Et.pop()||0,zr=Et.pop()||0;if(Mr-zr<=ht){for(let ja=zr;ja<=Mr;ja++){let Ka=We[2*ja],Wi=We[2*ja+1];Ka>=D&&Ka<=pe&&Wi>=J&&Wi<=ke&&Ut.push(je[ja])}continue}let Wr=zr+Mr>>1,ia=We[2*Wr],ha=We[2*Wr+1];ia>=D&&ia<=pe&&ha>=J&&ha<=ke&&Ut.push(je[Wr]),(or===0?D<=ia:J<=ha)&&(Et.push(zr),Et.push(Wr-1),Et.push(1-or)),(or===0?pe>=ia:ke>=ha)&&(Et.push(Wr+1),Et.push(Mr),Et.push(1-or))}return Ut}within(D,J,pe){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:ke,coords:je,nodeSize:We}=this,ht=[0,ke.length-1,0],Et=[],Ut=pe*pe;for(;ht.length;){let or=ht.pop()||0,Mr=ht.pop()||0,zr=ht.pop()||0;if(Mr-zr<=We){for(let ja=zr;ja<=Mr;ja++)ob(je[2*ja],je[2*ja+1],D,J)<=Ut&&Et.push(ke[ja]);continue}let Wr=zr+Mr>>1,ia=je[2*Wr],ha=je[2*Wr+1];ob(ia,ha,D,J)<=Ut&&Et.push(ke[Wr]),(or===0?D-pe<=ia:J-pe<=ha)&&(ht.push(zr),ht.push(Wr-1),ht.push(1-or)),(or===0?D+pe>=ia:J+pe>=ha)&&(ht.push(Wr+1),ht.push(Mr),ht.push(1-or))}return Et}}function Ig(W,D,J,pe,ke,je){if(ke-pe<=J)return;let We=pe+ke>>1;nb(W,D,We,pe,ke,je),Ig(W,D,J,pe,We-1,1-je),Ig(W,D,J,We+1,ke,1-je)}function nb(W,D,J,pe,ke,je){for(;ke>pe;){if(ke-pe>600){let Ut=ke-pe+1,or=J-pe+1,Mr=Math.log(Ut),zr=.5*Math.exp(2*Mr/3),Wr=.5*Math.sqrt(Mr*zr*(Ut-zr)/Ut)*(or-Ut/2<0?-1:1);nb(W,D,J,Math.max(pe,Math.floor(J-or*zr/Ut+Wr)),Math.min(ke,Math.floor(J+(Ut-or)*zr/Ut+Wr)),je)}let We=D[2*J+je],ht=pe,Et=ke;for(F0(W,D,pe,J),D[2*ke+je]>We&&F0(W,D,pe,ke);ht<Et;){for(F0(W,D,ht,Et),ht++,Et--;D[2*ht+je]<We;)ht++;for(;D[2*Et+je]>We;)Et--}D[2*pe+je]===We?F0(W,D,pe,Et):(Et++,F0(W,D,Et,ke)),Et<=J&&(pe=Et+1),J<=Et&&(ke=Et-1)}}function F0(W,D,J,pe){Z1(W,J,pe),Z1(D,2*J,2*pe),Z1(D,2*J+1,2*pe+1)}function Z1(W,D,J){let pe=W[D];W[D]=W[J],W[J]=pe}function ob(W,D,J,pe){let ke=W-J,je=D-pe;return ke*ke+je*je}var Rg;e.bg=void 0,(Rg=e.bg||(e.bg={})).create="create",Rg.load="load",Rg.fullLoad="fullLoad";let O0=null,Hf=[],Y1=1e3/60,K1="loadTime",Dg="fullLoadTime",sA={mark(W){performance.mark(W)},frame(W){let D=W;O0!=null&&Hf.push(D-O0),O0=D},clearMetrics(){O0=null,Hf=[],performance.clearMeasures(K1),performance.clearMeasures(Dg);for(let W in e.bg)performance.clearMarks(e.bg[W])},getPerformanceMetrics(){performance.measure(K1,e.bg.create,e.bg.load),performance.measure(Dg,e.bg.create,e.bg.fullLoad);let W=performance.getEntriesByName(K1)[0].duration,D=performance.getEntriesByName(Dg)[0].duration,J=Hf.length,pe=1/(Hf.reduce((je,We)=>je+We,0)/J/1e3),ke=Hf.filter(je=>je>Y1).reduce((je,We)=>je+(We-Y1)/Y1,0);return{loadTime:W,fullLoadTime:D,fps:pe,percentDroppedFrames:ke/(J+ke)*100,totalFrames:J}}};e.$=class extends Tr{},e.A=Qa,e.B=Hi,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=ho,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 U1(()=>this.process()),this.subscription=function(J,pe,ke,je){return J.addEventListener(pe,ke,!1),{unsubscribe:()=>{J.removeEventListener(pe,ke,!1)}}}(this.target,"message",J=>this.receive(J)),this.globalScope=L(self)?W:window}registerMessageHandler(W,D){this.messageHandlers[W]=D}sendAsync(W,D){return new Promise((J,pe)=>{let ke=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[ke]={resolve:J,reject:pe},D&&D.signal.addEventListener("abort",()=>{delete this.resolveRejects[ke];let ht={id:ke,type:"<cancel>",origin:location.origin,targetMapId:W.targetMapId,sourceMapId:this.mapId};this.target.postMessage(ht)},{once:!0});let je=[],We=Object.assign(Object.assign({},W),{id:ke,sourceMapId:this.mapId,origin:location.origin,data:eo(W.data,je)});this.target.postMessage(We,{transfer:je})})}receive(W){let D=W.data,J=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[J];let pe=this.abortControllers[J];return delete this.abortControllers[J],void(pe&&pe.abort())}if(L(self)||D.mustQueue)return this.tasks[J]=D,this.taskQueue.push(J),void this.invoker.trigger();this.processTask(J,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 ke=this.resolveRejects[W];return delete this.resolveRejects[W],ke?void(D.error?ke.reject(fo(D.error)):ke.resolve(fo(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 J=fo(D.data),pe=new AbortController;this.abortControllers[W]=pe;try{let ke=yield this.messageHandlers[D.type](D.sourceMapId,J,pe);this.completeTask(W,null,ke)}catch(ke){this.completeTask(W,ke)}})}completeTask(W,D,J){let pe=[];delete this.abortControllers[W];let ke={id:W,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:D?eo(D):null,data:eo(J,pe)};this.target.postMessage(ke,{transfer:pe})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.G=le,e.H=function(){var W=new Qa(16);return Qa!=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=wg,e.J=function(W,D,J){var pe,ke,je,We,ht,Et,Ut,or,Mr,zr,Wr,ia,ha=J[0],ja=J[1],Ka=J[2];return D===W?(W[12]=D[0]*ha+D[4]*ja+D[8]*Ka+D[12],W[13]=D[1]*ha+D[5]*ja+D[9]*Ka+D[13],W[14]=D[2]*ha+D[6]*ja+D[10]*Ka+D[14],W[15]=D[3]*ha+D[7]*ja+D[11]*Ka+D[15]):(ke=D[1],je=D[2],We=D[3],ht=D[4],Et=D[5],Ut=D[6],or=D[7],Mr=D[8],zr=D[9],Wr=D[10],ia=D[11],W[0]=pe=D[0],W[1]=ke,W[2]=je,W[3]=We,W[4]=ht,W[5]=Et,W[6]=Ut,W[7]=or,W[8]=Mr,W[9]=zr,W[10]=Wr,W[11]=ia,W[12]=pe*ha+ht*ja+Mr*Ka+D[12],W[13]=ke*ha+Et*ja+zr*Ka+D[13],W[14]=je*ha+Ut*ja+Wr*Ka+D[14],W[15]=We*ha+or*ja+ia*Ka+D[15]),W},e.K=function(W,D,J){var pe=J[0],ke=J[1],je=J[2];return W[0]=D[0]*pe,W[1]=D[1]*pe,W[2]=D[2]*pe,W[3]=D[3]*pe,W[4]=D[4]*ke,W[5]=D[5]*ke,W[6]=D[6]*ke,W[7]=D[7]*ke,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=Va,e.M=function(W,D){let J={};for(let pe=0;pe<D.length;pe++){let ke=D[pe];ke in W&&(J[ke]=W[ke])}return J},e.N=Hd,e.O=Cg,e.P=n,e.Q=qx,e.R=Ii,e.S=Gp,e.T=Zu,e.U=p,e.V=T,e.W=O,e.X=vo,e.Y=dt,e.Z=D0,e._=t,e.a=$,e.a$=function(W,D){var J=W[0],pe=W[1],ke=W[2],je=W[3],We=W[4],ht=W[5],Et=W[6],Ut=W[7],or=W[8],Mr=W[9],zr=W[10],Wr=W[11],ia=W[12],ha=W[13],ja=W[14],Ka=W[15],Wi=D[0],gi=D[1],qi=D[2],en=D[3],qn=D[4],Eo=D[5],ys=D[6],mo=D[7],zn=D[8],ts=D[9],Uo=D[10],zo=D[11],wn=D[12],os=D[13],Fo=D[14],Ls=D[15];return Math.abs(J-Wi)<=Ma*Math.max(1,Math.abs(J),Math.abs(Wi))&&Math.abs(pe-gi)<=Ma*Math.max(1,Math.abs(pe),Math.abs(gi))&&Math.abs(ke-qi)<=Ma*Math.max(1,Math.abs(ke),Math.abs(qi))&&Math.abs(je-en)<=Ma*Math.max(1,Math.abs(je),Math.abs(en))&&Math.abs(We-qn)<=Ma*Math.max(1,Math.abs(We),Math.abs(qn))&&Math.abs(ht-Eo)<=Ma*Math.max(1,Math.abs(ht),Math.abs(Eo))&&Math.abs(Et-ys)<=Ma*Math.max(1,Math.abs(Et),Math.abs(ys))&&Math.abs(Ut-mo)<=Ma*Math.max(1,Math.abs(Ut),Math.abs(mo))&&Math.abs(or-zn)<=Ma*Math.max(1,Math.abs(or),Math.abs(zn))&&Math.abs(Mr-ts)<=Ma*Math.max(1,Math.abs(Mr),Math.abs(ts))&&Math.abs(zr-Uo)<=Ma*Math.max(1,Math.abs(zr),Math.abs(Uo))&&Math.abs(Wr-zo)<=Ma*Math.max(1,Math.abs(Wr),Math.abs(zo))&&Math.abs(ia-wn)<=Ma*Math.max(1,Math.abs(ia),Math.abs(wn))&&Math.abs(ha-os)<=Ma*Math.max(1,Math.abs(ha),Math.abs(os))&&Math.abs(ja-Fo)<=Ma*Math.max(1,Math.abs(ja),Math.abs(Fo))&&Math.abs(Ka-Ls)<=Ma*Math.max(1,Math.abs(Ka),Math.abs(Ls))},e.a0=Mt,e.a1=q1,e.a2=ye,e.a3=W=>{let D=window.document.createElement("video");return D.muted=!0,new Promise(J=>{D.onloadstart=()=>{J(D)};for(let pe of W){let ke=window.document.createElement("source");ee(pe)||(D.crossOrigin="Anonymous"),ke.src=pe,D.appendChild(ke)}})},e.a4=function(){return g++},e.a5=nn,e.a6=cm,e.a7=Ec,e.a8=Hl,e.a9=V1,e.aA=function(W){if(W.type==="custom")return new N1(W);switch(W.type){case"background":return new QT(W);case"circle":return new Ha(W);case"fill":return new Ht(W);case"fill-extrusion":return new kp(W);case"heatmap":return new Dn(W);case"hillshade":return new bl(W);case"line":return new Lv(W);case"raster":return new I0(W);case"symbol":return new Dv(W)}},e.aB=u,e.aC=function(W,D){if(!W)return[{command:"setStyle",args:[D]}];let J=[];try{if(!Ae(W.version,D.version))return[{command:"setStyle",args:[D]}];Ae(W.center,D.center)||J.push({command:"setCenter",args:[D.center]}),Ae(W.zoom,D.zoom)||J.push({command:"setZoom",args:[D.zoom]}),Ae(W.bearing,D.bearing)||J.push({command:"setBearing",args:[D.bearing]}),Ae(W.pitch,D.pitch)||J.push({command:"setPitch",args:[D.pitch]}),Ae(W.sprite,D.sprite)||J.push({command:"setSprite",args:[D.sprite]}),Ae(W.glyphs,D.glyphs)||J.push({command:"setGlyphs",args:[D.glyphs]}),Ae(W.transition,D.transition)||J.push({command:"setTransition",args:[D.transition]}),Ae(W.light,D.light)||J.push({command:"setLight",args:[D.light]}),Ae(W.terrain,D.terrain)||J.push({command:"setTerrain",args:[D.terrain]}),Ae(W.sky,D.sky)||J.push({command:"setSky",args:[D.sky]}),Ae(W.projection,D.projection)||J.push({command:"setProjection",args:[D.projection]});let pe={},ke=[];(function(We,ht,Et,Ut){let or;for(or in ht=ht||{},We=We||{})Object.prototype.hasOwnProperty.call(We,or)&&(Object.prototype.hasOwnProperty.call(ht,or)||Ze(or,Et,Ut));for(or in ht)Object.prototype.hasOwnProperty.call(ht,or)&&(Object.prototype.hasOwnProperty.call(We,or)?Ae(We[or],ht[or])||(We[or].type==="geojson"&&ht[or].type==="geojson"&&nt(We,ht,or)?De(Et,{command:"setGeoJSONSourceData",args:[or,ht[or].data]}):at(or,ht,Et,Ut)):ze(or,ht,Et))})(W.sources,D.sources,ke,pe);let je=[];W.layers&&W.layers.forEach(We=>{"source"in We&&pe[We.source]?J.push({command:"removeLayer",args:[We.id]}):je.push(We)}),J=J.concat(ke),function(We,ht,Et){ht=ht||[];let Ut=(We=We||[]).map(st),or=ht.map(st),Mr=We.reduce(Me,{}),zr=ht.reduce(Me,{}),Wr=Ut.slice(),ia=Object.create(null),ha,ja,Ka,Wi,gi;for(let qi=0,en=0;qi<Ut.length;qi++)ha=Ut[qi],Object.prototype.hasOwnProperty.call(zr,ha)?en++:(De(Et,{command:"removeLayer",args:[ha]}),Wr.splice(Wr.indexOf(ha,en),1));for(let qi=0,en=0;qi<or.length;qi++)ha=or[or.length-1-qi],Wr[Wr.length-1-qi]!==ha&&(Object.prototype.hasOwnProperty.call(Mr,ha)?(De(Et,{command:"removeLayer",args:[ha]}),Wr.splice(Wr.lastIndexOf(ha,Wr.length-en),1)):en++,Wi=Wr[Wr.length-qi],De(Et,{command:"addLayer",args:[zr[ha],Wi]}),Wr.splice(Wr.length-qi,0,ha),ia[ha]=!0);for(let qi=0;qi<or.length;qi++)if(ha=or[qi],ja=Mr[ha],Ka=zr[ha],!ia[ha]&&!Ae(ja,Ka))if(Ae(ja.source,Ka.source)&&Ae(ja["source-layer"],Ka["source-layer"])&&Ae(ja.type,Ka.type)){for(gi in rt(ja.layout,Ka.layout,Et,ha,null,"setLayoutProperty"),rt(ja.paint,Ka.paint,Et,ha,null,"setPaintProperty"),Ae(ja.filter,Ka.filter)||De(Et,{command:"setFilter",args:[ha,Ka.filter]}),Ae(ja.minzoom,Ka.minzoom)&&Ae(ja.maxzoom,Ka.maxzoom)||De(Et,{command:"setLayerZoomRange",args:[ha,Ka.minzoom,Ka.maxzoom]}),ja)Object.prototype.hasOwnProperty.call(ja,gi)&&gi!=="layout"&&gi!=="paint"&&gi!=="filter"&&gi!=="metadata"&&gi!=="minzoom"&&gi!=="maxzoom"&&(gi.indexOf("paint.")===0?rt(ja[gi],Ka[gi],Et,ha,gi.slice(6),"setPaintProperty"):Ae(ja[gi],Ka[gi])||De(Et,{command:"setLayerProperty",args:[ha,gi,Ka[gi]]}));for(gi in Ka)Object.prototype.hasOwnProperty.call(Ka,gi)&&!Object.prototype.hasOwnProperty.call(ja,gi)&&gi!=="layout"&&gi!=="paint"&&gi!=="filter"&&gi!=="metadata"&&gi!=="minzoom"&&gi!=="maxzoom"&&(gi.indexOf("paint.")===0?rt(ja[gi],Ka[gi],Et,ha,gi.slice(6),"setPaintProperty"):Ae(ja[gi],Ka[gi])||De(Et,{command:"setLayerProperty",args:[ha,gi,Ka[gi]]}))}else De(Et,{command:"removeLayer",args:[ha]}),Wi=Wr[Wr.lastIndexOf(ha)+1],De(Et,{command:"addLayer",args:[Ka,Wi]})}(je,D.layers,J)}catch(pe){console.warn("Unable to compute style diff:",pe),J=[{command:"setStyle",args:[D]}]}return J},e.aD=function(W){let D=[],J=W.id;return J===void 0&&D.push({message:`layers.${J}: missing required property "id"`}),W.render===void 0&&D.push({message:`layers.${J}: missing required method "render"`}),W.renderingMode&&W.renderingMode!=="2d"&&W.renderingMode!=="3d"&&D.push({message:`layers.${J}: property "renderingMode" must be either "2d" or "3d"`}),D},e.aE=function W(D,J){if(Array.isArray(D)){if(!Array.isArray(J)||D.length!==J.length)return!1;for(let pe=0;pe<D.length;pe++)if(!W(D[pe],J[pe]))return!1;return!0}if(typeof D=="object"&&D!==null&&J!==null){if(typeof J!="object"||Object.keys(D).length!==Object.keys(J).length)return!1;for(let pe in D)if(!W(D[pe],J[pe]))return!1;return!0}return D===J},e.aF=b,e.aG=d,e.aH=class extends ni{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=La,e.aJ=class extends ni{constructor(W,D){super(W,D),this.current=vn}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=sn,e.aL=rn,e.aM=Jt,e.aN=class extends ni{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 ni{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,J,pe,ke,je,We){var ht=1/(D-J),Et=1/(pe-ke),Ut=1/(je-We);return W[0]=-2*ht,W[1]=0,W[2]=0,W[3]=0,W[4]=0,W[5]=-2*Et,W[6]=0,W[7]=0,W[8]=0,W[9]=0,W[10]=2*Ut,W[11]=0,W[12]=(D+J)*ht,W[13]=(ke+pe)*Et,W[14]=(We+je)*Ut,W[15]=1,W},e.aQ=Li,e.aR=class extends zt{},e.aS=nv,e.aT=class extends yr{},e.aU=kn,e.aV=function(W){return W<=1?1:Math.pow(2,Math.ceil(Math.log(W)/Math.LN2))},e.aW=an,e.aX=Jo,e.aY=Fe,e.aZ=class extends ci{},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,(J,pe,ke,je)=>{let We=ke||je;return D[pe]=!We||We.toLowerCase(),""}),D["max-age"]){let J=parseInt(D["max-age"],10);isNaN(J)?delete D["max-age"]:D["max-age"]=J}return D},e.ab=function(W,D){let J=[];for(let pe in W)pe in D||J.push(pe);return J},e.ac=w,e.ad=function(W,D,J){var pe=Math.sin(J),ke=Math.cos(J),je=D[0],We=D[1],ht=D[2],Et=D[3],Ut=D[4],or=D[5],Mr=D[6],zr=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*ke+Ut*pe,W[1]=We*ke+or*pe,W[2]=ht*ke+Mr*pe,W[3]=Et*ke+zr*pe,W[4]=Ut*ke-je*pe,W[5]=or*ke-We*pe,W[6]=Mr*ke-ht*pe,W[7]=zr*ke-Et*pe,W},e.ae=function(W){var D=new Qa(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=pn,e.ag=function(W,D){let J=0,pe=0;if(W.kind==="constant")pe=W.layoutSize;else if(W.kind!=="source"){let{interpolationType:ke,minZoom:je,maxZoom:We}=W,ht=ke?w(no.interpolationFactor(ke,D,je,We),0,1):0;W.kind==="camera"?pe=On.number(W.minSize,W.maxSize,ht):J=ht}return{uSizeT:J,uSize:pe}},e.ai=function(W,{uSize:D,uSizeT:J},{lowerSize:pe,upperSize:ke}){return W.kind==="source"?pe/yd:W.kind==="composite"?On.number(pe/yd,ke/yd,J):D},e.aj=z1,e.ak=function(W,D,J,pe){let ke=D.y-W.y,je=D.x-W.x,We=pe.y-J.y,ht=pe.x-J.x,Et=We*je-ht*ke;if(Et===0)return null;let Ut=(ht*(W.y-J.y)-We*(W.x-J.x))/Et;return new n(W.x+Ut*je,W.y+Ut*ke)},e.al=Zx,e.am=_c,e.an=di,e.ao=function(W){let D=1/0,J=1/0,pe=-1/0,ke=-1/0;for(let je of W)D=Math.min(D,je.x),J=Math.min(J,je.y),pe=Math.max(pe,je.x),ke=Math.max(ke,je.y);return[D,J,pe,ke]},e.ap=fu,e.ar=D1,e.as=function(W,D){var J=D[0],pe=D[1],ke=D[2],je=D[3],We=D[4],ht=D[5],Et=D[6],Ut=D[7],or=D[8],Mr=D[9],zr=D[10],Wr=D[11],ia=D[12],ha=D[13],ja=D[14],Ka=D[15],Wi=J*ht-pe*We,gi=J*Et-ke*We,qi=J*Ut-je*We,en=pe*Et-ke*ht,qn=pe*Ut-je*ht,Eo=ke*Ut-je*Et,ys=or*ha-Mr*ia,mo=or*ja-zr*ia,zn=or*Ka-Wr*ia,ts=Mr*ja-zr*ha,Uo=Mr*Ka-Wr*ha,zo=zr*Ka-Wr*ja,wn=Wi*zo-gi*Uo+qi*ts+en*zn-qn*mo+Eo*ys;return wn?(W[0]=(ht*zo-Et*Uo+Ut*ts)*(wn=1/wn),W[1]=(ke*Uo-pe*zo-je*ts)*wn,W[2]=(ha*Eo-ja*qn+Ka*en)*wn,W[3]=(zr*qn-Mr*Eo-Wr*en)*wn,W[4]=(Et*zn-We*zo-Ut*mo)*wn,W[5]=(J*zo-ke*zn+je*mo)*wn,W[6]=(ja*qi-ia*Eo-Ka*gi)*wn,W[7]=(or*Eo-zr*qi+Wr*gi)*wn,W[8]=(We*Uo-ht*zn+Ut*ys)*wn,W[9]=(pe*zn-J*Uo-je*ys)*wn,W[10]=(ia*qn-ha*qi+Ka*Wi)*wn,W[11]=(Mr*qi-or*qn-Wr*Wi)*wn,W[12]=(ht*mo-We*ts-Et*ys)*wn,W[13]=(J*ts-pe*mo+ke*ys)*wn,W[14]=(ha*gi-ia*en-ja*Wi)*wn,W[15]=(or*en-Mr*gi+zr*Wi)*wn,W):null},e.at=W1,e.au=Mg,e.av=X1,e.aw=function(){let W={},D=re.$version;for(let J in re.$root){let pe=re.$root[J];if(pe.required){let ke=null;ke=J==="version"?D:pe.type==="array"?[]:{},ke!=null&&(W[J]=ke)}}return W},e.ax=An,e.ay=V,e.az=function(W){W=W.slice();let D=Object.create(null);for(let J=0;J<W.length;J++)D[W[J].id]=W[J];for(let J=0;J<W.length;J++)"ref"in W[J]&&(W[J]=be(W[J],D[W[J].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,J){return W[0]=D[0]*J[0],W[1]=D[1]*J[1],W[2]=D[2]*J[2],W[3]=D[3]*J[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=Vx,e.b5=Lg,e.b6=function(W,D,J,pe,ke){var je,We=1/Math.tan(D/2);return W[0]=We/J,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,ke!=null&&ke!==1/0?(W[10]=(ke+pe)*(je=1/(pe-ke)),W[14]=2*ke*pe*je):(W[10]=-1,W[14]=-2*pe),W},e.b7=function(W,D,J){var pe=Math.sin(J),ke=Math.cos(J),je=D[4],We=D[5],ht=D[6],Et=D[7],Ut=D[8],or=D[9],Mr=D[10],zr=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*ke+Ut*pe,W[5]=We*ke+or*pe,W[6]=ht*ke+Mr*pe,W[7]=Et*ke+zr*pe,W[8]=Ut*ke-je*pe,W[9]=or*ke-We*pe,W[10]=Mr*ke-ht*pe,W[11]=zr*ke-Et*pe,W},e.b8=l,e.b9=_,e.bA=Dh,e.bB=function(W){return W.message===B},e.bC=ol,e.bD=Js,e.ba=function(W){return W*Math.PI/180},e.bb=function(W,D){let{x:J,y:pe}=D0.fromLngLat(D);return!(W<0||W>25||pe<0||pe>=1||J<0||J>=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 $t{},e.be=j1,e.bf=sA,e.bh=fe,e.bi=function(W,D){$.REGISTERED_PROTOCOLS[W]=D},e.bj=function(W){delete $.REGISTERED_PROTOCOLS[W]},e.bk=function(W,D){let J={};for(let ke=0;ke<W.length;ke++){let je=D&&D[W[ke].id]||hh(W[ke]);D&&(D[W[ke].id]=je);let We=J[je];We||(We=J[je]=[]),We.push(W[ke])}let pe=[];for(let ke in J)pe.push(J[ke]);return pe},e.bl=mi,e.bm=Hx,e.bn=zv,e.bo=Tg,e.bp=function(W){W.bucket.createArrays(),W.bucket.tilePixelRatio=vo/(512*W.bucket.overscaling),W.bucket.compareText={},W.bucket.iconsNeedLinear=!1;let D=W.bucket.layers[0],J=D.layout,pe=D._unevaluatedLayout._values,ke={layoutIconSize:pe["icon-size"].possiblyEvaluate(new Rs(W.bucket.zoom+1),W.canonical),layoutTextSize:pe["text-size"].possiblyEvaluate(new Rs(W.bucket.zoom+1),W.canonical),textMaxSize:pe["text-size"].possiblyEvaluate(new Rs(18))};if(W.bucket.textSizeData.kind==="composite"){let{minZoom:Ut,maxZoom:or}=W.bucket.textSizeData;ke.compositeTextSizes=[pe["text-size"].possiblyEvaluate(new Rs(Ut),W.canonical),pe["text-size"].possiblyEvaluate(new Rs(or),W.canonical)]}if(W.bucket.iconSizeData.kind==="composite"){let{minZoom:Ut,maxZoom:or}=W.bucket.iconSizeData;ke.compositeIconSizes=[pe["icon-size"].possiblyEvaluate(new Rs(Ut),W.canonical),pe["icon-size"].possiblyEvaluate(new Rs(or),W.canonical)]}let je=J.get("text-line-height")*fu,We=J.get("text-rotation-alignment")!=="viewport"&&J.get("symbol-placement")!=="point",ht=J.get("text-keep-upright"),Et=J.get("text-size");for(let Ut of W.bucket.features){let or=J.get("text-font").evaluate(Ut,{},W.canonical).join(","),Mr=Et.evaluate(Ut,{},W.canonical),zr=ke.layoutTextSize.evaluate(Ut,{},W.canonical),Wr=ke.layoutIconSize.evaluate(Ut,{},W.canonical),ia={horizontal:{},vertical:void 0},ha=Ut.text,ja,Ka=[0,0];if(ha){let qi=ha.toString(),en=J.get("text-letter-spacing").evaluate(Ut,{},W.canonical)*fu,qn=Ko(qi)?en:0,Eo=J.get("text-anchor").evaluate(Ut,{},W.canonical),ys=tb(D,Ut,W.canonical);if(!ys){let Uo=J.get("text-radial-offset").evaluate(Ut,{},W.canonical);Ka=Uo?H1(Eo,[Uo*fu,Fv]):J.get("text-offset").evaluate(Ut,{},W.canonical).map(zo=>zo*fu)}let mo=We?"center":J.get("text-justify").evaluate(Ut,{},W.canonical),zn=J.get("symbol-placement")==="point"?J.get("text-max-width").evaluate(Ut,{},W.canonical)*fu:1/0,ts=()=>{W.bucket.allowVerticalPlacement&&yo(qi)&&(ia.vertical=M0(ha,W.glyphMap,W.glyphPositions,W.imagePositions,or,zn,je,Eo,"left",qn,Ka,e.ah.vertical,!0,zr,Mr))};if(!We&&ys){let Uo=new Set;if(mo==="auto")for(let wn=0;wn<ys.values.length;wn+=2)Uo.add(W1(ys.values[wn]));else Uo.add(mo);let zo=!1;for(let wn of Uo)if(!ia.horizontal[wn])if(zo)ia.horizontal[wn]=ia.horizontal[0];else{let os=M0(ha,W.glyphMap,W.glyphPositions,W.imagePositions,or,zn,je,"center",wn,qn,Ka,e.ah.horizontal,!1,zr,Mr);os&&(ia.horizontal[wn]=os,zo=os.positionedLines.length===1)}ts()}else{mo==="auto"&&(mo=W1(Eo));let Uo=M0(ha,W.glyphMap,W.glyphPositions,W.imagePositions,or,zn,je,Eo,mo,qn,Ka,e.ah.horizontal,!1,zr,Mr);Uo&&(ia.horizontal[mo]=Uo),ts(),yo(qi)&&We&&ht&&(ia.vertical=M0(ha,W.glyphMap,W.glyphPositions,W.imagePositions,or,zn,je,Eo,mo,qn,Ka,e.ah.vertical,!1,zr,Mr))}}let Wi=!1;if(Ut.icon&&Ut.icon.name){let qi=W.imageMap[Ut.icon.name];qi&&(ja=E0(W.imagePositions[Ut.icon.name],J.get("icon-offset").evaluate(Ut,{},W.canonical),J.get("icon-anchor").evaluate(Ut,{},W.canonical)),Wi=!!qi.sdf,W.bucket.sdfIcons===void 0?W.bucket.sdfIcons=Wi:W.bucket.sdfIcons!==Wi&&f("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(qi.pixelRatio!==W.bucket.pixelRatio||J.get("icon-rotate").constantOr(1)!==0)&&(W.bucket.iconsNeedLinear=!0))}let gi=ab(ia.horizontal)||ia.vertical;W.bucket.iconsInText=!!gi&&gi.iconsInText,(gi||ja)&&nA(W.bucket,Ut,ia,ja,W.imageMap,ke,zr,Wr,Ka,Wi,W.canonical)}W.showCollisionBoxes&&W.bucket.generateCollisionDebugBuffers()},e.bq=Vp,e.br=hr,e.bs=Do,e.bt=Jr,e.bu=P1,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,J,pe,ke){return t(this,void 0,void 0,function*(){if(T())try{return yield O(W,D,J,pe,ke)}catch{}return function(je,We,ht,Et,Ut){let or=je.width,Mr=je.height;P&&U||(P=new OffscreenCanvas(or,Mr),U=P.getContext("2d",{willReadFrequently:!0})),P.width=or,P.height=Mr,U.drawImage(je,0,0,or,Mr);let zr=U.getImageData(We,ht,Et,Ut);return U.clearRect(0,0,or,Mr),zr.data}(W,D,J,pe,ke)})},e.bx=Gx,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(J){throw new Error(`Could not load image because of ${J.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,J)=>{let pe=new Image;pe.onload=()=>{D(pe),URL.revokeObjectURL(pe.src),pe.onload=null,window.requestAnimationFrame(()=>{pe.src=N})},pe.onerror=()=>J(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 ke=new Blob([new Uint8Array(W)],{type:"image/png"});pe.src=W.byteLength?URL.createObjectURL(ke):N}),e.g=se,e.h=(W,D)=>Y(M(W,{type:"json"}),D),e.i=L,e.j=j,e.k=ae,e.l=(W,D)=>Y(M(W,{type:"arrayBuffer"}),D),e.m=Y,e.n=function(W){return new P1(W).readFields(mk,[])},e.o=In,e.p=R1,e.q=Ue,e.r=Ci,e.s=ee,e.t=Pi,e.u=li,e.v=re,e.w=f,e.x=function([W,D,J]){return D+=90,D*=Math.PI/180,J*=Math.PI/180,{x:W*Math.cos(D)*Math.sin(J),y:W*Math.sin(D)*Math.sin(J),z:W*Math.cos(J)}},e.y=On,e.z=Rs}),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,Ke){for(let Ie of Ne){this._layerConfigs[Ie.id]=Ie;let Ve=this._layers[Ie.id]=e.aA(Ie);Ve._featureFilter=e.a7(Ve.filter),this.keyCache[Ie.id]&&delete this.keyCache[Ie.id]}for(let Ie of Ke)delete this.keyCache[Ie],delete this._layerConfigs[Ie],delete this._layers[Ie];this.familiesBySource={};let Te=e.bk(Object.values(this._layerConfigs),this.keyCache);for(let Ie of Te){let Ve=Ie.map(_t=>this._layers[_t.id]),Ce=Ve[0];if(Ce.visibility==="none")continue;let Ee=Ce.source||"",Pe=this.familiesBySource[Ee];Pe||(Pe=this.familiesBySource[Ee]={});let ft=Ce.sourceLayer||"_geojsonTileLayer",ct=Pe[ft];ct||(ct=Pe[ft]=[]),ct.push(Ve)}}}class r{constructor(Ne){let Ke={},Te=[];for(let Ee in Ne){let Pe=Ne[Ee],ft=Ke[Ee]={};for(let ct in Pe){let _t=Pe[+ct];if(!_t||_t.bitmap.width===0||_t.bitmap.height===0)continue;let Ct={x:0,y:0,w:_t.bitmap.width+2,h:_t.bitmap.height+2};Te.push(Ct),ft[ct]={rect:Ct,metrics:_t.metrics}}}let{w:Ie,h:Ve}=e.p(Te),Ce=new e.o({width:Ie||1,height:Ve||1});for(let Ee in Ne){let Pe=Ne[Ee];for(let ft in Pe){let ct=Pe[+ft];if(!ct||ct.bitmap.width===0||ct.bitmap.height===0)continue;let _t=Ke[Ee][ft].rect;e.o.copy(ct.bitmap,Ce,{x:0,y:0},{x:_t.x+1,y:_t.y+1},ct.bitmap)}}this.image=Ce,this.positions=Ke}}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,Ke,Te,Ie){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=Ne,this.collisionBoxArray=new e.a5;let Ve=new e.bm(Object.keys(Ne.layers).sort()),Ce=new e.bn(this.tileID,this.promoteId);Ce.bucketLayerIDs=[];let Ee={},Pe={featureIndex:Ce,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:Te},ft=Ke.familiesBySource[this.source];for(let Wa in ft){let Ca=Ne.layers[Wa];if(!Ca)continue;Ca.version===1&&e.w(`Vector tile source "${this.source}" layer "${Wa}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let hi=Ve.encode(Wa),wi=[];for(let Kt=0;Kt<Ca.length;Kt++){let Ft=Ca.feature(Kt),Yt=Ce.getId(Ft,Wa);wi.push({feature:Ft,id:Yt,index:Kt,sourceLayerIndex:hi})}for(let Kt of ft[Wa]){let Ft=Kt[0];Ft.source!==this.source&&e.w(`layer.source = ${Ft.source} does not equal this.source = ${this.source}`),Ft.minzoom&&this.zoom<Math.floor(Ft.minzoom)||Ft.maxzoom&&this.zoom>=Ft.maxzoom||Ft.visibility!=="none"&&(a(Kt,this.zoom,Te),(Ee[Ft.id]=Ft.createBucket({index:Ce.bucketLayerIDs.length,layers:Kt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:hi,sourceID:this.source})).populate(wi,Pe,this.tileID.canonical),Ce.bucketLayerIDs.push(Kt.map(Yt=>Yt.id)))}}let ct=e.aF(Pe.glyphDependencies,Wa=>Object.keys(Wa).map(Number));this.inFlightDependencies.forEach(Wa=>Wa?.abort()),this.inFlightDependencies=[];let _t=Promise.resolve({});if(Object.keys(ct).length){let Wa=new AbortController;this.inFlightDependencies.push(Wa),_t=Ie.sendAsync({type:"GG",data:{stacks:ct,source:this.source,tileID:this.tileID,type:"glyphs"}},Wa)}let Ct=Object.keys(Pe.iconDependencies),ir=Promise.resolve({});if(Ct.length){let Wa=new AbortController;this.inFlightDependencies.push(Wa),ir=Ie.sendAsync({type:"GI",data:{icons:Ct,source:this.source,tileID:this.tileID,type:"icons"}},Wa)}let rr=Object.keys(Pe.patternDependencies),er=Promise.resolve({});if(rr.length){let Wa=new AbortController;this.inFlightDependencies.push(Wa),er=Ie.sendAsync({type:"GI",data:{icons:rr,source:this.source,tileID:this.tileID,type:"patterns"}},Wa)}let[Lr,fa,Da]=yield Promise.all([_t,ir,er]),Ia=new r(Lr),qa=new e.bo(fa,Da);for(let Wa in Ee){let Ca=Ee[Wa];Ca instanceof e.a6?(a(Ca.layers,this.zoom,Te),e.bp({bucket:Ca,glyphMap:Lr,glyphPositions:Ia.positions,imageMap:fa,imagePositions:qa.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ca.hasPattern&&(Ca instanceof e.bq||Ca instanceof e.br||Ca instanceof e.bs)&&(a(Ca.layers,this.zoom,Te),Ca.addFeatures(Pe,this.tileID.canonical,qa.patternPositions))}return this.status="done",{buckets:Object.values(Ee).filter(Wa=>!Wa.isEmpty()),featureIndex:Ce,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ia.image,imageAtlas:qa,glyphMap:this.returnDependencies?Lr:null,iconMap:this.returnDependencies?fa:null,glyphPositions:this.returnDependencies?Ia.positions:null}})}}function a(wt,Ne,Ke){let Te=new e.z(Ne);for(let Ie of wt)Ie.recalculate(Te,Ke)}class n{constructor(Ne,Ke,Te){this.actor=Ne,this.layerIndex=Ke,this.availableImages=Te,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Ne,Ke){return e._(this,void 0,void 0,function*(){let Te=yield e.l(Ne.request,Ke);try{return{vectorTile:new e.bt.VectorTile(new e.bu(Te.data)),rawData:Te.data,cacheControl:Te.cacheControl,expires:Te.expires}}catch(Ie){let Ve=new Uint8Array(Te.data),Ce=`Unable to parse the tile at ${Ne.request.url}, `;throw Ce+=Ve[0]===31&&Ve[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(Ce)}})}loadTile(Ne){return e._(this,void 0,void 0,function*(){let Ke=Ne.uid,Te=!!(Ne&&Ne.request&&Ne.request.collectResourceTiming)&&new e.bv(Ne.request),Ie=new o(Ne);this.loading[Ke]=Ie;let Ve=new AbortController;Ie.abort=Ve;try{let Ce=yield this.loadVectorTile(Ne,Ve);if(delete this.loading[Ke],!Ce)return null;let Ee=Ce.rawData,Pe={};Ce.expires&&(Pe.expires=Ce.expires),Ce.cacheControl&&(Pe.cacheControl=Ce.cacheControl);let ft={};if(Te){let _t=Te.finish();_t&&(ft.resourceTiming=JSON.parse(JSON.stringify(_t)))}Ie.vectorTile=Ce.vectorTile;let ct=Ie.parse(Ce.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[Ke]=Ie,this.fetching[Ke]={rawTileData:Ee,cacheControl:Pe,resourceTiming:ft};try{let _t=yield ct;return e.e({rawTileData:Ee.slice(0)},_t,Pe,ft)}finally{delete this.fetching[Ke]}}catch(Ce){throw delete this.loading[Ke],Ie.status="done",this.loaded[Ke]=Ie,Ce}})}reloadTile(Ne){return e._(this,void 0,void 0,function*(){let Ke=Ne.uid;if(!this.loaded||!this.loaded[Ke])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let Te=this.loaded[Ke];if(Te.showCollisionBoxes=Ne.showCollisionBoxes,Te.status==="parsing"){let Ie=yield Te.parse(Te.vectorTile,this.layerIndex,this.availableImages,this.actor),Ve;if(this.fetching[Ke]){let{rawTileData:Ce,cacheControl:Ee,resourceTiming:Pe}=this.fetching[Ke];delete this.fetching[Ke],Ve=e.e({rawTileData:Ce.slice(0)},Ie,Ee,Pe)}else Ve=Ie;return Ve}if(Te.status==="done"&&Te.vectorTile)return Te.parse(Te.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(Ne){return e._(this,void 0,void 0,function*(){let Ke=this.loading,Te=Ne.uid;Ke&&Ke[Te]&&Ke[Te].abort&&(Ke[Te].abort.abort(),delete Ke[Te])})}removeTile(Ne){return e._(this,void 0,void 0,function*(){this.loaded&&this.loaded[Ne.uid]&&delete this.loaded[Ne.uid]})}}class i{constructor(){this.loaded={}}loadTile(Ne){return e._(this,void 0,void 0,function*(){let{uid:Ke,encoding:Te,rawImageData:Ie,redFactor:Ve,greenFactor:Ce,blueFactor:Ee,baseShift:Pe}=Ne,ft=Ie.width+2,ct=Ie.height+2,_t=e.b(Ie)?new e.R({width:ft,height:ct},yield e.bw(Ie,-1,-1,ft,ct)):Ie,Ct=new e.bx(Ke,_t,Te,Ve,Ce,Ee,Pe);return this.loaded=this.loaded||{},this.loaded[Ke]=Ct,Ct})}removeTile(Ne){let Ke=this.loaded,Te=Ne.uid;Ke&&Ke[Te]&&delete Ke[Te]}}function s(wt,Ne){if(wt.length!==0){h(wt[0],Ne);for(var Ke=1;Ke<wt.length;Ke++)h(wt[Ke],!Ne)}}function h(wt,Ne){for(var Ke=0,Te=0,Ie=0,Ve=wt.length,Ce=Ve-1;Ie<Ve;Ce=Ie++){var Ee=(wt[Ie][0]-wt[Ce][0])*(wt[Ce][1]+wt[Ie][1]),Pe=Ke+Ee;Te+=Math.abs(Ke)>=Math.abs(Ee)?Ke-Pe+Ee:Ee-Pe+Ke,Ke=Pe}Ke+Te>=0!=!!Ne&&wt.reverse()}var c=e.by(function wt(Ne,Ke){var Te,Ie=Ne&&Ne.type;if(Ie==="FeatureCollection")for(Te=0;Te<Ne.features.length;Te++)wt(Ne.features[Te],Ke);else if(Ie==="GeometryCollection")for(Te=0;Te<Ne.geometries.length;Te++)wt(Ne.geometries[Te],Ke);else if(Ie==="Feature")wt(Ne.geometry,Ke);else if(Ie==="Polygon")s(Ne.coordinates,Ke);else if(Ie==="MultiPolygon")for(Te=0;Te<Ne.coordinates.length;Te++)s(Ne.coordinates[Te],Ke);return Ne});let m=e.bt.VectorTileFeature.prototype.toGeoJSON;var p={exports:{}},T=e.bz,l=e.bt.VectorTileFeature,_=w;function w(wt,Ne){this.options=Ne||{},this.features=wt,this.length=wt.length}function A(wt,Ne){this.id=typeof wt.id=="number"?wt.id:void 0,this.type=wt.type,this.rawGeometry=wt.type===1?[wt.geometry]:wt.geometry,this.properties=wt.tags,this.extent=Ne||4096}w.prototype.feature=function(wt){return new A(this.features[wt],this.options.extent)},A.prototype.loadGeometry=function(){var wt=this.rawGeometry;this.geometry=[];for(var Ne=0;Ne<wt.length;Ne++){for(var Ke=wt[Ne],Te=[],Ie=0;Ie<Ke.length;Ie++)Te.push(new T(Ke[Ie][0],Ke[Ie][1]));this.geometry.push(Te)}return this.geometry},A.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var wt=this.geometry,Ne=1/0,Ke=-1/0,Te=1/0,Ie=-1/0,Ve=0;Ve<wt.length;Ve++)for(var Ce=wt[Ve],Ee=0;Ee<Ce.length;Ee++){var Pe=Ce[Ee];Ne=Math.min(Ne,Pe.x),Ke=Math.max(Ke,Pe.x),Te=Math.min(Te,Pe.y),Ie=Math.max(Ie,Pe.y)}return[Ne,Te,Ke,Ie]},A.prototype.toGeoJSON=l.prototype.toGeoJSON;var M=e.bA,g=_;function b(wt){var Ne=new M;return function(Ke,Te){for(var Ie in Ke.layers)Te.writeMessage(3,d,Ke.layers[Ie])}(wt,Ne),Ne.finish()}function d(wt,Ne){var Ke;Ne.writeVarintField(15,wt.version||1),Ne.writeStringField(1,wt.name||""),Ne.writeVarintField(5,wt.extent||4096);var Te={keys:[],values:[],keycache:{},valuecache:{}};for(Ke=0;Ke<wt.length;Ke++)Te.feature=wt.feature(Ke),Ne.writeMessage(2,u,Te);var Ie=Te.keys;for(Ke=0;Ke<Ie.length;Ke++)Ne.writeStringField(3,Ie[Ke]);var Ve=Te.values;for(Ke=0;Ke<Ve.length;Ke++)Ne.writeMessage(4,z,Ve[Ke])}function u(wt,Ne){var Ke=wt.feature;Ke.id!==void 0&&Ne.writeVarintField(1,Ke.id),Ne.writeMessage(2,y,wt),Ne.writeVarintField(3,Ke.type),Ne.writeMessage(4,L,Ke)}function y(wt,Ne){var Ke=wt.feature,Te=wt.keys,Ie=wt.values,Ve=wt.keycache,Ce=wt.valuecache;for(var Ee in Ke.properties){var Pe=Ke.properties[Ee],ft=Ve[Ee];if(Pe!==null){ft===void 0&&(Te.push(Ee),Ve[Ee]=ft=Te.length-1),Ne.writeVarint(ft);var ct=typeof Pe;ct!=="string"&&ct!=="boolean"&&ct!=="number"&&(Pe=JSON.stringify(Pe));var _t=ct+":"+Pe,Ct=Ce[_t];Ct===void 0&&(Ie.push(Pe),Ce[_t]=Ct=Ie.length-1),Ne.writeVarint(Ct)}}}function f(wt,Ne){return(Ne<<3)+(7&wt)}function R(wt){return wt<<1^wt>>31}function L(wt,Ne){for(var Ke=wt.loadGeometry(),Te=wt.type,Ie=0,Ve=0,Ce=Ke.length,Ee=0;Ee<Ce;Ee++){var Pe=Ke[Ee],ft=1;Te===1&&(ft=Pe.length),Ne.writeVarint(f(1,ft));for(var ct=Te===3?Pe.length-1:Pe.length,_t=0;_t<ct;_t++){_t===1&&Te!==1&&Ne.writeVarint(f(2,ct-1));var Ct=Pe[_t].x-Ie,ir=Pe[_t].y-Ve;Ne.writeVarint(R(Ct)),Ne.writeVarint(R(ir)),Ie+=Ct,Ve+=ir}Te===3&&Ne.writeVarint(f(7,1))}}function z(wt,Ne){var Ke=typeof wt;Ke==="string"?Ne.writeStringField(1,wt):Ke==="boolean"?Ne.writeBooleanField(7,wt):Ke==="number"&&(wt%1!=0?Ne.writeDoubleField(3,wt):wt<0?Ne.writeSVarintField(6,wt):Ne.writeVarintField(5,wt))}p.exports=b,p.exports.fromVectorTileJs=b,p.exports.fromGeojsonVt=function(wt,Ne){Ne=Ne||{};var Ke={};for(var Te in wt)Ke[Te]=new g(wt[Te].features,Ne),Ke[Te].name=Te,Ke[Te].version=Ne.version,Ke[Te].extent=Ne.extent;return b({layers:Ke})},p.exports.GeoJSONWrapper=g;var F=e.by(p.exports);let N={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:wt=>wt},O=Math.fround||(P=new Float32Array(1),wt=>(P[0]=+wt,P[0]));var P;let U=3,B=5,X=6;class ${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:Ke,minZoom:Te,maxZoom:Ie}=this.options;Ke&&console.time("total time");let Ve=`prepare ${Ne.length} points`;Ke&&console.time(Ve),this.points=Ne;let Ce=[];for(let Pe=0;Pe<Ne.length;Pe++){let ft=Ne[Pe];if(!ft.geometry)continue;let[ct,_t]=ft.geometry.coordinates,Ct=O(fe(ct)),ir=O(V(_t));Ce.push(Ct,ir,1/0,Pe,-1,1),this.options.reduce&&Ce.push(0)}let Ee=this.trees[Ie+1]=this._createTree(Ce);Ke&&console.timeEnd(Ve);for(let Pe=Ie;Pe>=Te;Pe--){let ft=+Date.now();Ee=this.trees[Pe]=this._createTree(this._cluster(Ee,Pe)),Ke&&console.log("z%d: %d clusters in %dms",Pe,Ee.numItems,+Date.now()-ft)}return Ke&&console.timeEnd("total time"),this}getClusters(Ne,Ke){let Te=((Ne[0]+180)%360+360)%360-180,Ie=Math.max(-90,Math.min(90,Ne[1])),Ve=Ne[2]===180?180:((Ne[2]+180)%360+360)%360-180,Ce=Math.max(-90,Math.min(90,Ne[3]));if(Ne[2]-Ne[0]>=360)Te=-180,Ve=180;else if(Te>Ve){let _t=this.getClusters([Te,Ie,180,Ce],Ke),Ct=this.getClusters([-180,Ie,Ve,Ce],Ke);return _t.concat(Ct)}let Ee=this.trees[this._limitZoom(Ke)],Pe=Ee.range(fe(Te),V(Ce),fe(Ve),V(Ie)),ft=Ee.data,ct=[];for(let _t of Pe){let Ct=this.stride*_t;ct.push(ft[Ct+B]>1?se(ft,Ct,this.clusterProps):this.points[ft[Ct+U]])}return ct}getChildren(Ne){let Ke=this._getOriginId(Ne),Te=this._getOriginZoom(Ne),Ie="No cluster with the specified id.",Ve=this.trees[Te];if(!Ve)throw new Error(Ie);let Ce=Ve.data;if(Ke*this.stride>=Ce.length)throw new Error(Ie);let Ee=this.options.radius/(this.options.extent*Math.pow(2,Te-1)),Pe=Ve.within(Ce[Ke*this.stride],Ce[Ke*this.stride+1],Ee),ft=[];for(let ct of Pe){let _t=ct*this.stride;Ce[_t+4]===Ne&&ft.push(Ce[_t+B]>1?se(Ce,_t,this.clusterProps):this.points[Ce[_t+U]])}if(ft.length===0)throw new Error(Ie);return ft}getLeaves(Ne,Ke,Te){let Ie=[];return this._appendLeaves(Ie,Ne,Ke=Ke||10,Te=Te||0,0),Ie}getTile(Ne,Ke,Te){let Ie=this.trees[this._limitZoom(Ne)],Ve=Math.pow(2,Ne),{extent:Ce,radius:Ee}=this.options,Pe=Ee/Ce,ft=(Te-Pe)/Ve,ct=(Te+1+Pe)/Ve,_t={features:[]};return this._addTileFeatures(Ie.range((Ke-Pe)/Ve,ft,(Ke+1+Pe)/Ve,ct),Ie.data,Ke,Te,Ve,_t),Ke===0&&this._addTileFeatures(Ie.range(1-Pe/Ve,ft,1,ct),Ie.data,Ve,Te,Ve,_t),Ke===Ve-1&&this._addTileFeatures(Ie.range(0,ft,Pe/Ve,ct),Ie.data,-1,Te,Ve,_t),_t.features.length?_t:null}getClusterExpansionZoom(Ne){let Ke=this._getOriginZoom(Ne)-1;for(;Ke<=this.options.maxZoom;){let Te=this.getChildren(Ne);if(Ke++,Te.length!==1)break;Ne=Te[0].properties.cluster_id}return Ke}_appendLeaves(Ne,Ke,Te,Ie,Ve){let Ce=this.getChildren(Ke);for(let Ee of Ce){let Pe=Ee.properties;if(Pe&&Pe.cluster?Ve+Pe.point_count<=Ie?Ve+=Pe.point_count:Ve=this._appendLeaves(Ne,Pe.cluster_id,Te,Ie,Ve):Ve<Ie?Ve++:Ne.push(Ee),Ne.length===Te)break}return Ve}_createTree(Ne){let Ke=new e.av(Ne.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Te=0;Te<Ne.length;Te+=this.stride)Ke.add(Ne[Te],Ne[Te+1]);return Ke.finish(),Ke.data=Ne,Ke}_addTileFeatures(Ne,Ke,Te,Ie,Ve,Ce){for(let Ee of Ne){let Pe=Ee*this.stride,ft=Ke[Pe+B]>1,ct,_t,Ct;if(ft)ct=le(Ke,Pe,this.clusterProps),_t=Ke[Pe],Ct=Ke[Pe+1];else{let er=this.points[Ke[Pe+U]];ct=er.properties;let[Lr,fa]=er.geometry.coordinates;_t=fe(Lr),Ct=V(fa)}let ir={type:1,geometry:[[Math.round(this.options.extent*(_t*Ve-Te)),Math.round(this.options.extent*(Ct*Ve-Ie))]],tags:ct},rr;rr=ft||this.options.generateId?Ke[Pe+U]:this.points[Ke[Pe+U]].id,rr!==void 0&&(ir.id=rr),Ce.features.push(ir)}}_limitZoom(Ne){return Math.max(this.options.minZoom,Math.min(Math.floor(+Ne),this.options.maxZoom+1))}_cluster(Ne,Ke){let{radius:Te,extent:Ie,reduce:Ve,minPoints:Ce}=this.options,Ee=Te/(Ie*Math.pow(2,Ke)),Pe=Ne.data,ft=[],ct=this.stride;for(let _t=0;_t<Pe.length;_t+=ct){if(Pe[_t+2]<=Ke)continue;Pe[_t+2]=Ke;let Ct=Pe[_t],ir=Pe[_t+1],rr=Ne.within(Pe[_t],Pe[_t+1],Ee),er=Pe[_t+B],Lr=er;for(let fa of rr){let Da=fa*ct;Pe[Da+2]>Ke&&(Lr+=Pe[Da+B])}if(Lr>er&&Lr>=Ce){let fa,Da=Ct*er,Ia=ir*er,qa=-1,Wa=((_t/ct|0)<<5)+(Ke+1)+this.points.length;for(let Ca of rr){let hi=Ca*ct;if(Pe[hi+2]<=Ke)continue;Pe[hi+2]=Ke;let wi=Pe[hi+B];Da+=Pe[hi]*wi,Ia+=Pe[hi+1]*wi,Pe[hi+4]=Wa,Ve&&(fa||(fa=this._map(Pe,_t,!0),qa=this.clusterProps.length,this.clusterProps.push(fa)),Ve(fa,this._map(Pe,hi)))}Pe[_t+4]=Wa,ft.push(Da/Lr,Ia/Lr,1/0,Wa,-1,Lr),Ve&&ft.push(qa)}else{for(let fa=0;fa<ct;fa++)ft.push(Pe[_t+fa]);if(Lr>1)for(let fa of rr){let Da=fa*ct;if(!(Pe[Da+2]<=Ke)){Pe[Da+2]=Ke;for(let Ia=0;Ia<ct;Ia++)ft.push(Pe[Da+Ia])}}}}return ft}_getOriginId(Ne){return Ne-this.points.length>>5}_getOriginZoom(Ne){return(Ne-this.points.length)%32}_map(Ne,Ke,Te){if(Ne[Ke+B]>1){let Ce=this.clusterProps[Ne[Ke+X]];return Te?Object.assign({},Ce):Ce}let Ie=this.points[Ne[Ke+U]].properties,Ve=this.options.map(Ie);return Te&&Ve===Ie?Object.assign({},Ve):Ve}}function se(wt,Ne,Ke){return{type:"Feature",id:wt[Ne+U],properties:le(wt,Ne,Ke),geometry:{type:"Point",coordinates:[(Te=wt[Ne],360*(Te-.5)),Y(wt[Ne+1])]}};var Te}function le(wt,Ne,Ke){let Te=wt[Ne+B],Ie=Te>=1e4?`${Math.round(Te/1e3)}k`:Te>=1e3?Math.round(Te/100)/10+"k":Te,Ve=wt[Ne+X],Ce=Ve===-1?{}:Object.assign({},Ke[Ve]);return Object.assign(Ce,{cluster:!0,cluster_id:wt[Ne+U],point_count:Te,point_count_abbreviated:Ie})}function fe(wt){return wt/360+.5}function V(wt){let Ne=Math.sin(wt*Math.PI/180),Ke=.5-.25*Math.log((1+Ne)/(1-Ne))/Math.PI;return Ke<0?0:Ke>1?1:Ke}function Y(wt){let Ne=(180-360*wt)*Math.PI/180;return 360*Math.atan(Math.exp(Ne))/Math.PI-90}function ee(wt,Ne,Ke,Te){let Ie=Te,Ve=Ne+(Ke-Ne>>1),Ce,Ee=Ke-Ne,Pe=wt[Ne],ft=wt[Ne+1],ct=wt[Ke],_t=wt[Ke+1];for(let Ct=Ne+3;Ct<Ke;Ct+=3){let ir=q(wt[Ct],wt[Ct+1],Pe,ft,ct,_t);if(ir>Ie)Ce=Ct,Ie=ir;else if(ir===Ie){let rr=Math.abs(Ct-Ve);rr<Ee&&(Ce=Ct,Ee=rr)}}Ie>Te&&(Ce-Ne>3&&ee(wt,Ne,Ce,Te),wt[Ce+2]=Ie,Ke-Ce>3&&ee(wt,Ce,Ke,Te))}function q(wt,Ne,Ke,Te,Ie,Ve){let Ce=Ie-Ke,Ee=Ve-Te;if(Ce!==0||Ee!==0){let Pe=((wt-Ke)*Ce+(Ne-Te)*Ee)/(Ce*Ce+Ee*Ee);Pe>1?(Ke=Ie,Te=Ve):Pe>0&&(Ke+=Ce*Pe,Te+=Ee*Pe)}return Ce=wt-Ke,Ee=Ne-Te,Ce*Ce+Ee*Ee}function oe(wt,Ne,Ke,Te){let Ie={id:wt??null,type:Ne,geometry:Ke,tags:Te,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Ne==="Point"||Ne==="MultiPoint"||Ne==="LineString")ae(Ie,Ke);else if(Ne==="Polygon")ae(Ie,Ke[0]);else if(Ne==="MultiLineString")for(let Ve of Ke)ae(Ie,Ve);else if(Ne==="MultiPolygon")for(let Ve of Ke)ae(Ie,Ve[0]);return Ie}function ae(wt,Ne){for(let Ke=0;Ke<Ne.length;Ke+=3)wt.minX=Math.min(wt.minX,Ne[Ke]),wt.minY=Math.min(wt.minY,Ne[Ke+1]),wt.maxX=Math.max(wt.maxX,Ne[Ke]),wt.maxY=Math.max(wt.maxY,Ne[Ke+1])}function j(wt,Ne,Ke,Te){if(!Ne.geometry)return;let Ie=Ne.geometry.coordinates;if(Ie&&Ie.length===0)return;let Ve=Ne.geometry.type,Ce=Math.pow(Ke.tolerance/((1<<Ke.maxZoom)*Ke.extent),2),Ee=[],Pe=Ne.id;if(Ke.promoteId?Pe=Ne.properties[Ke.promoteId]:Ke.generateId&&(Pe=Te||0),Ve==="Point")Q(Ie,Ee);else if(Ve==="MultiPoint")for(let ft of Ie)Q(ft,Ee);else if(Ve==="LineString")re(Ie,Ee,Ce,!1);else if(Ve==="MultiLineString"){if(Ke.lineMetrics){for(let ft of Ie)Ee=[],re(ft,Ee,Ce,!1),wt.push(oe(Pe,"LineString",Ee,Ne.properties));return}ce(Ie,Ee,Ce,!1)}else if(Ve==="Polygon")ce(Ie,Ee,Ce,!0);else{if(Ve!=="MultiPolygon"){if(Ve==="GeometryCollection"){for(let ft of Ne.geometry.geometries)j(wt,{id:Pe,geometry:ft,properties:Ne.properties},Ke,Te);return}throw new Error("Input data is not a valid GeoJSON object.")}for(let ft of Ie){let ct=[];ce(ft,ct,Ce,!0),Ee.push(ct)}}wt.push(oe(Pe,Ve,Ee,Ne.properties))}function Q(wt,Ne){Ne.push(be(wt[0]),Ae(wt[1]),0)}function re(wt,Ne,Ke,Te){let Ie,Ve,Ce=0;for(let Pe=0;Pe<wt.length;Pe++){let ft=be(wt[Pe][0]),ct=Ae(wt[Pe][1]);Ne.push(ft,ct,0),Pe>0&&(Ce+=Te?(Ie*ct-ft*Ve)/2:Math.sqrt(Math.pow(ft-Ie,2)+Math.pow(ct-Ve,2))),Ie=ft,Ve=ct}let Ee=Ne.length-3;Ne[2]=1,ee(Ne,0,Ee,Ke),Ne[Ee+2]=1,Ne.size=Math.abs(Ce),Ne.start=0,Ne.end=Ne.size}function ce(wt,Ne,Ke,Te){for(let Ie=0;Ie<wt.length;Ie++){let Ve=[];re(wt[Ie],Ve,Ke,Te),Ne.push(Ve)}}function be(wt){return wt/360+.5}function Ae(wt){let Ne=Math.sin(wt*Math.PI/180),Ke=.5-.25*Math.log((1+Ne)/(1-Ne))/Math.PI;return Ke<0?0:Ke>1?1:Ke}function De(wt,Ne,Ke,Te,Ie,Ve,Ce,Ee){if(Te/=Ne,Ve>=(Ke/=Ne)&&Ce<Te)return wt;if(Ce<Ke||Ve>=Te)return null;let Pe=[];for(let ft of wt){let ct=ft.geometry,_t=ft.type,Ct=Ie===0?ft.minX:ft.minY,ir=Ie===0?ft.maxX:ft.maxY;if(Ct>=Ke&&ir<Te){Pe.push(ft);continue}if(ir<Ke||Ct>=Te)continue;let rr=[];if(_t==="Point"||_t==="MultiPoint")ze(ct,rr,Ke,Te,Ie);else if(_t==="LineString")Ze(ct,rr,Ke,Te,Ie,!1,Ee.lineMetrics);else if(_t==="MultiLineString")nt(ct,rr,Ke,Te,Ie,!1);else if(_t==="Polygon")nt(ct,rr,Ke,Te,Ie,!0);else if(_t==="MultiPolygon")for(let er of ct){let Lr=[];nt(er,Lr,Ke,Te,Ie,!0),Lr.length&&rr.push(Lr)}if(rr.length){if(Ee.lineMetrics&&_t==="LineString"){for(let er of rr)Pe.push(oe(ft.id,_t,er,ft.tags));continue}_t!=="LineString"&&_t!=="MultiLineString"||(rr.length===1?(_t="LineString",rr=rr[0]):_t="MultiLineString"),_t!=="Point"&&_t!=="MultiPoint"||(_t=rr.length===3?"Point":"MultiPoint"),Pe.push(oe(ft.id,_t,rr,ft.tags))}}return Pe.length?Pe:null}function ze(wt,Ne,Ke,Te,Ie){for(let Ve=0;Ve<wt.length;Ve+=3){let Ce=wt[Ve+Ie];Ce>=Ke&&Ce<=Te&&rt(Ne,wt[Ve],wt[Ve+1],wt[Ve+2])}}function Ze(wt,Ne,Ke,Te,Ie,Ve,Ce){let Ee=at(wt),Pe=Ie===0?st:Me,ft,ct,_t=wt.start;for(let Lr=0;Lr<wt.length-3;Lr+=3){let fa=wt[Lr],Da=wt[Lr+1],Ia=wt[Lr+2],qa=wt[Lr+3],Wa=wt[Lr+4],Ca=Ie===0?fa:Da,hi=Ie===0?qa:Wa,wi=!1;Ce&&(ft=Math.sqrt(Math.pow(fa-qa,2)+Math.pow(Da-Wa,2))),Ca<Ke?hi>Ke&&(ct=Pe(Ee,fa,Da,qa,Wa,Ke),Ce&&(Ee.start=_t+ft*ct)):Ca>Te?hi<Te&&(ct=Pe(Ee,fa,Da,qa,Wa,Te),Ce&&(Ee.start=_t+ft*ct)):rt(Ee,fa,Da,Ia),hi<Ke&&Ca>=Ke&&(ct=Pe(Ee,fa,Da,qa,Wa,Ke),wi=!0),hi>Te&&Ca<=Te&&(ct=Pe(Ee,fa,Da,qa,Wa,Te),wi=!0),!Ve&&wi&&(Ce&&(Ee.end=_t+ft*ct),Ne.push(Ee),Ee=at(wt)),Ce&&(_t+=ft)}let Ct=wt.length-3,ir=wt[Ct],rr=wt[Ct+1],er=Ie===0?ir:rr;er>=Ke&&er<=Te&&rt(Ee,ir,rr,wt[Ct+2]),Ct=Ee.length-3,Ve&&Ct>=3&&(Ee[Ct]!==Ee[0]||Ee[Ct+1]!==Ee[1])&&rt(Ee,Ee[0],Ee[1],Ee[2]),Ee.length&&Ne.push(Ee)}function at(wt){let Ne=[];return Ne.size=wt.size,Ne.start=wt.start,Ne.end=wt.end,Ne}function nt(wt,Ne,Ke,Te,Ie,Ve){for(let Ce of wt)Ze(Ce,Ne,Ke,Te,Ie,Ve,!1)}function rt(wt,Ne,Ke,Te){wt.push(Ne,Ke,Te)}function st(wt,Ne,Ke,Te,Ie,Ve){let Ce=(Ve-Ne)/(Te-Ne);return rt(wt,Ve,Ke+(Ie-Ke)*Ce,1),Ce}function Me(wt,Ne,Ke,Te,Ie,Ve){let Ce=(Ve-Ke)/(Ie-Ke);return rt(wt,Ne+(Te-Ne)*Ce,Ve,1),Ce}function ye(wt,Ne){let Ke=[];for(let Te=0;Te<wt.length;Te++){let Ie=wt[Te],Ve=Ie.type,Ce;if(Ve==="Point"||Ve==="MultiPoint"||Ve==="LineString")Ce=he(Ie.geometry,Ne);else if(Ve==="MultiLineString"||Ve==="Polygon"){Ce=[];for(let Ee of Ie.geometry)Ce.push(he(Ee,Ne))}else if(Ve==="MultiPolygon"){Ce=[];for(let Ee of Ie.geometry){let Pe=[];for(let ft of Ee)Pe.push(he(ft,Ne));Ce.push(Pe)}}Ke.push(oe(Ie.id,Ve,Ce,Ie.tags))}return Ke}function he(wt,Ne){let Ke=[];Ke.size=wt.size,wt.start!==void 0&&(Ke.start=wt.start,Ke.end=wt.end);for(let Te=0;Te<wt.length;Te+=3)Ke.push(wt[Te]+Ne,wt[Te+1],wt[Te+2]);return Ke}function Oe(wt,Ne){if(wt.transformed)return wt;let Ke=1<<wt.z,Te=wt.x,Ie=wt.y;for(let Ve of wt.features){let Ce=Ve.geometry,Ee=Ve.type;if(Ve.geometry=[],Ee===1)for(let Pe=0;Pe<Ce.length;Pe+=2)Ve.geometry.push(tt(Ce[Pe],Ce[Pe+1],Ne,Ke,Te,Ie));else for(let Pe=0;Pe<Ce.length;Pe++){let ft=[];for(let ct=0;ct<Ce[Pe].length;ct+=2)ft.push(tt(Ce[Pe][ct],Ce[Pe][ct+1],Ne,Ke,Te,Ie));Ve.geometry.push(ft)}}return wt.transformed=!0,wt}function tt(wt,Ne,Ke,Te,Ie,Ve){return[Math.round(Ke*(wt*Te-Ie)),Math.round(Ke*(Ne*Te-Ve))]}function ot(wt,Ne,Ke,Te,Ie){let Ve=Ne===Ie.maxZoom?0:Ie.tolerance/((1<<Ne)*Ie.extent),Ce={features:[],numPoints:0,numSimplified:0,numFeatures:wt.length,source:null,x:Ke,y:Te,z:Ne,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let Ee of wt)Qe(Ce,Ee,Ve,Ie);return Ce}function Qe(wt,Ne,Ke,Te){let Ie=Ne.geometry,Ve=Ne.type,Ce=[];if(wt.minX=Math.min(wt.minX,Ne.minX),wt.minY=Math.min(wt.minY,Ne.minY),wt.maxX=Math.max(wt.maxX,Ne.maxX),wt.maxY=Math.max(wt.maxY,Ne.maxY),Ve==="Point"||Ve==="MultiPoint")for(let Ee=0;Ee<Ie.length;Ee+=3)Ce.push(Ie[Ee],Ie[Ee+1]),wt.numPoints++,wt.numSimplified++;else if(Ve==="LineString")Pt(Ce,Ie,wt,Ke,!1,!1);else if(Ve==="MultiLineString"||Ve==="Polygon")for(let Ee=0;Ee<Ie.length;Ee++)Pt(Ce,Ie[Ee],wt,Ke,Ve==="Polygon",Ee===0);else if(Ve==="MultiPolygon")for(let Ee=0;Ee<Ie.length;Ee++){let Pe=Ie[Ee];for(let ft=0;ft<Pe.length;ft++)Pt(Ce,Pe[ft],wt,Ke,!0,ft===0)}if(Ce.length){let Ee=Ne.tags||null;if(Ve==="LineString"&&Te.lineMetrics){Ee={};for(let ft in Ne.tags)Ee[ft]=Ne.tags[ft];Ee.mapbox_clip_start=Ie.start/Ie.size,Ee.mapbox_clip_end=Ie.end/Ie.size}let Pe={geometry:Ce,type:Ve==="Polygon"||Ve==="MultiPolygon"?3:Ve==="LineString"||Ve==="MultiLineString"?2:1,tags:Ee};Ne.id!==null&&(Pe.id=Ne.id),wt.features.push(Pe)}}function Pt(wt,Ne,Ke,Te,Ie,Ve){let Ce=Te*Te;if(Te>0&&Ne.size<(Ie?Ce:Te))return void(Ke.numPoints+=Ne.length/3);let Ee=[];for(let Pe=0;Pe<Ne.length;Pe+=3)(Te===0||Ne[Pe+2]>Ce)&&(Ke.numSimplified++,Ee.push(Ne[Pe],Ne[Pe+1])),Ke.numPoints++;Ie&&function(Pe,ft){let ct=0;for(let _t=0,Ct=Pe.length,ir=Ct-2;_t<Ct;ir=_t,_t+=2)ct+=(Pe[_t]-Pe[ir])*(Pe[_t+1]+Pe[ir+1]);if(ct>0===ft)for(let _t=0,Ct=Pe.length;_t<Ct/2;_t+=2){let ir=Pe[_t],rr=Pe[_t+1];Pe[_t]=Pe[Ct-2-_t],Pe[_t+1]=Pe[Ct-1-_t],Pe[Ct-2-_t]=ir,Pe[Ct-1-_t]=rr}}(Ee,Ve),wt.push(Ee)}let It={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class qt{constructor(Ne,Ke){let Te=(Ke=this.options=function(Ve,Ce){for(let Ee in Ce)Ve[Ee]=Ce[Ee];return Ve}(Object.create(It),Ke)).debug;if(Te&&console.time("preprocess data"),Ke.maxZoom<0||Ke.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Ke.promoteId&&Ke.generateId)throw new Error("promoteId and generateId cannot be used together.");let Ie=function(Ve,Ce){let Ee=[];if(Ve.type==="FeatureCollection")for(let Pe=0;Pe<Ve.features.length;Pe++)j(Ee,Ve.features[Pe],Ce,Pe);else j(Ee,Ve.type==="Feature"?Ve:{geometry:Ve},Ce);return Ee}(Ne,Ke);this.tiles={},this.tileCoords=[],Te&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Ke.indexMaxZoom,Ke.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Ie=function(Ve,Ce){let Ee=Ce.buffer/Ce.extent,Pe=Ve,ft=De(Ve,1,-1-Ee,Ee,0,-1,2,Ce),ct=De(Ve,1,1-Ee,2+Ee,0,-1,2,Ce);return(ft||ct)&&(Pe=De(Ve,1,-Ee,1+Ee,0,-1,2,Ce)||[],ft&&(Pe=ye(ft,1).concat(Pe)),ct&&(Pe=Pe.concat(ye(ct,-1)))),Pe}(Ie,Ke),Ie.length&&this.splitTile(Ie,0,0,0),Te&&(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,Ke,Te,Ie,Ve,Ce,Ee){let Pe=[Ne,Ke,Te,Ie],ft=this.options,ct=ft.debug;for(;Pe.length;){Ie=Pe.pop(),Te=Pe.pop(),Ke=Pe.pop(),Ne=Pe.pop();let _t=1<<Ke,Ct=Wt(Ke,Te,Ie),ir=this.tiles[Ct];if(!ir&&(ct>1&&console.time("creation"),ir=this.tiles[Ct]=ot(Ne,Ke,Te,Ie,ft),this.tileCoords.push({z:Ke,x:Te,y:Ie}),ct)){ct>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ke,Te,Ie,ir.numFeatures,ir.numPoints,ir.numSimplified),console.timeEnd("creation"));let wi=`z${Ke}`;this.stats[wi]=(this.stats[wi]||0)+1,this.total++}if(ir.source=Ne,Ve==null){if(Ke===ft.indexMaxZoom||ir.numPoints<=ft.indexMaxPoints)continue}else{if(Ke===ft.maxZoom||Ke===Ve)continue;if(Ve!=null){let wi=Ve-Ke;if(Te!==Ce>>wi||Ie!==Ee>>wi)continue}}if(ir.source=null,Ne.length===0)continue;ct>1&&console.time("clipping");let rr=.5*ft.buffer/ft.extent,er=.5-rr,Lr=.5+rr,fa=1+rr,Da=null,Ia=null,qa=null,Wa=null,Ca=De(Ne,_t,Te-rr,Te+Lr,0,ir.minX,ir.maxX,ft),hi=De(Ne,_t,Te+er,Te+fa,0,ir.minX,ir.maxX,ft);Ne=null,Ca&&(Da=De(Ca,_t,Ie-rr,Ie+Lr,1,ir.minY,ir.maxY,ft),Ia=De(Ca,_t,Ie+er,Ie+fa,1,ir.minY,ir.maxY,ft),Ca=null),hi&&(qa=De(hi,_t,Ie-rr,Ie+Lr,1,ir.minY,ir.maxY,ft),Wa=De(hi,_t,Ie+er,Ie+fa,1,ir.minY,ir.maxY,ft),hi=null),ct>1&&console.timeEnd("clipping"),Pe.push(Da||[],Ke+1,2*Te,2*Ie),Pe.push(Ia||[],Ke+1,2*Te,2*Ie+1),Pe.push(qa||[],Ke+1,2*Te+1,2*Ie),Pe.push(Wa||[],Ke+1,2*Te+1,2*Ie+1)}}getTile(Ne,Ke,Te){Ne=+Ne,Ke=+Ke,Te=+Te;let Ie=this.options,{extent:Ve,debug:Ce}=Ie;if(Ne<0||Ne>24)return null;let Ee=1<<Ne,Pe=Wt(Ne,Ke=Ke+Ee&Ee-1,Te);if(this.tiles[Pe])return Oe(this.tiles[Pe],Ve);Ce>1&&console.log("drilling down to z%d-%d-%d",Ne,Ke,Te);let ft,ct=Ne,_t=Ke,Ct=Te;for(;!ft&&ct>0;)ct--,_t>>=1,Ct>>=1,ft=this.tiles[Wt(ct,_t,Ct)];return ft&&ft.source?(Ce>1&&(console.log("found parent tile z%d-%d-%d",ct,_t,Ct),console.time("drilling down")),this.splitTile(ft.source,ct,_t,Ct,Ne,Ke,Te),Ce>1&&console.timeEnd("drilling down"),this.tiles[Pe]?Oe(this.tiles[Pe],Ve):null):null}}function Wt(wt,Ne,Ke){return 32*((1<<wt)*Ke+Ne)+wt}function kr(wt,Ne){return Ne?wt.properties[Ne]:wt.id}function mr(wt,Ne){if(wt==null)return!0;if(wt.type==="Feature")return kr(wt,Ne)!=null;if(wt.type==="FeatureCollection"){let Ke=new Set;for(let Te of wt.features){let Ie=kr(Te,Ne);if(Ie==null||Ke.has(Ie))return!1;Ke.add(Ie)}return!0}return!1}function qr(wt,Ne){let Ke=new Map;if(wt!=null)if(wt.type==="Feature")Ke.set(kr(wt,Ne),wt);else for(let Te of wt.features)Ke.set(kr(Te,Ne),Te);return Ke}class Sr extends n{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(Ne,Ke){return e._(this,void 0,void 0,function*(){let Te=Ne.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let Ie=this._geoJSONIndex.getTile(Te.z,Te.x,Te.y);if(!Ie)return null;let Ve=new class{constructor(Ee){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.X,this.length=Ee.length,this._features=Ee}feature(Ee){return new class{constructor(Pe){this._feature=Pe,this.extent=e.X,this.type=Pe.type,this.properties=Pe.tags,"id"in Pe&&!isNaN(Pe.id)&&(this.id=parseInt(Pe.id,10))}loadGeometry(){if(this._feature.type===1){let Pe=[];for(let ft of this._feature.geometry)Pe.push([new e.P(ft[0],ft[1])]);return Pe}{let Pe=[];for(let ft of this._feature.geometry){let ct=[];for(let _t of ft)ct.push(new e.P(_t[0],_t[1]));Pe.push(ct)}return Pe}}toGeoJSON(Pe,ft,ct){return m.call(this,Pe,ft,ct)}}(this._features[Ee])}}(Ie.features),Ce=F(Ve);return Ce.byteOffset===0&&Ce.byteLength===Ce.buffer.byteLength||(Ce=new Uint8Array(Ce)),{vectorTile:Ve,rawData:Ce.buffer}})}loadData(Ne){return e._(this,void 0,void 0,function*(){var Ke;(Ke=this._pendingRequest)===null||Ke===void 0||Ke.abort();let Te=!!(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 $(function({superclusterOptions:Ce,clusterProperties:Ee}){if(!Ee||!Ce)return Ce;let Pe={},ft={},ct={accumulated:null,zoom:0},_t={properties:null},Ct=Object.keys(Ee);for(let ir of Ct){let[rr,er]=Ee[ir],Lr=e.bC(er),fa=e.bC(typeof rr=="string"?[rr,["accumulated"],["get",ir]]:rr);Pe[ir]=Lr.value,ft[ir]=fa.value}return Ce.map=ir=>{_t.properties=ir;let rr={};for(let er of Ct)rr[er]=Pe[er].evaluate(ct,_t);return rr},Ce.reduce=(ir,rr)=>{_t.properties=rr;for(let er of Ct)ct.accumulated=ir[er],ir[er]=ft[er].evaluate(ct,_t)},Ce}(Ne)).load((yield this._pendingData).features):(Ie=yield this._pendingData,new qt(Ie,Ne.geojsonVtOptions)),this.loaded={};let Ve={};if(Te){let Ce=Te.finish();Ce&&(Ve.resourceTiming={},Ve.resourceTiming[Ne.source]=JSON.parse(JSON.stringify(Ce)))}return Ve}catch(Ve){if(delete this._pendingRequest,e.bB(Ve))return{abandoned:!0};throw Ve}var Ie})}getData(){return e._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(Ne){let Ke=this.loaded;return Ke&&Ke[Ne.uid]?super.reloadTile(Ne):this.loadTile(Ne)}loadAndProcessGeoJSON(Ne,Ke){return e._(this,void 0,void 0,function*(){let Te=yield this.loadGeoJSON(Ne,Ke);if(delete this._pendingRequest,typeof Te!="object")throw new Error(`Input data given to '${Ne.source}' is not a valid GeoJSON object.`);if(c(Te,!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(Ce=>`${Ce.key}: ${Ce.message}`).join(", "));Te={type:"FeatureCollection",features:Te.features.filter(Ce=>Ie.value.evaluate({zoom:0},Ce))}}return Te})}loadGeoJSON(Ne,Ke){return e._(this,void 0,void 0,function*(){let{promoteId:Te}=Ne;if(Ne.request){let Ie=yield e.h(Ne.request,Ke);return this._dataUpdateable=mr(Ie.data,Te)?qr(Ie.data,Te):void 0,Ie.data}if(typeof Ne.data=="string")try{let Ie=JSON.parse(Ne.data);return this._dataUpdateable=mr(Ie,Te)?qr(Ie,Te):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,Ve,Ce){var Ee,Pe,ft,ct;if(Ve.removeAll&&Ie.clear(),Ve.remove)for(let _t of Ve.remove)Ie.delete(_t);if(Ve.add)for(let _t of Ve.add){let Ct=kr(_t,Ce);Ct!=null&&Ie.set(Ct,_t)}if(Ve.update)for(let _t of Ve.update){let Ct=Ie.get(_t.id);if(Ct==null)continue;let ir=!_t.removeAllProperties&&(((Ee=_t.removeProperties)===null||Ee===void 0?void 0:Ee.length)>0||((Pe=_t.addOrUpdateProperties)===null||Pe===void 0?void 0:Pe.length)>0);if((_t.newGeometry||_t.removeAllProperties||ir)&&(Ct=Object.assign({},Ct),Ie.set(_t.id,Ct),ir&&(Ct.properties=Object.assign({},Ct.properties))),_t.newGeometry&&(Ct.geometry=_t.newGeometry),_t.removeAllProperties)Ct.properties={};else if(((ft=_t.removeProperties)===null||ft===void 0?void 0:ft.length)>0)for(let rr of _t.removeProperties)Object.prototype.hasOwnProperty.call(Ct.properties,rr)&&delete Ct.properties[rr];if(((ct=_t.addOrUpdateProperties)===null||ct===void 0?void 0:ct.length)>0)for(let{key:rr,value:er}of _t.addOrUpdateProperties)Ct.properties[rr]=er}}(this._dataUpdateable,Ne.dataDiff,Te),{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 Rr{constructor(Ne){this.self=Ne,this.actor=new e.F(Ne),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Ke,Te)=>{if(this.externalWorkerSourceTypes[Ke])throw new Error(`Worker source with name "${Ke}" already registered.`);this.externalWorkerSourceTypes[Ke]=Te},this.self.addProtocol=e.bi,this.self.removeProtocol=e.bj,this.self.registerRTLTextPlugin=Ke=>{if(e.bD.isParsed())throw new Error("RTL text plugin already registered.");e.bD.setMethods(Ke)},this.actor.registerMessageHandler("LDT",(Ke,Te)=>this._getDEMWorkerSource(Ke,Te.source).loadTile(Te)),this.actor.registerMessageHandler("RDT",(Ke,Te)=>e._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Ke,Te.source).removeTile(Te)})),this.actor.registerMessageHandler("GCEZ",(Ke,Te)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(Ke,Te.type,Te.source).getClusterExpansionZoom(Te)})),this.actor.registerMessageHandler("GCC",(Ke,Te)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(Ke,Te.type,Te.source).getClusterChildren(Te)})),this.actor.registerMessageHandler("GCL",(Ke,Te)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(Ke,Te.type,Te.source).getClusterLeaves(Te)})),this.actor.registerMessageHandler("LD",(Ke,Te)=>this._getWorkerSource(Ke,Te.type,Te.source).loadData(Te)),this.actor.registerMessageHandler("GD",(Ke,Te)=>this._getWorkerSource(Ke,Te.type,Te.source).getData()),this.actor.registerMessageHandler("LT",(Ke,Te)=>this._getWorkerSource(Ke,Te.type,Te.source).loadTile(Te)),this.actor.registerMessageHandler("RT",(Ke,Te)=>this._getWorkerSource(Ke,Te.type,Te.source).reloadTile(Te)),this.actor.registerMessageHandler("AT",(Ke,Te)=>this._getWorkerSource(Ke,Te.type,Te.source).abortTile(Te)),this.actor.registerMessageHandler("RMT",(Ke,Te)=>this._getWorkerSource(Ke,Te.type,Te.source).removeTile(Te)),this.actor.registerMessageHandler("RS",(Ke,Te)=>e._(this,void 0,void 0,function*(){if(!this.workerSources[Ke]||!this.workerSources[Ke][Te.type]||!this.workerSources[Ke][Te.type][Te.source])return;let Ie=this.workerSources[Ke][Te.type][Te.source];delete this.workerSources[Ke][Te.type][Te.source],Ie.removeSource!==void 0&&Ie.removeSource(Te)})),this.actor.registerMessageHandler("RM",Ke=>e._(this,void 0,void 0,function*(){delete this.layerIndexes[Ke],delete this.availableImages[Ke],delete this.workerSources[Ke],delete this.demWorkerSources[Ke]})),this.actor.registerMessageHandler("SR",(Ke,Te)=>e._(this,void 0,void 0,function*(){this.referrer=Te})),this.actor.registerMessageHandler("SRPS",(Ke,Te)=>this._syncRTLPluginState(Ke,Te)),this.actor.registerMessageHandler("IS",(Ke,Te)=>e._(this,void 0,void 0,function*(){this.self.importScripts(Te)})),this.actor.registerMessageHandler("SI",(Ke,Te)=>this._setImages(Ke,Te)),this.actor.registerMessageHandler("UL",(Ke,Te)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(Ke).update(Te.layers,Te.removedIds)})),this.actor.registerMessageHandler("SL",(Ke,Te)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(Ke).replace(Te)}))}_setImages(Ne,Ke){return e._(this,void 0,void 0,function*(){this.availableImages[Ne]=Ke;for(let Te in this.workerSources[Ne]){let Ie=this.workerSources[Ne][Te];for(let Ve in Ie)Ie[Ve].availableImages=Ke}})}_syncRTLPluginState(Ne,Ke){return e._(this,void 0,void 0,function*(){if(e.bD.isParsed())return e.bD.getState();if(Ke.pluginStatus!=="loading")return e.bD.setState(Ke),Ke;let Te=Ke.pluginURL;if(this.self.importScripts(Te),e.bD.isParsed()){let Ie={pluginStatus:"loaded",pluginURL:Te};return e.bD.setState(Ie),Ie}throw e.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${Te}`)})}_getAvailableImages(Ne){let Ke=this.availableImages[Ne];return Ke||(Ke=[]),Ke}_getLayerIndex(Ne){let Ke=this.layerIndexes[Ne];return Ke||(Ke=this.layerIndexes[Ne]=new t),Ke}_getWorkerSource(Ne,Ke,Te){if(this.workerSources[Ne]||(this.workerSources[Ne]={}),this.workerSources[Ne][Ke]||(this.workerSources[Ne][Ke]={}),!this.workerSources[Ne][Ke][Te]){let Ie={sendAsync:(Ve,Ce)=>(Ve.targetMapId=Ne,this.actor.sendAsync(Ve,Ce))};switch(Ke){case"vector":this.workerSources[Ne][Ke][Te]=new n(Ie,this._getLayerIndex(Ne),this._getAvailableImages(Ne));break;case"geojson":this.workerSources[Ne][Ke][Te]=new Sr(Ie,this._getLayerIndex(Ne),this._getAvailableImages(Ne));break;default:this.workerSources[Ne][Ke][Te]=new this.externalWorkerSourceTypes[Ke](Ie,this._getLayerIndex(Ne),this._getAvailableImages(Ne))}}return this.workerSources[Ne][Ke][Te]}_getDEMWorkerSource(Ne,Ke){return this.demWorkerSources[Ne]||(this.demWorkerSources[Ne]={}),this.demWorkerSources[Ne][Ke]||(this.demWorkerSources[Ne][Ke]=new i),this.demWorkerSources[Ne][Ke]}}return e.i(self)&&(self.worker=new Rr(self)),Rr}),S("index",["exports","./shared"],function(e,t){"use strict";var r="4.7.1";let o,a,n={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:Ue=>new Promise((I,ie)=>{let we=requestAnimationFrame(I);Ue.signal.addEventListener("abort",()=>{cancelAnimationFrame(we),ie(t.c())})}),getImageData(Ue,I=0){return this.getImageCanvasContext(Ue).getImageData(-I,-I,Ue.width+2*I,Ue.height+2*I)},getImageCanvasContext(Ue){let I=window.document.createElement("canvas"),ie=I.getContext("2d",{willReadFrequently:!0});if(!ie)throw new Error("failed to create canvas 2d context");return I.width=Ue.width,I.height=Ue.height,ie.drawImage(Ue,0,0,Ue.width,Ue.height),ie},resolveURL:Ue=>(o||(o=document.createElement("a")),o.href=Ue,o.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(a==null&&(a=matchMedia("(prefers-reduced-motion: reduce)")),a.matches)}};class i{static testProp(I){if(!i.docStyle)return I[0];for(let ie=0;ie<I.length;ie++)if(I[ie]in i.docStyle)return I[ie];return I[0]}static create(I,ie,we){let Se=window.document.createElement(I);return ie!==void 0&&(Se.className=ie),we&&we.appendChild(Se),Se}static createNS(I,ie){return window.document.createElementNS(I,ie)}static disableDrag(){i.docStyle&&i.selectProp&&(i.userSelect=i.docStyle[i.selectProp],i.docStyle[i.selectProp]="none")}static enableDrag(){i.docStyle&&i.selectProp&&(i.docStyle[i.selectProp]=i.userSelect)}static setTransform(I,ie){I.style[i.transformProp]=ie}static addEventListener(I,ie,we,Se={}){I.addEventListener(ie,we,"passive"in Se?Se:Se.capture)}static removeEventListener(I,ie,we,Se={}){I.removeEventListener(ie,we,"passive"in Se?Se:Se.capture)}static suppressClickInternal(I){I.preventDefault(),I.stopPropagation(),window.removeEventListener("click",i.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",i.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",i.suppressClickInternal,!0)},0)}static getScale(I){let ie=I.getBoundingClientRect();return{x:ie.width/I.offsetWidth||1,y:ie.height/I.offsetHeight||1,boundingClientRect:ie}}static getPoint(I,ie,we){let Se=ie.boundingClientRect;return new t.P((we.clientX-Se.left)/ie.x-I.clientLeft,(we.clientY-Se.top)/ie.y-I.clientTop)}static mousePos(I,ie){let we=i.getScale(I);return i.getPoint(I,we,ie)}static touchPos(I,ie){let we=[],Se=i.getScale(I);for(let Be=0;Be<ie.length;Be++)we.push(i.getPoint(I,Se,ie[Be]));return we}static mouseButton(I){return I.button}static remove(I){I.parentNode&&I.parentNode.removeChild(I)}}i.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,i.selectProp=i.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),i.transformProp=i.testProp(["transform","WebkitTransform"]);let s={supported:!1,testSupport:function(Ue){!m&&c&&(p?T(Ue):h=Ue)}},h,c,m=!1,p=!1;function T(Ue){let I=Ue.createTexture();Ue.bindTexture(Ue.TEXTURE_2D,I);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(I),m=!0}var l;typeof document<"u"&&(c=document.createElement("img"),c.onload=()=>{h&&T(h),h=null,p=!0},c.onerror=()=>{m=!0,h=null},c.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(Ue){let I,ie,we,Se;Ue.resetRequestQueue=()=>{I=[],ie=0,we=0,Se={}},Ue.addThrottleControl=Nt=>{let $t=we++;return Se[$t]=Nt,$t},Ue.removeThrottleControl=Nt=>{delete Se[Nt],dt()},Ue.getImage=(Nt,$t,Tr=!0)=>new Promise((Ar,Kr)=>{s.supported&&(Nt.headers||(Nt.headers={}),Nt.headers.accept="image/webp,*/*"),t.e(Nt,{type:"image"}),I.push({abortController:$t,requestParameters:Nt,supportImageRefresh:Tr,state:"queued",onError:na=>{Kr(na)},onSuccess:na=>{Ar(na)}}),dt()});let Be=Nt=>t._(this,void 0,void 0,function*(){Nt.state="running";let{requestParameters:$t,supportImageRefresh:Tr,onError:Ar,onSuccess:Kr,abortController:na}=Nt,He=Tr===!1&&!t.i(self)&&!t.g($t.url)&&(!$t.headers||Object.keys($t.headers).reduce((vt,Lt)=>vt&&Lt==="accept",!0));ie++;let Je=He?St($t,na):t.m($t,na);try{let vt=yield Je;delete Nt.abortController,Nt.state="completed",vt.data instanceof HTMLImageElement||t.b(vt.data)?Kr(vt):vt.data&&Kr({data:yield(lt=vt.data,typeof createImageBitmap=="function"?t.d(lt):t.f(lt)),cacheControl:vt.cacheControl,expires:vt.expires})}catch(vt){delete Nt.abortController,Ar(vt)}finally{ie--,dt()}var lt}),dt=()=>{let Nt=(()=>{for(let $t of Object.keys(Se))if(Se[$t]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let $t=ie;$t<Nt&&I.length>0;$t++){let Tr=I.shift();Tr.abortController.signal.aborted?$t--:Be(Tr)}},St=(Nt,$t)=>new Promise((Tr,Ar)=>{let Kr=new Image,na=Nt.url,He=Nt.credentials;He&&He==="include"?Kr.crossOrigin="use-credentials":(He&&He==="same-origin"||!t.s(na))&&(Kr.crossOrigin="anonymous"),$t.signal.addEventListener("abort",()=>{Kr.src="",Ar(t.c())}),Kr.fetchPriority="high",Kr.onload=()=>{Kr.onerror=Kr.onload=null,Tr({data:Kr})},Kr.onerror=()=>{Kr.onerror=Kr.onload=null,$t.signal.aborted||Ar(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=na})}(l||(l={})),l.resetRequestQueue();class _{constructor(I){this._transformRequestFn=I}transformRequest(I,ie){return this._transformRequestFn&&this._transformRequestFn(I,ie)||{url:I}}setTransformRequest(I){this._transformRequestFn=I}}function w(Ue){var I=new t.A(3);return I[0]=Ue[0],I[1]=Ue[1],I[2]=Ue[2],I}var A,M=function(Ue,I,ie){return Ue[0]=I[0]-ie[0],Ue[1]=I[1]-ie[1],Ue[2]=I[2]-ie[2],Ue};A=new t.A(3),t.A!=Float32Array&&(A[0]=0,A[1]=0,A[2]=0);var g=function(Ue){var I=Ue[0],ie=Ue[1];return I*I+ie*ie};function b(Ue){let I=[];if(typeof Ue=="string")I.push({id:"default",url:Ue});else if(Ue&&Ue.length>0){let ie=[];for(let{id:we,url:Se}of Ue){let Be=`${we}${Se}`;ie.indexOf(Be)===-1&&(ie.push(Be),I.push({id:we,url:Se}))}}return I}function d(Ue,I,ie){let we=Ue.split("?");return we[0]+=`${I}${ie}`,we.join("?")}(function(){var Ue=new t.A(2);t.A!=Float32Array&&(Ue[0]=0,Ue[1]=0)})();class u{constructor(I,ie,we,Se){this.context=I,this.format=we,this.texture=I.gl.createTexture(),this.update(ie,Se)}update(I,ie,we){let{width:Se,height:Be}=I,dt=!(this.size&&this.size[0]===Se&&this.size[1]===Be||we),{context:St}=this,{gl:Nt}=St;if(this.useMipmap=!!(ie&&ie.useMipmap),Nt.bindTexture(Nt.TEXTURE_2D,this.texture),St.pixelStoreUnpackFlipY.set(!1),St.pixelStoreUnpack.set(1),St.pixelStoreUnpackPremultiplyAlpha.set(this.format===Nt.RGBA&&(!ie||ie.premultiply!==!1)),dt)this.size=[Se,Be],I instanceof HTMLImageElement||I instanceof HTMLCanvasElement||I instanceof HTMLVideoElement||I instanceof ImageData||t.b(I)?Nt.texImage2D(Nt.TEXTURE_2D,0,this.format,this.format,Nt.UNSIGNED_BYTE,I):Nt.texImage2D(Nt.TEXTURE_2D,0,this.format,Se,Be,0,this.format,Nt.UNSIGNED_BYTE,I.data);else{let{x:$t,y:Tr}=we||{x:0,y:0};I instanceof HTMLImageElement||I instanceof HTMLCanvasElement||I instanceof HTMLVideoElement||I instanceof ImageData||t.b(I)?Nt.texSubImage2D(Nt.TEXTURE_2D,0,$t,Tr,Nt.RGBA,Nt.UNSIGNED_BYTE,I):Nt.texSubImage2D(Nt.TEXTURE_2D,0,$t,Tr,Se,Be,Nt.RGBA,Nt.UNSIGNED_BYTE,I.data)}this.useMipmap&&this.isSizePowerOfTwo()&&Nt.generateMipmap(Nt.TEXTURE_2D)}bind(I,ie,we){let{context:Se}=this,{gl:Be}=Se;Be.bindTexture(Be.TEXTURE_2D,this.texture),we!==Be.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(we=Be.LINEAR),I!==this.filter&&(Be.texParameteri(Be.TEXTURE_2D,Be.TEXTURE_MAG_FILTER,I),Be.texParameteri(Be.TEXTURE_2D,Be.TEXTURE_MIN_FILTER,we||I),this.filter=I),ie!==this.wrap&&(Be.texParameteri(Be.TEXTURE_2D,Be.TEXTURE_WRAP_S,ie),Be.texParameteri(Be.TEXTURE_2D,Be.TEXTURE_WRAP_T,ie),this.wrap=ie)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:I}=this.context;I.deleteTexture(this.texture),this.texture=null}}function y(Ue){let{userImage:I}=Ue;return!!(I&&I.render&&I.render())&&(Ue.data.replace(new Uint8Array(I.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(I){if(this.loaded!==I&&(this.loaded=I,I)){for(let{ids:ie,promiseResolve:we}of this.requestors)we(this._getImagesForIds(ie));this.requestors=[]}}getImage(I){let ie=this.images[I];if(ie&&!ie.data&&ie.spriteData){let we=ie.spriteData;ie.data=new t.R({width:we.width,height:we.height},we.context.getImageData(we.x,we.y,we.width,we.height).data),ie.spriteData=null}return ie}addImage(I,ie){if(this.images[I])throw new Error(`Image id ${I} already exist, use updateImage instead`);this._validate(I,ie)&&(this.images[I]=ie)}_validate(I,ie){let we=!0,Se=ie.data||ie.spriteData;return this._validateStretch(ie.stretchX,Se&&Se.width)||(this.fire(new t.j(new Error(`Image "${I}" has invalid "stretchX" value`))),we=!1),this._validateStretch(ie.stretchY,Se&&Se.height)||(this.fire(new t.j(new Error(`Image "${I}" has invalid "stretchY" value`))),we=!1),this._validateContent(ie.content,ie)||(this.fire(new t.j(new Error(`Image "${I}" has invalid "content" value`))),we=!1),we}_validateStretch(I,ie){if(!I)return!0;let we=0;for(let Se of I){if(Se[0]<we||Se[1]<Se[0]||ie<Se[1])return!1;we=Se[1]}return!0}_validateContent(I,ie){if(!I)return!0;if(I.length!==4)return!1;let we=ie.spriteData,Se=we&&we.width||ie.data.width,Be=we&&we.height||ie.data.height;return!(I[0]<0||Se<I[0]||I[1]<0||Be<I[1]||I[2]<0||Se<I[2]||I[3]<0||Be<I[3]||I[2]<I[0]||I[3]<I[1])}updateImage(I,ie,we=!0){let Se=this.getImage(I);if(we&&(Se.data.width!==ie.data.width||Se.data.height!==ie.data.height))throw new Error(`size mismatch between old image (${Se.data.width}x${Se.data.height}) and new image (${ie.data.width}x${ie.data.height}).`);ie.version=Se.version+1,this.images[I]=ie,this.updatedImages[I]=!0}removeImage(I){let ie=this.images[I];delete this.images[I],delete this.patterns[I],ie.userImage&&ie.userImage.onRemove&&ie.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(I){return new Promise((ie,we)=>{let Se=!0;if(!this.isLoaded())for(let Be of I)this.images[Be]||(Se=!1);this.isLoaded()||Se?ie(this._getImagesForIds(I)):this.requestors.push({ids:I,promiseResolve:ie})})}_getImagesForIds(I){let ie={};for(let we of I){let Se=this.getImage(we);Se||(this.fire(new t.k("styleimagemissing",{id:we})),Se=this.getImage(we)),Se?ie[we]={data:Se.data.clone(),pixelRatio:Se.pixelRatio,sdf:Se.sdf,version:Se.version,stretchX:Se.stretchX,stretchY:Se.stretchY,content:Se.content,textFitWidth:Se.textFitWidth,textFitHeight:Se.textFitHeight,hasRenderCallback:!!(Se.userImage&&Se.userImage.render)}:t.w(`Image "${we}" 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 ie}getPixelSize(){let{width:I,height:ie}=this.atlasImage;return{width:I,height:ie}}getPattern(I){let ie=this.patterns[I],we=this.getImage(I);if(!we)return null;if(ie&&ie.position.version===we.version)return ie.position;if(ie)ie.position.version=we.version;else{let Se={w:we.data.width+2,h:we.data.height+2,x:0,y:0},Be=new t.I(Se,we);this.patterns[I]={bin:Se,position:Be}}return this._updatePatternAtlas(),this.patterns[I].position}bind(I){let ie=I.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new u(I,this.atlasImage,ie.RGBA),this.atlasTexture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)}_updatePatternAtlas(){let I=[];for(let Be in this.patterns)I.push(this.patterns[Be].bin);let{w:ie,h:we}=t.p(I),Se=this.atlasImage;Se.resize({width:ie||1,height:we||1});for(let Be in this.patterns){let{bin:dt}=this.patterns[Be],St=dt.x+1,Nt=dt.y+1,$t=this.getImage(Be).data,Tr=$t.width,Ar=$t.height;t.R.copy($t,Se,{x:0,y:0},{x:St,y:Nt},{width:Tr,height:Ar}),t.R.copy($t,Se,{x:0,y:Ar-1},{x:St,y:Nt-1},{width:Tr,height:1}),t.R.copy($t,Se,{x:0,y:0},{x:St,y:Nt+Ar},{width:Tr,height:1}),t.R.copy($t,Se,{x:Tr-1,y:0},{x:St-1,y:Nt},{width:1,height:Ar}),t.R.copy($t,Se,{x:0,y:0},{x:St+Tr,y:Nt},{width:1,height:Ar})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(I){for(let ie of I){if(this.callbackDispatchedThisFrame[ie])continue;this.callbackDispatchedThisFrame[ie]=!0;let we=this.getImage(ie);we||t.w(`Image with ID: "${ie}" was not found`),y(we)&&this.updateImage(ie,we)}}}let R=1e20;function L(Ue,I,ie,we,Se,Be,dt,St,Nt){for(let $t=I;$t<I+we;$t++)z(Ue,ie*Be+$t,Be,Se,dt,St,Nt);for(let $t=ie;$t<ie+Se;$t++)z(Ue,$t*Be+I,1,we,dt,St,Nt)}function z(Ue,I,ie,we,Se,Be,dt){Be[0]=0,dt[0]=-R,dt[1]=R,Se[0]=Ue[I];for(let St=1,Nt=0,$t=0;St<we;St++){Se[St]=Ue[I+St*ie];let Tr=St*St;do{let Ar=Be[Nt];$t=(Se[St]-Se[Ar]+Tr-Ar*Ar)/(St-Ar)/2}while($t<=dt[Nt]&&--Nt>-1);Nt++,Be[Nt]=St,dt[Nt]=$t,dt[Nt+1]=R}for(let St=0,Nt=0;St<we;St++){for(;dt[Nt+1]<St;)Nt++;let $t=Be[Nt],Tr=St-$t;Ue[I+St*ie]=Se[$t]+Tr*Tr}}class F{constructor(I,ie){this.requestManager=I,this.localIdeographFontFamily=ie,this.entries={}}setURL(I){this.url=I}getGlyphs(I){return t._(this,void 0,void 0,function*(){let ie=[];for(let Be in I)for(let dt of I[Be])ie.push(this._getAndCacheGlyphsPromise(Be,dt));let we=yield Promise.all(ie),Se={};for(let{stack:Be,id:dt,glyph:St}of we)Se[Be]||(Se[Be]={}),Se[Be][dt]=St&&{id:St.id,bitmap:St.bitmap.clone(),metrics:St.metrics};return Se})}_getAndCacheGlyphsPromise(I,ie){return t._(this,void 0,void 0,function*(){let we=this.entries[I];we||(we=this.entries[I]={glyphs:{},requests:{},ranges:{}});let Se=we.glyphs[ie];if(Se!==void 0)return{stack:I,id:ie,glyph:Se};if(Se=this._tinySDF(we,I,ie),Se)return we.glyphs[ie]=Se,{stack:I,id:ie,glyph:Se};let Be=Math.floor(ie/256);if(256*Be>65535)throw new Error("glyphs > 65535 not supported");if(we.ranges[Be])return{stack:I,id:ie,glyph:Se};if(!this.url)throw new Error("glyphsUrl is not set");if(!we.requests[Be]){let St=F.loadGlyphRange(I,Be,this.url,this.requestManager);we.requests[Be]=St}let dt=yield we.requests[Be];for(let St in dt)this._doesCharSupportLocalGlyph(+St)||(we.glyphs[+St]=dt[+St]);return we.ranges[Be]=!0,{stack:I,id:ie,glyph:dt[ie]||null}})}_doesCharSupportLocalGlyph(I){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(I))}_tinySDF(I,ie,we){let Se=this.localIdeographFontFamily;if(!Se||!this._doesCharSupportLocalGlyph(we))return;let Be=I.tinySDF;if(!Be){let St="400";/bold/i.test(ie)?St="900":/medium/i.test(ie)?St="500":/light/i.test(ie)&&(St="200"),Be=I.tinySDF=new F.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:Se,fontWeight:St})}let dt=Be.draw(String.fromCharCode(we));return{id:we,bitmap:new t.o({width:dt.width||60,height:dt.height||60},dt.data),metrics:{width:dt.glyphWidth/2||24,height:dt.glyphHeight/2||24,left:dt.glyphLeft/2+.5||0,top:dt.glyphTop/2-27.5||-8,advance:dt.glyphAdvance/2||24,isDoubleResolution:!0}}}}F.loadGlyphRange=function(Ue,I,ie,we){return t._(this,void 0,void 0,function*(){let Se=256*I,Be=Se+255,dt=we.transformRequest(ie.replace("{fontstack}",Ue).replace("{range}",`${Se}-${Be}`),"Glyphs"),St=yield t.l(dt,new AbortController);if(!St||!St.data)throw new Error(`Could not load glyph range. range: ${I}, ${Se}-${Be}`);let Nt={};for(let $t of t.n(St.data))Nt[$t.id]=$t;return Nt})},F.TinySDF=class{constructor({fontSize:Ue=24,buffer:I=3,radius:ie=8,cutoff:we=.25,fontFamily:Se="sans-serif",fontWeight:Be="normal",fontStyle:dt="normal"}={}){this.buffer=I,this.cutoff=we,this.radius=ie;let St=this.size=Ue+4*I,Nt=this._createCanvas(St),$t=this.ctx=Nt.getContext("2d",{willReadFrequently:!0});$t.font=`${dt} ${Be} ${Ue}px ${Se}`,$t.textBaseline="alphabetic",$t.textAlign="left",$t.fillStyle="black",this.gridOuter=new Float64Array(St*St),this.gridInner=new Float64Array(St*St),this.f=new Float64Array(St),this.z=new Float64Array(St+1),this.v=new Uint16Array(St)}_createCanvas(Ue){let I=document.createElement("canvas");return I.width=I.height=Ue,I}draw(Ue){let{width:I,actualBoundingBoxAscent:ie,actualBoundingBoxDescent:we,actualBoundingBoxLeft:Se,actualBoundingBoxRight:Be}=this.ctx.measureText(Ue),dt=Math.ceil(ie),St=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(Be-Se))),Nt=Math.min(this.size-this.buffer,dt+Math.ceil(we)),$t=St+2*this.buffer,Tr=Nt+2*this.buffer,Ar=Math.max($t*Tr,0),Kr=new Uint8ClampedArray(Ar),na={data:Kr,width:$t,height:Tr,glyphWidth:St,glyphHeight:Nt,glyphTop:dt,glyphLeft:0,glyphAdvance:I};if(St===0||Nt===0)return na;let{ctx:He,buffer:Je,gridInner:lt,gridOuter:vt}=this;He.clearRect(Je,Je,St,Nt),He.fillText(Ue,Je,Je+dt);let Lt=He.getImageData(Je,Je,St,Nt);vt.fill(R,0,Ar),lt.fill(0,0,Ar);for(let At=0;At<Nt;At++)for(let zt=0;zt<St;zt++){let cr=Lt.data[4*(At*St+zt)+3]/255;if(cr===0)continue;let yr=(At+Je)*$t+zt+Je;if(cr===1)vt[yr]=0,lt[yr]=R;else{let Er=.5-cr;vt[yr]=Er>0?Er*Er:0,lt[yr]=Er<0?Er*Er:0}}L(vt,0,0,$t,Tr,$t,this.f,this.v,this.z),L(lt,Je,Je,St,Nt,$t,this.f,this.v,this.z);for(let At=0;At<Ar;At++){let zt=Math.sqrt(vt[At])-Math.sqrt(lt[At]);Kr[At]=Math.round(255-255*(zt/this.radius+this.cutoff))}return na}};class N{constructor(){this.specification=t.v.light.position}possiblyEvaluate(I,ie){return t.x(I.expression.evaluate(ie))}interpolate(I,ie,we){return{x:t.y.number(I.x,ie.x,we),y:t.y.number(I.y,ie.y,we),z:t.y.number(I.z,ie.z,we)}}}let O;class P extends t.E{constructor(I){super(),O=O||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(O),this.setLight(I),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(I,ie={}){if(!this._validate(t.r,I,ie))for(let we in I){let Se=I[we];we.endsWith("-transition")?this._transitionable.setTransition(we.slice(0,-11),Se):this._transitionable.setValue(we,Se)}}updateTransitions(I){this._transitioning=this._transitionable.transitioned(I,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(I){this.properties=this._transitioning.possiblyEvaluate(I)}_validate(I,ie,we){return(!we||we.validate!==!1)&&t.t(this,I.call(t.u,{value:ie,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 B extends t.E{constructor(I){super(),this._transitionable=new t.T(U),this.setSky(I),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.z(0))}setSky(I,ie={}){if(!this._validate(t.B,I,ie)){I||(I={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let we in I){let Se=I[we];we.endsWith("-transition")?this._transitionable.setTransition(we.slice(0,-11),Se):this._transitionable.setValue(we,Se)}}}getSky(){return this._transitionable.serialize()}updateTransitions(I){this._transitioning=this._transitionable.transitioned(I,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(I){this.properties=this._transitioning.possiblyEvaluate(I)}_validate(I,ie,we={}){return we?.validate!==!1&&t.t(this,I.call(t.u,t.e({value:ie,style:{glyphs:!0,sprite:!0},styleSpec:t.v})))}calculateFogBlendOpacity(I){return I<60?0:I<70?(I-60)/10:1}}class X{constructor(I,ie){this.width=I,this.height=ie,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(I,ie){let we=I.join(",")+String(ie);return this.dashEntry[we]||(this.dashEntry[we]=this.addDash(I,ie)),this.dashEntry[we]}getDashRanges(I,ie,we){let Se=[],Be=I.length%2==1?-I[I.length-1]*we:0,dt=I[0]*we,St=!0;Se.push({left:Be,right:dt,isDash:St,zeroLength:I[0]===0});let Nt=I[0];for(let $t=1;$t<I.length;$t++){St=!St;let Tr=I[$t];Be=Nt*we,Nt+=Tr,dt=Nt*we,Se.push({left:Be,right:dt,isDash:St,zeroLength:Tr===0})}return Se}addRoundDash(I,ie,we){let Se=ie/2;for(let Be=-we;Be<=we;Be++){let dt=this.width*(this.nextRow+we+Be),St=0,Nt=I[St];for(let $t=0;$t<this.width;$t++){$t/Nt.right>1&&(Nt=I[++St]);let Tr=Math.abs($t-Nt.left),Ar=Math.abs($t-Nt.right),Kr=Math.min(Tr,Ar),na,He=Be/we*(Se+1);if(Nt.isDash){let Je=Se-Math.abs(He);na=Math.sqrt(Kr*Kr+Je*Je)}else na=Se-Math.sqrt(Kr*Kr+He*He);this.data[dt+$t]=Math.max(0,Math.min(255,na+128))}}}addRegularDash(I){for(let St=I.length-1;St>=0;--St){let Nt=I[St],$t=I[St+1];Nt.zeroLength?I.splice(St,1):$t&&$t.isDash===Nt.isDash&&($t.left=Nt.left,I.splice(St,1))}let ie=I[0],we=I[I.length-1];ie.isDash===we.isDash&&(ie.left=we.left-this.width,we.right=ie.right+this.width);let Se=this.width*this.nextRow,Be=0,dt=I[Be];for(let St=0;St<this.width;St++){St/dt.right>1&&(dt=I[++Be]);let Nt=Math.abs(St-dt.left),$t=Math.abs(St-dt.right),Tr=Math.min(Nt,$t);this.data[Se+St]=Math.max(0,Math.min(255,(dt.isDash?Tr:-Tr)+128))}}addDash(I,ie){let we=ie?7:0,Se=2*we+1;if(this.nextRow+Se>this.height)return t.w("LineAtlas out of space"),null;let Be=0;for(let St=0;St<I.length;St++)Be+=I[St];if(Be!==0){let St=this.width/Be,Nt=this.getDashRanges(I,this.width,St);ie?this.addRoundDash(Nt,St,we):this.addRegularDash(Nt)}let dt={y:(this.nextRow+we+.5)/this.height,height:2*we/this.height,width:Be};return this.nextRow+=Se,this.dirty=!0,dt}bind(I){let ie=I.gl;this.texture?(ie.bindTexture(ie.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,ie.texSubImage2D(ie.TEXTURE_2D,0,0,0,this.width,this.height,ie.ALPHA,ie.UNSIGNED_BYTE,this.data))):(this.texture=ie.createTexture(),ie.bindTexture(ie.TEXTURE_2D,this.texture),ie.texParameteri(ie.TEXTURE_2D,ie.TEXTURE_WRAP_S,ie.REPEAT),ie.texParameteri(ie.TEXTURE_2D,ie.TEXTURE_WRAP_T,ie.REPEAT),ie.texParameteri(ie.TEXTURE_2D,ie.TEXTURE_MIN_FILTER,ie.LINEAR),ie.texParameteri(ie.TEXTURE_2D,ie.TEXTURE_MAG_FILTER,ie.LINEAR),ie.texImage2D(ie.TEXTURE_2D,0,ie.ALPHA,this.width,this.height,0,ie.ALPHA,ie.UNSIGNED_BYTE,this.data))}}let $="maplibre_preloaded_worker_pool";class se{constructor(){this.active={}}acquire(I){if(!this.workers)for(this.workers=[];this.workers.length<se.workerCount;)this.workers.push(new Worker(t.a.WORKER_URL));return this.active[I]=!0,this.workers.slice()}release(I){delete this.active[I],this.numActive()===0&&(this.workers.forEach(ie=>{ie.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[$]}numActive(){return Object.keys(this.active).length}}let le=Math.floor(n.hardwareConcurrency/2),fe,V;function Y(){return fe||(fe=new se),fe}se.workerCount=t.C(globalThis)?Math.max(Math.min(le,3),1):1;class ee{constructor(I,ie){this.workerPool=I,this.actors=[],this.currentActor=0,this.id=ie;let we=this.workerPool.acquire(ie);for(let Se=0;Se<we.length;Se++){let Be=new t.F(we[Se],ie);Be.name=`Worker ${Se}`,this.actors.push(Be)}if(!this.actors.length)throw new Error("No actors found")}broadcast(I,ie){let we=[];for(let Se of this.actors)we.push(Se.sendAsync({type:I,data:ie}));return Promise.all(we)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(I=!0){this.actors.forEach(ie=>{ie.remove()}),this.actors=[],I&&this.workerPool.release(this.id)}registerMessageHandler(I,ie){for(let we of this.actors)we.registerMessageHandler(I,ie)}}function q(){return V||(V=new ee(Y(),t.G),V.registerMessageHandler("GR",(Ue,I,ie)=>t.m(I,ie))),V}function oe(Ue,I){let ie=t.H();return t.J(ie,ie,[1,1,0]),t.K(ie,ie,[.5*Ue.width,.5*Ue.height,1]),t.L(ie,ie,Ue.calculatePosMatrix(I.toUnwrapped()))}function ae(Ue,I,ie,we,Se,Be){let dt=function(Ar,Kr,na){if(Ar)for(let He of Ar){let Je=Kr[He];if(Je&&Je.source===na&&Je.type==="fill-extrusion")return!0}else for(let He in Kr){let Je=Kr[He];if(Je.source===na&&Je.type==="fill-extrusion")return!0}return!1}(Se&&Se.layers,I,Ue.id),St=Be.maxPitchScaleFactor(),Nt=Ue.tilesIn(we,St,dt);Nt.sort(j);let $t=[];for(let Ar of Nt)$t.push({wrappedTileID:Ar.tileID.wrapped().key,queryResults:Ar.tile.queryRenderedFeatures(I,ie,Ue._state,Ar.queryGeometry,Ar.cameraQueryGeometry,Ar.scale,Se,Be,St,oe(Ue.transform,Ar.tileID))});let Tr=function(Ar){let Kr={},na={};for(let He of Ar){let Je=He.queryResults,lt=He.wrappedTileID,vt=na[lt]=na[lt]||{};for(let Lt in Je){let At=Je[Lt],zt=vt[Lt]=vt[Lt]||{},cr=Kr[Lt]=Kr[Lt]||[];for(let yr of At)zt[yr.featureIndex]||(zt[yr.featureIndex]=!0,cr.push(yr))}}return Kr}($t);for(let Ar in Tr)Tr[Ar].forEach(Kr=>{let na=Kr.feature,He=Ue.getFeatureState(na.layer["source-layer"],na.id);na.source=na.layer.source,na.layer["source-layer"]&&(na.sourceLayer=na.layer["source-layer"]),na.state=He});return Tr}function j(Ue,I){let ie=Ue.tileID,we=I.tileID;return ie.overscaledZ-we.overscaledZ||ie.canonical.y-we.canonical.y||ie.wrap-we.wrap||ie.canonical.x-we.canonical.x}function Q(Ue,I,ie){return t._(this,void 0,void 0,function*(){let we=Ue;if(Ue.url?we=(yield t.h(I.transformRequest(Ue.url,"Source"),ie)).data:yield n.frameAsync(ie),!we)return null;let Se=t.M(t.e(we,Ue),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in we&&we.vector_layers&&(Se.vectorLayerIds=we.vector_layers.map(Be=>Be.id)),Se})}class re{constructor(I,ie){I&&(ie?this.setSouthWest(I).setNorthEast(ie):Array.isArray(I)&&(I.length===4?this.setSouthWest([I[0],I[1]]).setNorthEast([I[2],I[3]]):this.setSouthWest(I[0]).setNorthEast(I[1])))}setNorthEast(I){return this._ne=I instanceof t.N?new t.N(I.lng,I.lat):t.N.convert(I),this}setSouthWest(I){return this._sw=I instanceof t.N?new t.N(I.lng,I.lat):t.N.convert(I),this}extend(I){let ie=this._sw,we=this._ne,Se,Be;if(I instanceof t.N)Se=I,Be=I;else{if(!(I instanceof re))return Array.isArray(I)?I.length===4||I.every(Array.isArray)?this.extend(re.convert(I)):this.extend(t.N.convert(I)):I&&("lng"in I||"lon"in I)&&"lat"in I?this.extend(t.N.convert(I)):this;if(Se=I._sw,Be=I._ne,!Se||!Be)return this}return ie||we?(ie.lng=Math.min(Se.lng,ie.lng),ie.lat=Math.min(Se.lat,ie.lat),we.lng=Math.max(Be.lng,we.lng),we.lat=Math.max(Be.lat,we.lat)):(this._sw=new t.N(Se.lng,Se.lat),this._ne=new t.N(Be.lng,Be.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(I){let{lng:ie,lat:we}=t.N.convert(I),Se=this._sw.lng<=ie&&ie<=this._ne.lng;return this._sw.lng>this._ne.lng&&(Se=this._sw.lng>=ie&&ie>=this._ne.lng),this._sw.lat<=we&&we<=this._ne.lat&&Se}static convert(I){return I instanceof re?I:I&&new re(I)}static fromLngLat(I,ie=0){let we=360*ie/40075017,Se=we/Math.cos(Math.PI/180*I.lat);return new re(new t.N(I.lng-Se,I.lat-we),new t.N(I.lng+Se,I.lat+we))}adjustAntiMeridian(){let I=new t.N(this._sw.lng,this._sw.lat),ie=new t.N(this._ne.lng,this._ne.lat);return new re(I,I.lng>ie.lng?new t.N(ie.lng+360,ie.lat):ie)}}class ce{constructor(I,ie,we){this.bounds=re.convert(this.validateBounds(I)),this.minzoom=ie||0,this.maxzoom=we||24}validateBounds(I){return Array.isArray(I)&&I.length===4?[Math.max(-180,I[0]),Math.max(-90,I[1]),Math.min(180,I[2]),Math.min(90,I[3])]:[-180,-90,180,90]}contains(I){let ie=Math.pow(2,I.z),we=Math.floor(t.O(this.bounds.getWest())*ie),Se=Math.floor(t.Q(this.bounds.getNorth())*ie),Be=Math.ceil(t.O(this.bounds.getEast())*ie),dt=Math.ceil(t.Q(this.bounds.getSouth())*ie);return I.x>=we&&I.x<Be&&I.y>=Se&&I.y<dt}}class be extends t.E{constructor(I,ie,we,Se){if(super(),this.id=I,this.dispatcher=we,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(ie,["url","scheme","tileSize","promoteId"])),this._options=t.e({type:"vector"},ie),this._collectResourceTiming=ie.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(Se)}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 I=yield Q(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),I&&(t.e(this,I),I.bounds&&(this.tileBounds=new ce(I.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(I){this._tileJSONRequest=null,this.fire(new t.j(I))}})}loaded(){return this._loaded}hasTile(I){return!this.tileBounds||this.tileBounds.contains(I.canonical)}onAdd(I){this.map=I,this.load()}setSourceProperty(I){this._tileJSONRequest&&this._tileJSONRequest.abort(),I(),this.load()}setTiles(I){return this.setSourceProperty(()=>{this._options.tiles=I}),this}setUrl(I){return this.setSourceProperty(()=>{this.url=I,this._options.url=I}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(I){return t._(this,void 0,void 0,function*(){let ie=I.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),we={request:this.map._requestManager.transformRequest(ie,"Tile"),uid:I.uid,tileID:I.tileID,zoom:I.tileID.overscaledZ,tileSize:this.tileSize*I.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};we.request.collectResourceTiming=this._collectResourceTiming;let Se="RT";if(I.actor&&I.state!=="expired"){if(I.state==="loading")return new Promise((Be,dt)=>{I.reloadPromise={resolve:Be,reject:dt}})}else I.actor=this.dispatcher.getActor(),Se="LT";I.abortController=new AbortController;try{let Be=yield I.actor.sendAsync({type:Se,data:we},I.abortController);if(delete I.abortController,I.aborted)return;this._afterTileLoadWorkerResponse(I,Be)}catch(Be){if(delete I.abortController,I.aborted)return;if(Be&&Be.status!==404)throw Be;this._afterTileLoadWorkerResponse(I,null)}})}_afterTileLoadWorkerResponse(I,ie){if(ie&&ie.resourceTiming&&(I.resourceTiming=ie.resourceTiming),ie&&this.map._refreshExpiredTiles&&I.setExpiryData(ie),I.loadVectorData(ie,this.map.painter),I.reloadPromise){let we=I.reloadPromise;I.reloadPromise=null,this.loadTile(I).then(we.resolve).catch(we.reject)}}abortTile(I){return t._(this,void 0,void 0,function*(){I.abortController&&(I.abortController.abort(),delete I.abortController),I.actor&&(yield I.actor.sendAsync({type:"AT",data:{uid:I.uid,type:this.type,source:this.id}}))})}unloadTile(I){return t._(this,void 0,void 0,function*(){I.unloadVectorData(),I.actor&&(yield I.actor.sendAsync({type:"RMT",data:{uid:I.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Ae extends t.E{constructor(I,ie,we,Se){super(),this.id=I,this.dispatcher=we,this.setEventedParent(Se),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"},ie),t.e(this,t.M(ie,["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 I=yield Q(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,I&&(t.e(this,I),I.bounds&&(this.tileBounds=new ce(I.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(I){this._tileJSONRequest=null,this.fire(new t.j(I))}})}loaded(){return this._loaded}onAdd(I){this.map=I,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(I){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),I(),this.load()}setTiles(I){return this.setSourceProperty(()=>{this._options.tiles=I}),this}setUrl(I){return this.setSourceProperty(()=>{this.url=I,this._options.url=I}),this}serialize(){return t.e({},this._options)}hasTile(I){return!this.tileBounds||this.tileBounds.contains(I.canonical)}loadTile(I){return t._(this,void 0,void 0,function*(){let ie=I.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);I.abortController=new AbortController;try{let we=yield l.getImage(this.map._requestManager.transformRequest(ie,"Tile"),I.abortController,this.map._refreshExpiredTiles);if(delete I.abortController,I.aborted)return void(I.state="unloaded");if(we&&we.data){this.map._refreshExpiredTiles&&we.cacheControl&&we.expires&&I.setExpiryData({cacheControl:we.cacheControl,expires:we.expires});let Se=this.map.painter.context,Be=Se.gl,dt=we.data;I.texture=this.map.painter.getTileTexture(dt.width),I.texture?I.texture.update(dt,{useMipmap:!0}):(I.texture=new u(Se,dt,Be.RGBA,{useMipmap:!0}),I.texture.bind(Be.LINEAR,Be.CLAMP_TO_EDGE,Be.LINEAR_MIPMAP_NEAREST)),I.state="loaded"}}catch(we){if(delete I.abortController,I.aborted)I.state="unloaded";else if(we)throw I.state="errored",we}})}abortTile(I){return t._(this,void 0,void 0,function*(){I.abortController&&(I.abortController.abort(),delete I.abortController)})}unloadTile(I){return t._(this,void 0,void 0,function*(){I.texture&&this.map.painter.saveTileTexture(I.texture)})}hasTransition(){return!1}}class De extends Ae{constructor(I,ie,we,Se){super(I,ie,we,Se),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},ie),this.encoding=ie.encoding||"mapbox",this.redFactor=ie.redFactor,this.greenFactor=ie.greenFactor,this.blueFactor=ie.blueFactor,this.baseShift=ie.baseShift}loadTile(I){return t._(this,void 0,void 0,function*(){let ie=I.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),we=this.map._requestManager.transformRequest(ie,"Tile");I.neighboringTiles=this._getNeighboringTiles(I.tileID),I.abortController=new AbortController;try{let Se=yield l.getImage(we,I.abortController,this.map._refreshExpiredTiles);if(delete I.abortController,I.aborted)return void(I.state="unloaded");if(Se&&Se.data){let Be=Se.data;this.map._refreshExpiredTiles&&Se.cacheControl&&Se.expires&&I.setExpiryData({cacheControl:Se.cacheControl,expires:Se.expires});let dt=t.b(Be)&&t.U()?Be:yield this.readImageNow(Be),St={type:this.type,uid:I.uid,source:this.id,rawImageData:dt,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!I.actor||I.state==="expired"){I.actor=this.dispatcher.getActor();let Nt=yield I.actor.sendAsync({type:"LDT",data:St});I.dem=Nt,I.needsHillshadePrepare=!0,I.needsTerrainPrepare=!0,I.state="loaded"}}}catch(Se){if(delete I.abortController,I.aborted)I.state="unloaded";else if(Se)throw I.state="errored",Se}})}readImageNow(I){return t._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&t.V()){let ie=I.width+2,we=I.height+2;try{return new t.R({width:ie,height:we},yield t.W(I,-1,-1,ie,we))}catch{}}return n.getImageData(I,1)})}_getNeighboringTiles(I){let ie=I.canonical,we=Math.pow(2,ie.z),Se=(ie.x-1+we)%we,Be=ie.x===0?I.wrap-1:I.wrap,dt=(ie.x+1+we)%we,St=ie.x+1===we?I.wrap+1:I.wrap,Nt={};return Nt[new t.S(I.overscaledZ,Be,ie.z,Se,ie.y).key]={backfilled:!1},Nt[new t.S(I.overscaledZ,St,ie.z,dt,ie.y).key]={backfilled:!1},ie.y>0&&(Nt[new t.S(I.overscaledZ,Be,ie.z,Se,ie.y-1).key]={backfilled:!1},Nt[new t.S(I.overscaledZ,I.wrap,ie.z,ie.x,ie.y-1).key]={backfilled:!1},Nt[new t.S(I.overscaledZ,St,ie.z,dt,ie.y-1).key]={backfilled:!1}),ie.y+1<we&&(Nt[new t.S(I.overscaledZ,Be,ie.z,Se,ie.y+1).key]={backfilled:!1},Nt[new t.S(I.overscaledZ,I.wrap,ie.z,ie.x,ie.y+1).key]={backfilled:!1},Nt[new t.S(I.overscaledZ,St,ie.z,dt,ie.y+1).key]={backfilled:!1}),Nt}unloadTile(I){return t._(this,void 0,void 0,function*(){I.demTexture&&this.map.painter.saveTileTexture(I.demTexture),I.fbo&&(I.fbo.destroy(),delete I.fbo),I.dem&&delete I.dem,delete I.neighboringTiles,I.state="unloaded",I.actor&&(yield I.actor.sendAsync({type:"RDT",data:{type:this.type,uid:I.uid,source:this.id}}))})}}class ze extends t.E{constructor(I,ie,we,Se){super(),this.id=I,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=we.getActor(),this.setEventedParent(Se),this._data=ie.data,this._options=t.e({},ie),this._collectResourceTiming=ie.collectResourceTiming,ie.maxzoom!==void 0&&(this.maxzoom=ie.maxzoom),ie.type&&(this.type=ie.type),ie.attribution&&(this.attribution=ie.attribution),this.promoteId=ie.promoteId;let Be=t.X/this.tileSize;ie.clusterMaxZoom!==void 0&&this.maxzoom<=ie.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${ie.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:ie.cluster||!1,geojsonVtOptions:{buffer:(ie.buffer!==void 0?ie.buffer:128)*Be,tolerance:(ie.tolerance!==void 0?ie.tolerance:.375)*Be,extent:t.X,maxZoom:this.maxzoom,lineMetrics:ie.lineMetrics||!1,generateId:ie.generateId||!1},superclusterOptions:{maxZoom:ie.clusterMaxZoom!==void 0?ie.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,ie.clusterMinPoints||2),extent:t.X,radius:(ie.clusterRadius||50)*Be,log:!1,generateId:ie.generateId||!1},clusterProperties:ie.clusterProperties,filter:ie.filter},ie.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return t._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(I){this.map=I,this.load()}setData(I){return this._data=I,this._updateWorkerData(),this}updateData(I){return this._updateWorkerData(I),this}getData(){return t._(this,void 0,void 0,function*(){let I=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:I})})}setClusterOptions(I){return this.workerOptions.cluster=I.cluster,I&&(I.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=I.clusterRadius),I.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=I.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(I){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:I,source:this.id}})}getClusterChildren(I){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:I,source:this.id}})}getClusterLeaves(I,ie,we){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:I,limit:ie,offset:we}})}_updateWorkerData(I){return t._(this,void 0,void 0,function*(){let ie=t.e({type:this.type},this.workerOptions);I?ie.dataDiff=I:typeof this._data=="string"?(ie.request=this.map._requestManager.transformRequest(n.resolveURL(this._data),"Source"),ie.request.collectResourceTiming=this._collectResourceTiming):ie.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.k("dataloading",{dataType:"source"}));try{let we=yield this.actor.sendAsync({type:"LD",data:ie});if(this._pendingLoads--,this._removed||we.abandoned)return void this.fire(new t.k("dataabort",{dataType:"source"}));let Se=null;we.resourceTiming&&we.resourceTiming[this.id]&&(Se=we.resourceTiming[this.id].slice(0));let Be={dataType:"source"};this._collectResourceTiming&&Se&&Se.length>0&&t.e(Be,{resourceTiming:Se}),this.fire(new t.k("data",Object.assign(Object.assign({},Be),{sourceDataType:"metadata"}))),this.fire(new t.k("data",Object.assign(Object.assign({},Be),{sourceDataType:"content"})))}catch(we){if(this._pendingLoads--,this._removed)return void this.fire(new t.k("dataabort",{dataType:"source"}));this.fire(new t.j(we))}})}loaded(){return this._pendingLoads===0}loadTile(I){return t._(this,void 0,void 0,function*(){let ie=I.actor?"RT":"LT";I.actor=this.actor;let we={type:this.type,uid:I.uid,tileID:I.tileID,zoom:I.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};I.abortController=new AbortController;let Se=yield this.actor.sendAsync({type:ie,data:we},I.abortController);delete I.abortController,I.unloadVectorData(),I.aborted||I.loadVectorData(Se,this.map.painter,ie==="RT")})}abortTile(I){return t._(this,void 0,void 0,function*(){I.abortController&&(I.abortController.abort(),delete I.abortController),I.aborted=!0})}unloadTile(I){return t._(this,void 0,void 0,function*(){I.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:I.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 Ze=t.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class at extends t.E{constructor(I,ie,we,Se){super(),this.id=I,this.dispatcher=we,this.coordinates=ie.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(Se),this.options=ie}load(I){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 ie=yield l.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,ie&&ie.data&&(this.image=ie.data,I&&(this.coordinates=I),this._finishLoading())}catch(ie){this._request=null,this._loaded=!0,this.fire(new t.j(ie))}})}loaded(){return this._loaded}updateImage(I){return I.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=I.url,this.load(I.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(I){this.map=I,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(I){this.coordinates=I;let ie=I.map(t.Z.fromLngLat);this.tileID=function(Se){let Be=1/0,dt=1/0,St=-1/0,Nt=-1/0;for(let Kr of Se)Be=Math.min(Be,Kr.x),dt=Math.min(dt,Kr.y),St=Math.max(St,Kr.x),Nt=Math.max(Nt,Kr.y);let $t=Math.max(St-Be,Nt-dt),Tr=Math.max(0,Math.floor(-Math.log($t)/Math.LN2)),Ar=Math.pow(2,Tr);return new t.a1(Tr,Math.floor((Be+St)/2*Ar),Math.floor((dt+Nt)/2*Ar))}(ie),this.minzoom=this.maxzoom=this.tileID.z;let we=ie.map(Se=>this.tileID.getTilePoint(Se)._round());return this._boundsArray=new t.$,this._boundsArray.emplaceBack(we[0].x,we[0].y,0,0),this._boundsArray.emplaceBack(we[1].x,we[1].y,t.X,0),this._boundsArray.emplaceBack(we[3].x,we[3].y,0,t.X),this._boundsArray.emplaceBack(we[2].x,we[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 I=this.map.painter.context,ie=I.gl;this.boundsBuffer||(this.boundsBuffer=I.createVertexBuffer(this._boundsArray,Ze.members)),this.boundsSegments||(this.boundsSegments=t.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new u(I,this.image,ie.RGBA),this.texture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE));let we=!1;for(let Se in this.tiles){let Be=this.tiles[Se];Be.state!=="loaded"&&(Be.state="loaded",Be.texture=this.texture,we=!0)}we&&this.fire(new t.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(I){return t._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(I.tileID.canonical)?(this.tiles[String(I.tileID.wrap)]=I,I.buckets={}):I.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class nt extends at{constructor(I,ie,we,Se){super(I,ie,we,Se),this.roundZoom=!0,this.type="video",this.options=ie}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1;let I=this.options;this.urls=[];for(let ie of I.urls)this.urls.push(this.map._requestManager.transformRequest(ie,"Source").url);try{let ie=yield t.a3(this.urls);if(this._loaded=!0,!ie)return;this.video=ie,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(ie){this.fire(new t.j(ie))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(I){if(this.video){let ie=this.video.seekable;I<ie.start(0)||I>ie.end(0)?this.fire(new t.j(new t.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${ie.start(0)} and ${ie.end(0)}-second mark.`))):this.video.currentTime=I}}getVideo(){return this.video}onAdd(I){this.map||(this.map=I,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 I=this.map.painter.context,ie=I.gl;this.boundsBuffer||(this.boundsBuffer=I.createVertexBuffer(this._boundsArray,Ze.members)),this.boundsSegments||(this.boundsSegments=t.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE),ie.texSubImage2D(ie.TEXTURE_2D,0,0,0,ie.RGBA,ie.UNSIGNED_BYTE,this.video)):(this.texture=new u(I,this.video,ie.RGBA),this.texture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE));let we=!1;for(let Se in this.tiles){let Be=this.tiles[Se];Be.state!=="loaded"&&(Be.state="loaded",Be.texture=this.texture,we=!0)}we&&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 rt extends at{constructor(I,ie,we,Se){super(I,ie,we,Se),ie.coordinates?Array.isArray(ie.coordinates)&&ie.coordinates.length===4&&!ie.coordinates.some(Be=>!Array.isArray(Be)||Be.length!==2||Be.some(dt=>typeof dt!="number"))||this.fire(new t.j(new t.a2(`sources.${I}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.j(new t.a2(`sources.${I}`,null,'missing required property "coordinates"'))),ie.animate&&typeof ie.animate!="boolean"&&this.fire(new t.j(new t.a2(`sources.${I}`,null,'optional "animate" property must be a boolean value'))),ie.canvas?typeof ie.canvas=="string"||ie.canvas instanceof HTMLCanvasElement||this.fire(new t.j(new t.a2(`sources.${I}`,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.${I}`,null,'missing required property "canvas"'))),this.options=ie,this.animate=ie.animate===void 0||ie.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(I){this.map=I,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let I=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,I=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,I=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let ie=this.map.painter.context,we=ie.gl;this.boundsBuffer||(this.boundsBuffer=ie.createVertexBuffer(this._boundsArray,Ze.members)),this.boundsSegments||(this.boundsSegments=t.a0.simpleSegment(0,0,4,2)),this.texture?(I||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new u(ie,this.canvas,we.RGBA,{premultiply:!0});let Se=!1;for(let Be in this.tiles){let dt=this.tiles[Be];dt.state!=="loaded"&&(dt.state="loaded",dt.texture=this.texture,Se=!0)}Se&&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 I of[this.canvas.width,this.canvas.height])if(isNaN(I)||I<=0)return!0;return!1}}let st={},Me=Ue=>{switch(Ue){case"geojson":return ze;case"image":return at;case"raster":return Ae;case"raster-dem":return De;case"vector":return be;case"video":return nt;case"canvas":return rt}return st[Ue]},ye="RTLPluginLoaded";class he extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=q()}_syncState(I){return this.status=I,this.dispatcher.broadcast("SRPS",{pluginStatus:I,pluginURL:this.url}).catch(ie=>{throw this.status="error",ie})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(I){return t._(this,arguments,void 0,function*(ie,we=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=n.resolveURL(ie),!this.url)throw new Error(`requested url ${ie} is invalid`);if(this.status==="unavailable"){if(!we)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(ye))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Oe=null;function tt(){return Oe||(Oe=new he),Oe}class ot{constructor(I,ie){this.timeAdded=0,this.fadeEndTime=0,this.tileID=I,this.uid=t.a4(),this.uses=0,this.tileSize=ie,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(I){let ie=I+this.timeAdded;ie<this.fadeEndTime||(this.fadeEndTime=ie)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(I){this.demTexture&&I.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(I,ie,we){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",I){I.featureIndex&&(this.latestFeatureIndex=I.featureIndex,I.rawTileData?(this.latestRawTileData=I.rawTileData,this.latestFeatureIndex.rawTileData=I.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=I.collisionBoxArray,this.buckets=function(Se,Be){let dt={};if(!Be)return dt;for(let St of Se){let Nt=St.layerIds.map($t=>Be.getLayer($t)).filter(Boolean);if(Nt.length!==0){St.layers=Nt,St.stateDependentLayerIds&&(St.stateDependentLayers=St.stateDependentLayerIds.map($t=>Nt.filter(Tr=>Tr.id===$t)[0]));for(let $t of Nt)dt[$t.id]=St}}return dt}(I.buckets,ie.style),this.hasSymbolBuckets=!1;for(let Se in this.buckets){let Be=this.buckets[Se];if(Be instanceof t.a6){if(this.hasSymbolBuckets=!0,!we)break;Be.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let Se in this.buckets){let Be=this.buckets[Se];if(Be instanceof t.a6&&Be.hasRTLText){this.hasRTLText=!0,tt().lazyLoad();break}}this.queryPadding=0;for(let Se in this.buckets){let Be=this.buckets[Se];this.queryPadding=Math.max(this.queryPadding,ie.style.getLayer(Se).queryRadius(Be))}I.imageAtlas&&(this.imageAtlas=I.imageAtlas),I.glyphAtlasImage&&(this.glyphAtlasImage=I.glyphAtlasImage)}else this.collisionBoxArray=new t.a5}unloadVectorData(){for(let I in this.buckets)this.buckets[I].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(I){return this.buckets[I.id]}upload(I){for(let we in this.buckets){let Se=this.buckets[we];Se.uploadPending()&&Se.upload(I)}let ie=I.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new u(I,this.imageAtlas.image,ie.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new u(I,this.glyphAtlasImage,ie.ALPHA),this.glyphAtlasImage=null)}prepare(I){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(I,this.imageAtlasTexture)}queryRenderedFeatures(I,ie,we,Se,Be,dt,St,Nt,$t,Tr){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:Se,cameraQueryGeometry:Be,scale:dt,tileSize:this.tileSize,pixelPosMatrix:Tr,transform:Nt,params:St,queryPadding:this.queryPadding*$t},I,ie,we):{}}querySourceFeatures(I,ie){let we=this.latestFeatureIndex;if(!we||!we.rawTileData)return;let Se=we.loadVTLayers(),Be=ie&&ie.sourceLayer?ie.sourceLayer:"",dt=Se._geojsonTileLayer||Se[Be];if(!dt)return;let St=t.a7(ie&&ie.filter),{z:Nt,x:$t,y:Tr}=this.tileID.canonical,Ar={z:Nt,x:$t,y:Tr};for(let Kr=0;Kr<dt.length;Kr++){let na=dt.feature(Kr);if(St.needGeometry){let lt=t.a8(na,!0);if(!St.filter(new t.z(this.tileID.overscaledZ),lt,this.tileID.canonical))continue}else if(!St.filter(new t.z(this.tileID.overscaledZ),na))continue;let He=we.getId(na,Be),Je=new t.a9(na,Nt,$t,Tr,He);Je.tile=Ar,I.push(Je)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(I){let ie=this.expirationTime;if(I.cacheControl){let we=t.aa(I.cacheControl);we["max-age"]&&(this.expirationTime=Date.now()+1e3*we["max-age"])}else I.expires&&(this.expirationTime=new Date(I.expires).getTime());if(this.expirationTime){let we=Date.now(),Se=!1;if(this.expirationTime>we)Se=!1;else if(ie)if(this.expirationTime<ie)Se=!0;else{let Be=this.expirationTime-ie;Be?this.expirationTime=we+Math.max(Be,3e4):Se=!0}else Se=!0;Se?(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(I,ie){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(I).length===0)return;let we=this.latestFeatureIndex.loadVTLayers();for(let Se in this.buckets){if(!ie.style.hasLayer(Se))continue;let Be=this.buckets[Se],dt=Be.layers[0].sourceLayer||"_geojsonTileLayer",St=we[dt],Nt=I[dt];if(!St||!Nt||Object.keys(Nt).length===0)continue;Be.update(Nt,St,this.imageAtlas&&this.imageAtlas.patternPositions||{});let $t=ie&&ie.style&&ie.style.getLayer(Se);$t&&(this.queryPadding=Math.max(this.queryPadding,$t.queryRadius(Be)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<n.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(I){this.symbolFadeHoldUntil=n.now()+I}setDependencies(I,ie){let we={};for(let Se of ie)we[Se]=!0;this.dependencies[I]=we}hasDependency(I,ie){for(let we of I){let Se=this.dependencies[we];if(Se){for(let Be of ie)if(Se[Be])return!0}}return!1}}class Qe{constructor(I,ie){this.max=I,this.onRemove=ie,this.reset()}reset(){for(let I in this.data)for(let ie of this.data[I])ie.timeout&&clearTimeout(ie.timeout),this.onRemove(ie.value);return this.data={},this.order=[],this}add(I,ie,we){let Se=I.wrapped().key;this.data[Se]===void 0&&(this.data[Se]=[]);let Be={value:ie,timeout:void 0};if(we!==void 0&&(Be.timeout=setTimeout(()=>{this.remove(I,Be)},we)),this.data[Se].push(Be),this.order.push(Se),this.order.length>this.max){let dt=this._getAndRemoveByKey(this.order[0]);dt&&this.onRemove(dt)}return this}has(I){return I.wrapped().key in this.data}getAndRemove(I){return this.has(I)?this._getAndRemoveByKey(I.wrapped().key):null}_getAndRemoveByKey(I){let ie=this.data[I].shift();return ie.timeout&&clearTimeout(ie.timeout),this.data[I].length===0&&delete this.data[I],this.order.splice(this.order.indexOf(I),1),ie.value}getByKey(I){let ie=this.data[I];return ie?ie[0].value:null}get(I){return this.has(I)?this.data[I.wrapped().key][0].value:null}remove(I,ie){if(!this.has(I))return this;let we=I.wrapped().key,Se=ie===void 0?0:this.data[we].indexOf(ie),Be=this.data[we][Se];return this.data[we].splice(Se,1),Be.timeout&&clearTimeout(Be.timeout),this.data[we].length===0&&delete this.data[we],this.onRemove(Be.value),this.order.splice(this.order.indexOf(we),1),this}setMaxSize(I){for(this.max=I;this.order.length>this.max;){let ie=this._getAndRemoveByKey(this.order[0]);ie&&this.onRemove(ie)}return this}filter(I){let ie=[];for(let we in this.data)for(let Se of this.data[we])I(Se.value)||ie.push(Se);for(let we of ie)this.remove(we.value.tileID,we)}}class Pt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(I,ie,we){let Se=String(ie);if(this.stateChanges[I]=this.stateChanges[I]||{},this.stateChanges[I][Se]=this.stateChanges[I][Se]||{},t.e(this.stateChanges[I][Se],we),this.deletedStates[I]===null){this.deletedStates[I]={};for(let Be in this.state[I])Be!==Se&&(this.deletedStates[I][Be]=null)}else if(this.deletedStates[I]&&this.deletedStates[I][Se]===null){this.deletedStates[I][Se]={};for(let Be in this.state[I][Se])we[Be]||(this.deletedStates[I][Se][Be]=null)}else for(let Be in we)this.deletedStates[I]&&this.deletedStates[I][Se]&&this.deletedStates[I][Se][Be]===null&&delete this.deletedStates[I][Se][Be]}removeFeatureState(I,ie,we){if(this.deletedStates[I]===null)return;let Se=String(ie);if(this.deletedStates[I]=this.deletedStates[I]||{},we&&ie!==void 0)this.deletedStates[I][Se]!==null&&(this.deletedStates[I][Se]=this.deletedStates[I][Se]||{},this.deletedStates[I][Se][we]=null);else if(ie!==void 0)if(this.stateChanges[I]&&this.stateChanges[I][Se])for(we in this.deletedStates[I][Se]={},this.stateChanges[I][Se])this.deletedStates[I][Se][we]=null;else this.deletedStates[I][Se]=null;else this.deletedStates[I]=null}getState(I,ie){let we=String(ie),Se=t.e({},(this.state[I]||{})[we],(this.stateChanges[I]||{})[we]);if(this.deletedStates[I]===null)return{};if(this.deletedStates[I]){let Be=this.deletedStates[I][ie];if(Be===null)return{};for(let dt in Be)delete Se[dt]}return Se}initializeTileState(I,ie){I.setFeatureState(this.state,ie)}coalesceChanges(I,ie){let we={};for(let Se in this.stateChanges){this.state[Se]=this.state[Se]||{};let Be={};for(let dt in this.stateChanges[Se])this.state[Se][dt]||(this.state[Se][dt]={}),t.e(this.state[Se][dt],this.stateChanges[Se][dt]),Be[dt]=this.state[Se][dt];we[Se]=Be}for(let Se in this.deletedStates){this.state[Se]=this.state[Se]||{};let Be={};if(this.deletedStates[Se]===null)for(let dt in this.state[Se])Be[dt]={},this.state[Se][dt]={};else for(let dt in this.deletedStates[Se]){if(this.deletedStates[Se][dt]===null)this.state[Se][dt]={};else for(let St of Object.keys(this.deletedStates[Se][dt]))delete this.state[Se][dt][St];Be[dt]=this.state[Se][dt]}we[Se]=we[Se]||{},t.e(we[Se],Be)}if(this.stateChanges={},this.deletedStates={},Object.keys(we).length!==0)for(let Se in I)I[Se].setFeatureState(we,ie)}}class It extends t.E{constructor(I,ie,we){super(),this.id=I,this.dispatcher=we,this.on("data",Se=>this._dataHandler(Se)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((Se,Be,dt,St)=>{let Nt=new(Me(Be.type))(Se,Be,dt,St);if(Nt.id!==Se)throw new Error(`Expected Source id to be ${Se} instead of ${Nt.id}`);return Nt})(I,ie,we,this),this._tiles={},this._cache=new Qe(0,Se=>this._unloadTile(Se)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Pt,this._didEmitContent=!1,this._updated=!1}onAdd(I){this.map=I,this._maxTileCacheSize=I?I._maxTileCacheSize:null,this._maxTileCacheZoomLevels=I?I._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(I)}onRemove(I){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(I)}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 I in this._tiles){let ie=this._tiles[I];if(ie.state!=="loaded"&&ie.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let I=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,I&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(I,ie,we){return t._(this,void 0,void 0,function*(){try{yield this._source.loadTile(I),this._tileLoaded(I,ie,we)}catch(Se){I.state="errored",Se.status!==404?this._source.fire(new t.j(Se,{tile:I})):this.update(this.transform,this.terrain)}})}_unloadTile(I){this._source.unloadTile&&this._source.unloadTile(I)}_abortTile(I){this._source.abortTile&&this._source.abortTile(I),this._source.fire(new t.k("dataabort",{tile:I,coord:I.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(I){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let ie in this._tiles){let we=this._tiles[ie];we.upload(I),we.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(I=>I.tileID).sort(qt).map(I=>I.key)}getRenderableIds(I){let ie=[];for(let we in this._tiles)this._isIdRenderable(we,I)&&ie.push(this._tiles[we]);return I?ie.sort((we,Se)=>{let Be=we.tileID,dt=Se.tileID,St=new t.P(Be.canonical.x,Be.canonical.y)._rotate(this.transform.angle),Nt=new t.P(dt.canonical.x,dt.canonical.y)._rotate(this.transform.angle);return Be.overscaledZ-dt.overscaledZ||Nt.y-St.y||Nt.x-St.x}).map(we=>we.tileID.key):ie.map(we=>we.tileID).sort(qt).map(we=>we.key)}hasRenderableParent(I){let ie=this.findLoadedParent(I,0);return!!ie&&this._isIdRenderable(ie.tileID.key)}_isIdRenderable(I,ie){return this._tiles[I]&&this._tiles[I].hasData()&&!this._coveredTiles[I]&&(ie||!this._tiles[I].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let I in this._tiles)this._tiles[I].state!=="errored"&&this._reloadTile(I,"reloading")}}_reloadTile(I,ie){return t._(this,void 0,void 0,function*(){let we=this._tiles[I];we&&(we.state!=="loading"&&(we.state=ie),yield this._loadTile(we,I,ie))})}_tileLoaded(I,ie,we){I.timeAdded=n.now(),we==="expired"&&(I.refreshedUponExpiration=!0),this._setTileReloadTimer(ie,I),this.getSource().type==="raster-dem"&&I.dem&&this._backfillDEM(I),this._state.initializeTileState(I,this.map?this.map.painter:null),I.aborted||this._source.fire(new t.k("data",{dataType:"source",tile:I,coord:I.tileID}))}_backfillDEM(I){let ie=this.getRenderableIds();for(let Se=0;Se<ie.length;Se++){let Be=ie[Se];if(I.neighboringTiles&&I.neighboringTiles[Be]){let dt=this.getTileByID(Be);we(I,dt),we(dt,I)}}function we(Se,Be){Se.needsHillshadePrepare=!0,Se.needsTerrainPrepare=!0;let dt=Be.tileID.canonical.x-Se.tileID.canonical.x,St=Be.tileID.canonical.y-Se.tileID.canonical.y,Nt=Math.pow(2,Se.tileID.canonical.z),$t=Be.tileID.key;dt===0&&St===0||Math.abs(St)>1||(Math.abs(dt)>1&&(Math.abs(dt+Nt)===1?dt+=Nt:Math.abs(dt-Nt)===1&&(dt-=Nt)),Be.dem&&Se.dem&&(Se.dem.backfillBorder(Be.dem,dt,St),Se.neighboringTiles&&Se.neighboringTiles[$t]&&(Se.neighboringTiles[$t].backfilled=!0)))}}getTile(I){return this.getTileByID(I.key)}getTileByID(I){return this._tiles[I]}_retainLoadedChildren(I,ie,we,Se){for(let Be in this._tiles){let dt=this._tiles[Be];if(Se[Be]||!dt.hasData()||dt.tileID.overscaledZ<=ie||dt.tileID.overscaledZ>we)continue;let St=dt.tileID;for(;dt&&dt.tileID.overscaledZ>ie+1;){let $t=dt.tileID.scaledTo(dt.tileID.overscaledZ-1);dt=this._tiles[$t.key],dt&&dt.hasData()&&(St=$t)}let Nt=St;for(;Nt.overscaledZ>ie;)if(Nt=Nt.scaledTo(Nt.overscaledZ-1),I[Nt.key]){Se[St.key]=St;break}}}findLoadedParent(I,ie){if(I.key in this._loadedParentTiles){let we=this._loadedParentTiles[I.key];return we&&we.tileID.overscaledZ>=ie?we:null}for(let we=I.overscaledZ-1;we>=ie;we--){let Se=I.scaledTo(we),Be=this._getLoadedTile(Se);if(Be)return Be}}findLoadedSibling(I){return this._getLoadedTile(I)}_getLoadedTile(I){let ie=this._tiles[I.key];return ie&&ie.hasData()?ie:this._cache.getByKey(I.wrapped().key)}updateCacheSize(I){let ie=Math.ceil(I.width/this._source.tileSize)+1,we=Math.ceil(I.height/this._source.tileSize)+1,Se=Math.floor(ie*we*(this._maxTileCacheZoomLevels===null?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),Be=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,Se):Se;this._cache.setMaxSize(Be)}handleWrapJump(I){let ie=Math.round((I-(this._prevLng===void 0?I:this._prevLng))/360);if(this._prevLng=I,ie){let we={};for(let Se in this._tiles){let Be=this._tiles[Se];Be.tileID=Be.tileID.unwrapTo(Be.tileID.wrap+ie),we[Be.tileID.key]=Be}this._tiles=we;for(let Se in this._timers)clearTimeout(this._timers[Se]),delete this._timers[Se];for(let Se in this._tiles)this._setTileReloadTimer(Se,this._tiles[Se])}}_updateCoveredAndRetainedTiles(I,ie,we,Se,Be,dt){let St={},Nt={},$t=Object.keys(I),Tr=n.now();for(let Ar of $t){let Kr=I[Ar],na=this._tiles[Ar];if(!na||na.fadeEndTime!==0&&na.fadeEndTime<=Tr)continue;let He=this.findLoadedParent(Kr,ie),Je=this.findLoadedSibling(Kr),lt=He||Je||null;lt&&(this._addTile(lt.tileID),St[lt.tileID.key]=lt.tileID),Nt[Ar]=Kr}this._retainLoadedChildren(Nt,Se,we,I);for(let Ar in St)I[Ar]||(this._coveredTiles[Ar]=!0,I[Ar]=St[Ar]);if(dt){let Ar={},Kr={};for(let na of Be)this._tiles[na.key].hasData()?Ar[na.key]=na:Kr[na.key]=na;for(let na in Kr){let He=Kr[na].children(this._source.maxzoom);this._tiles[He[0].key]&&this._tiles[He[1].key]&&this._tiles[He[2].key]&&this._tiles[He[3].key]&&(Ar[He[0].key]=I[He[0].key]=He[0],Ar[He[1].key]=I[He[1].key]=He[1],Ar[He[2].key]=I[He[2].key]=He[2],Ar[He[3].key]=I[He[3].key]=He[3],delete Kr[na])}for(let na in Kr){let He=Kr[na],Je=this.findLoadedParent(He,this._source.minzoom),lt=this.findLoadedSibling(He),vt=Je||lt||null;if(vt){Ar[vt.tileID.key]=I[vt.tileID.key]=vt.tileID;for(let Lt in Ar)Ar[Lt].isChildOf(vt.tileID)&&delete Ar[Lt]}}for(let na in this._tiles)Ar[na]||(this._coveredTiles[na]=!0)}}update(I,ie){if(!this._sourceLoaded||this._paused)return;let we;this.transform=I,this.terrain=ie,this.updateCacheSize(I),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?we=I.getVisibleUnwrappedCoordinates(this._source.tileID).map(Tr=>new t.S(Tr.canonical.z,Tr.wrap,Tr.canonical.z,Tr.canonical.x,Tr.canonical.y)):(we=I.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:ie}),this._source.hasTile&&(we=we.filter(Tr=>this._source.hasTile(Tr)))):we=[];let Se=I.coveringZoomLevel(this._source),Be=Math.max(Se-It.maxOverzooming,this._source.minzoom),dt=Math.max(Se+It.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let Tr={};for(let Ar of we)if(Ar.canonical.z>this._source.minzoom){let Kr=Ar.scaledTo(Ar.canonical.z-1);Tr[Kr.key]=Kr;let na=Ar.scaledTo(Math.max(this._source.minzoom,Math.min(Ar.canonical.z,5)));Tr[na.key]=na}we=we.concat(Object.values(Tr))}let St=we.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,St&&this.fire(new t.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let Nt=this._updateRetainedTiles(we,Se);Wt(this._source.type)&&this._updateCoveredAndRetainedTiles(Nt,Be,dt,Se,we,ie);for(let Tr in Nt)this._tiles[Tr].clearFadeHold();let $t=t.ab(this._tiles,Nt);for(let Tr of $t){let Ar=this._tiles[Tr];Ar.hasSymbolBuckets&&!Ar.holdingForFade()?Ar.setHoldDuration(this.map._fadeDuration):Ar.hasSymbolBuckets&&!Ar.symbolFadeFinished()||this._removeTile(Tr)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let I in this._tiles)this._tiles[I].holdingForFade()&&this._removeTile(I)}_updateRetainedTiles(I,ie){var we;let Se={},Be={},dt=Math.max(ie-It.maxOverzooming,this._source.minzoom),St=Math.max(ie+It.maxUnderzooming,this._source.minzoom),Nt={};for(let $t of I){let Tr=this._addTile($t);Se[$t.key]=$t,Tr.hasData()||ie<this._source.maxzoom&&(Nt[$t.key]=$t)}this._retainLoadedChildren(Nt,ie,St,Se);for(let $t of I){let Tr=this._tiles[$t.key];if(Tr.hasData())continue;if(ie+1>this._source.maxzoom){let Kr=$t.children(this._source.maxzoom)[0],na=this.getTile(Kr);if(na&&na.hasData()){Se[Kr.key]=Kr;continue}}else{let Kr=$t.children(this._source.maxzoom);if(Se[Kr[0].key]&&Se[Kr[1].key]&&Se[Kr[2].key]&&Se[Kr[3].key])continue}let Ar=Tr.wasRequested();for(let Kr=$t.overscaledZ-1;Kr>=dt;--Kr){let na=$t.scaledTo(Kr);if(Be[na.key])break;if(Be[na.key]=!0,Tr=this.getTile(na),!Tr&&Ar&&(Tr=this._addTile(na)),Tr){let He=Tr.hasData();if((He||!(!((we=this.map)===null||we===void 0)&&we.cancelPendingTileRequestsWhileZooming)||Ar)&&(Se[na.key]=na),Ar=Tr.wasRequested(),He)break}}}return Se}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let I in this._tiles){let ie=[],we,Se=this._tiles[I].tileID;for(;Se.overscaledZ>0;){if(Se.key in this._loadedParentTiles){we=this._loadedParentTiles[Se.key];break}ie.push(Se.key);let Be=Se.scaledTo(Se.overscaledZ-1);if(we=this._getLoadedTile(Be),we)break;Se=Be}for(let Be of ie)this._loadedParentTiles[Be]=we}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let I in this._tiles){let ie=this._tiles[I].tileID,we=this._getLoadedTile(ie);this._loadedSiblingTiles[ie.key]=we}}_addTile(I){let ie=this._tiles[I.key];if(ie)return ie;ie=this._cache.getAndRemove(I),ie&&(this._setTileReloadTimer(I.key,ie),ie.tileID=I,this._state.initializeTileState(ie,this.map?this.map.painter:null),this._cacheTimers[I.key]&&(clearTimeout(this._cacheTimers[I.key]),delete this._cacheTimers[I.key],this._setTileReloadTimer(I.key,ie)));let we=ie;return ie||(ie=new ot(I,this._source.tileSize*I.overscaleFactor()),this._loadTile(ie,I.key,ie.state)),ie.uses++,this._tiles[I.key]=ie,we||this._source.fire(new t.k("dataloading",{tile:ie,coord:ie.tileID,dataType:"source"})),ie}_setTileReloadTimer(I,ie){I in this._timers&&(clearTimeout(this._timers[I]),delete this._timers[I]);let we=ie.getExpiryTimeout();we&&(this._timers[I]=setTimeout(()=>{this._reloadTile(I,"expired"),delete this._timers[I]},we))}_removeTile(I){let ie=this._tiles[I];ie&&(ie.uses--,delete this._tiles[I],this._timers[I]&&(clearTimeout(this._timers[I]),delete this._timers[I]),ie.uses>0||(ie.hasData()&&ie.state!=="reloading"?this._cache.add(ie.tileID,ie,ie.getExpiryTimeout()):(ie.aborted=!0,this._abortTile(ie),this._unloadTile(ie))))}_dataHandler(I){let ie=I.sourceDataType;I.dataType==="source"&&ie==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&I.dataType==="source"&&ie==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let I in this._tiles)this._removeTile(I);this._cache.reset()}tilesIn(I,ie,we){let Se=[],Be=this.transform;if(!Be)return Se;let dt=we?Be.getCameraQueryGeometry(I):I,St=I.map(He=>Be.pointCoordinate(He,this.terrain)),Nt=dt.map(He=>Be.pointCoordinate(He,this.terrain)),$t=this.getIds(),Tr=1/0,Ar=1/0,Kr=-1/0,na=-1/0;for(let He of Nt)Tr=Math.min(Tr,He.x),Ar=Math.min(Ar,He.y),Kr=Math.max(Kr,He.x),na=Math.max(na,He.y);for(let He=0;He<$t.length;He++){let Je=this._tiles[$t[He]];if(Je.holdingForFade())continue;let lt=Je.tileID,vt=Math.pow(2,Be.zoom-Je.tileID.overscaledZ),Lt=ie*Je.queryPadding*t.X/Je.tileSize/vt,At=[lt.getTilePoint(new t.Z(Tr,Ar)),lt.getTilePoint(new t.Z(Kr,na))];if(At[0].x-Lt<t.X&&At[0].y-Lt<t.X&&At[1].x+Lt>=0&&At[1].y+Lt>=0){let zt=St.map(yr=>lt.getTilePoint(yr)),cr=Nt.map(yr=>lt.getTilePoint(yr));Se.push({tile:Je,tileID:lt,queryGeometry:zt,cameraQueryGeometry:cr,scale:vt})}}return Se}getVisibleCoordinates(I){let ie=this.getRenderableIds(I).map(we=>this._tiles[we].tileID);for(let we of ie)we.posMatrix=this.transform.calculatePosMatrix(we.toUnwrapped());return ie}hasTransition(){if(this._source.hasTransition())return!0;if(Wt(this._source.type)){let I=n.now();for(let ie in this._tiles)if(this._tiles[ie].fadeEndTime>=I)return!0}return!1}setFeatureState(I,ie,we){this._state.updateState(I=I||"_geojsonTileLayer",ie,we)}removeFeatureState(I,ie,we){this._state.removeFeatureState(I=I||"_geojsonTileLayer",ie,we)}getFeatureState(I,ie){return this._state.getState(I=I||"_geojsonTileLayer",ie)}setDependencies(I,ie,we){let Se=this._tiles[I];Se&&Se.setDependencies(ie,we)}reloadTilesForDependencies(I,ie){for(let we in this._tiles)this._tiles[we].hasDependency(I,ie)&&this._reloadTile(we,"reloading");this._cache.filter(we=>!we.hasDependency(I,ie))}}function qt(Ue,I){let ie=Math.abs(2*Ue.wrap)-+(Ue.wrap<0),we=Math.abs(2*I.wrap)-+(I.wrap<0);return Ue.overscaledZ-I.overscaledZ||we-ie||I.canonical.y-Ue.canonical.y||I.canonical.x-Ue.canonical.x}function Wt(Ue){return Ue==="raster"||Ue==="image"||Ue==="video"}It.maxOverzooming=10,It.maxUnderzooming=3;class kr{constructor(I,ie){this.reset(I,ie)}reset(I,ie){this.points=I||[],this._distances=[0];for(let we=1;we<this.points.length;we++)this._distances[we]=this._distances[we-1]+this.points[we].dist(this.points[we-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(ie||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(I){if(this.points.length===1)return this.points[0];I=t.ac(I,0,1);let ie=1,we=this._distances[ie],Se=I*this.paddedLength+this.padding;for(;we<Se&&ie<this._distances.length;)we=this._distances[++ie];let Be=ie-1,dt=this._distances[Be],St=we-dt,Nt=St>0?(Se-dt)/St:0;return this.points[Be].mult(1-Nt).add(this.points[ie].mult(Nt))}}function mr(Ue,I){let ie=!0;return Ue==="always"||Ue!=="never"&&I!=="never"||(ie=!1),ie}class qr{constructor(I,ie,we){let Se=this.boxCells=[],Be=this.circleCells=[];this.xCellCount=Math.ceil(I/we),this.yCellCount=Math.ceil(ie/we);for(let dt=0;dt<this.xCellCount*this.yCellCount;dt++)Se.push([]),Be.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=I,this.height=ie,this.xScale=this.xCellCount/I,this.yScale=this.yCellCount/ie,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(I,ie,we,Se,Be){this._forEachCell(ie,we,Se,Be,this._insertBoxCell,this.boxUid++),this.boxKeys.push(I),this.bboxes.push(ie),this.bboxes.push(we),this.bboxes.push(Se),this.bboxes.push(Be)}insertCircle(I,ie,we,Se){this._forEachCell(ie-Se,we-Se,ie+Se,we+Se,this._insertCircleCell,this.circleUid++),this.circleKeys.push(I),this.circles.push(ie),this.circles.push(we),this.circles.push(Se)}_insertBoxCell(I,ie,we,Se,Be,dt){this.boxCells[Be].push(dt)}_insertCircleCell(I,ie,we,Se,Be,dt){this.circleCells[Be].push(dt)}_query(I,ie,we,Se,Be,dt,St){if(we<0||I>this.width||Se<0||ie>this.height)return[];let Nt=[];if(I<=0&&ie<=0&&this.width<=we&&this.height<=Se){if(Be)return[{key:null,x1:I,y1:ie,x2:we,y2:Se}];for(let $t=0;$t<this.boxKeys.length;$t++)Nt.push({key:this.boxKeys[$t],x1:this.bboxes[4*$t],y1:this.bboxes[4*$t+1],x2:this.bboxes[4*$t+2],y2:this.bboxes[4*$t+3]});for(let $t=0;$t<this.circleKeys.length;$t++){let Tr=this.circles[3*$t],Ar=this.circles[3*$t+1],Kr=this.circles[3*$t+2];Nt.push({key:this.circleKeys[$t],x1:Tr-Kr,y1:Ar-Kr,x2:Tr+Kr,y2:Ar+Kr})}}else this._forEachCell(I,ie,we,Se,this._queryCell,Nt,{hitTest:Be,overlapMode:dt,seenUids:{box:{},circle:{}}},St);return Nt}query(I,ie,we,Se){return this._query(I,ie,we,Se,!1,null)}hitTest(I,ie,we,Se,Be,dt){return this._query(I,ie,we,Se,!0,Be,dt).length>0}hitTestCircle(I,ie,we,Se,Be){let dt=I-we,St=I+we,Nt=ie-we,$t=ie+we;if(St<0||dt>this.width||$t<0||Nt>this.height)return!1;let Tr=[];return this._forEachCell(dt,Nt,St,$t,this._queryCellCircle,Tr,{hitTest:!0,overlapMode:Se,circle:{x:I,y:ie,radius:we},seenUids:{box:{},circle:{}}},Be),Tr.length>0}_queryCell(I,ie,we,Se,Be,dt,St,Nt){let{seenUids:$t,hitTest:Tr,overlapMode:Ar}=St,Kr=this.boxCells[Be];if(Kr!==null){let He=this.bboxes;for(let Je of Kr)if(!$t.box[Je]){$t.box[Je]=!0;let lt=4*Je,vt=this.boxKeys[Je];if(I<=He[lt+2]&&ie<=He[lt+3]&&we>=He[lt+0]&&Se>=He[lt+1]&&(!Nt||Nt(vt))&&(!Tr||!mr(Ar,vt.overlapMode))&&(dt.push({key:vt,x1:He[lt],y1:He[lt+1],x2:He[lt+2],y2:He[lt+3]}),Tr))return!0}}let na=this.circleCells[Be];if(na!==null){let He=this.circles;for(let Je of na)if(!$t.circle[Je]){$t.circle[Je]=!0;let lt=3*Je,vt=this.circleKeys[Je];if(this._circleAndRectCollide(He[lt],He[lt+1],He[lt+2],I,ie,we,Se)&&(!Nt||Nt(vt))&&(!Tr||!mr(Ar,vt.overlapMode))){let Lt=He[lt],At=He[lt+1],zt=He[lt+2];if(dt.push({key:vt,x1:Lt-zt,y1:At-zt,x2:Lt+zt,y2:At+zt}),Tr)return!0}}}return!1}_queryCellCircle(I,ie,we,Se,Be,dt,St,Nt){let{circle:$t,seenUids:Tr,overlapMode:Ar}=St,Kr=this.boxCells[Be];if(Kr!==null){let He=this.bboxes;for(let Je of Kr)if(!Tr.box[Je]){Tr.box[Je]=!0;let lt=4*Je,vt=this.boxKeys[Je];if(this._circleAndRectCollide($t.x,$t.y,$t.radius,He[lt+0],He[lt+1],He[lt+2],He[lt+3])&&(!Nt||Nt(vt))&&!mr(Ar,vt.overlapMode))return dt.push(!0),!0}}let na=this.circleCells[Be];if(na!==null){let He=this.circles;for(let Je of na)if(!Tr.circle[Je]){Tr.circle[Je]=!0;let lt=3*Je,vt=this.circleKeys[Je];if(this._circlesCollide(He[lt],He[lt+1],He[lt+2],$t.x,$t.y,$t.radius)&&(!Nt||Nt(vt))&&!mr(Ar,vt.overlapMode))return dt.push(!0),!0}}}_forEachCell(I,ie,we,Se,Be,dt,St,Nt){let $t=this._convertToXCellCoord(I),Tr=this._convertToYCellCoord(ie),Ar=this._convertToXCellCoord(we),Kr=this._convertToYCellCoord(Se);for(let na=$t;na<=Ar;na++)for(let He=Tr;He<=Kr;He++)if(Be.call(this,I,ie,we,Se,this.xCellCount*He+na,dt,St,Nt))return}_convertToXCellCoord(I){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(I*this.xScale)))}_convertToYCellCoord(I){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(I*this.yScale)))}_circlesCollide(I,ie,we,Se,Be,dt){let St=Se-I,Nt=Be-ie,$t=we+dt;return $t*$t>St*St+Nt*Nt}_circleAndRectCollide(I,ie,we,Se,Be,dt,St){let Nt=(dt-Se)/2,$t=Math.abs(I-(Se+Nt));if($t>Nt+we)return!1;let Tr=(St-Be)/2,Ar=Math.abs(ie-(Be+Tr));if(Ar>Tr+we)return!1;if($t<=Nt||Ar<=Tr)return!0;let Kr=$t-Nt,na=Ar-Tr;return Kr*Kr+na*na<=we*we}}function Sr(Ue,I,ie,we,Se){let Be=t.H();return I?(t.K(Be,Be,[1/Se,1/Se,1]),ie||t.ad(Be,Be,we.angle)):t.L(Be,we.labelPlaneMatrix,Ue),Be}function Rr(Ue,I,ie,we,Se){if(I){let Be=t.ae(Ue);return t.K(Be,Be,[Se,Se,1]),ie||t.ad(Be,Be,-we.angle),Be}return we.glCoordMatrix}function wt(Ue,I,ie,we){let Se;we?(Se=[Ue,I,we(Ue,I),1],t.af(Se,Se,ie)):(Se=[Ue,I,0,1],er(Se,Se,ie));let Be=Se[3];return{point:new t.P(Se[0]/Be,Se[1]/Be),signedDistanceFromCamera:Be,isOccluded:!1}}function Ne(Ue,I){return .5+Ue/I*.5}function Ke(Ue,I){return Ue.x>=-I[0]&&Ue.x<=I[0]&&Ue.y>=-I[1]&&Ue.y<=I[1]}function Te(Ue,I,ie,we,Se,Be,dt,St,Nt,$t,Tr,Ar,Kr,na,He){let Je=we?Ue.textSizeData:Ue.iconSizeData,lt=t.ag(Je,ie.transform.zoom),vt=[256/ie.width*2+1,256/ie.height*2+1],Lt=we?Ue.text.dynamicLayoutVertexArray:Ue.icon.dynamicLayoutVertexArray;Lt.clear();let At=Ue.lineVertexArray,zt=we?Ue.text.placedSymbolArray:Ue.icon.placedSymbolArray,cr=ie.transform.width/ie.transform.height,yr=!1;for(let Er=0;Er<zt.length;Er++){let jr=zt.get(Er);if(jr.hidden||jr.writingMode===t.ah.vertical&&!yr){rr(jr.numGlyphs,Lt);continue}yr=!1;let Qr=wt(jr.anchorX,jr.anchorY,I,He);if(!Ke(Qr.point,vt)){rr(jr.numGlyphs,Lt);continue}let pa=Ne(ie.transform.cameraToCenterDistance,Qr.signedDistanceFromCamera),Aa=t.ai(Je,lt,jr),za=dt?Aa/pa:Aa*pa,ci={getElevation:He,labelPlaneMatrix:Se,lineVertexArray:At,pitchWithMap:dt,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:$t,tileAnchorPoint:new t.P(jr.anchorX,jr.anchorY),unwrappedTileID:Tr,width:Ar,height:Kr,translation:na},Vi=Ce(ci,jr,za,!1,St,I,Be,Ue.glyphOffsetArray,Lt,cr,Nt);yr=Vi.useVertical,(Vi.notEnoughRoom||yr||Vi.needsFlipping&&Ce(ci,jr,za,!0,St,I,Be,Ue.glyphOffsetArray,Lt,cr,Nt).notEnoughRoom)&&rr(jr.numGlyphs,Lt)}we?Ue.text.dynamicLayoutVertexBuffer.updateData(Lt):Ue.icon.dynamicLayoutVertexBuffer.updateData(Lt)}function Ie(Ue,I,ie,we,Se,Be,dt,St){let Nt=Be.glyphStartIndex+Be.numGlyphs,$t=Be.lineStartIndex,Tr=Be.lineStartIndex+Be.lineLength,Ar=I.getoffsetX(Be.glyphStartIndex),Kr=I.getoffsetX(Nt-1),na=Ct(Ue*Ar,ie,we,Se,Be.segment,$t,Tr,St,dt);if(!na)return null;let He=Ct(Ue*Kr,ie,we,Se,Be.segment,$t,Tr,St,dt);return He?St.projectionCache.anyProjectionOccluded?null:{first:na,last:He}:null}function Ve(Ue,I,ie,we){return Ue===t.ah.horizontal&&Math.abs(ie.y-I.y)>Math.abs(ie.x-I.x)*we?{useVertical:!0}:(Ue===t.ah.vertical?I.y<ie.y:I.x>ie.x)?{needsFlipping:!0}:null}function Ce(Ue,I,ie,we,Se,Be,dt,St,Nt,$t,Tr){let Ar=ie/24,Kr=I.lineOffsetX*Ar,na=I.lineOffsetY*Ar,He;if(I.numGlyphs>1){let Je=I.glyphStartIndex+I.numGlyphs,lt=I.lineStartIndex,vt=I.lineStartIndex+I.lineLength,Lt=Ie(Ar,St,Kr,na,we,I,Tr,Ue);if(!Lt)return{notEnoughRoom:!0};let At=wt(Lt.first.point.x,Lt.first.point.y,dt,Ue.getElevation).point,zt=wt(Lt.last.point.x,Lt.last.point.y,dt,Ue.getElevation).point;if(Se&&!we){let cr=Ve(I.writingMode,At,zt,$t);if(cr)return cr}He=[Lt.first];for(let cr=I.glyphStartIndex+1;cr<Je-1;cr++)He.push(Ct(Ar*St.getoffsetX(cr),Kr,na,we,I.segment,lt,vt,Ue,Tr));He.push(Lt.last)}else{if(Se&&!we){let lt=wt(Ue.tileAnchorPoint.x,Ue.tileAnchorPoint.y,Be,Ue.getElevation).point,vt=I.lineStartIndex+I.segment+1,Lt=new t.P(Ue.lineVertexArray.getx(vt),Ue.lineVertexArray.gety(vt)),At=wt(Lt.x,Lt.y,Be,Ue.getElevation),zt=At.signedDistanceFromCamera>0?At.point:function(yr,Er,jr,Qr,pa,Aa){return Ee(yr,Er,jr,1,pa,Aa)}(Ue.tileAnchorPoint,Lt,lt,0,Be,Ue),cr=Ve(I.writingMode,lt,zt,$t);if(cr)return cr}let Je=Ct(Ar*St.getoffsetX(I.glyphStartIndex),Kr,na,we,I.segment,I.lineStartIndex,I.lineStartIndex+I.lineLength,Ue,Tr);if(!Je||Ue.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};He=[Je]}for(let Je of He)t.aj(Nt,Je.point,Je.angle);return{}}function Ee(Ue,I,ie,we,Se,Be){let dt=Ue.add(Ue.sub(I)._unit()),St=Se!==void 0?wt(dt.x,dt.y,Se,Be.getElevation).point:ft(dt.x,dt.y,Be).point,Nt=ie.sub(St);return ie.add(Nt._mult(we/Nt.mag()))}function Pe(Ue,I,ie){let we=I.projectionCache;if(we.projections[Ue])return we.projections[Ue];let Se=new t.P(I.lineVertexArray.getx(Ue),I.lineVertexArray.gety(Ue)),Be=ft(Se.x,Se.y,I);if(Be.signedDistanceFromCamera>0)return we.projections[Ue]=Be.point,we.anyProjectionOccluded=we.anyProjectionOccluded||Be.isOccluded,Be.point;let dt=Ue-ie.direction;return function(St,Nt,$t,Tr,Ar){return Ee(St,Nt,$t,Tr,void 0,Ar)}(ie.distanceFromAnchor===0?I.tileAnchorPoint:new t.P(I.lineVertexArray.getx(dt),I.lineVertexArray.gety(dt)),Se,ie.previousVertex,ie.absOffsetX-ie.distanceFromAnchor+1,I)}function ft(Ue,I,ie){let we=Ue+ie.translation[0],Se=I+ie.translation[1],Be;return!ie.pitchWithMap&&ie.projection.useSpecialProjectionForSymbols?(Be=ie.projection.projectTileCoordinates(we,Se,ie.unwrappedTileID,ie.getElevation),Be.point.x=(.5*Be.point.x+.5)*ie.width,Be.point.y=(.5*-Be.point.y+.5)*ie.height):(Be=wt(we,Se,ie.labelPlaneMatrix,ie.getElevation),Be.isOccluded=!1),Be}function ct(Ue,I,ie){return Ue._unit()._perp()._mult(I*ie)}function _t(Ue,I,ie,we,Se,Be,dt,St,Nt){if(St.projectionCache.offsets[Ue])return St.projectionCache.offsets[Ue];let $t=ie.add(I);if(Ue+Nt.direction<we||Ue+Nt.direction>=Se)return St.projectionCache.offsets[Ue]=$t,$t;let Tr=Pe(Ue+Nt.direction,St,Nt),Ar=ct(Tr.sub(ie),dt,Nt.direction),Kr=ie.add(Ar),na=Tr.add(Ar);return St.projectionCache.offsets[Ue]=t.ak(Be,$t,Kr,na)||$t,St.projectionCache.offsets[Ue]}function Ct(Ue,I,ie,we,Se,Be,dt,St,Nt){let $t=we?Ue-I:Ue+I,Tr=$t>0?1:-1,Ar=0;we&&(Tr*=-1,Ar=Math.PI),Tr<0&&(Ar+=Math.PI);let Kr,na=Tr>0?Be+Se:Be+Se+1;St.projectionCache.cachedAnchorPoint?Kr=St.projectionCache.cachedAnchorPoint:(Kr=ft(St.tileAnchorPoint.x,St.tileAnchorPoint.y,St).point,St.projectionCache.cachedAnchorPoint=Kr);let He,Je,lt=Kr,vt=Kr,Lt=0,At=0,zt=Math.abs($t),cr=[],yr;for(;Lt+At<=zt;){if(na+=Tr,na<Be||na>=dt)return null;Lt+=At,vt=lt,Je=He;let Qr={absOffsetX:zt,direction:Tr,distanceFromAnchor:Lt,previousVertex:vt};if(lt=Pe(na,St,Qr),ie===0)cr.push(vt),yr=lt.sub(vt);else{let pa,Aa=lt.sub(vt);pa=Aa.mag()===0?ct(Pe(na+Tr,St,Qr).sub(lt),ie,Tr):ct(Aa,ie,Tr),Je||(Je=vt.add(pa)),He=_t(na,pa,lt,Be,dt,Je,ie,St,Qr),cr.push(Je),yr=He.sub(Je)}At=yr.mag()}let Er=yr._mult((zt-Lt)/At)._add(Je||vt),jr=Ar+Math.atan2(lt.y-vt.y,lt.x-vt.x);return cr.push(Er),{point:Er,angle:Nt?jr:0,path:cr}}let ir=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function rr(Ue,I){for(let ie=0;ie<Ue;ie++){let we=I.length;I.resize(we+4),I.float32.set(ir,3*we)}}function er(Ue,I,ie){let we=I[0],Se=I[1];return Ue[0]=ie[0]*we+ie[4]*Se+ie[12],Ue[1]=ie[1]*we+ie[5]*Se+ie[13],Ue[3]=ie[3]*we+ie[7]*Se+ie[15],Ue}let Lr=100;class fa{constructor(I,ie,we=new qr(I.width+200,I.height+200,25),Se=new qr(I.width+200,I.height+200,25)){this.transform=I,this.mapProjection=ie,this.grid=we,this.ignoredGrid=Se,this.pitchFactor=Math.cos(I._pitch)*I.cameraToCenterDistance,this.screenRightBoundary=I.width+Lr,this.screenBottomBoundary=I.height+Lr,this.gridRightBoundary=I.width+200,this.gridBottomBoundary=I.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(I,ie,we,Se,Be,dt,St,Nt,$t,Tr,Ar){let Kr=I.anchorPointX+Nt[0],na=I.anchorPointY+Nt[1],He=this.projectAndGetPerspectiveRatio(Se,Kr,na,Be,Tr),Je=we*He.perspectiveRatio,lt;if(dt||St)lt=this._projectCollisionBox(I,Je,Se,Be,dt,St,Nt,He,Tr,Ar);else{let cr=He.point.x+(Ar?Ar.x*Je:0),yr=He.point.y+(Ar?Ar.y*Je:0);lt={allPointsOccluded:!1,box:[cr+I.x1*Je,yr+I.y1*Je,cr+I.x2*Je,yr+I.y2*Je]}}let[vt,Lt,At,zt]=lt.box;return this.mapProjection.useSpecialProjectionForSymbols&&(dt?lt.allPointsOccluded:this.mapProjection.isOccluded(Kr,na,Be))||He.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(vt,Lt,At,zt)||ie!=="always"&&this.grid.hitTest(vt,Lt,At,zt,ie,$t)?{box:[vt,Lt,At,zt],placeable:!1,offscreen:!1}:{box:[vt,Lt,At,zt],placeable:!0,offscreen:this.isOffscreen(vt,Lt,At,zt)}}placeCollisionCircles(I,ie,we,Se,Be,dt,St,Nt,$t,Tr,Ar,Kr,na,He,Je,lt){let vt=[],Lt=new t.P(ie.anchorX,ie.anchorY),At=this.getPerspectiveRatio(dt,Lt.x,Lt.y,St,lt),zt=(Ar?Be/At:Be*At)/t.ap,cr={getElevation:lt,labelPlaneMatrix:Nt,lineVertexArray:we,pitchWithMap:Ar,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:Lt,unwrappedTileID:St,width:this.transform.width,height:this.transform.height,translation:Je},yr=Ie(zt,Se,ie.lineOffsetX*zt,ie.lineOffsetY*zt,!1,ie,!1,cr),Er=!1,jr=!1,Qr=!0;if(yr){let pa=.5*na*At+He,Aa=new t.P(-100,-100),za=new t.P(this.screenRightBoundary,this.screenBottomBoundary),ci=new kr,Vi=yr.first,ji=yr.last,nn=[];for(let Bn=Vi.path.length-1;Bn>=1;Bn--)nn.push(Vi.path[Bn]);for(let Bn=1;Bn<ji.path.length;Bn++)nn.push(ji.path[Bn]);let Sn=2.5*pa;if($t){let Bn=this.projectPathToScreenSpace(nn,cr,$t);nn=Bn.some(wo=>wo.signedDistanceFromCamera<=0)?[]:Bn.map(wo=>wo.point)}let Kn=[];if(nn.length>0){let Bn=nn[0].clone(),wo=nn[0].clone();for(let is=1;is<nn.length;is++)Bn.x=Math.min(Bn.x,nn[is].x),Bn.y=Math.min(Bn.y,nn[is].y),wo.x=Math.max(wo.x,nn[is].x),wo.y=Math.max(wo.y,nn[is].y);Kn=Bn.x>=Aa.x&&wo.x<=za.x&&Bn.y>=Aa.y&&wo.y<=za.y?[nn]:wo.x<Aa.x||Bn.x>za.x||wo.y<Aa.y||Bn.y>za.y?[]:t.al([nn],Aa.x,Aa.y,za.x,za.y)}for(let Bn of Kn){ci.reset(Bn,.25*pa);let wo=0;wo=ci.length<=.5*pa?1:Math.ceil(ci.paddedLength/Sn)+1;for(let is=0;is<wo;is++){let Ao=is/Math.max(wo-1,1),Zo=ci.lerp(Ao),ps=Zo.x+Lr,ul=Zo.y+Lr;vt.push(ps,ul,pa,0);let tl=ps-pa,Jo=ul-pa,$o=ps+pa,Il=ul+pa;if(Qr=Qr&&this.isOffscreen(tl,Jo,$o,Il),jr=jr||this.isInsideGrid(tl,Jo,$o,Il),I!=="always"&&this.grid.hitTestCircle(ps,ul,pa,I,Kr)&&(Er=!0,!Tr))return{circles:[],offscreen:!1,collisionDetected:Er}}}}return{circles:!Tr&&Er||!jr||At<this.perspectiveRatioCutoff?[]:vt,offscreen:Qr,collisionDetected:Er}}projectPathToScreenSpace(I,ie,we){return I.map(Se=>wt(Se.x,Se.y,we,ie.getElevation))}queryRenderedSymbols(I){if(I.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let ie=[],we=1/0,Se=1/0,Be=-1/0,dt=-1/0;for(let Tr of I){let Ar=new t.P(Tr.x+Lr,Tr.y+Lr);we=Math.min(we,Ar.x),Se=Math.min(Se,Ar.y),Be=Math.max(Be,Ar.x),dt=Math.max(dt,Ar.y),ie.push(Ar)}let St=this.grid.query(we,Se,Be,dt).concat(this.ignoredGrid.query(we,Se,Be,dt)),Nt={},$t={};for(let Tr of St){let Ar=Tr.key;if(Nt[Ar.bucketInstanceId]===void 0&&(Nt[Ar.bucketInstanceId]={}),Nt[Ar.bucketInstanceId][Ar.featureIndex])continue;let Kr=[new t.P(Tr.x1,Tr.y1),new t.P(Tr.x2,Tr.y1),new t.P(Tr.x2,Tr.y2),new t.P(Tr.x1,Tr.y2)];t.am(ie,Kr)&&(Nt[Ar.bucketInstanceId][Ar.featureIndex]=!0,$t[Ar.bucketInstanceId]===void 0&&($t[Ar.bucketInstanceId]=[]),$t[Ar.bucketInstanceId].push(Ar.featureIndex))}return $t}insertCollisionBox(I,ie,we,Se,Be,dt){(we?this.ignoredGrid:this.grid).insert({bucketInstanceId:Se,featureIndex:Be,collisionGroupID:dt,overlapMode:ie},I[0],I[1],I[2],I[3])}insertCollisionCircles(I,ie,we,Se,Be,dt){let St=we?this.ignoredGrid:this.grid,Nt={bucketInstanceId:Se,featureIndex:Be,collisionGroupID:dt,overlapMode:ie};for(let $t=0;$t<I.length;$t+=4)St.insertCircle(Nt,I[$t],I[$t+1],I[$t+2])}projectAndGetPerspectiveRatio(I,ie,we,Se,Be){let dt;Be?(dt=[ie,we,Be(ie,we),1],t.af(dt,dt,I)):(dt=[ie,we,0,1],er(dt,dt,I));let St=dt[3];return{point:new t.P((dt[0]/St+1)/2*this.transform.width+Lr,(-dt[1]/St+1)/2*this.transform.height+Lr),perspectiveRatio:.5+this.transform.cameraToCenterDistance/St*.5,isOccluded:!1,signedDistanceFromCamera:St}}getPerspectiveRatio(I,ie,we,Se,Be){let dt=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(ie,we,Se,Be):wt(ie,we,I,Be);return .5+this.transform.cameraToCenterDistance/dt.signedDistanceFromCamera*.5}isOffscreen(I,ie,we,Se){return we<Lr||I>=this.screenRightBoundary||Se<Lr||ie>this.screenBottomBoundary}isInsideGrid(I,ie,we,Se){return we>=0&&I<this.gridRightBoundary&&Se>=0&&ie<this.gridBottomBoundary}getViewportMatrix(){let I=t.an([]);return t.J(I,I,[-100,-100,0]),I}_projectCollisionBox(I,ie,we,Se,Be,dt,St,Nt,$t,Tr){let Ar=new t.P(1,0),Kr=new t.P(0,1),na=new t.P(I.anchorPointX+St[0],I.anchorPointY+St[1]);if(dt&&!Be){let Qr=this.projectAndGetPerspectiveRatio(we,na.x+1,na.y,Se,$t).point.sub(Nt.point).unit(),pa=Math.atan(Qr.y/Qr.x)+(Qr.x<0?Math.PI:0),Aa=Math.sin(pa),za=Math.cos(pa);Ar=new t.P(za,Aa),Kr=new t.P(-Aa,za)}else if(!dt&&Be){let Qr=-this.transform.angle,pa=Math.sin(Qr),Aa=Math.cos(Qr);Ar=new t.P(Aa,pa),Kr=new t.P(-pa,Aa)}let He=Nt.point,Je=ie;if(Be){He=na;let Qr=this.transform.zoom-Math.floor(this.transform.zoom);Je=Math.pow(2,-Qr),Je*=this.mapProjection.getPitchedTextCorrection(this.transform,na,Se),Tr||(Je*=t.ac(.5+Nt.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}Tr&&(He=He.add(Ar.mult(Tr.x*Je)).add(Kr.mult(Tr.y*Je)));let lt=I.x1*Je,vt=I.x2*Je,Lt=(lt+vt)/2,At=I.y1*Je,zt=I.y2*Je,cr=(At+zt)/2,yr=[{offsetX:lt,offsetY:At},{offsetX:Lt,offsetY:At},{offsetX:vt,offsetY:At},{offsetX:vt,offsetY:cr},{offsetX:vt,offsetY:zt},{offsetX:Lt,offsetY:zt},{offsetX:lt,offsetY:zt},{offsetX:lt,offsetY:cr}],Er=[];for(let{offsetX:Qr,offsetY:pa}of yr)Er.push(new t.P(He.x+Ar.x*Qr+Kr.x*pa,He.y+Ar.y*Qr+Kr.y*pa));let jr=!1;if(Be){let Qr=Er.map(pa=>this.projectAndGetPerspectiveRatio(we,pa.x,pa.y,Se,$t));jr=Qr.some(pa=>!pa.isOccluded),Er=Qr.map(pa=>pa.point)}else jr=!0;return{box:t.ao(Er),allPointsOccluded:!jr}}}function Da(Ue,I,ie){return I*(t.X/(Ue.tileSize*Math.pow(2,ie-Ue.tileID.overscaledZ)))}class Ia{constructor(I,ie,we,Se){this.opacity=I?Math.max(0,Math.min(1,I.opacity+(I.placed?ie:-ie))):Se&&we?1:0,this.placed=we}isHidden(){return this.opacity===0&&!this.placed}}class qa{constructor(I,ie,we,Se,Be){this.text=new Ia(I?I.text:null,ie,we,Be),this.icon=new Ia(I?I.icon:null,ie,Se,Be)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Wa{constructor(I,ie,we){this.text=I,this.icon=ie,this.skipFade=we}}class Ca{constructor(){this.invProjMatrix=t.H(),this.viewportMatrix=t.H(),this.circles=[]}}class hi{constructor(I,ie,we,Se,Be){this.bucketInstanceId=I,this.featureIndex=ie,this.sourceLayerIndex=we,this.bucketIndex=Se,this.tileID=Be}}class wi{constructor(I){this.crossSourceCollisions=I,this.maxGroupID=0,this.collisionGroups={}}get(I){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[I]){let ie=++this.maxGroupID;this.collisionGroups[I]={ID:ie,predicate:we=>we.collisionGroupID===ie}}return this.collisionGroups[I]}}function Kt(Ue,I,ie,we,Se){let{horizontalAlign:Be,verticalAlign:dt}=t.au(Ue);return new t.P(-(Be-.5)*I+we[0]*Se,-(dt-.5)*ie+we[1]*Se)}class Ft{constructor(I,ie,we,Se,Be,dt){this.transform=I.clone(),this.terrain=we,this.collisionIndex=new fa(this.transform,ie),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=Se,this.retainedQueryData={},this.collisionGroups=new wi(Be),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=dt,dt&&(dt.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(I){let ie=this.terrain;return ie?(we,Se)=>ie.getElevation(I,we,Se):null}getBucketParts(I,ie,we,Se){let Be=we.getBucket(ie),dt=we.latestFeatureIndex;if(!Be||!dt||ie.id!==Be.layerIds[0])return;let St=we.collisionBoxArray,Nt=Be.layers[0].layout,$t=Be.layers[0].paint,Tr=Math.pow(2,this.transform.zoom-we.tileID.overscaledZ),Ar=we.tileSize/t.X,Kr=we.tileID.toUnwrapped(),na=this.transform.calculatePosMatrix(Kr),He=Nt.get("text-pitch-alignment")==="map",Je=Nt.get("text-rotation-alignment")==="map",lt=Da(we,1,this.transform.zoom),vt=this.collisionIndex.mapProjection.translatePosition(this.transform,we,$t.get("text-translate"),$t.get("text-translate-anchor")),Lt=this.collisionIndex.mapProjection.translatePosition(this.transform,we,$t.get("icon-translate"),$t.get("icon-translate-anchor")),At=Sr(na,He,Je,this.transform,lt),zt=null;if(He){let yr=Rr(na,He,Je,this.transform,lt);zt=t.L([],this.transform.labelPlaneMatrix,yr)}this.retainedQueryData[Be.bucketInstanceId]=new hi(Be.bucketInstanceId,dt,Be.sourceLayerIndex,Be.index,we.tileID);let cr={bucket:Be,layout:Nt,translationText:vt,translationIcon:Lt,posMatrix:na,unwrappedTileID:Kr,textLabelPlaneMatrix:At,labelToScreenMatrix:zt,scale:Tr,textPixelRatio:Ar,holdingForFade:we.holdingForFade(),collisionBoxArray:St,partiallyEvaluatedTextSize:t.ag(Be.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(Be.sourceID)};if(Se)for(let yr of Be.sortKeyRanges){let{sortKey:Er,symbolInstanceStart:jr,symbolInstanceEnd:Qr}=yr;I.push({sortKey:Er,symbolInstanceStart:jr,symbolInstanceEnd:Qr,parameters:cr})}else I.push({symbolInstanceStart:0,symbolInstanceEnd:Be.symbolInstances.length,parameters:cr})}attemptAnchorPlacement(I,ie,we,Se,Be,dt,St,Nt,$t,Tr,Ar,Kr,na,He,Je,lt,vt,Lt,At){let zt=t.aq[I.textAnchor],cr=[I.textOffset0,I.textOffset1],yr=Kt(zt,we,Se,cr,Be),Er=this.collisionIndex.placeCollisionBox(ie,Kr,Nt,$t,Tr,St,dt,lt,Ar.predicate,At,yr);if((!Lt||this.collisionIndex.placeCollisionBox(Lt,Kr,Nt,$t,Tr,St,dt,vt,Ar.predicate,At,yr).placeable)&&Er.placeable){let jr;if(this.prevPlacement&&this.prevPlacement.variableOffsets[na.crossTileID]&&this.prevPlacement.placements[na.crossTileID]&&this.prevPlacement.placements[na.crossTileID].text&&(jr=this.prevPlacement.variableOffsets[na.crossTileID].anchor),na.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[na.crossTileID]={textOffset:cr,width:we,height:Se,anchor:zt,textBoxScale:Be,prevAnchor:jr},this.markUsedJustification(He,zt,na,Je),He.allowVerticalPlacement&&(this.markUsedOrientation(He,Je,na),this.placedOrientations[na.crossTileID]=Je),{shift:yr,placedGlyphBoxes:Er}}}placeLayerBucketPart(I,ie,we){let{bucket:Se,layout:Be,translationText:dt,translationIcon:St,posMatrix:Nt,unwrappedTileID:$t,textLabelPlaneMatrix:Tr,labelToScreenMatrix:Ar,textPixelRatio:Kr,holdingForFade:na,collisionBoxArray:He,partiallyEvaluatedTextSize:Je,collisionGroup:lt}=I.parameters,vt=Be.get("text-optional"),Lt=Be.get("icon-optional"),At=t.ar(Be,"text-overlap","text-allow-overlap"),zt=At==="always",cr=t.ar(Be,"icon-overlap","icon-allow-overlap"),yr=cr==="always",Er=Be.get("text-rotation-alignment")==="map",jr=Be.get("text-pitch-alignment")==="map",Qr=Be.get("icon-text-fit")!=="none",pa=Be.get("symbol-z-order")==="viewport-y",Aa=zt&&(yr||!Se.hasIconData()||Lt),za=yr&&(zt||!Se.hasTextData()||vt);!Se.collisionArrays&&He&&Se.deserializeCollisionBoxes(He);let ci=this._getTerrainElevationFunc(this.retainedQueryData[Se.bucketInstanceId].tileID),Vi=(ji,nn,Sn)=>{var Kn,Bn;if(ie[ji.crossTileID])return;if(na)return void(this.placements[ji.crossTileID]=new Wa(!1,!1,!1));let wo=!1,is=!1,Ao=!0,Zo=null,ps={box:null,placeable:!1,offscreen:null},ul={box:null,placeable:!1,offscreen:null},tl=null,Jo=null,$o=null,Il=0,eu=0,Ru=0;nn.textFeatureIndex?Il=nn.textFeatureIndex:ji.useRuntimeCollisionCircles&&(Il=ji.featureIndex),nn.verticalTextFeatureIndex&&(eu=nn.verticalTextFeatureIndex);let vu=nn.textBox;if(vu){let Vl=et=>{let mt=t.ah.horizontal;if(Se.allowVerticalPlacement&&!et&&this.prevPlacement){let bt=this.prevPlacement.placedOrientations[ji.crossTileID];bt&&(this.placedOrientations[ji.crossTileID]=bt,mt=bt,this.markUsedOrientation(Se,mt,ji))}return mt},Gl=(et,mt)=>{if(Se.allowVerticalPlacement&&ji.numVerticalGlyphVertices>0&&nn.verticalTextBox){for(let bt of Se.writingModes)if(bt===t.ah.vertical?(ps=mt(),ul=ps):ps=et(),ps&&ps.placeable)break}else ps=et()},de=ji.textAnchorOffsetStartIndex,Fe=ji.textAnchorOffsetEndIndex;if(Fe===de){let et=(mt,bt)=>{let Mt=this.collisionIndex.placeCollisionBox(mt,At,Kr,Nt,$t,jr,Er,dt,lt.predicate,ci);return Mt&&Mt.placeable&&(this.markUsedOrientation(Se,bt,ji),this.placedOrientations[ji.crossTileID]=bt),Mt};Gl(()=>et(vu,t.ah.horizontal),()=>{let mt=nn.verticalTextBox;return Se.allowVerticalPlacement&&ji.numVerticalGlyphVertices>0&&mt?et(mt,t.ah.vertical):{box:null,offscreen:null}}),Vl(ps&&ps.placeable)}else{let et=t.aq[(Bn=(Kn=this.prevPlacement)===null||Kn===void 0?void 0:Kn.variableOffsets[ji.crossTileID])===null||Bn===void 0?void 0:Bn.anchor],mt=(Mt,ar,Ot)=>{let _r=Mt.x2-Mt.x1,Gr=Mt.y2-Mt.y1,Xr=ji.textBoxScale,xa=Qr&&cr==="never"?ar:null,da=null,Ja=At==="never"?1:2,ti="never";et&&Ja++;for(let Sa=0;Sa<Ja;Sa++){for(let Fa=de;Fa<Fe;Fa++){let Xa=Se.textAnchorOffsets.get(Fa);if(et&&Xa.textAnchor!==et)continue;let fi=this.attemptAnchorPlacement(Xa,Mt,_r,Gr,Xr,Er,jr,Kr,Nt,$t,lt,ti,ji,Se,Ot,dt,St,xa,ci);if(fi&&(da=fi.placedGlyphBoxes,da&&da.placeable))return wo=!0,Zo=fi.shift,da}et?et=null:ti=At}return we&&!da&&(da={box:this.collisionIndex.placeCollisionBox(vu,"always",Kr,Nt,$t,jr,Er,dt,lt.predicate,ci,new t.P(0,0)).box,offscreen:!1,placeable:!1}),da};Gl(()=>mt(vu,nn.iconBox,t.ah.horizontal),()=>{let Mt=nn.verticalTextBox;return Se.allowVerticalPlacement&&(!ps||!ps.placeable)&&ji.numVerticalGlyphVertices>0&&Mt?mt(Mt,nn.verticalIconBox,t.ah.vertical):{box:null,occluded:!0,offscreen:null}}),ps&&(wo=ps.placeable,Ao=ps.offscreen);let bt=Vl(ps&&ps.placeable);if(!wo&&this.prevPlacement){let Mt=this.prevPlacement.variableOffsets[ji.crossTileID];Mt&&(this.variableOffsets[ji.crossTileID]=Mt,this.markUsedJustification(Se,Mt.anchor,ji,bt))}}}if(tl=ps,wo=tl&&tl.placeable,Ao=tl&&tl.offscreen,ji.useRuntimeCollisionCircles){let Vl=Se.text.placedSymbolArray.get(ji.centerJustifiedTextSymbolIndex),Gl=t.ai(Se.textSizeData,Je,Vl),de=Be.get("text-padding");Jo=this.collisionIndex.placeCollisionCircles(At,Vl,Se.lineVertexArray,Se.glyphOffsetArray,Gl,Nt,$t,Tr,Ar,we,jr,lt.predicate,ji.collisionCircleDiameter,de,dt,ci),Jo.circles.length&&Jo.collisionDetected&&!we&&t.w("Collisions detected, but collision boxes are not shown"),wo=zt||Jo.circles.length>0&&!Jo.collisionDetected,Ao=Ao&&Jo.offscreen}if(nn.iconFeatureIndex&&(Ru=nn.iconFeatureIndex),nn.iconBox){let Vl=Gl=>this.collisionIndex.placeCollisionBox(Gl,cr,Kr,Nt,$t,jr,Er,St,lt.predicate,ci,Qr&&Zo?Zo:void 0);ul&&ul.placeable&&nn.verticalIconBox?($o=Vl(nn.verticalIconBox),is=$o.placeable):($o=Vl(nn.iconBox),is=$o.placeable),Ao=Ao&&$o.offscreen}let Tl=vt||ji.numHorizontalGlyphVertices===0&&ji.numVerticalGlyphVertices===0,cu=Lt||ji.numIconVertices===0;Tl||cu?cu?Tl||(is=is&&wo):wo=is&&wo:is=wo=is&&wo;let uc=is&&$o.placeable;if(wo&&tl.placeable&&this.collisionIndex.insertCollisionBox(tl.box,At,Be.get("text-ignore-placement"),Se.bucketInstanceId,ul&&ul.placeable&&eu?eu:Il,lt.ID),uc&&this.collisionIndex.insertCollisionBox($o.box,cr,Be.get("icon-ignore-placement"),Se.bucketInstanceId,Ru,lt.ID),Jo&&wo&&this.collisionIndex.insertCollisionCircles(Jo.circles,At,Be.get("text-ignore-placement"),Se.bucketInstanceId,Il,lt.ID),we&&this.storeCollisionData(Se.bucketInstanceId,Sn,nn,tl,$o,Jo),ji.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(Se.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ji.crossTileID]=new Wa(wo||Aa,is||za,Ao||Se.justReloaded),ie[ji.crossTileID]=!0};if(pa){if(I.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let ji=Se.getSortedSymbolIndexes(this.transform.angle);for(let nn=ji.length-1;nn>=0;--nn){let Sn=ji[nn];Vi(Se.symbolInstances.get(Sn),Se.collisionArrays[Sn],Sn)}}else for(let ji=I.symbolInstanceStart;ji<I.symbolInstanceEnd;ji++)Vi(Se.symbolInstances.get(ji),Se.collisionArrays[ji],ji);if(we&&Se.bucketInstanceId in this.collisionCircleArrays){let ji=this.collisionCircleArrays[Se.bucketInstanceId];t.as(ji.invProjMatrix,Nt),ji.viewportMatrix=this.collisionIndex.getViewportMatrix()}Se.justReloaded=!1}storeCollisionData(I,ie,we,Se,Be,dt){if(we.textBox||we.iconBox){let St,Nt;this.collisionBoxArrays.has(I)?St=this.collisionBoxArrays.get(I):(St=new Map,this.collisionBoxArrays.set(I,St)),St.has(ie)?Nt=St.get(ie):(Nt={text:null,icon:null},St.set(ie,Nt)),we.textBox&&(Nt.text=Se.box),we.iconBox&&(Nt.icon=Be.box)}if(dt){let St=this.collisionCircleArrays[I];St===void 0&&(St=this.collisionCircleArrays[I]=new Ca);for(let Nt=0;Nt<dt.circles.length;Nt+=4)St.circles.push(dt.circles[Nt+0]),St.circles.push(dt.circles[Nt+1]),St.circles.push(dt.circles[Nt+2]),St.circles.push(dt.collisionDetected?1:0)}}markUsedJustification(I,ie,we,Se){let Be;Be=Se===t.ah.vertical?we.verticalPlacedTextSymbolIndex:{left:we.leftJustifiedTextSymbolIndex,center:we.centerJustifiedTextSymbolIndex,right:we.rightJustifiedTextSymbolIndex}[t.at(ie)];let dt=[we.leftJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.rightJustifiedTextSymbolIndex,we.verticalPlacedTextSymbolIndex];for(let St of dt)St>=0&&(I.text.placedSymbolArray.get(St).crossTileID=Be>=0&&St!==Be?0:we.crossTileID)}markUsedOrientation(I,ie,we){let Se=ie===t.ah.horizontal||ie===t.ah.horizontalOnly?ie:0,Be=ie===t.ah.vertical?ie:0,dt=[we.leftJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.rightJustifiedTextSymbolIndex];for(let St of dt)I.text.placedSymbolArray.get(St).placedOrientation=Se;we.verticalPlacedTextSymbolIndex&&(I.text.placedSymbolArray.get(we.verticalPlacedTextSymbolIndex).placedOrientation=Be)}commit(I){this.commitTime=I,this.zoomAtLastRecencyCheck=this.transform.zoom;let ie=this.prevPlacement,we=!1;this.prevZoomAdjustment=ie?ie.zoomAdjustment(this.transform.zoom):0;let Se=ie?ie.symbolFadeChange(I):1,Be=ie?ie.opacities:{},dt=ie?ie.variableOffsets:{},St=ie?ie.placedOrientations:{};for(let Nt in this.placements){let $t=this.placements[Nt],Tr=Be[Nt];Tr?(this.opacities[Nt]=new qa(Tr,Se,$t.text,$t.icon),we=we||$t.text!==Tr.text.placed||$t.icon!==Tr.icon.placed):(this.opacities[Nt]=new qa(null,Se,$t.text,$t.icon,$t.skipFade),we=we||$t.text||$t.icon)}for(let Nt in Be){let $t=Be[Nt];if(!this.opacities[Nt]){let Tr=new qa($t,Se,!1,!1);Tr.isHidden()||(this.opacities[Nt]=Tr,we=we||$t.text.placed||$t.icon.placed)}}for(let Nt in dt)this.variableOffsets[Nt]||!this.opacities[Nt]||this.opacities[Nt].isHidden()||(this.variableOffsets[Nt]=dt[Nt]);for(let Nt in St)this.placedOrientations[Nt]||!this.opacities[Nt]||this.opacities[Nt].isHidden()||(this.placedOrientations[Nt]=St[Nt]);if(ie&&ie.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");we?this.lastPlacementChangeTime=I:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=ie?ie.lastPlacementChangeTime:I)}updateLayerOpacities(I,ie){let we={};for(let Se of ie){let Be=Se.getBucket(I);Be&&Se.latestFeatureIndex&&I.id===Be.layerIds[0]&&this.updateBucketOpacities(Be,Se.tileID,we,Se.collisionBoxArray)}}updateBucketOpacities(I,ie,we,Se){I.hasTextData()&&(I.text.opacityVertexArray.clear(),I.text.hasVisibleVertices=!1),I.hasIconData()&&(I.icon.opacityVertexArray.clear(),I.icon.hasVisibleVertices=!1),I.hasIconCollisionBoxData()&&I.iconCollisionBox.collisionVertexArray.clear(),I.hasTextCollisionBoxData()&&I.textCollisionBox.collisionVertexArray.clear();let Be=I.layers[0],dt=Be.layout,St=new qa(null,0,!1,!1,!0),Nt=dt.get("text-allow-overlap"),$t=dt.get("icon-allow-overlap"),Tr=Be._unevaluatedLayout.hasValue("text-variable-anchor")||Be._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Ar=dt.get("text-rotation-alignment")==="map",Kr=dt.get("text-pitch-alignment")==="map",na=dt.get("icon-text-fit")!=="none",He=new qa(null,0,Nt&&($t||!I.hasIconData()||dt.get("icon-optional")),$t&&(Nt||!I.hasTextData()||dt.get("text-optional")),!0);!I.collisionArrays&&Se&&(I.hasIconCollisionBoxData()||I.hasTextCollisionBoxData())&&I.deserializeCollisionBoxes(Se);let Je=(vt,Lt,At)=>{for(let zt=0;zt<Lt/4;zt++)vt.opacityVertexArray.emplaceBack(At);vt.hasVisibleVertices=vt.hasVisibleVertices||At!==ri},lt=this.collisionBoxArrays.get(I.bucketInstanceId);for(let vt=0;vt<I.symbolInstances.length;vt++){let Lt=I.symbolInstances.get(vt),{numHorizontalGlyphVertices:At,numVerticalGlyphVertices:zt,crossTileID:cr}=Lt,yr=this.opacities[cr];we[cr]?yr=St:yr||(yr=He,this.opacities[cr]=yr),we[cr]=!0;let Er=Lt.numIconVertices>0,jr=this.placedOrientations[Lt.crossTileID],Qr=jr===t.ah.vertical,pa=jr===t.ah.horizontal||jr===t.ah.horizontalOnly;if(At>0||zt>0){let za=Za(yr.text);Je(I.text,At,Qr?ri:za),Je(I.text,zt,pa?ri:za);let ci=yr.text.isHidden();[Lt.rightJustifiedTextSymbolIndex,Lt.centerJustifiedTextSymbolIndex,Lt.leftJustifiedTextSymbolIndex].forEach(nn=>{nn>=0&&(I.text.placedSymbolArray.get(nn).hidden=ci||Qr?1:0)}),Lt.verticalPlacedTextSymbolIndex>=0&&(I.text.placedSymbolArray.get(Lt.verticalPlacedTextSymbolIndex).hidden=ci||pa?1:0);let Vi=this.variableOffsets[Lt.crossTileID];Vi&&this.markUsedJustification(I,Vi.anchor,Lt,jr);let ji=this.placedOrientations[Lt.crossTileID];ji&&(this.markUsedJustification(I,"left",Lt,ji),this.markUsedOrientation(I,ji,Lt))}if(Er){let za=Za(yr.icon),ci=!(na&&Lt.verticalPlacedIconSymbolIndex&&Qr);Lt.placedIconSymbolIndex>=0&&(Je(I.icon,Lt.numIconVertices,ci?za:ri),I.icon.placedSymbolArray.get(Lt.placedIconSymbolIndex).hidden=yr.icon.isHidden()),Lt.verticalPlacedIconSymbolIndex>=0&&(Je(I.icon,Lt.numVerticalIconVertices,ci?ri:za),I.icon.placedSymbolArray.get(Lt.verticalPlacedIconSymbolIndex).hidden=yr.icon.isHidden())}let Aa=lt&<.has(vt)?lt.get(vt):{text:null,icon:null};if(I.hasIconCollisionBoxData()||I.hasTextCollisionBoxData()){let za=I.collisionArrays[vt];if(za){let ci=new t.P(0,0);if(za.textBox||za.verticalTextBox){let Vi=!0;if(Tr){let ji=this.variableOffsets[cr];ji?(ci=Kt(ji.anchor,ji.width,ji.height,ji.textOffset,ji.textBoxScale),Ar&&ci._rotate(Kr?this.transform.angle:-this.transform.angle)):Vi=!1}if(za.textBox||za.verticalTextBox){let ji;za.textBox&&(ji=Qr),za.verticalTextBox&&(ji=pa),Yt(I.textCollisionBox.collisionVertexArray,yr.text.placed,!Vi||ji,Aa.text,ci.x,ci.y)}}if(za.iconBox||za.verticalIconBox){let Vi=!!(!pa&&za.verticalIconBox),ji;za.iconBox&&(ji=Vi),za.verticalIconBox&&(ji=!Vi),Yt(I.iconCollisionBox.collisionVertexArray,yr.icon.placed,ji,Aa.icon,na?ci.x:0,na?ci.y:0)}}}}if(I.sortFeatures(this.transform.angle),this.retainedQueryData[I.bucketInstanceId]&&(this.retainedQueryData[I.bucketInstanceId].featureSortOrder=I.featureSortOrder),I.hasTextData()&&I.text.opacityVertexBuffer&&I.text.opacityVertexBuffer.updateData(I.text.opacityVertexArray),I.hasIconData()&&I.icon.opacityVertexBuffer&&I.icon.opacityVertexBuffer.updateData(I.icon.opacityVertexArray),I.hasIconCollisionBoxData()&&I.iconCollisionBox.collisionVertexBuffer&&I.iconCollisionBox.collisionVertexBuffer.updateData(I.iconCollisionBox.collisionVertexArray),I.hasTextCollisionBoxData()&&I.textCollisionBox.collisionVertexBuffer&&I.textCollisionBox.collisionVertexBuffer.updateData(I.textCollisionBox.collisionVertexArray),I.text.opacityVertexArray.length!==I.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${I.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${I.text.layoutVertexArray.length}) / 4`);if(I.icon.opacityVertexArray.length!==I.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${I.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${I.icon.layoutVertexArray.length}) / 4`);if(I.bucketInstanceId in this.collisionCircleArrays){let vt=this.collisionCircleArrays[I.bucketInstanceId];I.placementInvProjMatrix=vt.invProjMatrix,I.placementViewportMatrix=vt.viewportMatrix,I.collisionCircleArray=vt.circles,delete this.collisionCircleArrays[I.bucketInstanceId]}}symbolFadeChange(I){return this.fadeDuration===0?1:(I-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(I){return Math.max(0,(this.transform.zoom-I)/1.5)}hasTransitions(I){return this.stale||I-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(I,ie){let we=this.zoomAtLastRecencyCheck===ie?1-this.zoomAdjustment(ie):1;return this.zoomAtLastRecencyCheck=ie,this.commitTime+this.fadeDuration*we>I}setStale(){this.stale=!0}}function Yt(Ue,I,ie,we,Se,Be){we&&we.length!==0||(we=[0,0,0,0]);let dt=we[0]-Lr,St=we[1]-Lr,Nt=we[2]-Lr,$t=we[3]-Lr;Ue.emplaceBack(I?1:0,ie?1:0,Se||0,Be||0,dt,St),Ue.emplaceBack(I?1:0,ie?1:0,Se||0,Be||0,Nt,St),Ue.emplaceBack(I?1:0,ie?1:0,Se||0,Be||0,Nt,$t),Ue.emplaceBack(I?1:0,ie?1:0,Se||0,Be||0,dt,$t)}let Jt=Math.pow(2,25),Fr=Math.pow(2,24),ta=Math.pow(2,17),ra=Math.pow(2,16),ca=Math.pow(2,9),Ba=Math.pow(2,8),$a=Math.pow(2,1);function Za(Ue){if(Ue.opacity===0&&!Ue.placed)return 0;if(Ue.opacity===1&&Ue.placed)return 4294967295;let I=Ue.placed?1:0,ie=Math.floor(127*Ue.opacity);return ie*Jt+I*Fr+ie*ta+I*ra+ie*ca+I*Ba+ie*$a+I}let ri=0;function pi(){return{isOccluded:(Ue,I,ie)=>!1,getPitchedTextCorrection:(Ue,I,ie)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(Ue,I,ie,we){throw new Error("Not implemented.")},translatePosition:(Ue,I,ie,we)=>function(Se,Be,dt,St,Nt=!1){if(!dt[0]&&!dt[1])return[0,0];let $t=Nt?St==="map"?Se.angle:0:St==="viewport"?-Se.angle:0;if($t){let Tr=Math.sin($t),Ar=Math.cos($t);dt=[dt[0]*Ar-dt[1]*Tr,dt[0]*Tr+dt[1]*Ar]}return[Nt?dt[0]:Da(Be,dt[0],Se.zoom),Nt?dt[1]:Da(Be,dt[1],Se.zoom)]}(Ue,I,ie,we),getCircleRadiusCorrection:Ue=>1}}class Ra{constructor(I){this._sortAcrossTiles=I.layout.get("symbol-z-order")!=="viewport-y"&&!I.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(I,ie,we,Se,Be){let dt=this._bucketParts;for(;this._currentTileIndex<I.length;)if(ie.getBucketParts(dt,Se,I[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,Be())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,dt.sort((St,Nt)=>St.sortKey-Nt.sortKey));this._currentPartIndex<dt.length;)if(ie.placeLayerBucketPart(dt[this._currentPartIndex],this._seenCrossTileIDs,we),this._currentPartIndex++,Be())return!0;return!1}}class tn{constructor(I,ie,we,Se,Be,dt,St,Nt){this.placement=new Ft(I,pi(),ie,dt,St,Nt),this._currentPlacementIndex=we.length-1,this._forceFullPlacement=Se,this._showCollisionBoxes=Be,this._done=!1}isDone(){return this._done}continuePlacement(I,ie,we){let Se=n.now(),Be=()=>!this._forceFullPlacement&&n.now()-Se>2;for(;this._currentPlacementIndex>=0;){let dt=ie[I[this._currentPlacementIndex]],St=this.placement.collisionIndex.transform.zoom;if(dt.type==="symbol"&&(!dt.minzoom||dt.minzoom<=St)&&(!dt.maxzoom||dt.maxzoom>St)){if(this._inProgressLayer||(this._inProgressLayer=new Ra(dt)),this._inProgressLayer.continuePlacement(we[dt.source],this.placement,this._showCollisionBoxes,dt,Be))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(I){return this.placement.commit(I),this.placement}}let on=512/t.X/2;class hn{constructor(I,ie,we){this.tileID=I,this.bucketInstanceId=we,this._symbolsByKey={};let Se=new Map;for(let Be=0;Be<ie.length;Be++){let dt=ie.get(Be),St=dt.key,Nt=Se.get(St);Nt?Nt.push(dt):Se.set(St,[dt])}for(let[Be,dt]of Se){let St={positions:dt.map(Nt=>({x:Math.floor(Nt.anchorX*on),y:Math.floor(Nt.anchorY*on)})),crossTileIDs:dt.map(Nt=>Nt.crossTileID)};if(St.positions.length>128){let Nt=new t.av(St.positions.length,16,Uint16Array);for(let{x:$t,y:Tr}of St.positions)Nt.add($t,Tr);Nt.finish(),delete St.positions,St.index=Nt}this._symbolsByKey[Be]=St}}getScaledCoordinates(I,ie){let{x:we,y:Se,z:Be}=this.tileID.canonical,{x:dt,y:St,z:Nt}=ie.canonical,$t=on/Math.pow(2,Nt-Be),Tr=(St*t.X+I.anchorY)*$t,Ar=Se*t.X*on;return{x:Math.floor((dt*t.X+I.anchorX)*$t-we*t.X*on),y:Math.floor(Tr-Ar)}}findMatches(I,ie,we){let Se=this.tileID.canonical.z<ie.canonical.z?1:Math.pow(2,this.tileID.canonical.z-ie.canonical.z);for(let Be=0;Be<I.length;Be++){let dt=I.get(Be);if(dt.crossTileID)continue;let St=this._symbolsByKey[dt.key];if(!St)continue;let Nt=this.getScaledCoordinates(dt,ie);if(St.index){let $t=St.index.range(Nt.x-Se,Nt.y-Se,Nt.x+Se,Nt.y+Se).sort();for(let Tr of $t){let Ar=St.crossTileIDs[Tr];if(!we[Ar]){we[Ar]=!0,dt.crossTileID=Ar;break}}}else if(St.positions)for(let $t=0;$t<St.positions.length;$t++){let Tr=St.positions[$t],Ar=St.crossTileIDs[$t];if(Math.abs(Tr.x-Nt.x)<=Se&&Math.abs(Tr.y-Nt.y)<=Se&&!we[Ar]){we[Ar]=!0,dt.crossTileID=Ar;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:I})=>I)}}class Tt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ut{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(I){let ie=Math.round((I-this.lng)/360);if(ie!==0)for(let we in this.indexes){let Se=this.indexes[we],Be={};for(let dt in Se){let St=Se[dt];St.tileID=St.tileID.unwrapTo(St.tileID.wrap+ie),Be[St.tileID.key]=St}this.indexes[we]=Be}this.lng=I}addBucket(I,ie,we){if(this.indexes[I.overscaledZ]&&this.indexes[I.overscaledZ][I.key]){if(this.indexes[I.overscaledZ][I.key].bucketInstanceId===ie.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(I.overscaledZ,this.indexes[I.overscaledZ][I.key])}for(let Be=0;Be<ie.symbolInstances.length;Be++)ie.symbolInstances.get(Be).crossTileID=0;this.usedCrossTileIDs[I.overscaledZ]||(this.usedCrossTileIDs[I.overscaledZ]={});let Se=this.usedCrossTileIDs[I.overscaledZ];for(let Be in this.indexes){let dt=this.indexes[Be];if(Number(Be)>I.overscaledZ)for(let St in dt){let Nt=dt[St];Nt.tileID.isChildOf(I)&&Nt.findMatches(ie.symbolInstances,I,Se)}else{let St=dt[I.scaledTo(Number(Be)).key];St&&St.findMatches(ie.symbolInstances,I,Se)}}for(let Be=0;Be<ie.symbolInstances.length;Be++){let dt=ie.symbolInstances.get(Be);dt.crossTileID||(dt.crossTileID=we.generate(),Se[dt.crossTileID]=!0)}return this.indexes[I.overscaledZ]===void 0&&(this.indexes[I.overscaledZ]={}),this.indexes[I.overscaledZ][I.key]=new hn(I,ie.symbolInstances,ie.bucketInstanceId),!0}removeBucketCrossTileIDs(I,ie){for(let we of ie.getCrossTileIDsLists())for(let Se of we)delete this.usedCrossTileIDs[I][Se]}removeStaleBuckets(I){let ie=!1;for(let we in this.indexes){let Se=this.indexes[we];for(let Be in Se)I[Se[Be].bucketInstanceId]||(this.removeBucketCrossTileIDs(we,Se[Be]),delete Se[Be],ie=!0)}return ie}}class Br{constructor(){this.layerIndexes={},this.crossTileIDs=new Tt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(I,ie,we){let Se=this.layerIndexes[I.id];Se===void 0&&(Se=this.layerIndexes[I.id]=new ut);let Be=!1,dt={};Se.handleWrapJump(we);for(let St of ie){let Nt=St.getBucket(I);Nt&&I.id===Nt.layerIds[0]&&(Nt.bucketInstanceId||(Nt.bucketInstanceId=++this.maxBucketInstanceId),Se.addBucket(St.tileID,Nt,this.crossTileIDs)&&(Be=!0),dt[Nt.bucketInstanceId]=!0)}return Se.removeStaleBuckets(dt)&&(Be=!0),Be}pruneUnusedLayers(I){let ie={};I.forEach(we=>{ie[we]=!0});for(let we in this.layerIndexes)ie[we]||delete this.layerIndexes[we]}}let Cr=(Ue,I)=>t.t(Ue,I&&I.filter(ie=>ie.identifier!=="source.canvas")),xr=t.aw();class Ir extends t.E{constructor(I,ie={}){super(),this._rtlPluginLoaded=()=>{for(let we in this.sourceCaches){let Se=this.sourceCaches[we].getSource().type;Se!=="vector"&&Se!=="geojson"||this.sourceCaches[we].reload()}},this.map=I,this.dispatcher=new ee(Y(),I._getMapId()),this.dispatcher.registerMessageHandler("GG",(we,Se)=>this.getGlyphs(we,Se)),this.dispatcher.registerMessageHandler("GI",(we,Se)=>this.getImages(we,Se)),this.imageManager=new f,this.imageManager.setEventedParent(this),this.glyphManager=new F(I._requestManager,ie.localIdeographFontFamily),this.lineAtlas=new X(256,512),this.crossTileSymbolIndex=new Br,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()),tt().on(ye,this._rtlPluginLoaded),this.on("data",we=>{if(we.dataType!=="source"||we.sourceDataType!=="metadata")return;let Se=this.sourceCaches[we.sourceId];if(!Se)return;let Be=Se.getSource();if(Be&&Be.vectorLayerIds)for(let dt in this._layers){let St=this._layers[dt];St.source===Be.id&&this._validateLayer(St)}})}loadURL(I,ie={},we){this.fire(new t.k("dataloading",{dataType:"style"})),ie.validate=typeof ie.validate!="boolean"||ie.validate;let Se=this.map._requestManager.transformRequest(I,"Style");this._loadStyleRequest=new AbortController;let Be=this._loadStyleRequest;t.h(Se,this._loadStyleRequest).then(dt=>{this._loadStyleRequest=null,this._load(dt.data,ie,we)}).catch(dt=>{this._loadStyleRequest=null,dt&&!Be.signal.aborted&&this.fire(new t.j(dt))})}loadJSON(I,ie={},we){this.fire(new t.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,n.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,ie.validate=ie.validate!==!1,this._load(I,ie,we)}).catch(()=>{})}loadEmpty(){this.fire(new t.k("dataloading",{dataType:"style"})),this._load(xr,{validate:!1})}_load(I,ie,we){var Se;let Be=ie.transformStyle?ie.transformStyle(we,I):I;if(!ie.validate||!Cr(this,t.u(Be))){this._loaded=!0,this.stylesheet=Be;for(let dt in Be.sources)this.addSource(dt,Be.sources[dt],{validate:!1});Be.sprite?this._loadSprite(Be.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(Be.glyphs),this._createLayers(),this.light=new P(this.stylesheet.light),this.sky=new B(this.stylesheet.sky),this.map.setTerrain((Se=this.stylesheet.terrain)!==null&&Se!==void 0?Se:null),this.fire(new t.k("data",{dataType:"style"})),this.fire(new t.k("style.load"))}}_createLayers(){let I=t.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",I),this._order=I.map(ie=>ie.id),this._layers={},this._serializedLayers=null;for(let ie of I){let we=t.aA(ie);we.setEventedParent(this,{layer:{id:ie.id}}),this._layers[ie.id]=we}}_loadSprite(I,ie=!1,we=void 0){let Se;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(Be,dt,St,Nt){return t._(this,void 0,void 0,function*(){let $t=b(Be),Tr=St>1?"@2x":"",Ar={},Kr={};for(let{id:na,url:He}of $t){let Je=dt.transformRequest(d(He,Tr,".json"),"SpriteJSON");Ar[na]=t.h(Je,Nt);let lt=dt.transformRequest(d(He,Tr,".png"),"SpriteImage");Kr[na]=l.getImage(lt,Nt)}return yield Promise.all([...Object.values(Ar),...Object.values(Kr)]),function(na,He){return t._(this,void 0,void 0,function*(){let Je={};for(let lt in na){Je[lt]={};let vt=n.getImageCanvasContext((yield He[lt]).data),Lt=(yield na[lt]).data;for(let At in Lt){let{width:zt,height:cr,x:yr,y:Er,sdf:jr,pixelRatio:Qr,stretchX:pa,stretchY:Aa,content:za,textFitWidth:ci,textFitHeight:Vi}=Lt[At];Je[lt][At]={data:null,pixelRatio:Qr,sdf:jr,stretchX:pa,stretchY:Aa,content:za,textFitWidth:ci,textFitHeight:Vi,spriteData:{width:zt,height:cr,x:yr,y:Er,context:vt}}}}return Je})}(Ar,Kr)})}(I,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(Be=>{if(this._spriteRequest=null,Be)for(let dt in Be){this._spritesImagesIds[dt]=[];let St=this._spritesImagesIds[dt]?this._spritesImagesIds[dt].filter(Nt=>!(Nt in Be)):[];for(let Nt of St)this.imageManager.removeImage(Nt),this._changedImages[Nt]=!0;for(let Nt in Be[dt]){let $t=dt==="default"?Nt:`${dt}:${Nt}`;this._spritesImagesIds[dt].push($t),$t in this.imageManager.images?this.imageManager.updateImage($t,Be[dt][Nt],!1):this.imageManager.addImage($t,Be[dt][Nt]),ie&&(this._changedImages[$t]=!0)}}}).catch(Be=>{this._spriteRequest=null,Se=Be,this.fire(new t.j(Se))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),ie&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.k("data",{dataType:"style"})),we&&we(Se)})}_unloadSprite(){for(let I of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(I),this._changedImages[I]=!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(I){let ie=this.sourceCaches[I.source];if(!ie)return;let we=I.sourceLayer;if(!we)return;let Se=ie.getSource();(Se.type==="geojson"||Se.vectorLayerIds&&Se.vectorLayerIds.indexOf(we)===-1)&&this.fire(new t.j(new Error(`Source layer "${we}" does not exist on source "${Se.id}" as specified by style layer "${I.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let I in this.sourceCaches)if(!this.sourceCaches[I].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(I,ie=!1){let we=this._serializedAllLayers();if(!I||I.length===0)return Object.values(ie?t.aB(we):we);let Se=[];for(let Be of I)if(we[Be]){let dt=ie?t.aB(we[Be]):we[Be];Se.push(dt)}return Se}_serializedAllLayers(){let I=this._serializedLayers;if(I)return I;I=this._serializedLayers={};let ie=Object.keys(this._layers);for(let we of ie){let Se=this._layers[we];Se.type!=="custom"&&(I[we]=Se.serialize())}return I}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(let I in this.sourceCaches)if(this.sourceCaches[I].hasTransition())return!0;for(let I in this._layers)if(this._layers[I].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(I){if(!this._loaded)return;let ie=this._changed;if(ie){let Se=Object.keys(this._updatedLayers),Be=Object.keys(this._removedLayers);(Se.length||Be.length)&&this._updateWorkerLayers(Se,Be);for(let dt in this._updatedSources){let St=this._updatedSources[dt];if(St==="reload")this._reloadSource(dt);else{if(St!=="clear")throw new Error(`Invalid action ${St}`);this._clearSource(dt)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let dt in this._updatedPaintProps)this._layers[dt].updateTransitions(I);this.light.updateTransitions(I),this.sky.updateTransitions(I),this._resetUpdates()}let we={};for(let Se in this.sourceCaches){let Be=this.sourceCaches[Se];we[Se]=Be.used,Be.used=!1}for(let Se of this._order){let Be=this._layers[Se];Be.recalculate(I,this._availableImages),!Be.isHidden(I.zoom)&&Be.source&&(this.sourceCaches[Be.source].used=!0)}for(let Se in we){let Be=this.sourceCaches[Se];!!we[Se]!=!!Be.used&&Be.fire(new t.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:Se}))}this.light.recalculate(I),this.sky.recalculate(I),this.z=I.zoom,ie&&this.fire(new t.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){let I=Object.keys(this._changedImages);if(I.length){for(let ie in this.sourceCaches)this.sourceCaches[ie].reloadTilesForDependencies(["icons","patterns"],I);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let I in this.sourceCaches)this.sourceCaches[I].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(I,ie){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(I,!1),removedIds:ie})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(I,ie={}){var we;this._checkLoaded();let Se=this.serialize();if(I=ie.transformStyle?ie.transformStyle(Se,I):I,((we=ie.validate)===null||we===void 0||we)&&Cr(this,t.u(I)))return!1;(I=t.aB(I)).layers=t.az(I.layers);let Be=t.aC(Se,I),dt=this._getOperationsToPerform(Be);if(dt.unimplemented.length>0)throw new Error(`Unimplemented: ${dt.unimplemented.join(", ")}.`);if(dt.operations.length===0)return!1;for(let St of dt.operations)St();return this.stylesheet=I,this._serializedLayers=null,!0}_getOperationsToPerform(I){let ie=[],we=[];for(let Se of I)switch(Se.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":ie.push(()=>this.addLayer.apply(this,Se.args));break;case"removeLayer":ie.push(()=>this.removeLayer.apply(this,Se.args));break;case"setPaintProperty":ie.push(()=>this.setPaintProperty.apply(this,Se.args));break;case"setLayoutProperty":ie.push(()=>this.setLayoutProperty.apply(this,Se.args));break;case"setFilter":ie.push(()=>this.setFilter.apply(this,Se.args));break;case"addSource":ie.push(()=>this.addSource.apply(this,Se.args));break;case"removeSource":ie.push(()=>this.removeSource.apply(this,Se.args));break;case"setLayerZoomRange":ie.push(()=>this.setLayerZoomRange.apply(this,Se.args));break;case"setLight":ie.push(()=>this.setLight.apply(this,Se.args));break;case"setGeoJSONSourceData":ie.push(()=>this.setGeoJSONSourceData.apply(this,Se.args));break;case"setGlyphs":ie.push(()=>this.setGlyphs.apply(this,Se.args));break;case"setSprite":ie.push(()=>this.setSprite.apply(this,Se.args));break;case"setSky":ie.push(()=>this.setSky.apply(this,Se.args));break;case"setTerrain":ie.push(()=>this.map.setTerrain.apply(this,Se.args));break;case"setTransition":ie.push(()=>{});break;default:we.push(Se.command)}return{operations:ie,unimplemented:we}}addImage(I,ie){if(this.getImage(I))return this.fire(new t.j(new Error(`An image named "${I}" already exists.`)));this.imageManager.addImage(I,ie),this._afterImageUpdated(I)}updateImage(I,ie){this.imageManager.updateImage(I,ie)}getImage(I){return this.imageManager.getImage(I)}removeImage(I){if(!this.getImage(I))return this.fire(new t.j(new Error(`An image named "${I}" does not exist.`)));this.imageManager.removeImage(I),this._afterImageUpdated(I)}_afterImageUpdated(I){this._availableImages=this.imageManager.listImages(),this._changedImages[I]=!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(I,ie,we={}){if(this._checkLoaded(),this.sourceCaches[I]!==void 0)throw new Error(`Source "${I}" already exists.`);if(!ie.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(ie).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(ie.type)>=0&&this._validate(t.u.source,`sources.${I}`,ie,null,we))return;this.map&&this.map._collectResourceTiming&&(ie.collectResourceTiming=!0);let Se=this.sourceCaches[I]=new It(I,ie,this.dispatcher);Se.style=this,Se.setEventedParent(this,()=>({isSourceLoaded:Se.loaded(),source:Se.serialize(),sourceId:I})),Se.onAdd(this.map),this._changed=!0}removeSource(I){if(this._checkLoaded(),this.sourceCaches[I]===void 0)throw new Error("There is no source with this ID");for(let we in this._layers)if(this._layers[we].source===I)return this.fire(new t.j(new Error(`Source "${I}" cannot be removed while layer "${we}" is using it.`)));let ie=this.sourceCaches[I];delete this.sourceCaches[I],delete this._updatedSources[I],ie.fire(new t.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:I})),ie.setEventedParent(null),ie.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(I,ie){if(this._checkLoaded(),this.sourceCaches[I]===void 0)throw new Error(`There is no source with this ID=${I}`);let we=this.sourceCaches[I].getSource();if(we.type!=="geojson")throw new Error(`geojsonSource.type is ${we.type}, which is !== 'geojson`);we.setData(ie),this._changed=!0}getSource(I){return this.sourceCaches[I]&&this.sourceCaches[I].getSource()}addLayer(I,ie,we={}){this._checkLoaded();let Se=I.id;if(this.getLayer(Se))return void this.fire(new t.j(new Error(`Layer "${Se}" already exists on this map.`)));let Be;if(I.type==="custom"){if(Cr(this,t.aD(I)))return;Be=t.aA(I)}else{if("source"in I&&typeof I.source=="object"&&(this.addSource(Se,I.source),I=t.aB(I),I=t.e(I,{source:Se})),this._validate(t.u.layer,`layers.${Se}`,I,{arrayIndex:-1},we))return;Be=t.aA(I),this._validateLayer(Be),Be.setEventedParent(this,{layer:{id:Se}})}let dt=ie?this._order.indexOf(ie):this._order.length;if(ie&&dt===-1)this.fire(new t.j(new Error(`Cannot add layer "${Se}" before non-existing layer "${ie}".`)));else{if(this._order.splice(dt,0,Se),this._layerOrderChanged=!0,this._layers[Se]=Be,this._removedLayers[Se]&&Be.source&&Be.type!=="custom"){let St=this._removedLayers[Se];delete this._removedLayers[Se],St.type!==Be.type?this._updatedSources[Be.source]="clear":(this._updatedSources[Be.source]="reload",this.sourceCaches[Be.source].pause())}this._updateLayer(Be),Be.onAdd&&Be.onAdd(this.map)}}moveLayer(I,ie){if(this._checkLoaded(),this._changed=!0,!this._layers[I])return void this.fire(new t.j(new Error(`The layer '${I}' does not exist in the map's style and cannot be moved.`)));if(I===ie)return;let we=this._order.indexOf(I);this._order.splice(we,1);let Se=ie?this._order.indexOf(ie):this._order.length;ie&&Se===-1?this.fire(new t.j(new Error(`Cannot move layer "${I}" before non-existing layer "${ie}".`))):(this._order.splice(Se,0,I),this._layerOrderChanged=!0)}removeLayer(I){this._checkLoaded();let ie=this._layers[I];if(!ie)return void this.fire(new t.j(new Error(`Cannot remove non-existing layer "${I}".`)));ie.setEventedParent(null);let we=this._order.indexOf(I);this._order.splice(we,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[I]=ie,delete this._layers[I],this._serializedLayers&&delete this._serializedLayers[I],delete this._updatedLayers[I],delete this._updatedPaintProps[I],ie.onRemove&&ie.onRemove(this.map)}getLayer(I){return this._layers[I]}getLayersOrder(){return[...this._order]}hasLayer(I){return I in this._layers}setLayerZoomRange(I,ie,we){this._checkLoaded();let Se=this.getLayer(I);Se?Se.minzoom===ie&&Se.maxzoom===we||(ie!=null&&(Se.minzoom=ie),we!=null&&(Se.maxzoom=we),this._updateLayer(Se)):this.fire(new t.j(new Error(`Cannot set the zoom range of non-existing layer "${I}".`)))}setFilter(I,ie,we={}){this._checkLoaded();let Se=this.getLayer(I);if(Se){if(!t.aE(Se.filter,ie))return ie==null?(Se.filter=void 0,void this._updateLayer(Se)):void(this._validate(t.u.filter,`layers.${Se.id}.filter`,ie,null,we)||(Se.filter=t.aB(ie),this._updateLayer(Se)))}else this.fire(new t.j(new Error(`Cannot filter non-existing layer "${I}".`)))}getFilter(I){return t.aB(this.getLayer(I).filter)}setLayoutProperty(I,ie,we,Se={}){this._checkLoaded();let Be=this.getLayer(I);Be?t.aE(Be.getLayoutProperty(ie),we)||(Be.setLayoutProperty(ie,we,Se),this._updateLayer(Be)):this.fire(new t.j(new Error(`Cannot style non-existing layer "${I}".`)))}getLayoutProperty(I,ie){let we=this.getLayer(I);if(we)return we.getLayoutProperty(ie);this.fire(new t.j(new Error(`Cannot get style of non-existing layer "${I}".`)))}setPaintProperty(I,ie,we,Se={}){this._checkLoaded();let Be=this.getLayer(I);Be?t.aE(Be.getPaintProperty(ie),we)||(Be.setPaintProperty(ie,we,Se)&&this._updateLayer(Be),this._changed=!0,this._updatedPaintProps[I]=!0,this._serializedLayers=null):this.fire(new t.j(new Error(`Cannot style non-existing layer "${I}".`)))}getPaintProperty(I,ie){return this.getLayer(I).getPaintProperty(ie)}setFeatureState(I,ie){this._checkLoaded();let we=I.source,Se=I.sourceLayer,Be=this.sourceCaches[we];if(Be===void 0)return void this.fire(new t.j(new Error(`The source '${we}' does not exist in the map's style.`)));let dt=Be.getSource().type;dt==="geojson"&&Se?this.fire(new t.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):dt!=="vector"||Se?(I.id===void 0&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),Be.setFeatureState(Se,I.id,ie)):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(I,ie){this._checkLoaded();let we=I.source,Se=this.sourceCaches[we];if(Se===void 0)return void this.fire(new t.j(new Error(`The source '${we}' does not exist in the map's style.`)));let Be=Se.getSource().type,dt=Be==="vector"?I.sourceLayer:void 0;Be!=="vector"||dt?ie&&typeof I.id!="string"&&typeof I.id!="number"?this.fire(new t.j(new Error("A feature id is required to remove its specific state property."))):Se.removeFeatureState(dt,I.id,ie):this.fire(new t.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(I){this._checkLoaded();let ie=I.source,we=I.sourceLayer,Se=this.sourceCaches[ie];if(Se!==void 0)return Se.getSource().type!=="vector"||we?(I.id===void 0&&this.fire(new t.j(new Error("The feature id parameter must be provided."))),Se.getFeatureState(we,I.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 '${ie}' 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 I=t.aF(this.sourceCaches,Be=>Be.serialize()),ie=this._serializeByIds(this._order,!0),we=this.map.getTerrain()||void 0,Se=this.stylesheet;return t.aG({version:Se.version,name:Se.name,metadata:Se.metadata,light:Se.light,sky:Se.sky,center:Se.center,zoom:Se.zoom,bearing:Se.bearing,pitch:Se.pitch,sprite:Se.sprite,glyphs:Se.glyphs,transition:Se.transition,sources:I,layers:ie,terrain:we},Be=>Be!==void 0)}_updateLayer(I){this._updatedLayers[I.id]=!0,I.source&&!this._updatedSources[I.source]&&this.sourceCaches[I.source].getSource().type!=="raster"&&(this._updatedSources[I.source]="reload",this.sourceCaches[I.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(I){let ie=dt=>this._layers[dt].type==="fill-extrusion",we={},Se=[];for(let dt=this._order.length-1;dt>=0;dt--){let St=this._order[dt];if(ie(St)){we[St]=dt;for(let Nt of I){let $t=Nt[St];if($t)for(let Tr of $t)Se.push(Tr)}}}Se.sort((dt,St)=>St.intersectionZ-dt.intersectionZ);let Be=[];for(let dt=this._order.length-1;dt>=0;dt--){let St=this._order[dt];if(ie(St))for(let Nt=Se.length-1;Nt>=0;Nt--){let $t=Se[Nt].feature;if(we[$t.layer.id]<dt)break;Be.push($t),Se.pop()}else for(let Nt of I){let $t=Nt[St];if($t)for(let Tr of $t)Be.push(Tr.feature)}}return Be}queryRenderedFeatures(I,ie,we){ie&&ie.filter&&this._validate(t.u.filter,"queryRenderedFeatures.filter",ie.filter,null,ie);let Se={};if(ie&&ie.layers){if(!Array.isArray(ie.layers))return this.fire(new t.j(new Error("parameters.layers must be an Array."))),[];for(let St of ie.layers){let Nt=this._layers[St];if(!Nt)return this.fire(new t.j(new Error(`The layer '${St}' does not exist in the map's style and cannot be queried for features.`))),[];Se[Nt.source]=!0}}let Be=[];ie.availableImages=this._availableImages;let dt=this._serializedAllLayers();for(let St in this.sourceCaches)ie.layers&&!Se[St]||Be.push(ae(this.sourceCaches[St],this._layers,dt,I,ie,we));return this.placement&&Be.push(function(St,Nt,$t,Tr,Ar,Kr,na){let He={},Je=Kr.queryRenderedSymbols(Tr),lt=[];for(let vt of Object.keys(Je).map(Number))lt.push(na[vt]);lt.sort(j);for(let vt of lt){let Lt=vt.featureIndex.lookupSymbolFeatures(Je[vt.bucketInstanceId],Nt,vt.bucketIndex,vt.sourceLayerIndex,Ar.filter,Ar.layers,Ar.availableImages,St);for(let At in Lt){let zt=He[At]=He[At]||[],cr=Lt[At];cr.sort((yr,Er)=>{let jr=vt.featureSortOrder;if(jr){let Qr=jr.indexOf(yr.featureIndex);return jr.indexOf(Er.featureIndex)-Qr}return Er.featureIndex-yr.featureIndex});for(let yr of cr)zt.push(yr)}}for(let vt in He)He[vt].forEach(Lt=>{let At=Lt.feature,zt=$t[St[vt].source].getFeatureState(At.layer["source-layer"],At.id);At.source=At.layer.source,At.layer["source-layer"]&&(At.sourceLayer=At.layer["source-layer"]),At.state=zt});return He}(this._layers,dt,this.sourceCaches,I,ie,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(Be)}querySourceFeatures(I,ie){ie&&ie.filter&&this._validate(t.u.filter,"querySourceFeatures.filter",ie.filter,null,ie);let we=this.sourceCaches[I];return we?function(Se,Be){let dt=Se.getRenderableIds().map($t=>Se.getTileByID($t)),St=[],Nt={};for(let $t=0;$t<dt.length;$t++){let Tr=dt[$t],Ar=Tr.tileID.canonical.key;Nt[Ar]||(Nt[Ar]=!0,Tr.querySourceFeatures(St,Be))}return St}(we,ie):[]}getLight(){return this.light.getLight()}setLight(I,ie={}){this._checkLoaded();let we=this.light.getLight(),Se=!1;for(let dt in I)if(!t.aE(I[dt],we[dt])){Se=!0;break}if(!Se)return;let Be={now:n.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(I,ie),this.light.updateTransitions(Be)}getSky(){var I;return(I=this.stylesheet)===null||I===void 0?void 0:I.sky}setSky(I,ie={}){let we=this.getSky(),Se=!1;if(!I&&!we)return;if(I&&!we)Se=!0;else if(!I&&we)Se=!0;else for(let dt in I)if(!t.aE(I[dt],we[dt])){Se=!0;break}if(!Se)return;let Be={now:n.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=I,this.sky.setSky(I,ie),this.sky.updateTransitions(Be)}_validate(I,ie,we,Se,Be={}){return(!Be||Be.validate!==!1)&&Cr(this,I.call(t.u,t.e({key:ie,style:this.serialize(),value:we,styleSpec:t.v},Se)))}_remove(I=!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),tt().off(ye,this._rtlPluginLoaded);for(let ie in this._layers)this._layers[ie].setEventedParent(null);for(let ie in this.sourceCaches){let we=this.sourceCaches[ie];we.setEventedParent(null),we.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),I&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(I)}_clearSource(I){this.sourceCaches[I].clearTiles()}_reloadSource(I){this.sourceCaches[I].resume(),this.sourceCaches[I].reload()}_updateSources(I){for(let ie in this.sourceCaches)this.sourceCaches[ie].update(I,this.map.terrain)}_generateCollisionBoxes(){for(let I in this.sourceCaches)this._reloadSource(I)}_updatePlacement(I,ie,we,Se,Be=!1){let dt=!1,St=!1,Nt={};for(let $t of this._order){let Tr=this._layers[$t];if(Tr.type!=="symbol")continue;if(!Nt[Tr.source]){let Kr=this.sourceCaches[Tr.source];Nt[Tr.source]=Kr.getRenderableIds(!0).map(na=>Kr.getTileByID(na)).sort((na,He)=>He.tileID.overscaledZ-na.tileID.overscaledZ||(na.tileID.isLessThan(He.tileID)?-1:1))}let Ar=this.crossTileSymbolIndex.addLayer(Tr,Nt[Tr.source],I.center.lng);dt=dt||Ar}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((Be=Be||this._layerOrderChanged||we===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.now(),I.zoom))&&(this.pauseablePlacement=new tn(I,this.map.terrain,this._order,Be,ie,we,Se,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,Nt),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.now()),St=!0),dt&&this.pauseablePlacement.placement.setStale()),St||dt)for(let $t of this._order){let Tr=this._layers[$t];Tr.type==="symbol"&&this.placement.updateLayerOpacities(Tr,Nt[Tr.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.now())}_releaseSymbolFadeTiles(){for(let I in this.sourceCaches)this.sourceCaches[I].releaseSymbolFadeTiles()}getImages(I,ie){return t._(this,void 0,void 0,function*(){let we=yield this.imageManager.getImages(ie.icons);this._updateTilesForChangedImages();let Se=this.sourceCaches[ie.source];return Se&&Se.setDependencies(ie.tileID.key,ie.type,ie.icons),we})}getGlyphs(I,ie){return t._(this,void 0,void 0,function*(){let we=yield this.glyphManager.getGlyphs(ie.stacks),Se=this.sourceCaches[ie.source];return Se&&Se.setDependencies(ie.tileID.key,ie.type,[""]),we})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(I,ie={}){this._checkLoaded(),I&&this._validate(t.u.glyphs,"glyphs",I,null,ie)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=I,this.glyphManager.entries={},this.glyphManager.setURL(I))}addSprite(I,ie,we={},Se){this._checkLoaded();let Be=[{id:I,url:ie}],dt=[...b(this.stylesheet.sprite),...Be];this._validate(t.u.sprite,"sprite",dt,null,we)||(this.stylesheet.sprite=dt,this._loadSprite(Be,!0,Se))}removeSprite(I){this._checkLoaded();let ie=b(this.stylesheet.sprite);if(ie.find(we=>we.id===I)){if(this._spritesImagesIds[I])for(let we of this._spritesImagesIds[I])this.imageManager.removeImage(we),this._changedImages[we]=!0;ie.splice(ie.findIndex(we=>we.id===I),1),this.stylesheet.sprite=ie.length>0?ie:void 0,delete this._spritesImagesIds[I],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 "${I}" doesn't exists on this map.`)))}getSprite(){return b(this.stylesheet.sprite)}setSprite(I,ie={},we){this._checkLoaded(),I&&this._validate(t.u.sprite,"sprite",I,null,ie)||(this.stylesheet.sprite=I,I?this._loadSprite(I,!0,we):(this._unloadSprite(),we&&we(null)))}}var Ur=t.Y([{name:"a_pos",type:"Int16",components:2}]);let Hr={prelude:xt(`#ifdef GL_ES |